Lightmaps & Shadows

Started by
4 comments, last by Master Lolo 22 years, 2 months ago
Sorry for the crosspost on this forum and the opengl.org one, here is my problem (no one answered me on opengl.org) : Hi all, I''m trying to do what some people call "lightmaps". This is no texture or multitexturing related question, but more about a method to perform this (even if I don''t know exactly how to render a shadow). So let me explain what I exactly want to do : First I want to cast shadows from a single light source. This light source is STATIC (the sun), it won''t move, so I want to perform a minimum of calculations each frame. Of course I can perform a lot of precalculations while the app is loading, I can even store the results in a file. I want to use this to cast shadows from trees, as they are lit by the sun. The leaves of my tree are rendered with alpha textures, and I want theses "holes in the polys" to be rendered on the ground shadows. The ground is NOT flat, and I want the tree to self shadow if necessary. The best, I think, would be to store these shadows in a file (so what should I store exactly ?), and to render them as if it were textured on the objects of my scene (by multitexturing or any other way) Second I want to perform the same thing, but with multiple light sources (for indoor lightmapping). If shadows overlap, then the "resulting shadow color" will be darker. Any suggestions, any links, any help of any kind would be much appreciated. At the moment I am reading a pdf written by Mark Kilgard from nVidia about stencil shadows, is it the best way for my problem ? Lolo
Advertisement
I don''t know how to do lightmaps, but in my OGL programs i use GLUT.Download the full version (4.6 Mb ZIP) fron Nate''s page.It contains a lot of lighs & shadows examples. It''s useful ! For example there it a Tunes scene and it looks like normal 3d action game. I thing it''s the easyest way to do perfect lights & shadows. But you can do more cool efects with it !!! Just look at it...
Oops - Tunel scene
Hey!I''ve just found a Lightmap tutorial on Nate''s page ! Check it out !
u want static lightmaps (ala most fps''s up to and including unreal2)
im not to sure of any info links (+ it is quite difficult)
there are mabny ways of doing this heres a very simple ray cast method

for (each poly in scene)
{
for (each texel of the polys texture)
{
find texels position in world space
cast a ray from position -> light scource
check if the ray intersecs any geometry if so its in shadow if not it receieves light
}
}


check out ''barycentric coordinates''
useful for this + for alpha textures

this is prolly the simplest method (but A wont look great + B wont run great )

http://uk.geocities.com/sloppyturds/gotterdammerung.html
I''m getting infos about radiosity, it seems like the better way to perform this stuff. The concept is quite easy, but far less when it''s question of implementation ... I''ll let you know

This topic is closed to new replies.

Advertisement