I've often heard that you're not supposed to overlap uv's when making lightmaps. I wanted to test this theory and have found that it IS ok to overlap uv's. Sure, if you want multiple copies of say a pillar to have their own unique uv space for colour variation that's all good but I often come across little things that will receive the same light and don't really require any unique attention. I've now come to the conclusion that it's ok to overlap such elements and in the process I save extra uv space to improve the overal quality of the lightmap.
Let me explain what I found out and after I'd love to hear what others can add to the theory to help me better understand this process.
So first here is a scene. The box is the main piece in question. So in UV2 I have the bottom poly in the middle and the side poly to the left.
Now as expected, 2 is pitch black because it's sitting on the floor. 1 shows the shadow of the half box next to it.
Ok so now lets map the opposite side to 1 and give it unique uv's
both 1 and 3 have the same info because in the scene they are receiving the same light information because both sides of the scenery are symmetrical. As expected.
So I move the uv's of 3 and overlap with 1. It gets exactly the same result, uv space saved.
Ok,so what if we moved the teapot close to 1
I thought at this point the teapot shadow would be on both sides or something since they are flipped...
...Yet I flipped the uv of JUST 3 and rendered again, the same result. I flipped it vertically, the same.
Conclusion? It's fine to overlay lightmap UV's and it doesn't matter if they are flipped. Just as long as they perfectly overlayed.
Can anyone back this up or add some thoughts?
Replies
I'm trying to find a reason to map channel2 for an portfolio asset, does it make no sense to continue? Another advantage from mapping to channel2 that I know of is that you can add a 'colour map' (never found the correct term for this) that overlays the diffuse in the engine but because the uv's are much more unique you can add extra colours/stains etc to each of multiple repeated elements.
Basically, what's the advantages of mapping to UV2?
UV1 = you can overlap, reuse, and/or tile the texture to your heart's content. This makes the texture pixels smaller on the mesh, and so you get more apparent detail. Cracks, woodgrain, writing, etc.
The other texture you mentioned is usually called a detail map.
capone: If you're not lightmapping an asset, then you're right, you don't need a unique second uv channel. If you're looking to bake in certain always present shadows or occlusion, then doing a more clever unwrap in your first channel and baking it in there would probably be a better route.
1) Just say I was doing a lightmap for the purpose of the engine, does my original theory still make sense that it's ok to overlap/flip uv's?
2) So just for portfolio reasons I want to have some sort of detail map. So for (a made up) example, I have 4 wheels. I had a small texture budget so overlapped all 4 wheels in my diffuse map on channel1 but I want to add little smears of extra colour/dirt etc here and there on each wheel so they look different. Now glib suggested 2 solutions 1 of which is decals, when he says decals I think of lots of planes placed all over the wheel which is a bit messy. I'm guessing there is another way of adding decal within a texture using specialized shaders or something? Secondly is blending, no experience of this but again am guessing it it's a larger map that can be placed over the diffuse again using specialized shader options? Is there a shader that most max users use? I'm currently using Lumonix and Advance Software shaders.
Yeah you can use 2 color maps, depends on the shader. Pretty sure Shader FX can do this easily. Just multiply the detail map with the regular color map, both using UV1. Each wheel would need its own shader though, so you can setup different offsets for the detail map. So you could pack four wheel detailmaps into one.
Edit.. a cheaper way to add variations is to use vertex color instead. Less texture mem, but also less sexy.
Does anyone have any examples of a typical flat detail map?
http://www.cafu.de/wiki/textures:perfect_detail_maps
I don't agree with the results that programmer gets, too washed out, but it does show detail maps in action. UDK has an example too somewhere, couldn't find it though.
I assumed you wanted specific overlays, not a random low-frequency tiled texture. In that case I would approach it like a lightmap, packing each wheel's decal/overlay into its own quarter of the detailmap. Then I'd use offsets in the shader to show just the 1/4 of the detailmap that I wanted, for each wheel.
As mentioned though there are many different approaches. Floating decals is one approach, vertex color is another, vertex blending between two textures is another, using an overall detailmap is another, etc.
This is for a portfolio piece, right? I would then choose the method that is the most visually pleasing, without being technically wrong (like it would be if you packed four unique wheels in a single 2048 or something).
So if painting to UV2 is out of the question I'm not quite sure what the solution is. Shame because that's the only way you can paint while knowing where it's going to display. Have to say, I have never heard about massive memory increase with 2 UV's. All of the three engines I have used could handle them and it wasn't an issue at all.
I'll try and find more info on this, would be great if this could be cleared up.
Someone on your dev team is going to be the gatekeeper for perf issues, they'll tell you if your model is too bloated.