Skip to content

EffectPass.setDepthTexture from DepthSavePass #331

Answered by vanruesc
swingingtom asked this question in Q&A
Discussion options

You must be logged in to vote

It's possible to use the DepthSavePass in combination with a RenderPass to save a custom depth texture before rendering the main scene. Here's an example: https://codesandbox.io/s/postprocessing-god-rays-forked-tsq18?file=/src/App.js

This setup unearthed a problem though. The DepthSavePass uses RGBADepthPacking by default, but this produces fully white black pixels for fragments that read 0 1 in the input depth texture. I think this might be a quirk of the RGBA packing function, but I'm not sure if and how that could be fixed. Here's a comparison of the discrepancy:

DepthSavePass DepthPass

BasicDepthPacking can be used instead, but this will store depth in a FloatType texture …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@swingingtom
Comment options

Answer selected by swingingtom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants