POV-Ray : Newsgroups : povray.off-topic : Question about OpenGL and lightmaps : Question about OpenGL and lightmaps Server Time
29 Jul 2024 20:24:39 EDT (-0400)
  Question about OpenGL and lightmaps  
From: Warp
Date: 19 May 2011 19:43:59
Message: <4dd5ab3e@news.povray.org>
This might not be the best possible place to ask this, but at least it is
related to computer graphics (and there are lots of programmers here), and
I don't feel like subscribing to yet another random online forum.

  This is something I really should know, but I don't. And, more
surprisingly, I just can't find this info even though it should be
something that's trivial to find. It just doesn't seem to be. I was
wondering if someone with more experience on this subject could illuminate
me a bit.

  Light mapping is a common efficient method for lighting static scenes,
especially in older 3D games. I had always assumed that light maps could
both make the underlying texture darker *and* brighter (from complete black
to completely overexposed white where the lighting is the strongest, and
then of course an unmodified texture in between the two extremes).

  However, after searching info online about how to use light maps with
OpenGL, this possibility is actually not clear at all. There are tons and
tons of tutorials online (most of them dealing with how to *create* light
maps, which is not what I'm looking for rather than how to *use* them in
OpenGL). Whether the same light map can both make the underlying texture
darker and brighter (than the original texture) is inconclusive after my
extensive search. Some example images seem to indicate that it is possible,
but the details of *how* it's done are sketchy at best.

  When I tried to search information on how exactly do this with OpenGL,
I just can't find it. You can make the light map modulate (ie. multiply)
the underlying texture, which can only make the texture darker, or you
can make the light map add to the underlying texture, which can only make
the texture brighter, but I can't find the info of how to make it do both,
or whether it's actually possible at all.

  I am almost certain that in many games light maps do both. However,
trying to search for examples has also proven difficult. For example
screenshots of Quake 2 (which is a perfect example of a game using
light mapping) are inconclusive. It's difficult to say whether the
light maps are brightening the textures besides darkening them, or
whether they are only darkening them. I was pretty sure that they do
both, but I can't find conclusive screenshots demonstrating this.

  (One possibility could perhaps be layering *two* light maps on top
of the textures, one for darkening and another for brightening. However,
it seems that at least vanilla OpenGL does not easily support layering
more than two textures at a time.)

  Could someone more knowledgeable about the subject shed some light on it?
(Pun very much intended.)

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.