Jump to content
kubabuk

Zdepth - Extract

Recommended Posts

Hi

I need to save zdepth information as a rgb file, how can I extract Z channel from the houdini *.pic format. Every attempt (saving straight from mplay or saving as Pz.jpg in the deeprasters tab didn't succeed... (I always get b&w image) Futhermore sometimes when I render with pic format I get correct grayscale image and other time just black and white (see attachment) What am I doing wrong?!? Pleasy heeelp!

Thanks, Kuba

post-823-1146688701_thumb.jpg

Share this post


Link to post
Share on other sites

Z map images in Houdini aren't normalized to the 0-1 - they are effectively HDR images. So saving it to a format that doesn't support HDR will lose most of your information, and it'll look B/W. You would be better off trying to save it to a format that supports HDR, like TIFF or EXR. In the MPlay Save As... dialog, change the Color field to 'Pz' (and set the Alpha field to None) and then save. You can also save it into a pic by setting the scope to 'Pz'.

If you REALLY want to save it to JPG, though, display the depth plane, click "Adapt to Full Pixel Range' (hotkey Shift+R) and then select Save->Preview. This will normalize the depth to 0-1 for you, making your resulting JPG look more like a Z map.

Share this post


Link to post
Share on other sites

Thanks for response. :)

The trick with saving as a TIFF works but after I load it again I have to "Adapt to Full Pixel Range" to see the results. But I can't still load this image to photoshop. I also tried the solution saving the preview as jpeg. But it doesn't work for me I still get B&W image. Do you think my scene is so huge that it doesn't fit the zdepth range...?

Cheers

Kuba

Share this post


Link to post
Share on other sites
Thanks for response. :)

The trick with saving as a TIFF works but after I load it again I have to  "Adapt to Full Pixel Range" to see the results. But I can't still load this image to photoshop. I also tried the solution saving the preview as jpeg. But it doesn't work for me I still get B&W image. Do you think my scene is so huge that it doesn't fit the zdepth range...?

Cheers

Kuba

27257[/snapback]

Hi... The pixels in the z-depth image are stored as floating point numbers. Each pixel represents the distance from the camera of the surface which was rendered. So, if you have a grid that's 5 units from the camera, the pixel will have a value of 5 (very bright).

There's a command line tool called "izg" which will convert a depth image to a gray scale image. You might want to try processing the .tiff file using this application.

izg -a zdepth.tiff zdepth.jpg

You can also do a similar effect in COPs by adjusting the contrast of the image so that the brightest pixel goes to 1 (in the case above, you'd want to set the contrast to the range 0-0.2). However, this is probably a little harder to control.

  • Like 1

Share this post


Link to post
Share on other sites

Hmm, why not create a vop shop for this, and have a two slider (near/far) control? This is quite easy to do and very easy to control yet very flexible.

An example is in the pintable tutorial.

Share this post


Link to post
Share on other sites
Hmm, why not create a vop shop for this, and have a two slider (near/far) control? This is quite easy to do and very easy to control yet very flexible.

An example is in the pintable tutorial.

27263[/snapback]

Unless you're always working with static scenes, I don't think SHOPs are the way to go on this. Best leave range mapping to post, IMHO, because there you have the option of either a constant domain (near/far parameters), or a dynamic one (min/max per frame or per sequence).

Share this post


Link to post
Share on other sites

Thanks for help, it works now. :)

I've wrritten down everything step by step in case anyone comes up the same problem.

I render and save file as a houdini *.pic format with the Pz variable in Deep rasters tab

Open rendered file (with mplay) change from color to Pz, "save current frame" as a tif file, change the "color" to PZ and "alpha" to none.

open the tif file once again with mplay and SHIFT+R to Adapt to full pixel range, and save as a tif.

open IZG command line tool and convert the file to jpg:

izg -a file.tif file.jpg

Quite tedious work but at least I can load Zdepth files in Photoshop...

Kuba

Share this post


Link to post
Share on other sites
Thanks for help, it works now. :)

I've wrritten down everything step by step in case anyone comes up the same problem.

Another method you may want to try:

1. Load the Pz image (or whatever floating point image/channels you want to normalize) into the compositor (File COP).

2. [optional] If this is a deep raster .pic file, you may want to add a ChannelCopy COP to put Pz (or whatever) into the R,G,B (A) channels.

3. Follow with an Equalize COP to do the normalization.

4. Append a Convert COP to convert back to 8-bit, and save the result in any format you like.

Basically: you can use the Equalize COP to normalize your floating point channels.

Share this post


Link to post
Share on other sites
open IZG command line tool and convert the file to jpg:

izg -a file.tif file.jpg

27280[/snapback]

Why would you save to a lossy format like jpg?

I would stick with tif or tga or something non lossy.

Share this post


Link to post
Share on other sites
Thanks for help, it works now. :)

I've wrritten down everything step by step in case anyone comes up the same problem.

I render and save file as a houdini *.pic format with the Pz variable in Deep rasters tab

Open rendered file (with mplay) change from color to Pz, "save current frame" as a tif file, change the "color" to PZ and "alpha" to none.

open the tif file once again with mplay and SHIFT+R to Adapt to full pixel range, and save as a tif.

open IZG command line tool and convert the file to jpg:

izg -a file.tif file.jpg

Quite tedious work but at least I can load Zdepth files in Photoshop...

Kuba

27280[/snapback]

Gosh! so many steps to do so simple task?

Just render your file with pz plate (or plug in pz to cd in vop - you have then inaccurate but smooth edges deph map :) ) equlize it in cops to see you whole range of Pz, then save as tiff with forced 8bit depth.

Share this post


Link to post
Share on other sites
Gosh! so many steps to do so simple task?

Just render your file with pz plate (or plug in pz to cd in vop - you have then inaccurate but smooth edges deph map :) ) equlize it in cops to see you whole range of Pz, then save as tiff with forced 8bit depth.

27290[/snapback]

sorry, I've just read Mario post... :blush:

Share this post


Link to post
Share on other sites

Big thanks once again, I attach this time COPs network, which works very fine as well :)

Cheers

Kuba

post-823-1147078513_thumb.jpg

  • Thanks 1

Share this post


Link to post
Share on other sites
Big thanks once again, I attach this time COPs network, which works very fine as well :)

Cheers

Kuba

27352[/snapback]

(1) what is the first convertCOP for? Pz IS in floating point format so it doesn't have to be converted.

(2) you can even simplify this network by converting to 8bit in file format options, which have bit depth converions for most of file formats (so second convertCOP is optional also).

(3) if your plan is to use Pz outside Houdini and Halo, it's better as I suppose to store depth map in other file then your render, so you can use it just out of mantra in any application with support for 32bit per channel images. This extra step in Halo will be then unnecessary. After that you can still use it of course in Halo, just using CopyChannel COP.

cheeers,

SY.

Share this post


Link to post
Share on other sites

here is another method:

1) inside shop, create a vex z-depth fog.

2) In object level, create Atmosphere node . choice shading tab, and connect shop volume to vex z-depth fog.

then you can render a z depth file

hehe...

  • Like 1

Share this post


Link to post
Share on other sites
(3) if your plan is to use Pz outside Houdini and Halo, it's better as I suppose to store depth map in other file then your render, so you can use it just out of mantra in any application with support for 32bit per channel images. This extra step in Halo will be then unnecessary. After that you can still use it of course in Halo, just using CopyChannel COP.

cheeers,

SY.

27355[/snapback]

Hi SYmek,

(3) For some reason rendering zdepth as a separate file didn't work for me - every time I got B&W image as the pixel range was shifted, but at the same time I couldn't correct that in mplay.

(1) Previouslu I tried not to use the convertCOP and I got incorrect results, with ConvertCop everything works fine. Probably it depands what sort of channel depth I used for rendering color and alpha (I'm not sure but accidently I might have chosen 8bit in the render options...)

Kuba

Share this post


Link to post
Share on other sites

EGGer, works great, I figured there had to be an easier way to pull this pass,

I also used a Constant Material and mapped all my Geometry to this SHOP. Then took your suggestion and placed an Atmosphere Node and set its material to the VEX Z-depth fog (I also changed the Fog color to Black).

My Geometry had the default shader assigned to it and its Specular and Lambert shading were taken into effect by mantra.

Using the Constant Material, this eliminated the Specular highlights and made it workable in nuke and fusion Z-depth nodes.

Awesome post!!! I was looking for a logical solution.

Edited by Angelo

Share this post


Link to post
Share on other sites

Any one know of a VEX shader solution??

Edited by Angelo

Share this post


Link to post
Share on other sites
Any one know of a VEX shader solution??

solution for what?

Share this post


Link to post
Share on other sites
On 5/8/2006 at 2:55 PM, kubabuk said:

Big thanks once again, I attach this time COPs network, which works very fine as well :)

Cheers

Kuba

post-823-1147078513_thumb.jpg

Thank you for helping after 13 years :D

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×