More tex units needed


I am using a GeForce4 that supports 4 texture units. I have written a piece of code that is basically similar to the “Anisotropic Bump Mapping” that is part of the NVidia Effects Browser. The demo uses 4 texture units:

TEX0: tangentmap (RGB)
TEX1: texcoords are the L vector
TEX2: texcoords are the H vector, texture is a phong lookup texture
TEX3: the decal texture (RGBA)

I am trying to expand this demo with depth-based shadow mapping that would consume yet another texture unit. Unfortunately, I am not that experienced, so I have no idea, how to effectively combine these two techniques. Does anyone has an idea, how I can achieve this, but by still using this bump mapping technique?

You can multipass it. First draw your bumpmapping as you already do. Then draw the shadowing pass on top of that and do multiplicative blending.

What Humus said. Except that it might be problematic if you have multiple lights. In that case, you could render the shadows into destination alpha, then draw the light using (GL_DST_ALPHA, GL_ONE) blending.

– Tom

Yes, I will try this, thanks for your help!