• Create Account

Banner advertising on our site currently available from just \$5!

### #ActualMedo3337

Posted 08 November 2013 - 02:41 AM

I have created a shadow map

As I understand, I need to compare the current pixel depth with the shadow map, if the shadow map depth is LESS than the current pixel depth then I add shadow to the current pixel.

Now, I see half of the scene is darker (which is unexpected)

VS:

float4 oPosition = mul(float4(IN.Position, 1.0f), shadowWorldViewProj);
oPosition.x      = ((oPosition.x + oPosition.w) * ScreenParams.x + oPosition.w) * ScreenParams.z;
oPosition.y      = ((oPosition.w - oPosition.y) * ScreenParams.y + oPosition.w) * ScreenParams.w;
Out.screenPos    = oPosition;
Out.Z = mul(float4(IN.Position, 1.0f), shadowWorldView).z;

PS:

shadow = 0.0;
if (scene_z > 0)
{
if (In.Z > scene_z)
}

### #1Medo3337

Posted 08 November 2013 - 02:38 AM

I have created a shadow map

As I understand, I need to compare the current pixel depth with the shadow map, if the shadow map depth is LESS than the current pixel depth then I add shadow to the current pixel.

Now, I see half of the scene is darker (which is unexpected)

VS:

float4 oPosition = mul(float4(IN.Position, 1.0f), shadowWorldViewProj);
oPosition.x      = ((oPosition.x + oPosition.w) * ScreenParams.x + oPosition.w) * ScreenParams.z;
oPosition.y      = ((oPosition.w - oPosition.y) * ScreenParams.y + oPosition.w) * ScreenParams.w;
Out.screenPos    = oPosition;
Out.ShadowZ = mul(float4(IN.Position, 1.0f), shadowWorldView).z;

PS:

shadow = 0.0;
}