How to use multiple lightmaps for one Polygon? I need it for dynamic lightning, there is one Polygon effected by multiple light-sources.
My problem is: After use a lightmap with dark(0,0,0) texels this texels can’nt be made brighter by one of the following lightmaps. So a dark wall will ever be dark
Try putting the base texture (non lightmap) at the highest texture unit with GL_MODULATE on all the other lightmaps on the lowest texture units with GL_ADD (if your card supports it).
glActiveTextureARB(GL_TEXTURE_ARB1);
glEnable(GL_TEXTURE_2D);
glBind(GL_TEXTURE_2D, …); // your texture 1 here
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glActiveTextureARB(GL_TEXTURE_ARB0);
glEnable(GL_TEXTURE_2D);
glBind(GL_TEXTURE_2D, …); // your texture 0 here
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD); // not standard, must be an extension
Hmmm, let’s find some good links for you, I’m too tired now to write a good explanation.
Anyway, OpenGL extensions are functionality enhancements implemented by hardware producers, in order to extend the functionality of basic OpenGL. Anyway, the ARB_multitexture extension is now part of GL 1.2
Light is, by definition, additive. Thus, if
you’re thinking multi-pass, you should draw
your lightmaps FIRST in additive-stauration
mode (GL_ADD, non-standard), and THEN draw
the texture in multiplication mode
(GL_MODULATE). If you’re using two
lightmaps, a texture map and a detail map,
that will nicely split into two lightmaps the
first time, and the two non-lightmaps the
second time, on hardware with two texture
units.
When I list the extensions of my card there is no multitexturing…there are no ARB’s in the list! Do my card (s4-chip) not have multitexturing or are ARB-extensions not listed?
So I think I must use multipass.
Where to place the GL_ADD? On glTexEnv or glBlendFunc?
[This message has been edited by TB-Rex (edited 12-15-2000).]
That was the original. It got promoted to an ARB extension because it was so useful. Also, try downloading new drivers. They may have the ARB extension as well.