Home Technical Talk

Should I duplicate a repetitive mesh to avoid flooding my UV map ?

polycounter lvl 4
Offline / Send Message
wonkza polycounter lvl 4
This is something that has been confusing me for a long time, I heard many times that when you have to duplicate a mesh on the same object it can be a good idea to do the UV first and then duplicate it so you wont have a hundred cubes on the UV map for instance.

 But I don't really understand the logic behind it since if two cubes share the same UV it means also that the baking of the lights in the engine will be the same on all the cubes sharing the same UV?  and here is an example:


I am making this house for UE4 and this is the roof, but as you can see the tiles are really repetitive, so should I:
1) Make lets say 10 tiles do the UV and then just duplicate them until I get this roof again? Or should I
2) Make them individually with each tile a separate unique UV so in the final UV map I will have hundreds of unwrapped squares?
 
But If I do  the first way  I don't understand how it works since so many will share the same UV, what happens when you bake the lightmap? the shadow that should be on the left of the roof will also be on the right of the roof ?  That's what I am really confused about. 

Thanks for the help.

Replies

  • throttlekitty
    Options
    Offline / Send Message
    What you need is a second UV set for the lightmap, yessir! On UV set 1, you'd have the regular uvs set up for tiling and stacking. Set 2 would be the whole house laid out uniquely, so the light and shadow bakes down without messy overlaps. Here's a page filled with examples.
  • wonkza
    Options
    Offline / Send Message
    wonkza polycounter lvl 4
    What you need is a second UV set for the lightmap, yessir! On UV set 1, you'd have the regular uvs set up for tiling and stacking. Set 2 would be the whole house laid out uniquely, so the light and shadow bakes down without messy overlaps. Here's a page filled with examples.
    Thanks,
  • wonkza
    Options
    Offline / Send Message
    wonkza polycounter lvl 4
    What you need is a second UV set for the lightmap, yessir! On UV set 1, you'd have the regular uvs set up for tiling and stacking. Set 2 would be the whole house laid out uniquely, so the light and shadow bakes down without messy overlaps. Here's a page filled with examples.
    Hey just wondering, how do I bake the AO with the UV set 1? I tried and its all messed up because of all the tiling and stacking
  • throttlekitty
    Options
    Offline / Send Message
    Move any mirrored and stacked UV shells out of the 0-1 space by a whole unit (ie one square to the left).
  • wonkza
    Options
    Offline / Send Message
    wonkza polycounter lvl 4
    Move any mirrored and stacked UV shells out of the 0-1 space by a whole unit (ie one square to the left).
    Thanks, so can they be anywhere outside the 0-1 space ? or they need to be exactly one unit away?
    because if I tile something like 3times and I move the UV shell to one whole unit to the left for all of them, all of them will be stacked on top of each other but outside of the 0-1 space is that ok or I should move them around so they are never on top of each others?
  • SnowInChina
    Options
    Offline / Send Message
    SnowInChina interpolator
    yes thats ok, the baker ignores everything outside 0-1

  • wonkza
    Options
    Offline / Send Message
    wonkza polycounter lvl 4
    yes thats ok, the baker ignores everything outside 0-1

    I really don't understand, how can I bake the AO if its gonna ignore the UV shells...
  • throttlekitty
    Options
    Offline / Send Message
    Yes, I should have expanded on that. As mentioned, bakers ignore anything outside 0-1. You can move a UV shell a unit in any direction and still be located on the same place on the texture for rendering purposes. What happens is that the baker is sampling the geometry and writing pixels on the texture for any shell in 0-1 space. So when you have different geometry stacked up, the pixels are written again and again giving the mess you saw earlier. Also there's nothing wrong with leaving those stacked shells out there. I'm sure there's some scenarios where it's required, or some people may want everything centered for cleanliess' sake.
  • SnowInChina
    Options
    Offline / Send Message
    SnowInChina interpolator
    wonkza said:
    yes thats ok, the baker ignores everything outside 0-1

    I really don't understand, how can I bake the AO if its gonna ignore the UV shells...
    you won't

    if you duplicate the geometry and move all duplicates outside 0-1 they will get the same ao as the original still in the 0-1 space when you move them back after baking
    to have unique ao for every shingle, you would need to unwrap them unique

    you could use your second uv channel, which you will propably use for lightmaps, to bake the ao map from that and then modify your shader to that
  • wonkza
    Options
    Offline / Send Message
    wonkza polycounter lvl 4
    wonkza said:
    yes thats ok, the baker ignores everything outside 0-1

    I really don't understand, how can I bake the AO if its gonna ignore the UV shells...
    you won't

    if you duplicate the geometry and move all duplicates outside 0-1 they will get the same ao as the original still in the 0-1 space when you move them back after baking
    to have unique ao for every shingle, you would need to unwrap them unique

    you could use your second uv channel, which you will propably use for lightmaps, to bake the ao map from that and then modify your shader to that
    Oooookay now it makes sense...

    I was losing my mind over this.

    I tried doing the UV set thing to one whole unit to the left.

    But then I got this in the baker:
    This is what I get if every tile has a unique UV shell but the uv map is insane.


    What would they do in a professional environment?  is it not too much to have all those tiles?
Sign In or Register to comment.