Keep up-to-date with Free tutorials!!


Sign up to our twice-monthly newsletter today for the latest tutorials, interviews and product information.

Sign me up to receive third-party emails from 3dtotal's partners, too!

- Latest news
- Exclusive Shop Offers
- Preview early content
- Plus much more


Not Ready to take that step? OK, Why not just Subscribe to the RSS Feed

submit tutorial
1 | 2
ZDepth and height GrayScale Representation

| Your Rating:
rating star nonerating star nonerating star nonerating star nonerating star none
(0 Votes)
| Comments 0
Date Added: 9th December 2009
Software used:
This tutorial shows 3 different methods to create height and depth grayscale representations of a maya scene, which may be useful in many cases such as adding depth of field or fog in post production.

First Method

1. Create some spheres, and post them on different distances from the camera. Assign a material to the spheres, such as a simple lambert material (to make the result independent from the lights in your scene, use in all the methods a surface shader). When rendering at this stage, all the spheres have the same color, independently from the distance from the camera.

2. Go to the Attribute Editor of the material, and map its color with a ramp. In the Create render node dialog, make sure that As Projection is selected, and choose a ramp.

Edit the projection node by choosing planar as the projection type, and make the ramp a black and white 2 colors ramp.

3. The projection icon is now visible in the viewport, as a small rectangular shape. Scale that icon to fit your scene entirely. Take a render of the scene. The color of the spheres must now be fading towards black. If it is not the case, you will have to change the ramp type from U ramp to V ramp or vice versa.

4. The 2 main limitations of this method are:

  • If you move the camera away from the spheres, their color remains unchanged when rendering.
  • If you render the scene from the opposite side, the colors also remain unchanged, so that the closest sphere is dark, while the farthest sphere is clear.

  • This method is suitable for a static scene, where the place of the camera is already decided, because the result here is static, so it's not suitable for moving cameras. The problem can be solved by parenting the projection icon to the camera, but here another problem arises: the scene might fall out of the range of the projection icon, which will lead to unexpected results.

    Second Method

    5. Let's check another method to generate the same effect. Here it is calculated based on the distance of the object from the camera, so it's a lot more logical. In the hypershade, assign a lambert material to the spheres, and then create a sampler info node. You will take the point camera attribute, compute the RMS {root - mean - square: distance = <} value, and then choose a color on a ramp based on that distance.

    6. For this, your hypershade still open, create a multiplyDivide node. Click on the sampler info node you've created, then shift-click on the multiplyDivide node. Go to the hypershade menu click on window, and choose Connect selected. In the connection editor connect the Point CameraX of the sampler info node to the Input 1X of the multiplyDivide node; do the same for Point CameraY to the Input 1Y and Point CameraZ to the Input 1Z.

    In the multiplyDivide node attributes, choose Power as operation, and set all the 'Input 2' values to 2.

    Now to sum up these values, use a plusMinusAverage node. If you load the plusMinusAverage into the connection editor, under Input3D section you can't find the inputs to connect to. To make them appear, do the following steps. Using the middle mouse button, click on the multiplyDivide node and drag it on the plusMinusAverage node, then choose input3D[ n] -> 0. Do this 2 more times to choose input3D[ n] -> 1 and input3D[ n] -> 2.


    continued on next page >

    1 | 2
    Related Tutorials

    The making of Bane

    by Yoongkun Kim
    published on 2014-09-12

    Keywords: Bane, ZBrush, Character, Maya, MARI, Photoshop, UVLayout, V-Ray

    rating star fullrating star fullrating star fullrating star fullrating star full (5)
    Comments 2 Views 41056

    Environment Concept Design: From Brainstorming to Final Painting

    by Jessica Tung Chi Lee
    published on 2015-08-12

    Keywords: Jessica Tung Chi Lee, Maya, Photoshop, fantasy, making of

    rating star fullrating star fullrating star fullrating star fullrating star none (8)
    Comments 0 Views 15067

    Create photorealistic cars in Maya - Chapter 1

    by Alexandr Novitsky
    published on 2016-01-12

    Keywords: car, maya, photorealistic, alexandr novitsky

    rating star fullrating star fullrating star fullrating star fullrating star full (8)
    Comments 0 Views 9659

    Making of Fungi Forest

    by Emilie Stabell
    published on 2016-09-07

    Keywords: Emilie Stabell, Maya, fungi, forest, Maya

    rating star fullrating star fullrating star fullrating star fullrating star full (9)
    Comments 2 Views 5864
    Readers Comments (Newest on Top)
    no comments!
    No comments yet. Be the first to comment!
    Add Your Comment..