I wrote a shader to print depthTexture on Quad using
uniform sampler2D uDepthMap;
But it prints nothing.
When I add these extra codes in the initialization part.;
var depthLayer = pc.app.scene.layers.getLayerById(pc.LAYERID_DEPTH);
it prints pure white texture.
Here is the link of my editor: https://playcanvas.com/project/793925/overview/customshader
Below, I took a screenshot from Unity3D. I achieved to print cameraDepthTexture on a quad
UNITY_DECLARE_DEPTH_TEXTURE(_CameraDepthTexture); helper function.
Hi @fkavum and welcome,
If that’s meant for a post process effect, then you can extend the pc.PostEffect class and request depth map access using:
this.needsDepthBuffer = true;
Check the following example:
this example does debug rendering of the depth as well if that’s what you’re after
@Leonidas, @mvaligursky Thanks for the quick reply! Its really helped a lot.
I finally managed to make it without using any postProcessing effect.
For anyone struggling with this situation, can fork my project (its really messy).
I made it by the help of this and the other two posts:
I haven’t tried it on WebGL 1 yet, fingers crossed.
And here is the result:
Nice! Thanks for sharing this info @fkavum.