////////////////////////////////////////////////////
// Depth rendering shader
// Copyright (c) 2007 Conitec. All rights reserved.
////////////////////////////////////////////////////
// Application fed data:
const float4x4 matWorldViewProj;
//////////-----------------------
//////////------------------
void DepthVS (in float4 InPos : POSITION,
out float4 OutPos : POSITION,
out float OutDepth: TEXCOORD0)
{
// Output the transformed position
OutPos = mul(InPos,matWorldViewProj);
// Output the scene depth
OutDepth = (OutPos.z)*.002;
// OutDepth = OutPos.z;
//OutDepth -= OutDepth;
}
float4 DepthPS( in float InDepth: TEXCOORD0 ) : COLOR0
{
// Output the scene depth to a R32 floating point texture
// return float4( InDepth, 0.0, 0.0, 1.0 );
return float4(InDepth, 0.0, 0.0, 1.0 );
}
technique DepthTechnique
{
pass p0
{
Lighting = False;
VertexShader = compile vs_2_0 DepthVS();
PixelShader = compile ps_2_0 DepthPS();
}
}