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: linear filtering not working for variance shadow mapping

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    24

    linear filtering not working for variance shadow mapping

    hi, I'm trying to implement variance shadow map, but got the result with very sharp shadow edge. I checked the glsl code and found out it's because the variance( = moments.y - moments.x * moments.x) is always zero. so I suspect that somehow opengl failed to do linear filtering when fetching texels. Does anyone know why?


    Code :
    GL_DEBUG(glTexImage2D(GL_TEXTURE_2D, 0, GL_RG32F, 512, 512, 0, GL_RG, GL_FLOAT, 0));
    GL_DEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
    GL_DEBUG(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    783
    Very old (~2006) desktop GPUs and most current phone GPUs can't filter 32-bit floats. Try RG16F.

    Quote Originally Posted by Sobeit View Post
    so I suspect
    Do an experiment to confirm your suspicions: make a two-pixel texture with black and white, and stretch it across three pixels. Is the middle pixel grey?

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2011
    Posts
    24
    Thank you for your reply. I drew a 512x512 texture with left side being black and right side being red, then render this texture to 1152x648 frame buffer, and I did see some gradual transition in the middle. so linear filtering works in this case. by the way I'm using OpenGL 4.0.

    Do you know any other season may cause linear filtering to fail?

    EDIT: I fixed it, I was a tiny bug, I compared the wrong value. Thanks
    Last edited by Sobeit; 06-28-2014 at 12:03 AM.

Tags for this Thread

Posting Permissions

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