void VertShadowVolume( float4 vPos : POSITION,
float3 vNormal : NORMAL,
out float4 oPos : POSITION )
{
// Compute view space normal
float3 N = mul( vNormal, (float3x3)g_mWorldView );
// Obtain view space position
float4 PosView = mul( vPos, g_mWorldView );
// Light-to-vertex vector in view space
float3 LightVecView = PosView - g_vLightView;
// Perform reverse vertex extrusion
// Extrude the vertex away from light if it's facing away from the light.
if( dot( N, -LightVecView ) < 0.0f )
{
if( PosView.z > g_vLightView.z )
PosView.xyz += LightVecView * ( g_fFarClip - PosView.z ) / LightVecView.z;
else
[color=#ff0000]PosView = float4( LightVecView, 0.0f );[/color]
// Transform the position from view space to homogeneous projection space
oPos = mul( PosView, g_mProj );
} else
oPos = mul( vPos, g_mWorldViewProjection );
}
I can't understand the red line.
When the vertex is closer to viewer than light, we can also add PosView with some LightVecView.
But it just changes the position to a vector.
What is the meaning of the red line?




















