Get the scene depth into the post pass #88
Labels
No labels
animation
audio
blocked
bug report
controversial
documentation
easy
feature request
hard
medium
multiplayer
physics
ui
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
elsie/liuverse#88
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The present pass reads color only. ARCHITECTURE.md records why: GLSL cannot
textureLoada depth texture, so fog happens in the forward pass and the blit onlytonemaps.
That single constraint blocks every depth-aware effect worth having: post fog,
SSAO, contact shadows, depth of field, and any FXAA that wants edge confidence.
The cheap experiment is
textureSampleinstead oftextureLoadon a depthsampler. The restriction that was hit is specifically on loads; WebGL2 may sample
a depth texture normally. The naga GLSL translation test in
liuverse-render/src/shaders.rscan answer that in an afternoon, which is muchcheaper than designing around it.
If that fails, write linear view depth from the forward pass into a second target:
R32Floatwhere float attachments exist, packedRGBA8where they do not, or aplain depth-as-color texture. The forward pass already knows the eye position, so
the value is one length per fragment.
Related: #81 and #82 are the effects this unlocks; the fog decision
in ARCHITECTURE.md is the reason to do it at all.
Closing as out of scope. Once SSAO and the near shadow map are dropped it has no consumer left; the forward-pass fog already covers what the scene needs, and nothing else wanted a depth texture.