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

Recommended Posts

hi,
does any one can provide any clues on why I don't get shadow on certain areas (the screenshots will illustrate the problem)

and the shadow map, as seen by the light

format of the shadow texture is D3DFMT_R32F

here is how i calculate light view and orthographic projection matrix
 D3DXMatrixLookAtLH(&lightsView, &lightPos, &(D3DXVECTOR3(lightPos.x - 10.0f, 0.0f, lightPos.z - 10.0f)), &(D3DXVECTOR3(0.0f, 1.0f, 0.0f))); D3DXMatrixOrthoOffCenterLH(&ortho, 10, orthoX, 10, orthoY, 0, orthoZ); *lightsViewProjection = lightsView * ortho; 

Share on other sites
The artifact is called "shadow acne", it's caused by lack of precision in the depth values, and a common work-around is to bias your depth values (towards the camera a bit if drawing backface depth, or away from the camera if using frontface depths).

Share on other sites

The artifact is called "shadow acne", it's caused by lack of precision in the depth values, and a common work-around is to bias your depth values (towards the camera a bit if drawing backface depth, or away from the camera if using frontface depths).

how I am going to bias the depth values on the polygons that are not looking the light?

Share on other sites
You are not performing standard lighting.

Under a standard lighting model, polygons that are so close to being perpendicular to the direction of the light will be shaded fairly dark.

You have acne because the polygon is facing almost perpendicularly to the light, but this should also mean that the polygon is fairly dark anyway. This helps to hide a lot of shadow artifacts such as acne.

You can’t fully fix acne at steep angles, so your options are to use a standard lighting model and to blur/filter the shadow.

L. Spiro

Share on other sites

You are not performing standard lighting.

Under a standard lighting model, polygons that are so close to being perpendicular to the direction of the light will be shaded fairly dark.

You have acne because the polygon is facing almost perpendicularly to the light, but this should also mean that the polygon is fairly dark anyway. This helps to hide a lot of shadow artifacts such as acne.

You can’t fully fix acne at steep angles, so your options are to use a standard lighting model and to blur/filter the shadow.

L. Spiro

yes, the problem is the lighting direction is not align with the direction of the shadow .

I need to properly adjust the the correct direction [color=#ff0000](1, 1, 0) but i am not sure how.

D3DXMatrixLookAtLH(&lightsView, [color=#ff0000]&lightPos, &lightPosLookAt, &(D3DXVECTOR3(0.0f, 1.0f, 0.0f)));
D3DXMatrixOrthoLH(&ortho, orthoX, orthoY, 0, orthoZ);
*lightsViewProjection = lightsView * ortho;
...
float3 DiffuseLightDirection = float3(1, 1, 0);// my light direction

1. 1
2. 2
Rutin
20
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633737
• Total Posts
3013614
×