mixing lightmaps ?

need help about mixing two lightmaps
that one is “dark” lightmap (static)
and other is “bright” lightmap (from dynamic light) problem is mixing then at same time
i konw how to draw first “dark” lightmap
but no idea with second “bright” lightmap…
anybody know that?

Use multiplicative blending for the dark lightmaps (shadow maps?) and additive blending for the bright ones (GL_ONE, GL_ONE). That should do the trick

i try many times
but always got wrong result…
http://www.fanone.com.tw/tom/wood.jpg http://www.fanone.com.tw/tom/lightmap1.jpg http://www.fanone.com.tw/tom/lightmap2.jpg

when i only one layer that is fine… http://www.fanone.com.tw/tom/result1.jpg
(base texture): GL_ONE GL_ZERO
(lightmap for shadow):GL_DST_COLOR GL_SRC_COLOR

but two layers got wrong result… http://www.fanone.com.tw/tom/result2.jpg
(base texture): GL_ONE GL_ZERO
(lightmap for shadow):GL_DST_COLOR GL_SRC_COLOR
(lightmap for lighting):GL_ONE GL_ONE
last layer can’t bright dark side…

what should i do?

(sorry for my poor english… )

It seems you are trying to use two light sources: static and dynamic (right?)

What you normally want is to multiply the texture with the lightmap. Since you have two lightmaps, you need to ADD them together BEFORE you multiply them with the texture. In other words, what you really want is:

result = (static_light + dynamic_light) * texture

That can be accomplished in many various ways, depending on what technology you use. Unfortunately, most nVidia cards only support 2 texture units, so it’s hard to implement this with pure multitexturing. One solution would be to render it in two passes using blending:

Pass1: clear, static_light + dynamic_light
Pass2: (GL_DST_COLOR,GL_ZERO), texture

or in three passes

Pass1: clear, static_light
Pass2: (GL_ONE,GL_ONE), dynamic_light
Pass3: (GL_DST_COLOR,GL_ZERO), texture

I’m sure there are other solutions. E.g. the Radeon has three texture units, so it should be able to do it in one pass only. I’ve also understood that the GeForce3 has more texture units (4?).

[This message has been edited by marcus256 (edited 01-23-2002).]