Dynamic "decal" lights on brushes

I am adding dynamic lights to my FPS engine. For models, I use hardware lights with visibility testing. For brushes, I am attempting to blend in a circular gradient texture onto the walls.

I render brushes in this order:
-lightmap
-texture, with a modulate2x blend
-normal map, cube map, other layers (if enough texture units are available)

Decal lights are drawn by rendering another texture layer with a texture of a circular greyscale gradient. I use the material color to dim the dynamic light, depending on how far away it is from the light source. I also use that to change the color of the light.

The problem is that the dynamic light texture layer has to be rendered in a separate pass, since it uses a different material color. This makes it difficult to correctly blend the texture, since it modulates and multiples by two with only the underlying static lightmap.

If there is a way to set a maerial color for only one texture unit, or if you know of another technique I should consider, please let me know.

As for blending, the root of the problem is the modulate2x blend. I could also increase the screen gamma, and use a standard modulate blend, but then windowed apps would be…not quite so sexy.

not sure if its fastest way but, a more unified way would be:

render all solids to texture

  • lightmap, selfillum masks
  • decallights additive

render all solids again

  • material based texture setup
  • fullbrightness, no lighting

then modulate the “lighteyemap” as giant quad, on top of the unlit materials.

transparent stuff will be a bit ugly to deal with I guess, but if the vertices are static and VBOs, this should still be pretty fast for the rest.

I don’t follow you at all.

I was able to get a good result like this:

Pass 1 (no blend)
-lightmap
-texture
-normal map, anything else…

Pass 2 (GL_ONE,GL_ONE)
-Decal light
-texture
-normal map, anything else…

This makes logical sense, because I want the dynamic light to “fill in” black spots on the lightmap.

or if you know of another technique I should consider, please let me know.
materials? r u meaning GL_MATERIAL
personally i wouldnt worry about gl lighting + materials
if u want bumpmaps + theyve been stnadrad issue for a few years, gl lighitng isnt gonna work