Render the Z-Buffer in a linear way

Hello,

I am fairly new to rendering in general and even newer to Corona.

I want to render a Z-Buffer image, where the distance to an Object is represented in Pixel Values.

For my experiments I have simply put a plane at a distance of 500 mm, 1000 mm, 1500 mm and 2000 mm distance to the camera. And added the Render-Element CGeometry_ZDepth and adjusted the Min and Max to my desires (Max Z: 0,0 mm, Min Z: 91750,0 mm, and clipped the ouptut to 0-1 range).

While the Z-Buffer images were created I noticed that the distances are not linear.

Here is a comparison of a the middle point values;

at 500 mm: 6130
at 1000 mm: 8400
at 1500 mm: 10100
at 2000 mm: 11511

The pixel values are not representing the distance, which could be calculated later, however is there a possibilty to get a linearity in the Z-Buffer to the distances? (Meaning that an object which was at distance x has the pixel value y, and if the same object has the distance 2x , the pixel becomes 2y ?

Thank you really much in advance




Hi,
it’s probably due to gamma correction. If you apply x^2.2 to your values, the corrected values are approximately linear.

Thank you for your reply.

How can I turn off or adjust the gamma correction in the render setting?

And secondly, you mean by the power of 2.2 with the “^” sign, just to check?

You can specify gamma in save dialog when saving the rendered image.
And yes, ‘^’ means power.

Thank you really much - I am using Maxscript for rendering, that’s why I have not seen it.