Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Gl_NormalMatrix replacement in shaders

  1. #11
    Member Regular Contributor Nowhere-01's Avatar
    Join Date
    Feb 2011
    Location
    Novosibirsk
    Posts
    251
    i don't see any feedback about my last suggestion.

  2. #12
    Junior Member Newbie
    Join Date
    Feb 2010
    Posts
    20
    No feedback as I have not tried yet. Sleep and work intervene. Although, after a few hours of reflection I think I understand what was happening as stated in my last response. Setting both projection and modelview to identity causes the gl_NormalMatrix to be identity. Makes sense. I think I ran into this trying to emulate OpenGLES on a desktop platform. Start started small and started moving to pure shader world with the side effects of the Desktop GL 'helping'.

    That being said I also think my tangent and bi-tangent are incorrect as far as being in tangent space. I believe now, and always suspected, they are in object space. The calculation takes into account vertex and texture directions and makes some minor calculations. I believe the results are in object space. I have an addition piece I am not calling to calculate the inverse which should move to tangent space. With that I'm not sure what I'll gain by doing this. I'd then have to move the light and camera vectors into tangent space. Calculation already being preformed but for object space. Something I need to think about since normals on the map are in tangent space something has to give.

    So ultimately I was calculating the normal matrix properly, the shaders were getting an identity so whatever I attempted to replace with made things worse. I think this specific shader requires some thought and rework but as it appears to be working I will work with it, unless someone see off-hand where the object/tangent space resides. It may be in the fragment shader since thatís where the normal is actually extracted.

    Seems like I went from a 'how to compute normal matrix' to 'how to better emulate OpenGL ES and its lack of the fixed pipeline'.

Posting Permissions

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