Is it possible to save pixel perfect full-spectrum rgb height map? I made shader that calculates RGB based on height. Height -&gt; Map Range to 0-16777216 and result pixel based on where C is input number based on height:
B = C % 256
G = ((C-B)/256) % 256
R = ((C-B)/256**2) - G/256

Render result looks bad. Res: 5000x2900, tried cycles, evee, tga, openexr and all possible combinations i could think of. I'm not expecting render to look good, i just want file with correctly calculated pixels. Is there any way to achieve this with Blender? Any settings? Plugins?
Context: I'm working on isometric rpg. Need solution for hiding objects behind parts of pre-rendered background.
Depth map is not good enough (greyscale) for big maps so I'm going with height map based on full rgb - similar to Pillars of Eternity. The problem is they did it in Maya (using mental ray) - am not familiar with this soft and I don't have it.
Your calculation looks incorrect. Also, are you expecting RGB values in the range 0-255 or in the range 0.0-1.0? Blender shader nodes expect values in the range 0.0 -&gt; 1.0.
I suspect you actually require something like the folllowing :
B = C % 256
G = ( (C - B) / 256 ) % 256
R = ( ( (C - B) / 256 - G ) / 256 )

This will produce a colour with each channel in the range 0-255
Then, produce a shader colour (ranged 0.0-1.0) using :
Color = (R/255 , G/255, B/255)