1. Trang chủ
  2. » Công Nghệ Thông Tin

Advanced Maya Texturing and Lighting- P5 potx

30 311 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 30
Dung lượng 3,26 MB

Nội dung

99 ■ CHAPTER TUTORIAL: LIGHTING A FLICKERING FIRE PIT WITH SHADOWS Chapter Tutorial: Lighting a Flickering Fire Pit with Shadows In this tutorial, you will create a fire with soft, flickering shadows (see Figure 3.29). You will use Paint Effects fire with a volume, ambient, and directional light. Fir e pi t m o d e l co ur te sy oF Kr is t en sc al l i on Figure 3.29 Fire created with a Paint Eects brush and lit with a directional, ambient, and volume light. A QuickTime movie is included on the CD as fire_pit.mov. 1. Open the fire.ma file from the Chapter 3 scene folder on the CD. Create a directional light. Open its Attribute Editor tab. Change the Color to a pale blue. This will serve as the scene’s moonlight. 2. Move the directional light above the set and to screen right. Rotate it toward the fire pit. Render out a test frame. Adjust the light’s Intensity and Color until satisfactory. Although this light will not be the key light, the sand and rocks should be appropriately visible for nighttime. 3. In the directional light’s Attribute Editor tab, check Use Depth Map Shadows. Set Resolution to 512 and Filter Size to 6. This combination of medium Resolu- tion and moderate Filter Size will create a slightly soft shadow. Render a test frame. Experiment with different light positions and shadow settings. 4. Create an ambient light and open its Attribute Editor tab. Set the Intensity attri- bute to 0.2, or approximately 1/10th the Intensity value of the directional. Tint the ambient light’s Color to pale blue. Move the ambient light to screen left, just above the set. This light serves as a low fill that will prevent the backside of the rocks from becoming too black. 5. Create a volume light and open its Attribute Editor tab. Change Light Shape to Cylinder. Change the Color to a deep orange. In the Penumbra section, click the 92730c03.indd 99 6/18/08 11:28:55 PM 100 c h a p t e r 3: CREATING HIGH-QUALITY SHADOWS ■ left handle of the gradient. Once the handle is selected, change the Interpolation attribute to Smooth. This will change the linear gradient to one that has a slow start and a slow end; ultimately, this will make the falloff of the volume light more subtle. 6. Move the volume light to the center of the fire pit. Scale the light so that it is approximately twice the length, width, and height of the fire pit. In this case, the volume light will look oval from the top and short and squat from the side. Render a test frame to see how far the light from the volume light is traveling. 7. In the volume light’s Attribute Editor tab, check Use Depth Map Shadows. Set Resolution to 128 and Filter Size to 6. This creates a soft shadow emanating from the center of the pit. Render out a test frame. The rocks should produce shadows similar to the shadows in Figure 3.29. 8. Select the cone-shaped ash geometry, which lies in the center of the fire pit. Choose Paint Effects > Make Paintable. Choose Paint Effects > Get Brush. The Visor window opens. In the Paint Effects tab, click the brush category folder named fire. Several fire brush icons become visible. Click the largeFlames icon. Close the Visor window. In the top view, click-drag the pencil mouse icon over the ash geometry. When the mouse button is released, a Paint Effects stroke is created. Keep the stroke fairly short. 9. Render out a test frame. Fire will appear where the stroke is drawn. Initially, the fire is too small to be seen over the top of the sticks and rocks. Select the stroke curve and open its Attribute Editor tab (which is labeled largeFlames1). Change the Global Scale attribute to 60. Render out a test frame. The flame should be clearly visible. If the flames appear too bright or saturated, adjust the stroke’s Color1 and Color2 attributes (found in the Shading section of the stroke’s Attribute Editor tab). In addition, you can darken the Glow Color (found in the Glow section of the stroke’s Attribute Editor tab). Initially, the flames will move too slowly. To speed up the fire, change the Flow Speed attri- bute to 0.8. You can find Flow Speed in the Flow Animation section of the stroke’s Attribute Editor tab. 10. Following the process detailed in steps 8 and 9, paint additional Paint Effects strokes on the ash geometry. Multiple strokes are necessary to make the fire convincing. Experiment with different fire styles with different scales. The ver- sion illustrated in Figure 3.29 uses three strokes and employs the following brushes: largeFlames and flameMed. 11. Paint Effects fire is preanimated and will automatically change scale and shape in a convincing manner. To match this animation, you can keyframe the Inten- sity, TranslateX, and TranslateZ of the volume light. To do this, move the Time- line slider to frame 1. Select the volume light. Set a key by pressing Crtl+S or choosing Animate > Set Key from the Animation menu set. A red key frame line will appear at frame 1 of the Timeline. Move the Timeline slider to frame 5. Translate the volume light slightly in the X or Z direction (no more than 1 world unit). Set another key. Repeat the process through the duration of the Timeline. 92730c03.indd 100 6/18/08 11:28:56 PM 101 ■ CHAPTER TUTORIAL: LIGHTING A FLICKERING FIRE PIT WITH SHADOWS You’ll want to add keyframes every 3 to 12 frames in a random pattern (see Figure 3.30). In the end, the volume light should move back and forth in an unpredictable manner. This will cause the volume shadows to move over time in a fashion similar to actual flickering fire light. Figure 3.30 The Graph Editor view of the volume light’s Intensity curve (top) and TranslateX and TranslateZ curves (bottom) 12. To animate the volume light changing its Intensity over time, move the Time- line slider to a desired frame and right-click the Intensity field. In the shortcut menu, choose Set Key. For the duration of the Timeline, set Intensity keys every 3 to 12 frames. Randomly vary the Intensity from 2 to 3 (see Figure 3.30). 13. The fire pit is complete! Render out a low-resolution AVI as a test. The fire and corresponding light should flicker. If you get stuck, a finished version has been saved as fire_finished.ma in the Chapter 3 scene folder on the CD. 92730c03.indd 101 6/18/08 11:28:57 PM 4 92730c04.indd 102 6/18/08 11:33:02 PM 103 ■ Applying the CorreCt MAteriAl And 2d texture Applying the Correct Material and 2D Texture Simply put, a material determines the look of a surface. Although it’s easy enough to assign a material and a texture to a surface and produce a render, many powerful attributes and options are available to you. At the same time, a rich historical legacy has determined why materials and textures work the way they do. You can map a wide range of 2D textures to materials, creating an almost infinite array of results. Simple combinations of textures and materials can lead to believable reproductions of real- world objects. Chapter Contents Theoretical underpinnings of shading models Review of Maya materials Review of 2D textures Descriptions of extra texture attributes Material and texture layering tricks Using common mapping techniques to reproduce real materials 4 92730c04.indd 103 6/18/08 11:33:09 PM 104 c h a p t e r 4: APPLYING THE CORRECT MATERIAL AND 2D TEXTURE ■ Reviewing Shading Models and Materials A shader is a program used to determine the final surface quality of a 3D object. A shader uses a shading model, which is a mathematical algorithm that simulates the interaction of light with a surface. In common terms, surfaces are described as rough, smooth, shiny, or dull. In the Maya Hypershade and Multilister windows, a shading model is referred to as a material and is represented by a cylindrical or spherical icon. Ultimately, you can use the words shader and material interchangeably. A shading group, on the other hand, is connected to the material as soon as it’s assigned. The shading group’s sole function is to associate sets of surfaces with a material so that the renderer knows which surface is assigned to which material. The shading group does not provide any definition of surface quality. If the connection between a shading group node and material is deleted, the assigned surface appears solid green in the workspace view and is skipped by the renderer (see Figure 4.1). When a material is MMB-dragged into the Hypershade work area, it is automatically connected to a new shading group. If you select a material through the Create Render Node window, however, you have the option to uncheck the With Shading Group attribute; in this case, no new shading group is created. outColor surfaceShader instObjGroups[0] dagSetMembers[0] If this connection is broken, the surface will turn green in the workspace view and will be skipped by the renderer. Shading group Polygon shape node Figure 4.1 A shading group network Shading with Lambert The Lambert material carries common attributes: Color, Transparency, Ambient Color, Incandescence, Bump Mapping, Diffuse, Translucence, Translucence Depth, and Translucence Focus. In Maya, the Lambert node is considered a “parent” node. That is, Phong, Phong E, Blinn, and Anisotropic materials inherit their common attri- butes from the Lambert material. In each case, the attributes function in an identical 92730c04.indd 104 6/18/08 11:33:12 PM 105 ■ REVIEWING SHADING MODELS AND MATERIALS manner. (For a more detailed discussion of nodes and the Transparency attribute, see Chapter 6. For information on the Bump Mapping attribute, see Chapter 9.) Maya’s Lambert material uses a diffuse-reflection model in which the intensity of any given surface point is based on the angle between the surface normal and light vector. In order for Maya’s Lambert material to smoothly render across polygon faces, it bor- rows from other shading models, such as interpolated or Gouraud shading. With Gouraud, the intensity of any given point on a polygon face is linearly interpolated from the intensities of the polygon’s vertex normals and two edge points intersected by a scan line. Note: The Smooth Shade All option (Shading > Smooth Shade All through a workspace view menu) is able to interpolate across polygon faces to produce a smooth result. In contrast, the Flat Shade All option (Shading > Flat Shade All through a workspace view menu) applies a single illumination cal- culation per polygon face, which leads to faceting. NURBS surfaces, while based on Bezier splines, are converted to polygon faces at the point of render by the renderer. Hence, all the shading model techniques in this chapter apply equally to NURBS surfaces. If Flat Shade All is checked through a workspace view menu, a NURBS primitive sphere appears nearly identical to its polygon counterpart. Calculations involving diffuse reflections utilize Lambert’s Cosine Law. The law states that the observed radiant intensity of a surface is directly proportional to the cosine of the angle between the viewer’s line of sight and the surface normal. As a result, the radiant intensity of the surface, which is perceived as surface brightness, does not change with the viewing angle. Hence, a Lambertian surface is perfectly matte and does not generate highlights or specular hot spots. Physically, a real-world Lambertian surface has myriad surface imperfections that scatter reflected light in a random pattern. Paper and cardboard are examples of Lambertian surfaces. The law was developed by Johann Heinrich Lambert (1728–77), who also served as the inspi- ration for the Lambert material’s name. The term diffuse refers to that which is widely spread and not concentrated. Hence, the Diffuse attribute of the Lambert material represents the degree to which light rays are reflected in all directions. A high Diffuse value produces a bright sur- face. A low Diffuse value causes light rays to be absorbed and thereby makes the sur- face dark. The Ambient Color attribute represents diffuse reflections arriving from all other surfaces in a scene. To simplify the rendering process, the diffuse reflections are assumed to be arriving from all points in the scene with equal intensities. In practical terms, Ambient Color is the color of a surface when it receives no light. A high Ambi- ent Color value will cause the object to wash out and appear flat. The Incandescence attribute, on the other hand, creates the illusion that the assigned surface is emitting light. The color of the Incandescence attribute is added to the Color attribute, thus making the material appear brighter. 92730c04.indd 105 6/18/08 11:33:13 PM 106 c h a p t e r 4: APPLYING THE CORRECT MATERIAL AND 2D TEXTURE ■ Note: You can use the Ambient Color and Incandescence attributes as irradiant light sources when rendering with Final Gather. For more information, see Chapter 12. The Translucence attribute simulates the diffuse penetration of light into a solid surface. In the real world, you can see this effect when holding a flashlight to the back of your hand. Translucence naturally occurs with hair, fur, wax, paper, leaves, and human flesh. Advanced renderers, such as mental ray, are able to simulate translucence through subsurface scattering (see Chapter 12 for an example). Maya’s Translucence attribute, however, is a simplified system. The higher the attribute value, the more the scene’s light penetrates the surface (see Figure 4.2). Translucence = 0.5 Translucence Depth = 0.5 Translucence Focus = 0.5 Translucence = 1 Translucence Depth = 0.1 Translucence Focus = 0 Translucence = 0.8 Translucence Depth = 10 Translucence Focus = 0.95 Figure 4.2 Dierent combinations of Translucence, Translucence Depth, and Translucence Focus attributes on a primitive lit from behind. This scene is included on the CD as translucence.ma. A Translucence value of 1 allows 100 percent of the light to pass through the surface. A value of 0 turns the translucent effect off. Translucence Depth sets the vir- tual distance into the object to which the light is able to penetrate. The attribute is measured in world units and may be raised above 5. Translucence Focus controls the scattering of light through the surface. A value of 0 makes the scatter of light random and diffuse. High values focus the light into a point. Shading with Phong The Phong shading model uses diffuse and ambient components but also generates a specular highlight based on an arbitrary shininess. In general, specularity is the con- sistent reflection of light in one direction that creates a “hot spot” on a surface. With the Phong model, the position and intensity of a specular highlight is determined by reading the angle between the reflection vector and the view vector (see Figure 4.3). A vector, in this situation, is a line segment that runs between two points in 3D Car- tesian space that represents direction. (For a deeper discussion of vectors and vector math, see Chapter 8.) 92730c04.indd 106 6/18/08 11:33:16 PM 107 ■ REVIEWING SHADING MODELS AND MATERIALS Light Surface normal View vector (points to center of camera) Figure 4.3 A simplied representation of a specular shading model If the angle between the light vector and the surface normal is 60 degrees, the angle between the reflection vector and the surface normal is also 60 degrees. In this way, the reflection vector is a mirrored version of the light vector. If the angle between the reflection vector and view vector is large, the intensity of the specular highlight is either low or zero. If the angle between the reflection vector and view vector is small, the intensity of the specular highlight is high. The speed with which the specular high- light transitions from high intensity to no intensity is controlled by the Cosine Power attribute. The higher the Cosine Power value, the more rapid the falloff, and the smaller and “tighter” the highlight. Both Gouraud and Phong shading models produce specular highlights. How- ever, Phong produces a higher degree of accuracy, particularly with low-resolution geometry. As with the Gouraud technique, Phong reads vertex normals. Phong goes one step further, however, by interpolating new surface normals across the scan line. The angle between a surface normal at the point to be rendered (c) and the light vector determines the intensity of that point (see Figure 4.4). Interpolated surface normals Vertex normal 2 Light Vertex normal 3 Scan line Vertex normal 1 c Figure 4.4 A simplied representation of the Phong shading model 92730c04.indd 107 6/18/08 11:33:21 PM 108 c h a p t e r 4: APPLYING THE CORRECT MATERIAL AND 2D TEXTURE ■ Ultimately, 3D specular highlights are an artificial construct. Real-world specu- lar highlights are reflections of intense light sources (see Figure 4.5). Figure 4.5 (Top left) A classic specular highlight appears on an eye. (Top right) A closer look at the eye reveals that the specular highlight is the reection of the photographer’s light umbrella. (Bottom left) A glass oat with a large specular highlight. (Bottom middle) With the exposure adjusted, the oat’s specular highlight is revealed to be the reection of a window. (Bottom right) The window that creates the reection. Shading with Blinn The Blinn shading model borrows the specular shading component from the Phong model but treats the specular calculations in a more mathematically efficient way. Instead of determining the angle between the reflection vector and view vector, Blinn determines the angle between the view vector and a vector halfway between the light vector and view vector. This frees the specular calculation from specific surface curva- ture. In practical terms, you can make the Maya Phong and Blinn materials produce nearly identical highlights (see Figure 4.6). Maya’s Blinn material uses the Eccentricity attribute to control specular size and the Specular Roll Off attribute to control specu- lar intensity. When it comes to the position of the specular highlight, both Phong and Blinn re-create Fresnel reflections, whereby the amount of light reflected from a surface depends on the angle of view (which is the opposite of diffuse reflections). That is, when the view changes, the highlight appears at a different point on the surface (see Figure 4.7). 92730c04.indd 108 6/18/08 11:33:24 PM [...]... a bump map and is adjusted to emulate wind-blown sand chapter 4 :   A p p ly i n g t h e C o r r e c t M at e r i a l a n d 2 D T e x t u r e   ■ 118 The regularity, or irregularity, of the cloth pattern is controlled by ten attributes Gap Color, U Color, and V Color set the color of the virtual threads U Width and V Width determine the width of the threads in the U and V direction U Wave and V Wave... wave-like distortion into the cloth pattern Randomness harshly distorts the pattern in the U and V directions Width Spread randomly changes the thread widths Bright Spread randomly darkens of lightens the thread colors Figure 4.19 ​(Left) Wind-blown sand forms patterns on a dune (Right) A 3D facsimile utilizing the Water texture This scene is included on the CD as water_sand.ma Critical attributes of the Water... designed for Maya s Ocean System The Fluid Texture 2D texture uses Maya s fluid dynamic simulation For more information, refer to the “Fluid Effects” Maya help file Applying Perlin Noise Perlin noise was invented by Ken Perlin in the early 1980s as a means of generating random patterns from random numbers You can use Perlin-based 2D textures to break up surface regularity For example, you can map the Maya. .. Gaussian, and Box Off turns off the filtering process and removes the Filter and Filter Offset attributes Although this will speed up the render, moiré and stair-stepping artifacts will most likely appear Mipmap applies the mipmapping process In this case, Maya stores averaged color values for multiple sizes of each texture The sizes linearly decrease (for example, 512 × 512, 256 × 256, 128 × 128, and so... Materials and Textures” later in this chapter Maya s Fractal texture is a more complex variation of classic 2D Perlin noise in which turbulence (the averaging of multiple scales) is added for detail The majority of attributes are identical to the Noise texture The attribute list for both the Noise and Fractal texture is quite long but will be detailed in Chapter 5 Maya s Mountain texture, on the other hand,... size for the CD’s center hole Select both circles, switch to the Surfaces menu set, and choose Surfaces > Loft 3 Select the new surface and assign it to a new Anisotropic material Open the material’s Attribute Editor tab Set Spread X to 100, Spread Y to 1, Roughness to 0.8, and Fresnel Index to 9.5 4 Create a point light and place it above the surface Render a test At this point, the specular highlight... suited for custom cartoon materials in which shadowing and highlights are provided by a custom network and not by actual lights For a cartoon material example, see Chapter 7 Shadowing surface Blinn Surface Shader Figure 4.14 ​A plane assigned to a Blinn material picks up shadows and highlights, whereas a plane is assigned to a Surface Shader material and ignores all lighting information This scene is included... separately without any worry of which object is in the front and which is in the back Note:  ​You can isolate shadows with Maya s Render Layer Editor For a detailed description of the editor, see Chapter 13 Note:  ​Three materials—Hair Tube Shader, Ocean Shader, and Ramp Shader—are not discussed in this chapter The Hair Tube Shader is designed for the Maya Hair System, which is covered briefly in Chapter...Blinn Phong Blinn Phong Figure 4.6 ​Small and large specular highlights on Blinn and Phong materials This scene is included on the CD as blinn_ phong.ma Figure 4.7 ​Specular highlights appear at different points on the medallion as the view changes Note:  ​Although Maya s Blinn and Phong materials are able to change the location of the specular highlight as the... cylinder Phong E plane Figure 4.8 ​Blinn, Phong, and Phong E materials assigned to primitive spheres, cylinders, and planes This scene is included on the CD as blinn_phong_cylinders.ma When comparing the material’s highlights to photographs of real-world equivalents, it’s apparent that the Blinn, Phong, and Phong E models are fairly realistic (see Figure 4.9) Phong and Phong E materials do have a slight advantage . Figure 3.29 uses three strokes and employs the following brushes: largeFlames and flameMed. 11. Paint Effects fire is preanimated and will automatically change scale and shape in a convincing manner the Maya Hypershade and Multilister windows, a shading model is referred to as a material and is represented by a cylindrical or spherical icon. Ultimately, you can use the words shader and. Incandescence, Bump Mapping, Diffuse, Translucence, Translucence Depth, and Translucence Focus. In Maya, the Lambert node is considered a “parent” node. That is, Phong, Phong E, Blinn, and

Ngày đăng: 02/07/2014, 05:20

TỪ KHÓA LIÊN QUAN