the outcolor of the fractal node is connected to the transparency of a blinn material node named propellercolor.. For example, in Figure 7.16 the transform node of a single-node camera,
Trang 1output color
Figure 7.14 The colors of two abstract shapes are controlled by a Distance Between utility This scene is included on the CD as
Creating Simulated Propeller Spin
A spinning plane propeller is basically a blurred disc Although the prop is visible
with the correct point-of-view or proper frame rate, its shape is generally indistinct
You can emulate a spinning propeller in maya by having a propeller disc drive its
own transparency For example, in Figure 7.15 a nurBS disc is animated rotating
from 0 to 10,000 degrees in Z over a period of 90 frames
Trang 2rotateZ input1X
outputX input1X
outputX
offsetU
outC olor
placementMatrix
outC olor color
Figure 7.15 A NURBS disc serves as a spinning propeller The opacity flicker is driven by its own geometry The yellow arrow
indicates the point at which Maya inserts a unitConversion node A simplified version of this scene is included on the CD as
the rotateZ of the disc’s transform node is connected to the input1X of a plydivide node named multiplydivide1 the outputX of multiplydivide1 is connected
multi-to the input1X of a second multiplydivide node named multiplydivide2 the input2X
of multiplydivide1 is set to 0.01 the input2X of multiplydivide2 is set to 0.005
this sequence converts a potentially large rotation value into an extremely small one
the outputX of multiplydivide2 is connected to the offsetu of the place2dtexture node belonging to a fractal texture node thus, the rotation of the disc automatically pushes the fractal texture node in the u direction the repeat uV of the place2dtex-ture node is set to 0.001, 0.001, which reveals only a small section of the fractal the custom settings for the fractal texture node are as follows:
ratio: 0.5Frequency ratio: 10Bias: –0.3
Filter: 5
Trang 3these adjustments create a softer version of the fractal pattern the outcolor
of the fractal node is connected to the transparency of a blinn material node named
propellercolor As the disc rotates, the fractal moves left, revealing darker and lighter
sections hence, the propeller disc flickers during the animation the color of the disc
is derived from a circular ramp texture with brown and yellow handles the ramp is
projected onto the disc for a more exact lineup of colors while this technique might
not work for close-ups, it can be used successfully for wider shots and flybys it also
serves as an extremely efficient method of rendering since no motion blur is involved
Reproducing the Hitchcock Zoom-Dolly
Alfred hitchcock introduced a famous zoom-dolly camera move in the film Vertigo
(1958) Steven Spielberg later popularized the same motion in Jaws (1978) if a camera
zooms out while simultaneously dollying forward, the background distorts over time
this is due to the optical nature of the camera lens telephoto lenses (for example,
300 mm) flatten a scene, but wide lenses (for example, 24 mm) give a scene more
depth it’s possible to change the focal length of a zoom lens with a twist of the hand
(for example, 200 mm to 50 mm)
You can automate the hitchcock zoom-dolly with custom connections For example, in Figure 7.16 the transform node of a single-node camera, named hitch-
cam, is parented to a group node named hitchcamgroup to view the custom
shad-ing network, open hitchcock.ma and follow these steps:
1. open the hypershade window and switch to the utilities tab
2. mmB-drag the multiplydivide node into the work area
3. with the multiplydivide node selected, click the input And output connections
button
hitchcamgroup is animated along the Z axis hitchcamgroup’s translateZ attribute is connected to the input1X of the multiplydivide node the outputX of
the multiplydivide node is connected to the focallength of the camera’s shape node,
named hitchcamShape the multiplydivide node’s operation is set to multiply, and
its input2X is set to 10 when hitchcamgroup is at its start position of 0, 1, 10, the
focallength of hitchcamShape is 100 when hitchcamgroup is at its end position of
0, 1, 1, the focallength of hitchcamShape is 10 Scrubbing the timeline will quickly
show the high degree of distortion that happens to the background and foreground
objects An animation curve node—seen at the top of the network—appears because
an attribute is keyframed even though hitchcamgroup is the parent of hitchcam,
there is no visible connection in the hypershade window
on top of itself is the quickest way to do this Choosing Other from the Connect Input Of menu opens the Connection Editor and reveals that the node is listed in both the Output and the Input column That said, an attribute cannot be connected to itself (for example, focalLength
to focalLength) Nevertheless, two different attributes can be connected (for example,
focal-Length to shutterAngle)
Trang 4focalLength
input1X
translate Z
Figure 7.16 A Hitchcock zoom-dolly is created by connecting a camera’s translation to its focal length This
scene is included on the CD as hitchcock.ma A QuickTime movie is included as hitchcock.mov
Tapping into Construction History Nodes
You can put construction history nodes to work in the hypershade window in ure 7.17, an asteroid model automatically receives more surface detail as it approaches the camera along the X axis
Fig-to view the entire cusFig-tom network, open history.ma and follow these steps:
1. open the hypershade window and switch to the utilities tab
2. mmB-drag the clamp node into the work area
3. with the clamp node selected, click the input And output connections button
A portion of the network becomes visible
4. Select all the visible nodes and click the input And output connections button
a second time
Trang 5inputP olymesh
transla teX
input1X
outputX
Figure 7.17 A polygon asteroid receives more detail as it approaches the camera Iterations of a Smooth tool are driven by custom
connections This scene is included on the CD as history.ma A QuickTime movie is included as history.mov
For the network to function, the animated translateX attribute of the pSphere polygon transform node is connected to the input1X of a multiplydivide node the
multiplydivide node’s operation is set to divide and its input2X attribute is set to
15 this division increases the amount of distance the asteroid must travel before
the detail is increased the outputX of the multiplydivide node is connected to the
inputr of a clamp node the outputr of the clamp node is connected to the divisions
attribute of a polySmoothFace node the polySmoothFace node is a product of
choos-ing mesh > Smooth whenever the Smooth tool is applied, it creates two new nodes:
polySmoothFace and polySurfaceShape the divisions attribute of polySmoothFace
controls the number of iterations the Smooth tool undertakes the clamp node’s
maxr attribute is set to 3 so that the iterations stay between 0 and 3 the surface’s
pre-Smooth state is retained by polySurfaceShape Both polySmoothFace and
polySur-faceShape nodes, like all construction history nodes, will exist until history has been
deleted on the polygon surface (edit > delete By type > history)
Trang 6Redirecting the Initial Shading Group Node
By default, maya assigns all new geometry to the initial Shading group and the bert material connected to it (named lambert1) You can replace the lambert with a Blinn or any other material by deleting the connection between the outcolor of the default lambert material node and the surfaceShader attribute of the initialShading-group node You can locate the initialShadinggroup node by clicking the input And output connections button while lambert1 is selected You can then connect the outcolor of a new material to surfaceShader of the initialShadinggroup From that point forward, all new surfaces are automatically assigned to the new material (see Figure 7.18) the outcolor of the default lambert material node is also connected to the surfaceShader of the initialparticleSe node A different material can be connected
lam-to this as well the initialparticleSe node determines the default material qualities of software-rendered Blobby Surface, cloud, and tube particles
outC olor surfac eShader outC olor surfaceShader
New default Blinn
Old default Lambert
Figure 7.18 The default Lambert material is replaced with a Blinn This scene is included on the
CD as initial_shading.ma
group node with a name along the lines of blinn1SG These material-specific shading group nodes can
be deleted and replaced if necessary For additional information on shading groups, see Chapter 4
Connecting Multiple Materials in One Network
A custom shading network is not limited to a single material in some situations, necting one material to a second material can force the renderer to apply an additional layer of evaluation to the assigned surface As a simple demonstration of this, the out-color of a phong material node is connected to the color of a lambert material node
Trang 7(see Figure 7.19) Although the lambert node does not have the ability to produce a
specular highlight, it picks up the look of a specular highlight from the phong.
outColor
color
Figure 7.19 A Lambert material inherits the qualities of a Phong.
to achieve this, the renderer evaluates the assigned surface as if a phong rial was assigned to it the renderer takes the color information from this evaluation
mate-and applies it to the color of the lambert material this evaluation occurs at each
pixel and the color is assigned at each pixel if a pixel is white with the phong shading
model, then the lambert color is white hence, a false specular highlight is produced
Any attribute of the phong material node that is mapped will carry through For
example, if a texture is mapped to the Bump mapping attribute of the phong node, the
bump will appear automatically on the lambert node
Note: For a demonstration of a complex, custom skin shader that uses the majority of techniques
in this chapter (including multiple materials), see section 7.2 of the Additional_Techniques.pdf
file on the CD
Using the Studio Clear Coat Utility
Studio clear coat is a plug-in utility that’s in its own category its sole function is to
create reflections with uneven intensity As opposed to the car paint shading network
detailed in Figure 7.2, this utility functions as a single node
For example, in Figure 7.20 the outValue of a studioclearcoat node is nected to the reflectivity of a blinn material node (named car_paint) the same light-
con-ing and environment that was used in Figure 7.2 is applied here the studioclearcoat
node has an index value of 1.7, a Scale value of 1.55, and a Bias value of –0.1 the
resulting render is almost identical to Figure 7.2 the main difference is the rapidity
with which the Studio clear coat utility transitions between the hood reflection and
fender reflection Although this is not necessarily better or worse, the Studio clear
coat utility is extremely easy to apply unfortunately, it will not work with the mental
ray renderer the custom paint network used in Figure 7.2, on the other hand, offers
more flexibility with the addition of the Value gradient and will work with maya
soft-ware or mental ray renderers
Trang 8Figure 7.20 The reflective falloff of car paint is controlled by a Studio Clear Coat utility A simplified version
of the scene is included on the CD as clearcoat.ma.the Studio clear coat utility’s attributes follow:
Index represents the refractive index of the surface A refractive index is a constant
that relates the speed of light through a vacuum to the speed of light though a material (such as car paint) the constant follows:
speed of light through a vacuum
÷ speed of light through a material
water has a refractive index of 1.33, which equates to 1/0.75 the speed of light through water is only 0.75 times as fast as the speed of light through a vacuum the refractive index of air is extremely close to 1 and is considered 1 when working in 3d
As light passes between two materials that possess different refractive indices, the angle
of refraction does not match the angle of incidence (the angle between the incoming light ray and the material boundary normal, which is perpendicular to the boundary surface) if the light passes from a material with a low refractive index to a high refrac-tive index, the angle of refraction is rotated toward the material boundary normal hence, objects appear bent (for example, when a pole is dipped into water) the clear-coat paint systems on modern cars produce a refractive index somewhere between 1.4 and 1.8 the amount of perceived distortion is minimized by the extreme thinness of the transparent clear-coat layer (an average of 50 to 100 microns)
Scale Serves as a multiplier for the final result higher values will make the reflection
more intense
Bias offsets the intensity of the reflection lower values decrease the intensity of the
reflection and increase the contrast within the reflection higher values increase the intensity and lower the contrast the default value is –0.1
Trang 9Note: If the Studio Clear Coat utility is not visible in the General Utilities section of the Hypershade
window, choose Window > Settings/Preferences > Plug-In Manager and click the Loaded check box for
between angles of incidence and angles of refraction The law is named after Willebrord Snell (1580–1626), who developed a mathematical model based on earlier investigations by Claudius Ptolemy (ca 100–170) and others For more information on Snell’s Law, see Chapter 12
Chapter Tutorial: Building a Custom Cartoon Shading Network
in this tutorial, you will create a custom cartoon shading network that combines solid
colors with a simulated halftone print (see Figure 7.21) Sampler info, Surface
lumi-nance, condition, and multiply divide utilities will be used
Figure 7.21 A custom cartoon shading network applied to primitives A QuickTime movie is included
on the CD as cartoon.mov
1. create a new maya scene open the hypershade window
2. mmB-drag a Surface Shader material into the work area and rename it
Cartoon mmB-drag a condition utility (found in the general utilities section
of the create maya nodes menu) into the work area place it to the left of the cartoon node use Figure 7.22 as a reference
Trang 10ConditionA
place2dTexture ConditionB
projection
RampA
Figure 7.22 The shading network of the custom Cartoon material
3. connect the outcolor of the condition node to the outcolor of the cartoon node You will have to open the connection editor to do this
4 Select the condition node and rename it ConditionA open its Attribute editor
tab click the color if False map button and choose a ramp texture from the create render node window A place2dtexture node will automatically appear
with the new ramp node rename the ramp node RampA.
5. Select rampA and open its Attribute editor tab create four color handles that
go from black to green to white (see Figure 7.23) change rampA’s tion attribute to none
interpola-6. mmB-drag a Surface luminance utility (found in the color utilities section
of the create maya nodes menu) into the work area place it to the left of the
other nodes connect the outValue of the surfaceluminance node to the
first-term of conditionA
7. connect the outValue of the surfaceluminance node to the vcoord of rampA
You will have to use the connection editor this connection forces the render
to select different pixels in the V direction of the ramp based on the amount of
light any given point on the assigned surface receives if a surface point is dark,
it gets its color from the bottom of the ramp if a surface point receives a erate amount of light, it gets its color from the center of the ramp
mod-8. mmB-drag a second condition utility into the work area place it to the left
of conditionA rename the new condition node ConditonB connect the
out-color of conditionB to out-coloriftrue of conditionA
Trang 11Figure 7.23 (Left) RampB (Right) RampA
9. mmB-drag a Sampler info utility (found in the general utilities section of
the create maya nodes menu) into the work area place it to the left of ditionB connect the facingratio of the samplerinfo node to the firstterm of conditionB
con-10. Select conditionB and open its Attribute editor tab Set the color if False
attri-bute to 0, 0, 0 click the color if true map button, select As projection in the 2d textures section of the create render node window, and click the ramp texture button Selecting As projection creates the ramp texture with a projec-tion node and a place3dtexture node (see Figure 7.22) rename the new ramp
node RampB.
11 create a new one-node camera by choosing create > cameras > camera from
the main maya menu create several primitives and place them in the view of the camera Assign all the primitives to the cartoon material Feel free to change the camera’s Background color attribute to white or add a white ground plane
12. Select the projection node and open its Attribute editor tab change the proj
type attribute to perspective mmB-drag the new camera node, named camera, from the cameras tab area to the work area and drop it on top of the projection node choose other from the connect input of drop-down menu the con-nection editor window opens connect the message of the camera node to the linkedcamera of the projection node the message attribute is normally hid-den when you choose left display > Show hidden in the connection editor, the message attribute becomes visible at the top of the list when the camera
node is connected to the projection node, the projection node will know to
proj-ect from the view of the new camera and not the default persp camera
Trang 12Figure 7.24 Selected camera frustum
14. Select rampB and open its Attribute editor tab place two color handles in the color field A black handle should be at the bottom A dark purple handle should be at the center (Figure 7.23) Set type to circular ramp and interpola-tion to none rampB will produce a halftone print pattern Select the place2d-texture node of rampB open its Attribute editor tab and change the repeat
uV value to 65, 40 choose larger numbers to create smaller halftone circles
15. Select conditionB and open its Attribute editor tab Set the Second term bute to 0.3 and the operation to greater than conditionB works as an if statement if the facingratio of the samplerinfo node is greater than 0.3, con-ditionB will output the halftone pattern of rampB as the color if the facingra-tio is 0.3 or less, pure black will be output as the color; ultimately, this creates a black “ink line” around the edge of the objects
attri-16. Select conditionA and open its Attribute editor tab Set the Second term bute to 0.5 and the operation to less than conditionA serves as a second if statement if the outValue of the surfaceluminance node is less than 0.5, the
Trang 13color output by conditionB is selected (black or halftone dots) if the outValue
of the surfaceluminance node is equal to or greater than 0.5, the color output
by rampA (various shades of green) is selected the surfaceluminance node also controls the vcoord of rampA, so that the selection of different shades of green is based on the amount of light the surface receives
17. the custom cartoon material is complete! render out a test it should look
simi-lar to Figure 7.21 if you get stuck, a finished version of the material is saved as
Trang 148
Trang 15Math utilities refine outputs and emulate complex mathematics Switch utilities let you create numerous texture variations with
a single material With Array Mapper and Particle Sampler utilities, you can control a particle’s material and movement on a per- particle basis You can also create unique effects with Stencil and Optical FX utilities
Chapter Contents
Practical applications of each math utility
A general approach to using per-particles attributes The functionality of the Array Mapper and Particle Sampler utilities Uses for Stencil and Optical FX utilities
The purpose of Unit Conversion and other scene nodes
8