Sign in to follow this  
coba2

Shadow mapping with multi light source

Recommended Posts

I'm still confuse about step by step to create a shadow from object using shadow mapping algorithm. I already can create shadow with one light source using shadow mapping. I create my program like paulsprojects.net, but I using VC++ 8.0 and MFC. Maybe you can help me to create a shadow mapping with more than one light source. More details is better... Thanx..

Share this post


Link to post
Share on other sites
Is no one know about shadow mapping with several light source???? Or maybe using shadow mapping with more than one light source. I looking for some tutorial about this, but until now I still can't found.

Maybe one of you can share about your experience with shadow mapping and more than one light source. Thanx

Share this post


Link to post
Share on other sites
I have not yet done much with shadow mapping myself, but I think you will have to generate one shadow map for each light, and then combine them when rendering your scene.

Share this post


Link to post
Share on other sites
normally each light is done in a seperate pass, blended over each other

for all lights
{
bind its shadowmap etc
draw all geometry that is within the lights area

}

Share this post


Link to post
Share on other sites
So, I just do the shadow mapping in first light. And the result must process using shadow mapping in second light.

But, I hear that I must using only one ambient light in one process Shadow Mapping. If I using twice, the result will be wrong..

Share this post


Link to post
Share on other sites
Quote:
Original post by coba2
But, I hear that I must using only one ambient light in one process Shadow Mapping. If I using twice, the result will be wrong..
Welcome to the wonderful world of arbitrary (almost) scenegraphs in which you can assume little.

As zedz says, each light must have its projective shadow. As long as you have enough samplers, a single pass will suffice, but what will happen when you must multipass? Bad things happens!

There are always the same approaches.
1- Cancel out the wrong stuff (the multiple light source in some way)
2- Mangle/trick all your shaders so they get it right in the first place.

I suppose (2) to be the most used. The reason is that if light A casts a shadow, it won't be considered the next pass.
For the specific ambient example, you could just set the constribution to zero ... if you cannot disable it for some reason...

Or maybe I've misunderstood the question?

Share this post


Link to post
Share on other sites
So I must use each light one shadow map?? After that, what I must to do with that shadowmaps??? Am I must bind it?? Or what?? Drawing it?

Share this post


Link to post
Share on other sites
For easiness, I'll assume you'll draw a single shadow-casting light per pass.
In that case, you could (as already suggested) blend the various contributions with an ADD operator.
Unluckly, 1- light doesn't ADD linearly 2- Adding the same lights in different orders may give different results.

So, what shall you do? As zedz said, you should ADD the various light contributions, but if this is good enough, it's up to you! Doom3/HL2/FarCry likely ADD blindly and they work just ok. Halo3 likely does not (see the GDC presentation).

Share this post


Link to post
Share on other sites
Sorry I'm still confuse. Before create this thread, I was created an old thread in this forum too. <http://www.gamedev.net/community/forums/topic.asp?topic_id=449553>.

From this I can give conclusion that what I must to do is..

First: create shadowmap for each light. If I have two light, I must have two light.

Second: I must do shadow mapping step for each light. Is it right?

After that, I must bind the each shadowmap into one shadowmap. Is it right too??

Sorry.. I cannot learn this theory fast.. He4x

[Edited by - coba2 on August 23, 2007 2:23:20 AM]

Share this post


Link to post
Share on other sites
theres different possible ways heres sorta what i do

init - create 100 shadowmaps

SM creation (each frame)
for each light
{
render depth info into a different shadowmap
}

// drawing
for each light
{
bind that lights shadowmap
draw all objects within the lights radius
}

Share this post


Link to post
Share on other sites
So, I must render from each light and save it in each shadow map. After that, I render from camera. And each shadow map must be bind into one shadow map that will be compare with the camera's result. It's right?? By the way, thanks for your help.

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