Get the z buffer in 16 bit resolution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am fairly new to 3Ds max and are experimenting with the tool.
I want to get a Z-Buffer image within a 16 bit resolution, from a camera view. I also used a clipping of the plane. The following maxscript is used:
--Set to 16Bit writing out
pngio.setType #gray16
--Place the z camera
z_cam = freecamera name: "depth" position:[0.0,0.0,25] rotation: (eulertoquat (eulerAngles 0 0 0)) --Horizontal FOV z_cam.fovType = 1 z_cam.fov = 70.6 --Vertical FOV z_cam.fovType = 2 z_cam.fov =60 z_cam.clipManually true z_cam.nearclip 500 z_cam.fearclip 5000
z_name = "C:\\\Zimage.png"
/*
... some looping of loading the .obj file and rotating it
*/
--get z buffer
rbmp = render outputsize:[512,424] channels:#(#zdepth) vfb:off camera: z_cam
z_d = getchannelasmask rbmp #zdepth outputfile:z_name
z_d.fileName = z_name
save z_d
close z_d
However when I look at the image it is in 16Bit - but the lower 8Bits are not used, thus the values are stepping in 256 values. I guess that the z bitmap (rbmp) is from 0 to 255 from the beginning.
So is there any possibility to get the image in "real" 16 bit resolution?
I read about using Fog and turning the object white, however I have no experience with that and also do not know how to script it in Maxscirpt, so I would prefer to be working with the code snippet above, since this a snippet from larger script, which rotates the object, and I do not want to rewrite it completly.
I am using Maxscript 2018 student version
Thank you really much for help
