A depth texture is quite a specific type of data. It’s important to understand that depth textures come in different formats, and not all of them can be displayed directly on the screen. To visualize such a texture in PlayCanvas, you should use the dedicated function provided in the following link:
Hi @Wagner , thanks for the reply. For my use-case I’m not trying to display the depth (it’s only for debugging). I need it for compute shader. Concretely, I’m looking for a reliable way to obtain a depth resource that I can bind as texture_2d<f32>, ideally linear depth in R32F.
I’m also working through grabbing the scene depth texture. Did you figure this out?
I feel like the depthtexture you grabbed was actually valid, just not rendering on-screen properly(?)
I’ve just been doing a custom RT render pipeline to get access to the scene depth texture, and then doing a final render pass RT → render to scene, but its a huge performance hit. Personally I’m hoping I can bypass the step of rendering the RT to the scene by grabbing the depth directly from scene somehow
Ended up figuring it out for the most part. Doing a custom / extended render pass using scene depth by using the linked methods (checking for any warnings) for grabbing depth worked great. For some reason RenderPassGrabDepth or whatever it’s called worked great but I couldn’t reference it in the engine, so I just copied the script and hooked it in my render passes.
Turns out grabbing depth was a bit more expensive than what I would have liked anyway (20ms → 28ms frametime on our lower end target) so I moved on from grabbing depth for now.
This was on a 2014 iPad Air, performance seemed relatively negligible on my desktop as well so I’m sure it’s fine depending on what you want. Maybe bandwidth related?
Otherwise open to suggestions for a more accurate low end device for the current mobile market