Lightmapping with openGL

Started by
6 comments, last by Maitrek 23 years, 11 months ago
Hrm - I just want to ask a quick question. Are there really any alternative methods to doing lightmapping in opengl? I''ve yet to really give it a go, but i''m guessing it''s a multitexturing thing. And if it is, how would I combine the two textures in OpenGL? And also, I still seem to be having trouble with gllights on a voodoo 2, no matter what I do with them they seem to be full bright from whatever distance, maybe it''s an attenuation thing. Ahh well, any hints/help would be appreciated!
Advertisement
Hi,

Well, I only know one way, the multitexturing way... You can do it like this:

Set your glTexEnv to GL_MODULATE
Draw your object normaly with your 1st texture
Enable GL_BLEND
Disable GL_DEPTH_TEST
Set the BlendFunc that you want (I usually use GL_SRC_ALPHA - GL_ONE_MINUS_SRC_ALPHA, but if I''m not wrong, the corret is GL_ONE - GL_ONE... can''t say for sure, sorry... you''ll just have to try both )
Draw your object again, with your lightmap set as texture

And that''s it! As you can see, you have to draw your geometry twice, but that can be avoided if you use Compiled Vertex Arrays... I''m not THAT sure it''s right, but that''s how I remember of it.
I don''t know about your Voodoo 2 problem though... are you using the latest drivers?

Hope that helps,
Nicodemus.

Nicodemus.----"When everything goes well, something will go wrong." - Murphy
You can also use the multitextureing extension so you only have to draw the object once, but your OpenGL ICD has to support it...

----------
Drago, VerSoft
osu!
Drago - what are the functions involved in the multi-texturing extension, know of any decent documentation? I guess I''ll try the opengl.org or something.
So there is no way that I can get gl to combine the two textures or something like that before I draw the geometry so I can avoid multi-texturing...and would setting the glTexEnv to GL_BLEND do?
the extensions used are the ARB_multitexture and a logic op extension of which I do not remember the name right now.
You use those functions to switch the active texture unit. OpenGL.org has docs online.

quote:Original post by Maitrek

So there is no way that I can get gl to combine the two textures or something like that before I draw the geometry so I can avoid multi-texturing...and would setting the glTexEnv to GL_BLEND do?


You''d have to do this yourself by altering the textures, but aside from being slow, you''d also lose a major advantage of lightmapping. You''d wind up generating a unique texture for every surface in your scene, and unless they''re pretty low quality you most likely won''t have memory for it. Even if gl could combine the textures itself without multitexture, you''d be faced with this problem.

But why exactly don''t you want to use that? V2s are good at it.
I don''t really. I''d like to render all the textures in one pass (multi-texturing) anyway I''ll just run around and look for more stuff on the ARB extension.

This topic is closed to new replies.

Advertisement