This topic is 2537 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 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 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.

MJP made a good deferred shadow example that follows these steps. http://mynameismjp.w...ow-maps-sample/

Good luck!!!

##### Share on other sites
TiagoCosta: ah, yes .. i understand ! it's much simplier than i though

[color="#284b72"]jischneider: 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

##### Share on other sites

TiagoCosta: ah, yes .. i understand ! it's much simplier than i though

[color="#284b72"]jischneider: 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

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

I have a deferred shadow map working in XNA 4.0. Look at:http://xnafinalengine.codeplex.com/

1. 1
2. 2
3. 3
Rutin
21
4. 4
5. 5
gaxio
10

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631778
• Total Posts
3002310
×