Sign in to follow this  
wh1sp3rik

Screen-Space Shadows theory

Recommended Posts

Hello,

I am trying to figure out, how to render shadows from two depth maps.
Let's say, i have one depth map from Light View and one depth map from Camera View. I know a light position, direction, transformations.

firstly, i thought, i can get a position of pixel from light depth map, make ray, calc distance from light to that pixel and on camera depth, i can find pixel, which lay on this line. When distance is bigger to this camera depth point, it's in shadow. Problem is, i don't know if it will work and second, if yes, it will be slow, becuase O( n^2 ).


Do you have any ideas, how to make it right and fast ? Could you please give me some hints, ways, how to make it?

I attached a RenderMonkey project file, where i render two depth maps and third pass ready for calculation. if someone is really good in shadowing, could you have a look into and write simple example ?
Thank you very much for your help, hint, anything, what can help me :)

Share this post


Link to post
Share on other sites
I do it this way:
-Use the camera view depth map to reconstruct pixel world position.
-Transform that world position to light view position.
-Compare the depth value calculated and the one store in light view depth map.

Share this post


Link to post
Share on other sites
[quote name='TiagoCosta' timestamp='1313007611' post='4847300']
I do it this way:
-Use the camera view depth map to reconstruct pixel world position.
-Transform that world position to light view position.
-Compare the depth value calculated and the one store in light view depth map.
[/quote]
MJP made a good deferred shadow example that follows these steps. [url="http://mynameismjp.wordpress.com/samples-tutorials-tools/deferred-shadow-maps-sample/"]http://mynameismjp.w...ow-maps-sample/[/url]



Good luck!!!

Share this post


Link to post
Share on other sites
TiagoCosta: ah, yes .. i understand ! :D it's much simplier than i though :)

[url="http://www.gamedev.net/user/187495-jischneider/"][color="#284b72"]jischneider[/color][/url]: thank you, i tried it, unfortunately,i t's written in XNA Game studio 3.1 and i have 4.0 :) big changes, but i read the code and i have some questions ... which are solved now :D

Share this post


Link to post
Share on other sites
[quote name='wh1sp3rik' timestamp='1313049457' post='4847543']
TiagoCosta: ah, yes .. i understand ! :D it's much simplier than i though :)

[url="http://www.gamedev.net/user/187495-jischneider/"][color="#284b72"]jischneider[/color][/url]: thank you, i tried it, unfortunately,i t's written in XNA Game studio 3.1 and i have 4.0 :) big changes, but i read the code and i have some questions ... which are solved now :D
[/quote]

XNA 3.1? I didn’t remind it, sorry.

I have a deferred shadow map working in XNA 4.0. Look at:[url="http://xnafinalengine.codeplex.com/"]http://xnafinalengine.codeplex.com/[/url]




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