• Advertisement
Sign in to follow this  

Shadow mapping problem [solved]

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

// 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;

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
Sign in to follow this  

  • Advertisement