This topic is 5058 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 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]

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
17
5. 5

• 9
• 12
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632591
• Total Posts
3007250

×