Home Unreal Engine

Efficient use of UV space?

interpolator
Offline / Send Message
Zack Maxwell interpolator
I've found myself with an interesting dilemma.
I don't know if this sort of issue is universal, but just in case I'll specify that I'm using Unreal Engine.
So I have an object with a basic diamond shape. Eight triangular faces all connected.
Initially I just split the bottom open with an X, and spread the UV evenly into a perfect square.
I've now found myself wondering though, since every face will be using exactly the same image, if it would be more efficient to separate out every face individually in the UV space and overlay all of them with each other.
Basically leaving me with just one giant triangle for the UV.

Each individual face would take up significantly more space on the texture, and I could therefore afford to make the texture itself much smaller. Creation of the texture itself would also be much simpler.

One concern I have is that, if each individual face ends up with more pixels rendered on it, would that actually make the performance worse, even though the overall texture would be smaller.
Based on the theory behind texture atlasing, my guess would be yes. It would actually hurt performance.
It's the same idea as mirroring the UV, but I'm not sure if that is done to improve run-time performance, or just to reduce file sizes.

The other concern I have is that splitting each of the faces in the UV, and therefore creating more edges and vertices, might also harm performance noticeably. And would it be enough to have any chance of offsetting whatever performance gains the method might have, if any.


It may seem small, but this could affect how I handle more assets in the future.
Also keep in mind that, while the object is extremely simple, there will be a very large number of them on screen at any particular time.

Replies

  • Meloncov
    Offline / Send Message
    Meloncov greentooth
    More UV seams do increase the vertex count, which slightly hinders performance, but under most circumstances, the performance hit of a larger texture size is going to be much larger than the performance hit of a few extra vertices.
  • Ispheria
    Offline / Send Message
    Ispheria polycounter lvl 3
    Yeah, more UV seams increase the vertex count, but so does using hard edges, and it sounds like your mesh would be using hard edges anyways. I really highly doubt there's any way the extra vertices will impact performance as much as using a texture 8x bigger than necessary.
  • Mr.Moose
    Offline / Send Message
    Mr.Moose polycounter lvl 7
    Keep in mind you can also unwrap things without necessarily making a seam.

    (Also I believe I read a normality for UV unwraps is about 30% wasted. Always aim better, but don't feel bad if you can't get it any tighter. It comes with practice!)
  • Zack Maxwell
    Offline / Send Message
    Zack Maxwell interpolator
    Pff, guess I shouldn't have casually mentioned that I happen to be using unreal engine. Now my thread's been sent to the graveyard.
  • ZacD
    Online / Send Message
    ZacD ngon master
    Yeah, I'm not sure why a mod moved it here, it's a general question, should be just in tech talk at the worst. But you are kinda over optimizing, sometimes you'll favor unique texture detail, other times you will need to mirror as much as possible to save texture space.
  • Parkar
    Offline / Send Message
    Parkar polycounter lvl 18
    Grimwolf wrote: »
    One concern I have is that, if each individual face ends up with more pixels rendered on it, would that actually make the performance worse, even though the overall texture would be smaller.
    Based on the theory behind texture atlasing, my guess would be yes. It would actually hurt performance.
    It's the same idea as mirroring the UV, but I'm not sure if that is done to improve run-time performance, or just to reduce file sizes.

    Assuming the same texture is used and the face takes up the same screen space there is generally no extra cost to render more of it's pixels (usually refereed to as texels) on a face. It should take the same time to render if a single texel covers the whole face or the texture is repeated multiple times over the face.

    Each texel is not "placed" on the screen instead a lookup is done into the texture. You are basically just checking what is the color at coordiate U,V for each pixel on the screen. The cost of such lookup is not related to how big the face is on the UV layout or how many texels are covered by currently rendered face. The performance impact of textures is more to do with how much memory they use.

    I guess there could potentially be some caching benefit or such for fetching the same texel over and over but at this point your optimizing for stuff deep inside the GPU architecture. Or maybe mipmapping will play a role and you get the opposite effect where a smaller mip can be used. In any case size of the whole texture is what you need to worry about in this case so repeating the texture for each face is defiantly a better optimization.

    The reason to do atlasing is to lower the number of textures needed.
Sign In or Register to comment.