Shadow mapping in a Large Enviroment
Okay below is the depth map from the light source. Below is the overhead view I wanted because since I'm using orthogonal projection I can see actors, etc far into the distance. My dilemma is that I can see a lot of objects into the distance however not to the left / right / behind the toon. If I try to rotate the light source so that it will always face direction character is facing then the existing shadows will also rotate which looks hella wrong. Which goes back to my original question. Am I just simply supposed to 'never' rotate my sunlight to face the direction my character is facing? It seems to me it is okay to 'movve' the sunlight along with the character but never rotate it to face the direction he is facing.
Below is the image that is above the scene that my friend told me I should do (I need to make sure light source can see everything the player can see). This seems like a lot fo work to me if I go this route because it doesnt seem like I am benefiting much from the orthogonal projection? I will have to work to clip everything the character see in every possible direction. Looking at the shadowmaps from Lost Planet from the article I read I dont think their light source is top down like this....
So- I guess what I'm trying to ask is it okay to position my light source at whatever angle I choose as long as it can see all the objects encompassed by the view frustum? Right now the images above are obviously not optimized to only see the 3 objects but I was trying to get a feel how this would work with a huge scene populated by a lot of objects.
I want to use the position used in image #1 which can see objectsfar into the distance. it takes full advantage of the orthogonal projection. However, when my character moves left/right/back the shadowmap generated from that angle is no longer valid / needed and if I try to generate a new shadowmap for the new view direction I see the existing shadows sort of rotate along with the light source (because they rotate around in my depth map).
What I cant figure out is why doesnt anyone else have this problem and what did I do wrong....
In any case I'll go ahead and move forward with an algorithm. until I get the shaderx5 book, I'll probably have to go with LispPM since it looks easy to implement. Will also have to build a better orthogonal proj matrix that tightly encompasses the objects. hoping this mystery will unravel itself. once the wife goes to sleep maybe I'll have time to FRAPS this right fast I'll try to make the video filesize real small
Just a guess, I could be wrong. It's something along those lines.
Add here 'large environments'. Add reflection. Add sophisticated motion blur. Z-pass. All this things shrink your potential budget for vertices per scene down.
So, for distant part of the scene I would consider using shadowing methods that don't require updated every frame...
Now I need to try to get my hands on that shader x5 book I could not find an CSM implementation online.... I hope it includes good examples hehe. Was tempted to look at Parellel Split as well I wonder if CSM is much simpler then that? Does CSM naturally work with orthogonal light sources? Will have to remember to ask my friend to bring that book tomorrow
Thanks
In our case we're mostly cpu bound, even with heavy shaders. That's why I don't want to afford rendering the scene x times as required by CSM or PSSM. If you don't have this limits, CSM might be the way to go for you.
To summarize:
Perspective Shadow Mapping: depends on the angle between view direction and light direction. Has dead points.
Light Space Perspective Shadow Mapping: as above, but without the dead points. Scales back to uniform shadow mapping the closer your view direction gets to the light direction.
Cascaded Shadow Mapping / Parallel Split Shadow Mapping: perfect shadows everywhere due to multiple shadow maps or passes for different distances. To my knowledge the shadow maps itsself are projected uniformly, so it's simple to implement as well.
Nameless Shadow Mapping: my version of it. Works by distorting the shadow map texture coords like a lens effect that makes closer objects larger on the shadow map, thus improving the resolution for them. Works for all view angles and light angles, works with a single shadow map and a single pass, the difference is just some additional vertex shader instructions. But its improvement potential is limited and there's an unsolved problem with certain viewing angles where parts of very the distant scene end up outside the shadow map. Demo available in the thread linked above, but without source.
Hope it helps.
Bye, Thomas
Quote:Original post by Schrompf
...
What is exactly the differense of your method and other perspective corrected single-pass ones?
The function of 'scene pyramid' -> 'shadowmap square' transformation?
And why it is better, then?
Just interested.
Hi Schrompf, did you fix your algorithm such that it's guaranteed that no portion of the scene is warped outside the shadow map? (Otherwise I wouldn't consider it an alternative.)