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

By Nakhle Georges
| Your Rating:
rating star nonerating star nonerating star nonerating star nonerating star none
(0 Votes)
| 10547 Views
| 0 Comments
| Comments 0
Date Added: 9th December 2009
Software used:
Maya

7. Now delete the 3 connections you've just created by selecting them and hitting del on your keyboard (remember this trick was done only to make the input[3D] parameters of the plusMinusAverage node appear in the connection editor). Now select them both (the plusMinusAverage and the multiplyDivide), and go to Window -> Connect selected. Connect the OutputX, OutputY and OutputZ respectively to Input3D[0].Input3Dx and Input3D[1]. Input3Dx, Input3D[2]. Input3Dx.

100_tid_image010.jpg
8. To calculate the square root of the sum, create another multiplyDivide node, and connect the Output 3Dx of the plusMinus Average node, to the Input 1 of the multiplyDivide node. In its Attributes, choose Power as operation, and set the value of x in 'Input 2' to 0.5.

9. The output of the last multiplyDivide node we've created is the distance from the sampled point to the camera. And since the u or v values of the ramp can only take values between 0 and 1. So, create a Set Range node, select the second multiplyDivide node, shift select the Set Range node, and go to Window -> Connect selected. Connect the OutputX of the former, to ValueX of the latter. In the Set Range node Attributes, set the Min to 0, the Max to 1, the Old min to 0 and let the Old max represent the distance beyond which objects become invisible, so in our case, the distance from our camera to the farthest sphere.

100_tid_image011.jpg

10. Now you can use the output of the setRange node to choose between points of a ramp. Map the color of your objects material with a ramp. In the Create render node, make sure that Normal is selected, and choose ramp. Choose black and white for the colors of the ramp. Connect the Output X of the set range node to the UCoord of the ramp node. Make sure that your ramp is a U ramp. (You might need to invert its white and black colors, depends on your case.)

100_tid_image012.jpg
100_tid_image013.jpg
11. This method gets over the problems that we faced with the first one.

Third Method

12. You can also use scripting to obtain the same result of the second method. For this, you need a sampler info node, and a material. Map the color of the material with a ramp, choose normal, and choose a grayscale ramp as before.

13. In the Expression Editor, write the expression that calculates the RMS, which is the following code line (in my case my sampler info node is samplerInfo1):

$distance = sqrt ( pow (samplerInfo1.pointCameraX,2)

+( pow(samplerInfo1.pointCameraY,2)

+(pow (samplerInfo1.pointCameraZ,2));


Set a maximum value which is equivalent to the old max used in the second method, and divide the distance by this max value, for example let it be 56. Then you will have to link the obtained value the ramp's V coordinate (make sure your ramp is a v ramp in this case).

$MaxValue= 56;

ramp4.vCoord = $distance / $MaxValue;


Click on create to create your expression, and render the scene. You should obtain the same result as before.

100_tid_image014.jpg
The above methods can serve for many other uses. For example to create a height field, you have to choose the Point world Y attribute instead of the Point camera attribute, inside the sampler info node attributes.

For a video version of this tutorial, here is a direct download link (i.e. you don't have to pay or to wait to download the file): http://rapidshare.com/files/84378918/ZDepth_n_Height_GrayScale_represention.zip

For any questions or suggestions don't hesitate to contact me.

< previous page
 
1 | 2
Related Tutorials

Tutorial

Gallery Image.



Keywords: Maya, ZBrush, Maquette, Creature

Go to tutorial
rating star fullrating star fullrating star fullrating star fullrating star full (10)
Comments 0 Views 12230

Tutorial

Gallery Image.



Keywords: Maya, Rigging, Animation,

Go to galleries 1
rating star fullrating star fullrating star fullrating star fullrating star half
Comments 2 Views 9448

Tutorial

Gallery Image.



Keywords: Maya, Rigging, Hands, Fingers, Thumbs, Animation

Go to galleries 1
rating star fullrating star fullrating star fullrating star fullrating star full
Comments 1 Views 11867

Tutorial

Gallery Image.



Keywords: Making of, ZBrush, Maya, Photoshop, Fantasy, Alice, V-Ray, Mudbox, NUKE

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