Home Technical Talk

Texture Atlas layout planning questions

polycounter lvl 6
Offline / Send Message
bitinn polycounter lvl 6
Hi,

I am wondering, is there a reasonable way to pre-plan a texture atlas without knowing the exact shape of mesh beforehand?

After doing a few texture atlas on large modular pieces, I am trying to do the same to large props (for example, beds). But then I realized I wouldn't know the exact dimension of my future props, which leads to issues on maximizing atlas reusability.

Furthermore, I want to hear some opinions:

- Is layout planning common at texture atlas design time? (ie. I only know the general size of mesh, not the exact size of uv shells.)

- Are stripes-layout generally more productive than square-layout? (ie. stripe-layout allow artists to fit a large uv shell by stretching and shrinking)

- I had troubles fitting mesh uv into existing texture atlas while maintaining consistent texture density and minimize stretching, how do artists tackle this problem?

I know these are decided on a case-by-case basis, and many games can afford to use unique textures for each props, or simply batch texture on export instead. But I think the saving on texture memory is well worth the trouble for my case: many props, similar materials and limited devices.

(My references are Thiago Klafke's guides and Sunset Overdrive's ultimate trim texturing talk.)

Replies

  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6



    I gave my "texture before mesh" approach a try today and end up seeing a few problems with it:

    - Not knowing the exact shape = not knowing the uv size = there bound to be wasted texture space: the pillow, for example, doesn't need that much texture, so unless we know beforehand we are going to reuse those textures, this approach may create more waste.

    - Texel Density remains a problem: unless we use low-detailed textures, any significant difference in texel density are going to be obvious. To maintain consistent TD means the overall TD will be limited by largest shell size, as it needs fit into available texture space.

    - Not know uv shell size also mean tiling textures are hard to manage: we can't easily divide large shells into smaller parts and line them up, and unlike modular pieces, there are no simple math to align them properly. This also contributes to the TD issue.

    However, I do like this approach in general, most of its constraints could be tackled by:

    - Having a 2nd texture pass: basically, we still start with texture, after uv, we adjust texture size again, so that large uv shells are accommodated. This is surprisingly easy in Substance Designer, which allows me to re-atlas just by re-wiring nodes.

    - Having multiple uv maps: to further battle low TD issues, we can give normal maps and decals extra resolutions (and they can be quite reusable with a bit color tinting). I spend significant time in Maya/Blender setting up materials, not only to make them match Unity, but to allow this flexibility.

    Do let me know if there are other great solutions :)
  • Eric Chadwick
    Yes, it's a bit of a pickle. As sacboi would probably say. Hard to plan without knowing all the meshes in advance.

    One trick is to tile the UV for a piece, like the bedspread geometry. Then break the UVs at the regular UV boundaries and offset the shells in whole units to get them inside. Then scale the lot to fit your atlas layout.
  • bitinn
    Offline / Send Message
    bitinn polycounter lvl 6
    Yes, it's a bit of a pickle. As sacboi would probably say. Hard to plan without knowing all the meshes in advance.

    One trick is to tile the UV for a piece, like the bedspread geometry. Then break the UVs at the regular UV boundaries and offset the shells in whole units to get them inside. Then scale the lot to fit your atlas layout.
    Thx Eric, I am not sure about the "whole unit" part: as my bedspread polygon are not even quads, the uv shell will naturally be in different size. Say I align the large shell to the top-left of my texture space, then cut and stack them, I don't think they can be aligned perfectly to "whole unit" nicely (unless I plan the quads beforehand like a modular piece, which is a bit much for props).

    Another thing is I am using Blender nowadays: unlike Maya 2017/2018, its UV editor doesn't provide gizmo (aka manipulator) for shell resizing, it seems to me non-uniform rescaling uv are quite difficult (and I don't know how to stretch a shell only horizontally). I have tried built-in addon Magic UV and the famous TexTools, but haven't figured out issues like this. So I might be missing some tricks here.
  • Eric Chadwick
    Planning the geometry is a good idea, if you want good reuse, and even texel sizes. Vertex count is not expensive, relative to pixel cost.
  • monster
    Offline / Send Message
    monster polycounter
    I've done a couple of things before to produce an atlas. Both had a flexible workflow.

    Map everything to seperate textures. Then...
    • Copy all UVs to channel 3. Repack channel 1 UVs so all objects are on the same UV space. Render channel 3 textures to channel 1. If you have normal maps, don't rotate any shells when repacking.
    OR
    • In Unity, I made a tool that atlases a set of textures. Then, with code, you copy the meshes and modify their UVs by each texture offset. If you have a programmer on your team this should be an easy task for them.

    The first method has the benefit of repacking more tightly since you aren't bound by texture, but by UV island. You can also normalize scale when repacking so there's perfect texel density across objects.

    The second method has the benefit of auto-atlasing on a whim and growing the texture size as needed.

    I've also been in a situation on a mobile game where we had one 1024 texture, and we knew that we had to reserve half the texture for DLC to be made later. In that case we did as Eric suggested and made tiles and cut up the geo to support the UV tiling.
Sign In or Register to comment.