ok, must admit I’m not that familiar with using shader chunks (make separate openGL fragment and vertex shaders most of the time), but if I understand correctly “getLinearDepth(vPositionW)” and “getLinearScreenDepth()” are now integrated functions that can be accessed in any custom openGL script in PlayCanvas, returning the pixel and screen depth?
I’m assuming “vPositionW” is the world position. Is this also now a latent variable that no longer needs to be passed manually to the fragment shader, but can be accessed without any declaration?
So shader chunks are the small shader pieces that the PlayCanvas standard material is using to assemble the complete vertex and pixel shaders pushed to the GPU for rendering.
One way of writing custom shaders is instead of authoring them from scratch, to override the required shader pieces instead, and rebuild the material shader to include your changes.
Regarding the depth access methods, those are included in this shader chunk:
If you are writing a custom shader from scratch, you can still use them in your shader. You can copy/paste and include that shader code in your shader as helper methods to access depth.