Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] Feature Requests => Topic started by: genesys on 2021-08-12, 20:35:32

Title: Allow to store inverted (black close, white far) and unclamped CGeometry_ZDepth
Post by: genesys on 2021-08-12, 20:35:32
Corona renders out CGeometry_ZDepth with objects far away as black (0.0) and objects close as white (1.0)
This representation has several disadvantages:

1. precision
32bit floating-point numbers (which depth values are stored in when saved as exr) have higher precision around 0.0 than they have around 1.0. If we map for example a depth-range of 100km to the [0-1] interval, we get a precision of about 6mm at the high end (100km * 2^-24) and on the low end a resolution close to the planck length (the smallest physical size there is). With white = close and black = far, we get that low 6mm resolution close to the camera and the high resolution far away, which doesn't make sense. It'd be better to store it inverted (especially when saving to half-floats).

2. clamping
it'd be nice if values beyond 1 could be rendered out, so that depth isn't clamped at the far value. With the current mapping with far going towards zero, unclamped values would get negative, which isn't very elegant. So having close to the camera = 0, far = 1 and everything beyond far > 1 (proportionally obviously) would make most sense.
Title: Re: Allow to store inverted (black close, white far) and unclamped CGeometry_ZDepth
Post by: TomG on 2021-08-12, 23:21:21
You can invert the colors simply by making the min larger than the max, to have white represent far away.
Title: Re: Allow to store inverted (black close, white far) and unclamped CGeometry_ZDepth
Post by: genesys on 2021-08-13, 08:44:32
Great I will try that. What about the clamping though?