Home Technical Talk

Combining multiple UVs and exporting to UDK

polycounter lvl 9
Offline / Send Message
Chase polycounter lvl 9
I'm confused about unwrapping multiple components to a scene and combining those unwraps into one UV square. Also, I'm not understanding the idea of saving texture memory by sharing texture space by combining textures sheets into one. Here are some examples for me to better elaborate what I mean:

Let's say you have a few props and a building such as this
orangec.jpg

and everything is unwrapped into one UV space like this
unwrap.jpg

If I wanted to export just the ladder and drainage pipe to UDK, how does it affect any texturing I've done? When I texture the entire template which includes everything, does UDK know I've only imported the ladder and drainage pipe thus knowing I'm only applying their corresponding textures from the template? I would think there might be a hiccup along the way since everything is tied to the one UV square. Am I just thinking too much into this? haha.

The same goes for splitting up texture sheets to save memory. If there are separate meshes that I want to import yet they all share the same texture sheet, how does UDK know I only want to utilize sections of one texture sheet for one model when there are 3 other squares full of textures?

mergew.jpg

Replies

  • Scruples
    Offline / Send Message
    Scruples polycounter lvl 10
    Unless you are actually editing the uv's to make better use of the space, you wont be saving any texture memory. The advantage of having multiple object textures on 1 uv is you can use the same shader for all them thus saving some draw calls (although this won't work in some situations, iirc)

    I think you should avoid bothering with this since it is straying into TD territory and it sounds like you are either doing this for fun or for your demoreel.

    If you are going to anyway I recommend using a half-hour to take a look at the castle demo (epic citadel) for UDK. It is well optimised and works fine on the iphone apparently.
    You will notice the textures that repeat are usually not mixed with other textures because if they are, they need to be split whenever a polygon exits the 0-1 uv space.

    and here is some good reading, explains it better than I can http://unity3d.com/support/documentation/Manual/iphone-DrawCall-Batching.html
  • Chase
    Offline / Send Message
    Chase polycounter lvl 9
    So avoid combining multiple textures into one texture sheet? Putting four 2048x2048 textures into one 2048x2048 wouldn't save any memory?
  • WarrenM
    If all of the pieces map to unique areas of the 2048 then, sure, combine them into a single texture. You'll definitely save memory.

    As Scruples said, however, if you want textures to tile in that situation, you'll have to add geometry at every texture break which can get expensive on the vertex side of things. It's all a balancing act...
  • LoTekK
    Offline / Send Message
    LoTekK polycounter lvl 19
    Putting four 2048x2048 textures into one 2048x2048 wouldn't save any memory?
    Of course it would, you're reducing the size of each texture in that case. The more pertinent question is, would you be gaining performance in some way by using a 2k atlas vs 4x 1k textures.

    If you're always going to be seeing all 4 textures together, then yes, you should atlas them into a single texture, to save on texture fetches. If the assets can be separated (eg. your ladder example might be used on a different building using a different set of textures), then keep that on a separate sheet. Otherwise you load the entire 2k texture just for the little portion that the ladder occupies. In which case you're wasting a lot of texture memory.

    There are a lot of different considerations to keep in mind wrt to atlasing.
  • unstoppablex
    keep in mind that even if they share the same UVW, each and every mesh has to have its own UVW lightmap. meshes cannot share lightmaps.
  • Chase
    Offline / Send Message
    Chase polycounter lvl 9
    Why can't they share the same AO map? I can see why if it's a piece that I'd want to be reusable because everything casts shadows off each other so it wouldn't look right on reusable meshes. But if everything in one UVW is going to be exported as one entity why would it matter if they shared one AO map? Say I rendered out in a template, and textured the whole thing how then would you lay a AO map over the Diffuse for each individual mesh?

    That makes a lot more sense. I know this is just a put into practice time of question, but thanks for the replies. I got really bogged down with the whole exporting to UDK and how the textures follow the mesh into UDK. Let me just make sure I completely understand this.....

    Combining textures certainly saves texture memory, but if you need any of the textures to tile you're more or less giving yourself more geometry (more work). You just need to know if you're going to be gaining any performance increase by merging texture sheets. As far as combining multiple mesh unwraps goes, if you combine objects that you want to have reusable then don't include them in the same unwrap as everything else because you'll be importing the UV texture template that includes everything else. This wastes texture resolution for the one object you imported and wastes texture memory because you are only utilizing the one section of the entire template. Like you guys said though it's all on a per situation basis to know when to do something that positively affects the game.
  • unstoppablex
    well lightmaps in UDK and AO aren't the same. AO is natural shadows, like the shadows in a folded paper. lightmaps are generated in UDK based on the lights you created around this mesh. the reason why UDK doesn't share lightmaps between meshes is simple, a lightmap for a mesh is created for each mesh you have in the scene, if you have a shared texture of 1 ladder, 1 wall, 1 apple, and if you have 1 ladder, 1 wall, 4 apples in your udk scene, udk will make a total of 6 lightmaps. because the position of each apple in the scene will be different, so the lighting it receives will be different.
  • Chase
    Offline / Send Message
    Chase polycounter lvl 9
    Everything's hung up on this idea I have of combining multiple mesh UV's. If I want to have assets that can be plugged into other parts of the level then I should have them all unwrapped together or individually? Someone told me that it doesn't matter if I group random models together in the 0-1 UV space because UDK will know that I'm only exporting the one model, thus use its specific textured UV's when I connect the material. I just found the LightMap in the Polycount Wiki.

    As far as Light Maps go, I learned you should in fact combine multiple meshes to save render speed when baking out the Light Map. When's the best time to use Light Maps? Are they more expensive then AO maps?
  • unstoppablex
    UDK doesn't know anything, it won't know you imported 3 meshes that are sharing one UV.

    just to outline:

    -Only combine UVs of meshes into one texture map if they will always be near each other.
    -if you plan on using one of these meshes for a different location, don't share UVs.

    The reason why this is bad is because if i have 4 meshes, each 1024x1024. if i combine these into a shared 2048x2048 map and place it no where near the rest of the 3 meshes, then you have a 3 textured maps being loaded into the memory because UDK has no choice. that one little mesh's texture is shared, so udk loads that massive texture into the memory. becoming wasteful.
  • Chase
    Offline / Send Message
    Chase polycounter lvl 9
    Awesome! I finally understand it. Now, as far as Light Maps are concerned can I bake it into groups of meshes? If I had a traffic cone, fire hydrant, and garbage can all sharing the same UV space I would then switch to map channel 2, load the UV's from map channel 1, take care of any overlapping/inverted faces, and render the map. Or do I have to save the unwraps from each individual object and give them their own Light Map?
  • unstoppablex
    if you have a shared UV, select each single mesh and create a 2nd uv channel, and fully pack it from 0-1 UV, with no overlapping. you can load the uvs from channel 1 into channel 2, just remember to upsize the uvs since your channel 2 lightmaps won't/cannot be shared with any other mesh.
  • sprunghunt
    Offline / Send Message
    sprunghunt polycounter
    Texture atlasing in udk is only useful for procbuildings. Udk treats each section as a single drawcall and does not batch objects into drawcalls by shader. There is no speed increase or memory advantage to doing this. In some cases atlasing like this can confuse the streaming algorithm and cause issues.
  • Chase
    Offline / Send Message
    Chase polycounter lvl 9
    I think I get it, but can you explain wht meshes can't share light maps one last time. You guys have been humungous life savers. I never learned any of this in class so thanks for being patient
  • Teessider
    Offline / Send Message
    Teessider polycounter lvl 11
    I am currently doing this atm for some models I have created for my group module at uni. Keeping multiple meshes on the same light map (presumably like ur 1st UV channel) wastes a lot of texture space (as I found out the hard way lol). I've started to give each model an individual lightmap (just like unstoppablex says)
Sign In or Register to comment.