PDA

View Full Version : Directional diffuse bump mapping



SeskaPeel
08-26-2003, 04:48 AM
In order to perform tangent space directional diffuse bump mapping, I have to compute, for each texel, the direction from this texel to the light, in tangent space, and then dot it with the corresponding texel from the bump map.

The direction, in object space, from each texel to the light is the same. However, in tangent space it has to be interpolated (using a cube map, or simple gouraud interpolation) with the 3 vertex of the texel's face.

I'm having trouble with this, because I have a rather coarse geometry, and it leads to artifacts when using the Gouraud interpolation. A solution is to use a cube map to normalize ... but I have no more texture units available. (Decal, detail, diffuse cube map, bump map)

Would it be possible to avoid such artifacts by computing my normal map in object space, rather than in tangent space ?

SeskaPeel.

knackered
08-26-2003, 05:07 AM
glShadeModel(GL_FLAT) ??

Ysaneya
08-26-2003, 07:35 AM
Yeah, i think object space would elegantly solve your problem, if you cannot afford two pass.

jwatte
08-26-2003, 10:12 AM
Instead of putting the light into tangent space, you can transform the tangent space normal into object space. That makes reflection and specular much easier, too :-)

SeskaPeel
08-27-2003, 12:32 AM
How could I get my normal (from the normal bump map, that is in tangent space) back to obejct space ? I need the inverse tangent matrix, and the tangent matrix is specified by vertex, and not by texel ...

knackered
08-27-2003, 12:58 AM
Interpolate the tangent matrix.
NVidia have a paper on this using texture shaders.

SeskaPeel
08-27-2003, 11:26 AM
Sorry I posted a new thread before reading this one ...

I didn't find this paper ...
Could you precise wich one ? Or directly explain the solution to this problem ?
(passing tangent space normal from the normal map into object space in a fragment program)

Thanks,
SeskaPeel.