Professional Documents
Culture Documents
Depth Ps
Depth Ps
// Filename: depth.ps
////////////////////////////////////////////////////////////////////////////////
//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float4 depthPosition : TEXTURE0;
};
////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 DepthPixelShader(PixelInputType input) : SV_TARGET
{
float depthValue;
float4 color;
// Get the depth value of the pixel by dividing the Z pixel depth by the
homogeneous W coordinate.
depthValue = input.depthPosition.z / input.depthPosition.w;
return color;
}