I have a specific need in image processing and I hope you can help me or orient me.
I need to output a 16 bits per channel (BPC) depth map from my 3D authoring tool (Virtools, for the record). I will be quick on details but I use a post-processing shader which generate this map :
Internally in Virtools, this image has 32 BPC (and not 32 bits image: 8 BPC). But I cannot output it from Virtools in this pixel format. There is no way to do that.
The software only allows me to output it in 8 BPC and I lose all the depth details needed for an accurate use of this depthmap further in my workflow.
So I have modified my shader to write a grayscale 32 bits value in an 8 BPC image using the 8*4 bits of the image.
Here is the important part of the shader code :
Code: Select all
float distance ; // distance from the camera at this pixel
color.r = floor(distance)/256;
distance = frac(distance)* 256.0; // frac(x) is the fractional decimal part of the float [frac(x) = x - floor(x)] (for 23.6348 -> 0.6348)
color.g = floor(distance)/256;
distance = frac(distance)* 256.0;
color.b = floor(distance)/256;
distance = frac(distance)* 256.0;
color.a = floor(distance)/256;
------------------------------------------------------------------------------------
And now... finally , here is a simplified schema of the conversion I need to do in ImageMagick :
I know that ImageMagick connat handle 32 BPC images but if I could have a 16 BPC greyscale image, it would be just fine !
Here is a post which seems to be useful :
viewtopic.php?f=1&t=19752
Thanks for advance for your advices.