Your online Softimage Educational Resource

The blog has been online for more than 4 years and there’s still not a single post even remotely related to the delicious brew called coffee… Perhaps it will someday, but in the meantime you can read the articles about Softimage. Most of the material are tutorials and Q&As I’ve written for 3D World Magazine sometime between today and 2003. If you have any questions please don’t hesitate sending me an email.


Thanks to Letterbox Animation Studios for hosting all the scene files.

Make sure you visit their Redi-Vivus.com for 100s of hours of free XSI video tutorials.

Tuesday, January 13, 2009

Custom Depth Pass in XSI
















By using null objects and a couple of nodes in the render tree, you’ll get an interactive visual representation of the near and far values of your depth pass.
There are a couple of different ways to create depth passes in XSI, including the pre defined that can be found in the Render > Pass > Edit > New Pass menu. Since it’s only a mouse click away, it’s obviously the quickest to create. However, finding the proper values may not be the most intuitive with this setup.

Open the scene depth_pass.scn from this issues CD, or create a scene with a couple of object on your own. Create two Null objects and name them Near and Far. Position the Near null at the pear closest to the camera and the Far null at the pear in the back. These will be used to control the gradient. The surface closest to the camera will be white and the one furthest away will be black. Press [3] to switch to the Render toolbar and from the Pass > Edit > New Pass menu choose Empty. Name the pass Depth_Pass. Press [8] to open an Explorer and press [P] to change the scope to pass. Expand the Depth_Pass node and select the Background_Objects_Partition. From the Get > Material menu choose Constant and press [7] to open a Render Tree. From the Nodes > State menu get a Scalar state node (make sure it’s set to Ray Length in the PPG) and from the Nodes > Math get a Change Range node. Connect the Scalar state node to the input of the Change Range node and the Change Range node to the Surface input of the Material node. Double-click on the Change Range node to open the PPG. By converting the position of the null objects to zero (black) and one (white), you’ll create the grayscale image. Right click on the animation icon next to the Old Range: Start and choose Expression Editor... from the menu. Enter ctr_dist_cam( Far. ) in the editing pane, click the Apply button and close the editor. Right click on the animation icon next to the Old Range: End and choose Expression Editor... from the menu. Enter ctr_dist_cam( Near. ) in the editing pane, click the Apply button and close the editor. Set the New Range: Start to 0 (zero) and New Range: End to 1. Draw a Render Region and play with the nulls’ position to see the effect.

The project files used in this tutorial can be found at:
http://www.Redi-Vivus.com/Caffeineabuse/Custom_Depth_Pass_in_XSI.zip
















A depth pass is basically a grayscale image of your 3d scene, where the different shades of gray represents different depths.

Quick tip
By saving the material as a preset, you can easily create depth passes in future projects within a few mouse clicks.

9 comments:

vfxwolf said...

handy trick. The built-in depth pass a little tricky with large scenes. One problem though, saving the material as a preset dumps all expressions. Something I'm not doing?

dg said...

How would you add transparency to that mix?

Ola Madsen said...

Hi Vfxwolf,

No, you’re not doing anything wrong. The preset only stores the nodes in the render tree. A quick workaround is to put the material and the null objects in a model and then export it. whenever you need to setup a new depth pass, just import the model…

Cheers
O

Research Writer said...

Many institutions limit access to their online information. Making this information available will be an asset to all.
Custom Paper Writing

Paulo Barrelas said...

Great tip, thanks Ola!!
Is is possible to setup a depth pass in a scene full of leaves where a cutout map is applied to a plane in order to render those leaves properly? Or this technique also only works with geometry?

Unknown said...

wow!!! great! thank you very much! you should continue drinking coffe

yeoj said...

great tips!
just one thing... is there any ways to loose the relationship with the camera?
thank you!

Ola Madsen said...

Not quite sure what you mean with ”loose the relationship with the camera”. The depth pass is by design based on the objects position/distance from the camera. What is it that you’re trying to achieve? If you just want to control the color (or any other material attribute) of an object based on distance, maybe this post will help: http://caffeineabuse.blogspot.se/2011/01/changing-color-of-objects-based-on-its.html

Cheers
O

yeoj said...

Thank you so much!
that is exactly (kind of...) what i did. except mine was much simpler... or stupid-er...
i created a new camera for a gradient camera projection. this way, i can control where the direction of gradient could be.
ha. i guess i wasn't really looking for depth. thank you so much for your quick response. you are the best!

cheers!