View Full Version : Lightmapping
11-14-2000, 10:34 PM
does anyone know a sample implementation of lightmaps. I'm still quite confused how to generate the lightmap itself, and how to blend it with the original texture.
Thank you in advance,
Daniel Palomo van Es
11-15-2000, 01:27 AM
can't tell you about generating lightmaps, you may wanna check out quake or half life sdk sources. but assuming you have lightmaps already generated, to apply them:
// not using multi texture
texcoords for texture
set blend func to GL_ZERO, GL_SRC_COLOR
set blend on
texcoords for lightmap
set blend off
// using ARB_MULTI extension (way faster)
11-15-2000, 03:05 AM
that helps a lot. Now left only the generation of lightmaps themselves...
To generate light maps, you basically have
to assign light maps to your geometry, then
run through each pixel of each light map,
inverse-mapping that pixel to a point in
geometry, and ray-trace from that point to
all the available lights to determine their
intensity at the point in question.
Now, there are tricks you can pull to make
this go faster, such as using low resolution
for the light maps (fewer points to trace per
poly, and less texture memory used) and not
tracing to lights which are too far away to
have any perceptible impact. In a portal
engine, you could also approximate the amount
of light emitted by each portal (from the
room beyond) and check for visibility of the
portal instead of lights within that room.
Umm... yeah, there's a reason light map
compilers are sometimes slow, especially if
they're accurate :-)
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.