Hi Team, I’m working on occlusion culling (as seen here https://x.com/Adriaaaaaaaaanz/status/1950570854871372120). However I’m not sure what the correct way to pass the depth texture to the compute shader. I tried this (after using requestSceneDepthMap)
That enables ths depth prepass though. Not sure I want that, and in any case post processing may be disabled…
p.s. Playcanvas is forcing the depth prepass on sceneDepthMap in camera frame correct? This feels like an unexpected side effect compared to the non render pass version
Hmm, well, the snippet you provided should work. Could be perhaps it needs to render first to appear? Try reading it on the next frame or after a timeout to test?
That works only if cameraFrame / renderpass are not used. If I totally disable post processing it is populated as expected. Looks like I either need to use prepass or modifiy playcanvas so that I can make depth grab work like color grab when using post processing
We have RenderPassDepthGrab to grab the depth but CameraFrame currently does not use it. It’d be good to have it as an option, but it has not been done yet. Doing a prepass lets us do SSAO before lighting pass, and prepass was set up so that we can do velocity buffers for TAA as well. But an alternative, if those are not selected, would be good for sure.
You could extend CameraFrame engine class, and add RenderPassDepthGrab as a pass, or use the existing depth prepass.
Would be good to get a more formal api here, because we have requestSceneDepth that has inconsistent behaviour. Worse still the depth is in different formats depending on which one you use (PIXELFORMAT_DEPTH vs PIXELFORMAT_R32F). its also not a storage texture. If there could be an api that returns the depth texture regarless of the current state of post processing that would be nice.
Looks like I may have to do some juggling in the mean time