View Full Version : Exporting the z-depth data to a file
01-08-2005, 03:32 PM
I want to be able to export all the z-depth data of a rendered image to a file. I know I can render the zdepth to an image file in 3dsmax, but if I save it as a bmp the depth is saved as 8-bits per pixel, I need at least 16-bits per pixel precision.
After looking through the manual I found that if I save the image as a RPF or RLA, then I can export depth as well, and select the bit precision. But I think this only applies to the color channels and not the depth channel (correct me if I'm wrong)
So I asked on two different max forums if anyone knew a solution to this but no-one came up with an answer. So I continued looking and I stumbled upon MaxScript.
It appears from what I read in the MaxScript manuals that reading the float-value of every pixel in the z-buffer is possible. Am I right about this? Are there any excisting plugins or scripts that can do this? I'm an experienced C++ programmer but I know little about 3dsmax, would it be a lot of work with a long learning curve to do such a thing or would I be able to write a script for that in less than 2 days?
01-19-2005, 02:56 PM
You could try the Render Elements functionality, if that works then no need for MAXScript. You can tell it to output Z-depth as a separate bitmap. If you use TIFF, you can set it to 16 or 32 BPP. Should work.
01-19-2005, 03:43 PM
Maxscript could work for you but I don't think it would be a very ideal solution. To my knowledge, the primary problem with zbuffer data is that it isn't anti-aliased, now I haven't verified that this is still true but I believe it is. Thus, probably the most frequently used solution is to apply a 100% self illuminated white material to all your objects and then apply a black linear fog on the scene and render it. Now you're not saving any special buffers or anything you're just getting a b/w depth mask from the RGB data...
Portfolio @ christophergrant.com (http://www.christophergrant.com)
Maxscript Junkie @ scriptspot.com (http://www.scriptspot.com)
01-20-2006, 10:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.