Home Technical Talk

[Texture Atlas] ~ How can I UV a cylinder with a vertically tiled texture into an atlas?

triangle
Offline / Send Message
Steamy_Steve triangle
[Premises]
I'm planning a small scene for Sketchfab that will include some vegetation, some objects and possibly one or two human characters.
For all I can remember Sketchfab has a limitation in terms of UV channels, maximum two, thus the altas method. Possibly one 2k or 4k texture containing all the vegetation and objets, and another one with just the characters.

[Now my issue]
One of the vegetation elements will be a palm tree. I've already crafted the procedural texture for the trunk, which is obviously a square.
This texture covers only one section of the trunk, the idea is to vertically tile it several times.
It would be extremely easy, if the trunk had its own UV tile to squander over (see attached image). Not the case.


[The question]
How do I arrange the trunk on the UV tile so that its texture tiles only once horizontally and like 5-6 times vertically without taking over the whole atlas?

[My idea]
My idea is to cut the trunk (basically a cylinder) into several UV islands and overlap them all into a single square (diameter*3.14 to get the height of each section).
Would this be possible without incurring in awful UV seams?

I have already watched a (relatively old!) video about making atlases in Substance Designer, here on Polycount's wiki, which was very illuminating AND quite shocking: he was EYEBALLING the UV layout!!!!!!!!
Maybe it's just my mild OCD speaking, but wouldn't it be better if one could place the UVs while relying on precise topological coordinates? Or is that how it's actually done, by (*shivers up my spine*) placing them "more or less in the right spot"?


