Im in the process of UV mapping a weapon for UDK and was wondering if someone here knows if its possible to use mirrored UV surfaces in UDK and still get the cubemaps and normalmaps to look right on the "wrong side" of the mirrored parts.
I actually do think its possible by assigning say a vertex color to the "mirrored/flipped" side of these parts and have that as a mask for flipping the normal direction in the shader... But I haven't tried this in practice, anyone know if it works? Better yet, anyone have a screenshot of a working shader set-up they could share?
I'd save tons of UV space flipping say the left-right side of the magazine in the UVs... it's just that I'm worried the cubemaps might end up upside down on one side.. and normalmaps will create seams.
Replies
Either way, the fastest way would be to make a test model and just import it into UDK to see if it works the way you want.
Even if this was the case you would probably just use the lightmap uv set to apply the cubemap since it is unique.
IIRC it's more of an issue of baking the lighting info, maybe a dynamically lit object such as a typical weapon won't suffer from these problems.
And since it's a weapon it'll be dynamically lit, and lightmaps wouldn't help covering up the seam. I guess using a second UV channel for the cubemap would work, but then again I'd have to add another UV channel. Maybe it's not a big deal, I just like to optimize stuff as much as possible.
I believe, and I might be wrong, that the lighting resulting from the UVs on the flipped side will look inverted/wrong and cause seams where the UVs are mirrored.
Say a character that has his hands mirrored+stacked in the UVs might get incorrect lighting on one of his hands due to the fact that the normalmap is rendered based on the tangent direction of the verts on the other hand.
What I was thinking however, is that there might be a way around this if you detach those faces on the "mirrored" hand in order to get double the amount of vertices with different tangents for the seam area. Which you can then use to set a specific vertex color to those vertices and then mirror the UVs horisontally using that vertex color as a mask in the shader. Then both hands would in theory look correct? Assuming the geometry is completely mirrored as well so there's no difference in vert, tangents between the left and right hand.
I made a character that I imported into UDK that had a bare chest with mirrored arms and had tons of problems trying to cover up seams resulting from flipped normals and inverted cubemaps in his shoulder area. I guess I could have designed around the problem had I known it was a problem before I tried it.
Sorry for long post... I might just be overthinking this and should probably just go try it out in the editor. :P
It might not be the greatest of problems, maybe it won't be noticable. Maybe I can hide seams and stuff.... I was mostly curious if someone had tried this before.
What you need to do is simply offset the overlapping uvs on one side extra 1 unit in the uvs, this will ensure that everything bakes without fuss, and that you're using the correct mesh normals when baking to produce a seamless result.
I've found that in max 2010 and up you don't even need to do this. It seems to bake just fine if you have overlapping UVs. Of course if you're using a different baking tool then that may not work.
You shouldn't have to worry about the UVs for a reflection map as it should be using the reflection vector transformed into coordinates as UVs. A relfection won't look right if you use the regular UVs.
Umm, I'll just do some research and get back to you if I find something interesting.