Post Depth
App: apps/post_depth_demo/
Demonstrates full-screen post-process effects + scene depth (engine PLM-240/237 / ADR 0074). When a post effect is added, the engine renders the scene to an offscreen colour target plus a sampleable depth target, then runs a full-screen post shader that reads them. This demo’s post shader visualizes the scene depth as grayscale, proving the scene rendered offscreen and its depth is sampleable in the post pass.
Run from root
Section titled “Run from root”% ./plume3d post_depth_demoFour vertical bands are drawn at increasing clip-space depths and read back as distinct grays (near
= dark, far = light), with the cleared background white (depth 1.0). That the flat-coloured quads come
out as depth-ordered grays is the proof: the post pass is reading the captured scene depth, not the
scene colour.
What it does
Section titled “What it does”-
Draws four quads at different depths with an ordinary mesh shader (
Graphics.newMesh+Graphics.drawMesh). -
Loads a post shader (
shaders/depthviz) ininit(), then each frame indraw()adds it as a post effect:Graphics.addPostEffect("shaders/depthviz", [1.0]) // params[0] = contrast -
The post shader
#include "plume3d_post.slang"and outputs the depth:#include "plume3d_post.slang"[shader("fragment")]float4 fragment(PostVSOutput input) : SV_Target {float d = plume3d_sceneDepth(input.UV); // 0 near .. 1 farfloat v = saturate(d * plume3d_postParam(0).x);return float4(v, v, v, 1.0);}
The engine binds scene colour + scene depth + the frame clock + params at set 0 for the post pass. See the post shader ABI and the post-effects & scene-depth guide. Screenshot-verified.