Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Bamboocha on 2018-03-19, 14:28:46

Title: Render the Z-Buffer in a linear way
Post by: Bamboocha on 2018-03-19, 14:28:46
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 2*x , the pixel becomes 2*y ?


Thank you really much in advance
Title: Re: Render the Z-Buffer in a linear way
Post by: sevecek on 2018-03-19, 14:54:40
Hi,
it's probably due to gamma correction. If you apply x^2.2 to your values, the corrected values are approximately linear.
Title: Re: Render the Z-Buffer in a linear way
Post by: Bamboocha on 2018-03-19, 15:01:10
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?
Title: Re: Render the Z-Buffer in a linear way
Post by: sevecek on 2018-03-19, 15:26:25
You can specify gamma in save dialog when saving the rendered image.
And yes, '^' means power.
Title: Re: Render the Z-Buffer in a linear way
Post by: Bamboocha on 2018-03-19, 15:36:08
Thank you really much - I am using Maxscript for rendering, that's why I have not seen it.