How to Access Depth Buffer?

Right, probably depth is somewhere else. But still try to create custom render target for world layer and set up using depth.

I asked about that then layers were released, but nobody answered me.

That might be a solution, for now, you are right.

Found a hint here:

“That means calling all enable/disable callbacks. This is useful when multiple effects require a layer (e.g. particle systems wanting a depth map). Each effect would increment the counter, when activated and decrement when destroyed. So, for example, if the last depthmap-dependent particle system is destroyed, engine will no longer render the depth map.”

@will, @Mr_F I leave it to you.

Hey guys, I’m really struggling to get access to the depth map. I’ve tried setting the render target of the world layer, but depending on whether I do it before the effect is added or after the affect is added I get different results. I either get a blank texture or the color texture in the depth map texture. Pulling out my hair a bit here, a depth map is a pretty intrinsic requirement for post effects, can’t understand why there are no docs for it. I’ve tried the bokeh example, it’s written to work with a depth map, but it seems to be using the color map, in place of the depth map on my machine.

Any help would be greatly appreciated.


okay, so I changed _createOffscreenTarget method in playcanvas js to create a depth map texture for the render target of the first post effect. All seems to work fine now. Its unfortunate I had to change the play canvas code directly to get this to work.