Is it possible to query the depth buffer in a post processing shader? #10324
Unanswered
david4shure
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Add a DepthPrepass component to your camera, and then bind the depth texture from ViewPrepassTextures iirc is the component name. You might also be able to bind the main depth texture directly, without using the prepass, idr though. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently working on this shader and trying to port it to bevy and wgsl
https://github.com/BarthPaleologue/volumetric-atmospheric-scattering/blob/main/src/glsl/atmosphericScattering.glsl
I notice in it's invocation that it is invoked by the babylonjs project as a post processing effect
(see here https://github.com/BarthPaleologue/volumetric-atmospheric-scattering/blob/main/src/ts/starter.ts#L35 and here https://github.com/BarthPaleologue/volumetric-atmospheric-scattering/blob/main/src/ts/atmosphericScattering.ts#L30)
In order for this shader to function I will need to sample the depth texture and the screen texture at a specific coordinate
(see here https://github.com/BarthPaleologue/volumetric-atmospheric-scattering/blob/main/src/glsl/atmosphericScattering.glsl#L178-L180).
My question is this: Is it possible to sample the depth buffer in a post processing effect in bevy? I tried to do this and couldn't get it working. And if it is NOT possible, How should I proceed? As far as I can tell I am unable to sample the screen texture in the prepass shader.
Beta Was this translation helpful? Give feedback.
All reactions