Jump to content
  • Advertisement
Sign in to follow this  
goyg

A problem of Shadow map

This topic is 3754 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

When I use Shadow map to render a shadow.The picture which I get in the last have many incorrect texture, but the shadow is correct. Here is my attributes with the shadow texture: glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT32_ARB, shadowMapSize, shadowMapSize, 0,GL_DEPTH_COMPONENT32_ARB, GL_UNSIGNED_INT, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); ...... glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT32_ARB,0,0,shadowMapSize,shadowMapSize,0); ...... glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_S, GL_EYE_PLANE, textureMatrix); glEnable(GL_TEXTURE_GEN_S); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_T, GL_EYE_PLANE, textureMatrix+4); glEnable(GL_TEXTURE_GEN_T); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_R, GL_EYE_PLANE, textureMatrix+8); glEnable(GL_TEXTURE_GEN_R); glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGenfv(GL_Q, GL_EYE_PLANE, textureMatrix+12); glEnable(GL_TEXTURE_GEN_Q); ...... glEnable(GL_TEXTURE_2D); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LEQUAL); I hope someone can tell me which place I have a mistake. P.S.: As a new , I want to know how to clip a picture in this forums.

Share this post


Link to post
Share on other sites
Advertisement
Hi,

dunno which incorrectness you get - but I presume it's biasing problem (the most common). Just do some polygon offsetting, when you're rendering texture (example values from me are 4.0f and 2.0f ... for more information about polygon offset - http://www.opengl.org/wiki/index.php/Category:Polygon_Offset ):

glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(4.0f, 2.0f);
glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT32_ARB,0,0,shadowMapSize,shadowMapSize,0);
glDisable(GL_POLYGON_OFFSET_FILL);


About images - just upload them to imageshack and use <.a href.> and <./a.> (without periods), or <.img src="".> (without periods of course) to show image here - surely post it, because it might be another problem.

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!