Multiple lightmaps on one poly

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 :frowning:

Or is there a better way?

How they do this at Quake,Unreal…?

Thanks for every answer!

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).

Ahhhmmmm…I don’t understand!

He means:

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

I don’t know anything about extentions. Also I don’t know this …ARB funktions.

How do I use extentions?
Can someone explain it to me?

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

Now, for the links:
http://www.opengl.org/developers/code/features/OGLextensions/OGLextensions.html
http://oss.sgi.com/projects/ogl-sample/registry/
http://nehe.gamedev.net/tutorials/lesson25.asp
http://nate.scuzzy.net/programming.html (There’s an OpenGL extensions demo w/ source on this page)

Regards,
Memo

I think the links will help me after some time of reading…thanks!

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).]

Look for EXT_multitexture.

It’s exactly the same, except EXT instead of ARB.

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.

j