Mirroring and normal mapping [solved]

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1067
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
x 43
Contact:

Mirroring and normal mapping [solved]

Post by Oogst »

I am researching how to use normal mapping in combination with mirrored meshes (and textures) and I am wondering how certain things can be solved.

First there is the flipped lighting in the general case of a mirrored and normal mapped object. How is this solved generally? I know its easy, but I am just wondering how its done.

Then there is my main question, assuming the above one has been solved: Doom III clearly uses characters that are mirrored. I checked their texture-files and they surely do. How is this done? I can generate half the normal map, but using this will result in strange lighting around the seam. This is apparently caused by the tangent being interpolated over the seam. (Or not?)

A solution for this that I implemented in MEL (MAYA-script) is to split the mesh over the seam, but keep the normals the same as they were before splitting. This keeps the look of the mesh perfectly smooth, but makes sure the tangents are not interpolated over the seam. However, this still does not look smooth, for now there is a visible edge in the seam. I guess this is because the tangents are flipped at both sides of the seam.

So, what is the best way to get normal mapping to work well with mirrored meshes like characters?
Last edited by Oogst on Thu Oct 06, 2005 8:52 am, edited 1 time in total.
User avatar
RyanN
Halfling
Posts: 82
Joined: Thu Aug 19, 2004 6:41 am
Location: Victoria, Australia
Contact:

Post by RyanN »

mirroring a mesh flips its normals therefore normal mapping which uses the normals to calculate how it lights the texture is being screwed up, for 3dsmax all you need to do is apply the 'reset xforms' ( found in the 'utilities' menu ) to the mesh, once its applies you will notice that the faces now look inverted. To fix this simply apply the "normal' modifier from the modifiers list; problem solved. Doom3 character textures, like alot of games, are just half of the entire model that way you dont need to repeat yourself for each side of the mesh, the textures are uvw mapped backwards on the otherside however this does not affect normal mapping only the actual mesh normals would cause normal mapping to seem like its not working.
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1067
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
x 43
Contact:

Post by Oogst »

Okay, I was not clear enough, so I will show a picture to show the problem. This is a mesh that is mirrored and the lighting is incorrect around the seam. Above is the high poly mesh with correct lighting, below is the low poly mesh with incorrect lighting around the seam.

Image

This picture is taken with the normal mapping shader from MAYA and the same thing happens with the pixel shader in-game. In-game (not in MAYA) it is solved by splitting the mesh over the edge, so that no interpolation is done there. However, this makes the seam clearly visible, which is a big problem too.

What causes this problem and how can it be solved?
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1067
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
x 43
Contact:

Post by Oogst »

Does no one know a solution to this?
genva
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 1603
Joined: Wed Oct 20, 2004 7:54 am
Location: Beijing, China
x 1

Post by genva »

Following this link: http://developer.nvidia.com/object/NVMeshMender.html.
MeshMender's main purpose is to generate a tangent space basis for
per pixel lighting. Given a set of vertices and normal map texture coordinates,
MeshMender will return a set of normals, binormals, and tangents taking into
account texture mirroring.

Meshmender also lets you choose a minimum angle between neighboring
triangles vectors to determine whether or not they can smooth together.
If they can't smooth together, then MeshMender automagically mends the mesh
so that each unsmoothable neighbor has it's own set of vectors in a unique vertex.
When use texture mirroring, cylindrical texture coordinate, etc for pre-pixel-lighting, the tangent space basis maybe incorrect when calculate with simple algorithms. The NVIDIA MeshMender can solve a lot of tangent space basis issues. You may adapting it for process Ogre Mesh.
Oogst
OGRE Expert User
OGRE Expert User
Posts: 1067
Joined: Mon Mar 29, 2004 8:49 pm
Location: the Netherlands
x 43
Contact:

Post by Oogst »

Ah, yes, that seems like exactly what I was looking for. Thank you!

Has anyone gotten experience with this particular issue and NVMeshMender? Does it actually solve the problem? Just asking in case I spend a lot of time implementing this and then finding out it does not really work after all.
Post Reply