I am now doing with depth shadow mapping,and learning from this tutorial (http://www.ogre3d.org/tikiwiki/Depth+Shadow+Mapping)
I have 3 questions as following:
(1)Is it right that when I use custom shadow caster,I can get depth in shadow receiver using "uniform sampler2D shadowMap "?
void casterVP( out float2 outDepth : TEXCOORD0)
{
outPos = mul(worldViewProj, position);
outDepth.x = (outPos.z - depthRange.x) * depthRange.w;
}
void casterFP( float2 depth : TEXCOORD0,
out float4 result : COLOR)
{
result = float4(finalDepth, finalDepth, finalDepth, 1);
}
//shadow receiver fragment program
void receiverFP(uniform sampler2D shadowMap : register( s0 ))
{
}
(2) I am not very sure what this matrix(texture_viewproj_matrix) used for.
I guess,
texture coordinate->camera coordinate->screen coordinate??
and texture coordinates should be 2-D. Am I right?
(3) In shadow receiver fragment shader,I don't know what this line mean. And,do these 3 variable(finalCenterDepth,shadowUV.z and vertexColour) stand for depth?
result = (finalCenterDepth > shadowUV.z) ? vertexColour : float4(0,0,0,1);
Thank you~ any advice is useful for newbie :D