• Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

4 replies to this topic

### #1michaelmk86  Members   -  Reputation: 171

Like
0Likes
Like

Posted 17 July 2012 - 06:26 PM

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

### #2Hodgman  Moderators   -  Reputation: 13610

Like
0Likes
Like

Posted 17 July 2012 - 09:00 PM

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).

### #3michaelmk86  Members   -  Reputation: 171

Like
0Likes
Like

Posted 18 July 2012 - 12:33 PM

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?

### #4L. Spiro  Crossbones+   -  Reputation: 5187

Like
1Likes
Like

Posted 18 July 2012 - 06:06 PM

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
It is amazing how often people try to be unique, and yet they are always trying to make others be like them. - L. Spiro 2011
I spent most of my life learning the courage it takes to go out and get what I want. Now that I have it, I am not sure exactly what it is that I want. - L. Spiro 2013
L. Spiro Engine: http://lspiroengine.com
L. Spiro Engine Forums: http://lspiroengine.com/forums

### #5michaelmk86  Members   -  Reputation: 171

Like
0Likes
Like

Posted 20 July 2012 - 08:19 PM

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 (1, 1, 0) but i am not sure how.

D3DXMatrixLookAtLH(&lightsView, &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

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS