PDA

View Full Version : Issue with FBO and ARB_shadow on nvidia hardware...



Mars_999
04-23-2006, 05:43 PM
I have a 7800GT and with FBO's when I do a RTT for my shadowmap with the arb_shadow functions


glTexParameterf(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL);I get a shadowmap thats 0 or 1 (black or white) but when I render a single quad to check the values my shadowmap is white and no black dots, but the shadowmap works fine in my shaders since I do see shadows. Now if I don't use the above functions from the arb_shadow extension and I RTT I get a 0 to 1 gradient depthmap and when I render it to my single quad I can see the values. This behavior is the same whether its FBO's or glCopyTexImage2D() so as of now I can't check it on ATI to see if it happens there to see if it's a NVIDIA issue or am I missing something. I have called GL_NONE and recalled the
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); and still get the same result nothing is rendered in my single quad but when called in GLSL to apply it to my terrain it renders shadows... So I am out of ideas and stumped. Any help would be great. Thanks

game_cy
07-11-2006, 02:31 AM
I have the same problem when trying to render the shadow map,
I tried setting
the GL_DEPTH_TEXTURE_MODE to GL_LUMINANCE
the GL_Texture_compare_MODE to GL_NONE

and I get a white quad when rendered :-/
I also tried:
the GL_DEPTH_TEXTURE_MODE to GL_INTENSITY
glEnable(GL_BLEND);
glBlendFunc(GL_ZERO, GL_SRC_COLOR);

and it still renders white :p

any ideas?

Komat
07-11-2006, 08:57 AM
Originally posted by Mars_9999:
I get a shadowmap thats 0 or 1 (black or white) but when I render a single quad to check the values my shadowmap is white and no black dots, but the shadowmap works fine in my shaders since I do see shadows.
The shadowmap sampling does comparison between R coordinate of uv coordinates used for texture lookup and value inside the shadowmap. If value in R coordinate is lower than value in the texture, white color is returned. Otherwise a black color is returned. So what you get depends on R coordinate for your quad.

What function do you use to sample the shadowmap? It is texture2D* or shadow2D*? If depth comparison is enabled, the shadow2D* must be used. If depth comparison is disabled, the texture2D* must be used. If incorrect function is used, the result is undefined.