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
(Score 0 out of 5 after 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

    Basic Maya Lighting Tutorial

    by Sean Hewitt
    published on 2009-12-09

    Keywords: basic, maya, lighting, head, room,

    rating star fullrating star fullrating star fullrating star nonerating star none (6)
    Comments 2 Views 213141

    Principles of animation

    by Jahirul Amin
    published on 2017-01-11

    Keywords: Jahirul Amin, maya, Beginner’s Guide to Character Creation in Maya, free chapter, animation

    rating star fullrating star fullrating star fullrating star fullrating star half (13)
    Comments 0 Views 9459

    Hard surfaces in Softimage

    by Paul H. Paulino
    published on 2014-12-09

    Keywords: Softimage, Maya, vehicle, sci-fi

    rating star fullrating star fullrating star fullrating star fullrating star full (53)
    Comments 1 Views 45950

    Making Of 'HEMTT-M1075'

    by Gurmukh Bhasin
    published on 2013-11-06

    Keywords: Tutorial, Military, Tank, Maya, mental ray, Photoshop, Truck

    rating star fullrating star fullrating star fullrating star fullrating star half (32)
    Comments 1 Views 106073
    Readers Comments (Newest on Top)
    no comments!
    No comments yet. Be the first to comment!
    Add Your Comment..