There is a shader which implements shadow map technique
struct VS_INPUT { float4 Pos : POSITION0; float4 Normal: NORMAL; float4 Color : COLOR; float2 TexCoords : TEXCOORD0; float4 TexWeights : TEXCOORD1; };
float4x4 xLightWorld;
float4x4 xLightView;
float4x4 xLightProjection;
struct SMapVertexToPixel { float4 Position : POSITION0; float4 Position2D : POSITION1; };
SMapVertexToPixel ShadowMapVertexShader(VS_INPUT In)
{ SMapVertexToPixel Output = (SMapVertexToPixel)0;
Output.Position = mul(In.Pos, xLightWorld);
Output.Position = mul(Output.Position, xLightView);
Output.Position = mul(Output.Position, xLightProjection);
Output.Position2D = Output.Position; return Output; }
float4 ShadowMapPixelShader(SMapVertexToPixel PSIn) : COLOR
{
return float4(PSIn.Position2D.z/PSIn.Position2D.w, 0, 0, 1);
}I run this code in PIX in Debugger window and for some pixel i have
ShadowMapPixelShader | ( 0.161, 0.000, 0.000, 1.000 ) | float4but in Render window all pixels are black.
If i change code
float4 ShadowMapPixelShader(SMapVertexToPixel PSIn) : COLOR
{
return float4(0.5f, 0, 0, 1);
}
all pixels will be little bit red.Why?






