Jump to content
  • Advertisement
Sign in to follow this  
roos

Shadow mapping problem

This topic is 4885 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm having trouble getting my shadow demo working... I'm just trying to do a basic implementation as in "Cg Tutorial",i.e.: // in the fragment shader: OUT.color = baseColor * tex2Dproj( depthmap, IN.texcoord ); ... So, according to the Cg Tutorial, tex2Dproj should automatically do the shadow map comparison and spit out a 0 or a 1 depending on whether the part is in shadow or not, but it's not happening. Does anyone know if this functionality is NVidia-specific? (I got a raddy 9800) Anyways... I've checked out some other possibilities for why it's not working, and I can't seem to find anything else wrong. I know the texture matrix is set up correctly because this code was just ripped from my projective texture demo which works fine. I also verified that the scene's depth values from the light's perspective are being properly rendered to the depth texture. The only other thing I can think of offhand is maybe something is wrong in the texture parameters? Here is what I am using: glBindTexture( GL_TEXTURE_2D, texName ); GLuint fmt = GL_DEPTH_COMPONENT; glTexImage2D( GL_TEXTURE_2D, 0, fmt, RTT_SIZE_X, RTT_SIZE_Y, 0, fmt, GL_UNSIGNED_BYTE, NULL ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL ); glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY); If anyone might have any ideas I'd really appreciate it! I tried looking for some sample code on this stuff, but none of what I found had everything I need. (Some are written in Cg, but use DirectX, and some are in GL but don't use Cg, etc.) Thanks very much, roos

Share this post


Link to post
Share on other sites
Advertisement
Are pbuffers involved in this? I've had problems with ATI cards and depth components when they have been involved.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!