Accessing Post Process Depth Buffer

jdrosdeck
Posts: 3
Joined: Tue Jul 16, 2019 12:55 pm

Accessing Post Process Depth Buffer

Postby jdrosdeck » Tue Jul 16, 2019 1:01 pm

I'm trying to generate a camera view showing the depth buffer but it doesn't seem to be working as expected. The camera looks like its displaying grey scale. Any help would be greatly appreciated.

Here is my post process logic

Code: Select all

#include "Quad.sh" Texture2D<float> srcDepth; float4 PsDepthBuffer(PsQuad vert) : SV_Target { // Get the texture dimemsions. uint2 uDDim; srcDepth.GetDimensions(uDDim.x,uDDim.y); int3 iDepthCoord = int3(uDDim.x * vert.texcoord.x, uDDim.y * vert.texcoord.y, 0); // Use these new coordinates to look up the color in the texture float depth = srcDepth.Load(iDepthCoord); return float4(depth, depth, depth, 1.0f); }
And my corresponding XML File

Code: Select all

<?xml version="1.0" encoding="UTF-8"?> <SimBase.Document Type="AceXML" version="1,0"> <PostProcessEffects.PostProcessDefinition> <EffectName>RawDepthShader</EffectName> <ShaderFileName>RawDepthShader.psh</ShaderFileName> <ShaderEntryPoint>PsDepthBuffer</ShaderEntryPoint> <ColorRequest>FALSE</ColorRequest> <DepthRequest>TRUE</DepthRequest> </PostProcessEffects.PostProcessDefinition> </SimBase.Document>

JB3DG
Posts: 442
Joined: Mon Jan 09, 2012 6:44 pm

Re: Accessing Post Process Depth Buffer

Postby JB3DG » Tue Jul 16, 2019 4:23 pm

That's essentially what a depth buffer is. Monotone. Is there something else you are expecting?
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun

jdrosdeck
Posts: 3
Joined: Tue Jul 16, 2019 12:55 pm

Re: Accessing Post Process Depth Buffer

Postby jdrosdeck » Tue Jul 16, 2019 4:36 pm

I was expecting items closer to the camera to be near black, and items far away to be white, with most of the scene being white.

jdrosdeck
Posts: 3
Joined: Tue Jul 16, 2019 12:55 pm

Re: Accessing Post Process Depth Buffer

Postby jdrosdeck » Tue Jul 16, 2019 4:45 pm

Here's the output I'm getting
https://imgur.com/SJcPD6F

Here's the type of image that I would expect to get

https://imgur.com/FnUp7PH

JB3DG
Posts: 442
Joined: Mon Jan 09, 2012 6:44 pm

Re: Accessing Post Process Depth Buffer

Postby JB3DG » Tue Jul 16, 2019 7:07 pm

I don't know if what you are trying to do is possible via the post process system. I can only access the depth buffer via the PDK Texture Plugin system in a C++ module.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 3 guests