View Full Version : dot product-3 with mirrored UVs
12-05-2003, 01:30 PM
I'm an artist that has been working with normal mapping for a little while now, but have been stymied about how to fix the inverted normals I get when using mirrored UV texture coordinates.
Some game artists have hinted on other forums about how their programming team overcame this issue, but they have been reluctant to explain how it actually works.
I wonder if anyone here could enlighten me, so I could have a more intelligent conversation with my programmers, and ask the right questions about implementing this kind of feature.
12-06-2003, 10:46 AM
I assume you're doing this in shader?
Just check to see if the normal and eye vectors are pointing in opposite directions. If they are, you're ok, otherwise flip the normal (i.e. N = -N ) so it's pointing towards the camera.
If this is for a game engine then you're likely backface culling anyway, so back-facing normal should never ever happen.
Hope this helps, tell me if I've misunderstood
12-06-2003, 01:08 PM
when you mirror a polygon, the normals aren't fully inverted, just on one axis. thus doing a normal map with only 1/2 the model makes it look like light is shining on it from different directions. i bet you they do something really simple, like doing a normal map for each side and then averaging them, or they just play with it in photoshop. i really doubt they do any tweaking of the Sobel filters in the ATI code. there's a guy who gets on gdalg who's really good at this stuff, Tom Forsyth email@example.com, you might want to post this there, and ask them if they do anything to the code to minimize these visual artifacts. many of us programmer hobbiests are just learning this stuff too. it's hard to keep up to date with current hardware technology without a BIG budget.
12-08-2003, 02:04 PM
Alright, thanks for the info.
The problem isn't with the normals of the polygons themselves, it is with the texture coordinates. When I mirror a tangent-space normal map from one side of a character onto the other side, one of the sides will have the Red channel normals pointing the wrong direction (one side will be pointing left, the other pointing right).
It isn't possible to alter the texture to fix this (basically I would have to eliminate the Red channel), instead I think I have to request an alteration in the way the engine interprets the UVs.
Perhaps the engine could merely see when U is negative, and flip the red channel during the rendering process. One issue I can see with that is when it is V that's mirrored, or if the mirroring is on both U and V.
Anyhow, just rambling on here. Maybe someone can point out my errors.
12-09-2003, 08:25 AM
Ok sorry I misunderstood what it was you were getting at.
How are you generating your normal maps? I you're taking the normals from high-res geometry, surely you could just generate the normal maps after you've generated your UVs, and for both "sides" of the object - therefore the normals would be correct for each of the UV shells.
I think detecting when your UVs are mirrored might be a bit difficult. Would it not just be easier to flip the normal map's red channel in a paint program?
If I'm still not getting it please let me know:)
12-09-2003, 01:52 PM
The mirror-UV idea is done in order to save texture space, by superimposing bilaterally-symmetrical body parts onto the same texture area... the left arm would use non-mirrored UVs, while the right arm would be superimposed on top using mirrored UVs.
This trick is a common one that helps increase the texture resolution on a model. So, I can't change the bitmap itself for each side. The idea is to reuse existing texture.
Mirroring UVs works great with other texture passes, just not with normal maps. Our programmers have talked about methods to overcome this, but there are other things on their plates right now, and I thought it would be good to research it a bit on my own.
12-19-2003, 09:46 AM
nvida has posted a paper on their cg site, that mentions the mirroring issue. seems like they are brewing a toolset that helps in letting you use normalmaps on mirrored uv's.
look for the paper at http://developer.nvidia.com/object/gdc_tspacereal.html
12-19-2003, 01:37 PM
Hey thanks GIJoe! This quote is great...
To fix this type of problem, you need to duplicate triangle edges ( ie two vertices ) before smoothing the texture gradients. During smoothing, the face with the new version of the edge won’t smooth with the old edge. This solves the texture mirroring problem
07-30-2005, 12:43 AM
It seems that i got the same problems with mirroring. Is the nvidia way responsible of the seam along the symmetry? i asked the programmers of my company and they are still searching for a way to avoid it coz it s not so esthetic to have a seam in the middle of a character's face like in all the games like doom3, Riddick and so on.
07-30-2005, 07:24 PM
there's a guy who gets on gdalg who's really good at this stuff...
Hi guys. I'm sorry to be so off topic but can you post the address to gdalg list. I'm having trouble finding with google.
08-01-2005, 01:33 PM
Wow, old thread resurrected!
The mirrored-UV-seam issue has since been solved. Some code here:
Some artists have been discussing how to get this to work, without using the NVMeshMender approach of creating proper tangents... problem is it will never work (AFAIK) without doing that. You can read yhe discussion here (along with lots of other tricks/tools/techniques)
And its searchable archives:
08-02-2005, 07:47 AM
well, it seems that the programmers of my company succeed with this inversed vectors when mirroring but they still have a seam along the symetry...
08-02-2005, 07:47 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.