Replies

  • zachagreg
    Offline / Send Message
    zachagreg ngon master
    You could throw it back into designer and export out a nonsquare texture, something like 256x1024 would technically be a tile of 4 on the V and then you could just assign that to your trunk. Now if you want leaf cards and fronds, etc. on the sheet as well just compose the rest of the 1024x1024 sheet with those fronds and leaves. Then just relegate the trunk uvs to that portion of texture. Doing it this way would also give you more variation in the long run as you would have more variation along the length of the tree. 

    Also try to get over the precision pixel perfect, you have to eye leaf cards, grass, planes, a lot of trim sheets and things of those nature. Worrying about whether or not its pixel perfect and or having tools to specifically calculate and dial that in just wastes time. Part of being an artist is having an artistic eye regarding placement and precision where it is needed.
  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    zachagreg said:
    You could throw it back into designer and export out a nonsquare texture, something like 256x1024 would technically be a tile of 4 on the V and then you could just assign that to your trunk. Now if you want leaf cards and fronds, etc. on the sheet as well just compose the rest of the 1024x1024 sheet with those fronds and leaves. Then just relegate the trunk uvs to that portion of texture. Doing it this way would also give you more variation in the long run as you would have more variation along the length of the tree. 

    Also try to get over the precision pixel perfect, you have to eye leaf cards, grass, planes, a lot of trim sheets and things of those nature. Worrying about whether or not its pixel perfect and or having tools to specifically calculate and dial that in just wastes time. Part of being an artist is having an artistic eye regarding placement and precision where it is needed.
    Yeah, that is the plan, putting everything (trees, bushes, grass...) together into one single texture.
    But can SD work with non-square outputs? Would the texture still be seamlessly tileable both horizontally and vertically?

    Anyway, I've just tested it in Blender, and it seems it IS possible to overlap the sections of the trunk without any visible UV cut.


  • zachagreg
    Offline / Send Message
    zachagreg ngon master
    Yep SD will work with non-square textures, the issue you would run into with the uv splits is that youd have to make a dedicated lightmap with it all welded back together or engine lightbakes will show lines, also you are artificially increasing the amount of edge splits on the model which ups engine vert count on the model.
  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    zachagreg said:
    Yep SD will work with non-square textures, the issue you would run into with the uv splits is that youd have to make a dedicated lightmap with it all welded back together or engine lightbakes will show lines, also you are artificially increasing the amount of edge splits on the model which ups engine vert count on the model.
    "Increasing the amount of edge splits"?!
    I'm only cutting some UV seams, the mesh is still in one piece. Do UV cuts affect the "vert count" as well?! =O

    Anyway, an atlas is supposed to be exploited by overlapping UV islands, how else could you do it if not by cutting seams all over the model? =o
  • jStins
    Offline / Send Message
    jStins interpolator
    "Increasing the amount of edge splits"?!
    I'm only cutting some UV seams, the mesh is still in one piece. Do UV cuts affect the "vert count" as well?! =O

    Yes, UV splits increase the verts along the seam. 
  • zachagreg
    Offline / Send Message
    zachagreg ngon master
    Yep cutting UV seams does indeed effect vert count in engine. Basically its like two edges sitting on top of each other. Here is a thread about that: https://polycount.com/discussion/130622/vertex-count-vs-triangle-count

    But take this into account as well: https://www.guerrilla-games.com/read/killzone-shadow-fall-demo-postmortem this is what Monster is talking about in the thread I believe. 

    Cutting up UVs is standard for atlases so dont be afraid of it, just be aware of it is all
  • Snweos
    Offline / Send Message
    Snweos polycounter lvl 4
    Unless I am misunderstanding something, SketchFabs limit of 2 UV channels wouldn't effect the amount of materials / textures you could have. Though that being said, limiting yourself to two texture atlases isn't a terrible idea either, especially if you are presenting the scene as game-engine.
  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    Snweos said:
    Unless I am misunderstanding something, SketchFabs limit of 2 UV channels wouldn't effect the amount of materials / textures you could have. Though that being said, limiting yourself to two texture atlases isn't a terrible idea either, especially if you are presenting the scene as game-engine.
    Maybe *I* am the one who misunderstood something.
    When I say "2 UV channels" I mean that you can only use two separate materials, and you have to tell Sketchfab which material goes into which channel.
    Your meshes, on the other hand, are marked with a material ID, and that's what defines how many channels are needed.
    Two material IDs for the whole scene means two UV channels.

    Or not?

    I have already exploited this method for my gargoyle on Sketchfab, where the body uses one material and wings another one (search for Steamy_Steve on Sketchfab).
  • Eric Chadwick
    Material assignments/IDs and uv channels are two separate things.

    You can have 1 material with 5 UV channels. You can have 5 materials on one mesh, all using a single UV channel. Mix and match as needed.

    Each bitmap in a material can use a different UV, if you need to.

    Most apps/games have limits on the number of UV channels.

    Most of the time for games, you need no more than 2 UV channels. One for tiling textures, the other non-tiling (atlas layout) for lightmap textures. 

    Sketchfab may have specific requirements for how you mix and match, but it's unusual to require a separate material just so you can assign a different UV to one of the textures. 
  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    Material assignments/IDs and uv channels are two separate things.

    [....]
    I would heartfully appreciate an insightful explanation.
    When I upload maps on Sketchfab, I can only apply one material per material ID, which I do by selecting to which "UV" (channel?!) I want to apply it. And, for all I know, you can only use up to a maximum of 2 materials/UVs.
    What am I misunderstanding? =p
  • Eric Chadwick
    Read this first
    https://help.sketchfab.com/hc/en-us/articles/202600873-Materials-and-Textures

    Material ID is a method to help you assign more than one material to a single model. 

    You select some triangles, and apply an ID. Select some others, assign another ID. Etc. For as many different materials you want to use.

    Each triangle can only have a single Material ID. Only 1 material per face.

    UVs are assigned in a material, for each bitmap.


  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    [....]

    UVs are assigned in a material, for each bitmap.

    Ok, soooo....apparently, I can upload all the materials I want.
    What about "UV channels", then? =o
  • Eric Chadwick
    Only use as many as needed. You typically only need one. 
  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    Only use as many as needed. You typically only need one. 
    As I said, I'm planning a scene, which means at least 7-8 different objects/materials....
  • Eric Chadwick
    All objects in s scene can use the same uv channel. But each model can use its its own uv layout.

    Think of the UVs as being like sheets of white paper. Each sheet can have a different paper airplane folded design. But they're all coming from the same pile of white paper. 

    UV2 is like a pile of red colored paper. 

    This is a shitty analogy. 

    Which program are you using to UV your models? Read the help files. 
  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    [....]

    Which program are you using to UV your models? Read the help files. 
    I use Blender, to model and UV.
    I know all UVs share the same UV tile/space, and what really makes a difference is the material that is assigned to each object/group of faces.
    UVs are like stencils over paintings. The materials assigned to the meshes decide what painting each UV will be spread over.

    But then what is a "UV channel"? =o
  • Eric Chadwick
    That's a weird way to describe UVs. Makes me wonder if you understand how it actually works.
  • Eric Chadwick
    The UVs are not spread over the painting (texture). It's the reverse. 
  • Eric Chadwick
    Each triangle can have only a single location in the space of a single UV channel.

    If you want to layer two textures onto the same triangle, but using different UV layouts, that's where you would use another UV channel. 
  • Steamy_Steve
    Offline / Send Message
    Steamy_Steve triangle
    Each triangle can have only a single location in the space of a single UV channel.

    If you want to layer two textures onto the same triangle, but using different UV layouts, that's where you would use another UV channel. 
    This explanation of a UV channel doesn't make sense, in my head. =p
    Why would I want to change the placement of a triangle in the UV space, and why would I do this to apply two different textures?
    And how do you manage this passage from one UV channel to the other? =o

    The UVs are not spread over the painting (texture). It's the reverse. 
    It was a metaphor!! xD
    I was talking in terms of "stencils" (that is UVs), hence the order being stencil-on-painting.
    I know it's the opposite, as in laying textures over UVs! x)
  • Eric Chadwick
    Steamy_Steve said:

    Why would I want to change the placement of a triangle in the UV space, and why would I do this to apply two different textures?

    Lightmapping. Multitexture. Etc. 

    http://wiki.polycount.com/wiki/MultiTexture

    http://wiki.polycount.com/wiki/Light_map

    Steamy_Steve said:

    And how do you manage this passage from one UV channel to the other? =o

    When you load a texture in a material, it can only be assigned to a single UV channel. But you could assign a different texture to another UV channel.

    For example. A bump texture could use UV 1 and be tiled 5 times across the model (fabric weave for example). While in the same material, a lightmap texture could use UV 2 to apply non-tiled lighting across the whole surface. 
Sign In or Register to comment.