Sign in to follow this  
Foxostro

Multiple lightmaps and shadowmaps

Recommended Posts

I am trying to code a lighting system that uses spotlights that project spotlight-shaped textures as lightmaps onto objects and where each spotlight also projects a shadow map onto the scene. However, I am having a few problems gettign this to work: 1) Shadow mapping only works correctly if exactly one light binds and enables its shadowmap. Otherwise, all objects appear to be in shadow. (I am using the shadow mapping code from www.paulsprojects.com with a few modifications) 2) If two or more lights project their lightmaps, then light only appears on objects where the lightmaps overlap. Please, if you have any ideas on how to correct either one of these problems, I could use the help! EDIT: I uploaded some images of the lightmap problem. Clicky #1 When using one lightmap, everything works just fine. Clicky #2 When using two lightmaps, they only appear light up the region where they overlap on. NOTE: The seconds lightbulb is offscreen at the bottom right hand corner. Only the first light attempts to cast shadows btw. [Edited by - Foxostro on November 14, 2004 9:50:48 AM]

Share this post


Link to post
Share on other sites
I don't understand exactly what you're doing but it seems to me that you're modulating the 2 lightmaps. You should add the lightmaps, and then modulate the result with the textures.

Share this post


Link to post
Share on other sites
Can I set different GL_TEXTURE_ENV_MODE's for different texture stages? (I'm googling this right now)

I tried setting GL_ADD instead of GL_MODULATE, but everything looks washed out.

EDIT:
Okay, so I am now using stages 0 and 1 for the two lightmaps and stage 2 for the texture skins. Am I setting this up right?


glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

glActiveTextureARB(GL_TEXTURE1_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_ADD);

glActiveTextureARB(GL_TEXTURE2_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);


The spot lights are in the correct place, wit the correct brightness, but the skins don't show up.

[Edited by - Foxostro on November 14, 2004 10:00:12 AM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this