Depth buffer for post process

Does babylon generate a depth buffer for use in post-process shaders at all? Or by any chance does it generate a world-position buffer?

Edit: I found the depth buffer pretty quickly but it’d be more ideal if it worked. Are there any other requirements other than what’s outlined here? Depth Renderer | Babylon.js Documentation

What does not work for you with the depth renderer? Maybe you can setup a repro in the Playground as it should definitely work.

See for eg:
https://playground.babylonjs.com/#1PHYB0#86

1 Like

That’s definitely different from the documentation. Thanks!

Note that my PG was using a private method (_bindTexture), here’s one that uses the public setTexture method instead:

https://playground.babylonjs.com/#1PHYB0#108

As I can see it, it matches what the doc is saying:

  • do var renderer = scene.enableDepthRenderer(); to enable the depth renderer
  • do renderer.getDepthMap() to get the depth texture
1 Like