I’m trying to use Mist data for getting values of [0,255] for Mist range of [Start, Start+Depth]. but I’v got into two problems:
- Output values range is only [0,206] for [Start, Start+Depth]
- Output values are non linear relative to [Start, Start+Depth] values
I’m Using Blender 3.1.2
Here is how I did up to now (Figures below):
Building a scene of 5 elements, with heights of 0m, 1m, 2m, 3m and 4m.
Camera was placed directly above at height of 12m.
Mist start was set to 7.99 (in order to ensure the 4m height is in the Mist range)
Mist Depth was set to 4.02 (in order to ensure the 0m height is in the Mist range)
The Mist Falloff was set to be Linear.
Camera was set to Orthographic - because I check distances to the camera plane, not to the camera origin:
Only Mist data was enabled for output, that is the only data I need:
Now, checking the Mist data output yields the values: 0, 144, 178, 194 and 206, while I would expect to have 0,64,128,192 and 255:
So how should it done in order to have the expected values?
Seems like the mist pass can suffer antialiasing effects.
You may need the depth pass
Good explanaition here…
Hope that helps.
I think this is your problem- have you tried this with Perspective to see if the values are correct?
Thanks @AlphaChannel ,
Antialiasing effect influence the edges - smooth edges instead of hard ones, but as can be seen in figure 6, I checked the values inside the upper cubes planes and not at their edges.
From the link you gave: " Start sets the black (0) portions of the image. Depth sets the range in which the mist pass will convert the distance to a grayscale. Past that range everyting is white (1) "
That’s what I did in order to make the Mist range cover range between 4meters height and 0meters height. The 4 meters height which is the closer, should returns Mist data of 0, and that what we get, But the floor at at height of 0meters should return Mist data value of 1, which should be 255, and not 206 as is obtained in the results…
So I still missing something here…
Thanks @josephhansen ,
In case I would like the distance to the camera origin, you are absolutely right, but I need the distance to the camera plane. That’s why the use of orthographic camera. I should point this - thank you.
Anyway, it has nothing with the return Mist values issue. If you use perspective , it just causes to a gradient of distances over each upper cube surface, but you still get unexpected values. For example, the floor plane will still give you around 206 instead around of 255.
Could be your colour management settings what do you have here?
Your test should be in values between 0 and 1. If you’re using other softwares like PS/GIMP change to 32-bit linear. Color managment sRGB Standard.
Thats it ! @AlphaChannel .
This is the View Transform.
It should be changed to
Display Device: sRGB,
View Transform: Raw (not standard).
Alternatively it can be changed to:
Display Device: None,
View Transform: Standard
Thank you @lucas.coutin !
Color management was indeed the source of the problem. should be sRGB Raw, or None Standard.