Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Shadow cube map: Comparing the depth value

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Intern Contributor
    Join Date
    Nov 2011

    Question Shadow cube map: Comparing the depth value


    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!

  2. #2
    Intern Contributor
    Join Date
    Nov 2011
    Probably I just found the answer here:

    Can somebody confirm this is how it is done usually?

  3. #3
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    See this post:

    * Re: GLSL - cube shadows - projecting (deadc0de)

    for some working code showing how.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts