   Shadow mapping with multi light source
  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..   
  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   ;  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.   ;  normally each light is done in a seperate pass, blended over each otherfor all lights{ bind its shadowmap etc draw all geometry that is within the lights area}   ;  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..   ;  for each light you must create a different shadowmap   ;Quote:Original post by coba2But, 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?   ;  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?   ;  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).   ;  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]