Directional diffuse bump mapping

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 ?


glShadeModel(GL_FLAT) ??

Yeah, i think object space would elegantly solve your problem, if you cannot afford two pass.

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 :slight_smile:

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 …

Interpolate the tangent matrix.
NVidia have a paper on this using texture shaders.

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)