Why depth renderer texture only gave me 0 and 1?

Thanks so much! That’s awesome! Now I can see the gradient with your code!

    camera.minZ = 1;
    camera.maxZ = 17;

In case other readers encounter the same thing, FYI:

The camera minZ, maxZ: Camera | Babylon.js Documentation (babylonjs.com)
They define the near and far clipping plane of the camera.
By default (the doc doesn’t say it, but I test it in the playground), minZ is 1, maxZ is 10000.
The depth buffer will map that to a r value of 0 to 1 (the g b a values are just 1).

3 Likes