Multiple shadow casters in shadow mapping.
Hi,
I have just put together a basic shadow mapping program, mostly cut and pasted together from other tutorials so I can get a better understanding and generally fiddle with things.
I am trying to add multiple shadow casters and lights to the scene now and so far my approach is
Render depth map for light 1
Render depth map for light 2
Clear out depth and colour buffers
Render scene with 2 dim lights to create ambient light
Project first depth map and apply bright light
Project second depth map and apply different coloured bright light
The problem is that the shadows from the first light are only visible inside the shadows from the second light. I am using regular openGL, no shaders here. Is there a way to project multiple shadows at once, or a way of not letting the second light completly overlap the first set of shadows.
Thanks
Just in case anyone else gets this problem,
glBlendFunc(GL_SRC_COLOR,GL_DST_COLOR);
glEnable(GL_BLEND);
on the last 2 passes and remember to turn it off on the first passes
glBlendFunc(GL_SRC_COLOR,GL_DST_COLOR);
glEnable(GL_BLEND);
on the last 2 passes and remember to turn it off on the first passes
You actually want additive blending for the last 2 passes - that is, you want to add the results of the lighting passes to the ambient pass. So, you need:
glBlendFunc(GL_ONE, GL_ONE);
glBlendFunc(GL_ONE, GL_ONE);
Thanks,
That has made the whole scene lighter and looks better.
Now I just need to find why I get different colours in debug mode and release mode.
That has made the whole scene lighter and looks better.
Now I just need to find why I get different colours in debug mode and release mode.
Quote:Original post by RocketTree
Now I just need to find why I get different colours in debug mode and release mode.
Probably because you're not defaulting your colors to a constant at start-up. In debug mode all uninitialized variables receive a different value than in release mode (which should default all unintialized variables and pointers to zero or NULL, respectively).
Thats what I had thought but I went and checked everything.
I cant seem to find any that are missed out, all my colours are set up as
float black[] = {0.0f,0.0f,0.0f,0.0f};
float green[] = {0.0f,0.5f,0.0f,1.0f};
etc.
Also the lights seem to flicker on and off sometimes in release mode.
In debug mode its starting to get somewhere, multiple shadow casters all overlapping nicely, but cant break the 4 shadows mark for some reason.
I cant seem to find any that are missed out, all my colours are set up as
float black[] = {0.0f,0.0f,0.0f,0.0f};
float green[] = {0.0f,0.5f,0.0f,1.0f};
etc.
Also the lights seem to flicker on and off sometimes in release mode.
In debug mode its starting to get somewhere, multiple shadow casters all overlapping nicely, but cant break the 4 shadows mark for some reason.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement