Kav/Effects/HLSL/SimpleDepthEffect.fx

45 lines
780 B
Plaintext
Raw Normal View History

2020-08-07 00:58:50 +00:00
#include "Macros.fxh"
BEGIN_CONSTANTS
float4x4 ModelViewProjection _vs(c0) _cb(c0);
MATRIX_CONSTANTS
END_CONSTANTS
struct VertexShaderInput
{
float4 Position : POSITION;
};
struct VertexShaderOutput
{
float4 Position : SV_Position;
2020-08-27 21:46:20 +00:00
float Depth : TEXCOORD0;
2020-08-07 00:58:50 +00:00
};
VertexShaderOutput main_vs(VertexShaderInput input)
{
VertexShaderOutput output;
2020-08-27 21:46:20 +00:00
output.Position = mul(input.Position, ModelViewProjection);
output.Depth = output.Position.z / output.Position.w;
2020-08-07 00:58:50 +00:00
return output;
}
2020-08-27 21:46:20 +00:00
float4 main_ps(VertexShaderOutput input) : SV_TARGET0
{
return float4(input.Depth, 0.0, 0.0, 0.0);
}
2020-08-07 00:58:50 +00:00
Technique SimpleDepth
{
Pass
{
VertexShader = compile vs_3_0 main_vs();
2020-08-27 21:46:20 +00:00
PixelShader = compile ps_3_0 main_ps();
2020-08-07 00:58:50 +00:00
}
}