I read out the z-Buffer from an image like the following:
--get z buffer in HD resolution
rbmpHD = render outputsize:[1920,1080] channels:#(#zdepth) vfb:off camera: z_cam
z_dHD = getchannelasmask rbmp #zdepth outputfile:z_name
z_dHD.fileName = z_nameHD
save z_dHD
close z_dHD
I used
pngio.setType #gray16
To write out the imaes as 16 bit, however, they are not using the down 8-Bits, which means that the resolution of the depth image is limited to 256 steps. Thus, the z buffer read out is from 0 to 255 from the start. Is it possible to read out the z-Buffer image with a 16 bit resolution right from the beginning?
Edit:
The code MUST produce an output image of any kind which can be read back into a C++ program. To do so I need a resolution of 16 bit
The function
getChannel rbmpHD [x,y] #zDepth
Returns the z depth values, however - this would mean one has to loop over the entire visible space of the camera - and how can one get this visible surfaces to the camera? And even if it is possible, this would slow down the process a lot