I'm making a simple post-processing shader for P3D v5, which requries depth input. However after drawing the depth buffer to the screen, I noticed that it's basically the grayscale version of the color buffer, instead of the expected depth buffer. Am I doing something wrong?
This is the shader code:
Code: Select all
#include "Quad.sh"
Texture2D<float4> srcTex;
Texture2D<float> srcDepth;
float4 PsSSAOMain(PsQuad vert) : SV_Target
{
uint2 texture_dimensions;
srcDepth.GetDimensions(texture_dimensions.x, texture_dimensions.y);
int3 texture_coordinates = int3(vert.texcoord * texture_dimensions, 0);
float depth = srcDepth.Load(texture_coordinates);
return float4(depth, depth, depth, 1.0);
}
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document Type="AceXML" version="1,0">
<PostProcessEffects.PostProcessDefinition>
<EffectName>SSAO</EffectName>
<ShaderFileName>SSAO.psh</ShaderFileName>
<ShaderEntryPoint>PsSSAOMain</ShaderEntryPoint>
<ColorRequest>TRUE</ColorRequest>
<DepthRequest>TRUE</DepthRequest>
</PostProcessEffects.PostProcessDefinition>
</SimBase.Document>
It doesn't look like the depth buffer at all. Is this expected behavior?
Thanks in advance.