PDA

View Full Version : Shadow cube map: Comparing the depth value



RealtimeSlave
05-02-2014, 05:51 PM
Hello,

I have a scene rendered into the six sides of a depth cube map from an omni light position using a 90°FOV.

So far so good.

Now in the fragment shader I somehow need to compare
A) the distance between fragment position and light position (direction vector length) with
B) the distance/depth stored in the depth cube map

Problem is, the distance B in the cube map cannot be directly
compared with the "real world" distance A, right?

How can I get comparable distance values?

I know how to lookup B but not how to transform the returned
deoth value into something I can compare with A.

Help is really appreciated!

RealtimeSlave
05-02-2014, 06:07 PM
Probably I just found the answer here:
http://stackoverflow.com/questions/10786951/omnidirectional-shadow-mapping-with-depth-cubemap

Can somebody confirm this is how it is done usually?

Dark Photon
05-05-2014, 05:49 PM
See this post:

* Re: GLSL - cube shadows - projecting (http://www.opengl.org/discussion_boards/showthread.php/174093-GLSL-cube-shadows-projecting?p=1219162&viewfull=1#post1219162) (deadc0de)

for some working code showing how.