Part of the Khronos Group
OpenGL.org

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 Mapping UV coordinates

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    4

    Shadow Mapping UV coordinates

    Hello everyone,

    I'm trying to implement spot light shadow mapping in my opengl program (so perspective projection matrix), the issue i'm facing seems to be that i'm not getting the correct shadow map UV coordinates from my vertex transformation (biasMatrix * LightProjMatrix * lightViewMatrix * modelViewMatrix * gl_Vertex). Is this calculation wrong ?

    I tried setting my spot light the same direction and position as my camera, so if i'm right the matrices to use would be the regular ones for UV calculation (biasMatrix * cameraProjMatrix * cameraViewMatrix * modelViewMatrix * gl_Vertex). Still getting wrong results.

    My shadow map is correctly rendered.

    Thanks for your time, regards.

  2. #2
    Member Regular Contributor Nowhere-01's Avatar
    Join Date
    Feb 2011
    Location
    Novosibirsk
    Posts
    251
    it should be:
    biasMatrix * LightProjMatrix * lightViewMatrix * viewMatrixInverse * modelViewMatrix * gl_Vertex
    or
    biasMatrix * LightProjMatrix * lightViewMatrix * modelMatrix * gl_Vertex

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2013
    Posts
    4
    Thanks for your answer Nowhere

    Actually the coordinates calculation was right, i was just dividing these coordinates by W too early in the shader. It's now fixed. and i'm very happy^^. Merry christmas !

Posting Permissions

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