Dot3 and vertex lights

I am rendering static meshes using compiled vertex arrays, and setting the lighting environment up for each instance of the mesh, depending on a pre-compiled list of which lights are visible to this mesh.

I want to implement dot3 mapping in my materials, but want to be able to render staticmeshes with colored lights.

It seems the only way to make this work would be to render the meshes with lighting, then render the normal map in a second pass. This means glBlend would have to be enabled in the second pass. Would the second pass objects have z-ordering problems with each other? Is there a better way to do this?

In other words, rendering a second pass means enabling glBlendFunc. Does that mean I have to calculate z-order for every bump mapped surface in the scene?

By the way, I only want simple bump mapping, so I am willing to just use the nearest/brightest light for the lighting direction, and jut use it for a little highlight, not actual “lighting”. This is more just like detail textures with a little directionality.

An alternate method would be to render a “color” texture on top of the bump map, so that colored lights can still be used…sort of.

You won’t get z-fighting rendering the second pass with blending enabled (as long as both go through a vertex program or you use the position invariant option in the vertex programs)

So you don’t have to do any sorting for your second pass…

Yeah, I realized I have done terrain with this method, and there was no z-ordering problems.

So bump mapping should probably be done in a separate pass. There might be a few cards that can get around that, but most people have crap cards, like mine.