Jump to content
  • Advertisement
Sign in to follow this  
O-san

Shadow mapping problem [solved]

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

Hello! I’ve got a problem with shadow mapping and ambient lighting. The shaded side of my objects receives a strange artifact when the shadow is on the polygon. It’s like the edge gets even darker where it should have the ambient color intensity. This picture shows the problem.
I calculate the fragment color in this GLSL shader:
// Calculate the light ambient, diffuse and specular values
directionalLight(0,normal,gl_FrontMaterial.shininess,ambient,diffuse,specular);

// Final color variable
vec4 color=vec4(0.0);

// Add the sceneColor value
color += gl_FrontLightModelProduct.sceneColor * texColor;

// Add the light values (amb,dif,spe) and material+texture, multiply with shadowmap texture intensity (0.0-1.0)
color += ambient * gl_FrontMaterial.ambient * texColor ;
color += diffuse * gl_FrontMaterial.diffuse * texColor * shadowShade;
color += specular * gl_FrontMaterial.specular * shadowShade;
color.a=texColor.a;

gl_FragColor = color;

The ambient, diffuse and specular values are the values of gl_LightSource[0]. The shadowShade value is derived from shadow2D(). I’m not sure how to combine the texture rgb values with the lighting model and the current material. I have tried to make this to work for two days but I just can’t get it. Any help appreciated! [Edited by - O-san on February 12, 2008 8:47:19 AM]

Share this post


Link to post
Share on other sites
Advertisement
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!