Kav/Effects/HLSL/SimpleDepthEffect.fx

47 lines
898 B
Plaintext
Raw Permalink Normal View History

2020-08-07 00:58:50 +00:00
#include "Macros.fxh"
BEGIN_CONSTANTS
MATRIX_CONSTANTS
float4x4 World _vs(c0) _cb(c0);
float4x4 ViewProjection _vs(c4) _cb(c4);
2020-08-07 00:58:50 +00:00
END_CONSTANTS
struct VertexShaderInput
{
float4 Position : POSITION;
};
struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float Depth : TEXCOORD0;
2020-08-07 00:58:50 +00:00
};
VertexShaderOutput main_vs(VertexShaderInput input)
{
VertexShaderOutput output;
float4x4 worldViewProjection = mul(World, ViewProjection);
output.Position = mul(input.Position, worldViewProjection);
2020-10-19 10:01:37 +00:00
output.Depth = output.Position.z / output.Position.w;
2020-08-07 00:58:50 +00:00
return output;
}
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();
PixelShader = compile ps_3_0 main_ps();
2020-08-07 00:58:50 +00:00
}
}