[quote name='Tom KQT' timestamp='1313316551' post='4848907']
[quote name='blueShadow' timestamp='1313305751' post='4848875']
i use :
D3DXMatrixOrthoLH( &lightWVProjMatrix, 512.0f, 512.0f, 1.0f, 1000.0f );
Should I use what you told me ?
Can you explain me a little more the code you wrote ? I have problems to understand what are the variables.
What scale does your scene have? I mean how large is the car - 0.1 units or 1 unit or 10 units or 100 units...?
My point is that you should set your shadow camera as tightly around the scene as you can, especially the near and far planes, because that will limit your shadow precision and can lead to really strange behaviour in extreme cases.
[/quote]
I reduced the values to fit correctly to the car :
D3DXMatrixOrthoLH( &lightWVProjMatrix, 32.0f, 32.0f, 20.0f, 700.0f )
But now the orientation is still not correct
and the shadow is duplicated
The width of my car is of 5 units like say 3ds max but when i put these values, the car fits in width the shadow map.
Am I doing something wrong in the shaders ?
pixel shader which renders the shadow map (there are questions below):
float4 pixel_main( VSOUTPUT_SHADOW IN ) : COLOR0
{
IN.fDepth.x /= IN.fDepth.y ;// where x is in fact 'z' and y the 'w' coordinate of the position of the pixel in light space, is it right ?? Or am I supposed to divide by the far clip value ?
// Output the scene depth
return float4( IN.fDepth.x, IN.fDepth.x, IN.fDepth.x, 1.0f );
}
[color="#1C2837"][color="#880000"]where x is in fact 'z' and y the 'w' coordinate of the position of the pixel in light space, is it right ?? Or am I supposed to divide by the far clip value ?
[/quote]
[font=arial, verdana, tahoma, sans-serif][size=2]This my current result (to illustrate the message above) : [attachment=4924:bug.png][/font]