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

Advanced Maya Texturing and Lighting- P8 pdf

30 353 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,17 MB

Nội dung

189 ■ SHIFTING COLORS outAlpha outColor color inputValue outColor color[1].color_Color outColor color[0].color_Color Figure 6.23 Two textures are blended together with a Remap Value utility. This scene is included on the CD as remap_value.ma. Smearing Colors The Smear utility allows one texture to be distorted by another. If Smear is combined with a Ramp texture, it creates a stylized vision effect that might be appropriate for an alien, a monster, or a robot. For example, in Figure 6.24 a sequence of video images is loaded into a File texture. The Use Image Sequence attribute is checked so that the images are automatically loaded as the Timeline moves forward. The outColor of the file node is connected to the inRgb of a smear node. The outU of the smear node is connected to the offsetU of the place2dTexture node of a ramp texture node. The outV of the smear node is also connected to the offsetV of the place2dTexture node of the ramp node. The outColor of the ramp node is finally connected to the outColor of a surfaceShader material node, which is assigned to a primitive plane. The ramp has three handles: one red and two orange. The higher the values are in the video image bitmaps, the farther the smear node “pulls” the ramp down in the V direction. For instance, if a bitmap provides a pixel with RGB values 0.5, 0.5, 0.5, the ramp is pulled downward so that the top rests at the center of the ramp field. If a bitmap provides a pixel with RGB values 0.9, 0.9, 0.9, the ramp is pulled downward so that the top rests 92730c06.indd 189 6/18/08 11:41:07 PM 190 c h a p t e r 6: CREATING CUSTOM CONNECTIONS AND APPLYING COLOR UTILITIES ■ one tenth above the bottom of the ramp field. When the ramp is called upon by the surfaceShader material, every pixel of the ramp is offset in the V direction by a unique amount. Hence, the ramp appears as a colored version of the video bitmap. outColor inRgb outU outV outUV uvCoord outUvFliterSize uvFilterSize outColor outColor Figure 6.24 An image sequence and a Ramp texture are combined with the Smear utility. This scene is included on the CD as smear.ma. A QuickTime movie is included as smear.mov. Internally, the Smear utility converts the input RGB to HSV. New UV coordi- nates are generated by plotting values on an HSV color wheel. For another example of the Smear utility, see the tutorial at the end of this chapter. Correcting Gamma Gamma correction is the adjustment of an image to compensate for the physical limi- tations of a computer monitor. With a monitor, the intensity (brightness) of a screen pixel does not linearly increase with the application of additional voltage. Because of this, uncorrected images may appear inappropriately dark or washed-out. Gamma correction solves this by applying a complementary intensity curve to the image to negate the monitor’s intensity curve. Different operating systems apply gamma cor- rection in different ways, whether through hardware or software controls. Microsoft- based systems generally operate with a gamma value set to 2.2, whereas Macintosh 92730c06.indd 190 6/18/08 11:41:12 PM 191 ■ SHIFTING COLORS systems operate with a gamma value set to of 1.8. Some programs, like Adobe Photo- shop, allow you to apply different gamma values to the system on the fly. Gamma correction is applied to the image with the following standard formula: new pixel value = image pixel value ^ (1.0 / gamma value) Thus, if an image pixel has a value of 0.5, 0.5, 0.5 and the gamma value is set to 2.2, the new pixel value, which is sent to the screen, is roughly 0.73, 0.73, 0.73. Maya’s Gamma Correct utility also applies the standard gamma formula: outValue = value ^ (1.0 / Gamma) In this case, the Gamma Correct utility adjusts the values of the value input and outputs the result through outValue. No other node is affected. As a rule of thumb, the higher the Gamma attribute values are, the more washed out the mid-range values become. High- and low-range values (white whites and black blacks) are affected to a lesser degree. An interesting side effect of the Gamma Correct utility is the increase or decrease of saturation. For example, in Figure 6.25 face.tif is loaded into a File texture. The outColor of the file node is connected to the value of a gammaCorrect node. As a test, the outValue of the gammaCorrect node is connected to the inputs[0].color of a lay- eredTexture node. The Gamma attribute of the gammaCorrect node is set to 0.5, 0.5, 0.5. As a result, the washed-out bitmap gains a good deal of saturation. Raising the Gamma above 1 would have the opposite effect—less saturation. outColor value outValue inputs[0].color Figure 6.25 A washed-out face bitmap is given extra saturation with a Gamma Correct utility. This shading network is included on the CD as gamma_correct.ma. To view the custom shading network, follow these steps: 1. Open the gamma_correct.ma file from the CD. Open the Hypershade window. 2. Switch to the Utilities tab. MMB-drag the gammaCorrect node into the work area. 3. With the gammaCorrect node selected, click the Input And Output Connec- tions button. The network becomes visible. Note: Many Maya utilities feature vector attributes that are represented by three number fields (for example, Gamma). These fields are read left to right when representing color (red, green, blue) or position (X, Y, Z). When one of these fields is used in a custom shading network, the connection is made to a single channel of the attribute (for example, gammaX). 92730c06.indd 191 6/18/08 11:41:16 PM 192 c h a p t e r 6: CREATING CUSTOM CONNECTIONS AND APPLYING COLOR UTILITIES ■ Adjusting Contrast The Contrast utility does exactly what its name implies. The higher the Contrast attribute value of the Contrast utility, the whiter the whites and the blacker the blacks become. The lower the Contrast attribute value, the more the colors converge toward each other. The Bias attribute determines the RGB values that the colors converge to. For example, in Figure 6.26 face_2.tif is loaded into a File texture. The outColor of the file node is connected to the value of a contrast node. As a test, the outValue of the contrast node is connected to the inputs[0].color of a layeredTexture node. The Con- trast attribute of the contrast node is set to 4, 4, 4. The Bias attribute is set to 0.4, 0.4, 0.4. The resulting image has extremely white whites and black blacks and few colors in the mid-ranges. outColor value outValue inputs[0].color Figure 6.26 A washed-out face bitmap is given a great deal of contrast with the Contrast utility. This shading network is included on the CD as contrast.ma. A Contrast value of 1 and a Bias value of 0.5 leaves the texture unchanged. Lowering the Contrast value reduces the contrast. Raising the Bias value darkens the texture overall. A Note on Sliders and Super-White In Maya, many sliders that include number fields can readjust themselves. For instance, a Diffuse attribute slider normally runs from 0 to 1. However, if you enter 2 into the field, the slider automatically readjusts itself to run between 0 and 4. For the Diffuse attribute, higher values result in a predictably brighter surface. Other sliders, when pushed past their default range, will not display a perceptible change. Any Maya color channel can exceed the standard bounds of 0 to 1. Although it’s not possible to do this directly through the Attribute Editor, you can enter extra-high values into the fields of the Color Chooser window. To do so, follow these steps: 1. In the Attribute Editor tab, click the color swatch of an attribute. The Color Choose window opens. 2. Choose either RGB or HSV from the color space drop-down menu. If you choose RGB, enter a value into the Red, Green, or Blue field. There is no practi- cal limit to the size of the number you enter. If you choose HSV, enter a value into the Hue, Saturation, or Value field. Although Hue and Saturation accept large numbers, the Value field is generally the most useful for custom values. 3. Click the Accept button to close the window. 92730c06.indd 192 6/18/08 11:41:18 PM 193 ■ SHIFTING COLORS In addition, you can create extra-high values, either intentionally or uninten- tionally, through custom connections. As a demonstration, the Line Color and Filler Color attributes of a grid texture node are set to 0.5, 0.5, 0.5 in RGB, creating a solid gray (see Figure 6.27). The outColor of the grid node is connected to the input1 of a multiplyDivide node (see Chapter 8 for a description). The output of the first multiply- Divide node is connected to the input1 of a second multiplyDivide node. The output of the second multiplyDivide node is connected to a blinn material node. The Input2 attribute of the first multiplyDivide node is set to 4, 4, 4. The end result, as seen in the second multiplyDivide node, is an RGB color with values of 2, 2, 2. These inappro- priately high values are often referred to as super-white. From a practical standpoint, Maya simply clamps any color over 1.0 to 1.0 when rendering standard images. Even though the RGB is 2, 2, 2, it’s rendered as if it’s 1, 1, 1 (as seen on the blinn icon). Nevertheless, the super-white values can cause problems with custom connections if they are not taken into account. Fortunately, the Clamp utility can solve this problem (see the next section). Super-white values outColor input1 output input1 output color Figure 6.27 A shading network designed to test super-white values. This network is included on the CD as superwhite.ma. To view the custom shading network, follow these steps: 1. Open the superwhite.ma file from the CD. Open the Hypershade window. 2. Switch to the Utilities tab. MMB-drag the multiplyDivide1 node into the work area. 3. With the multiplyDivide1node selected, click the Input And Output Connec- tions button. The network becomes visible. Note: Maya supports high-dynamic range (HDR) image formats, which are able to store super- white values. See Chapter 13 for details. 92730c06.indd 193 6/18/08 11:41:22 PM 194 c h a p t e r 6: CREATING CUSTOM CONNECTIONS AND APPLYING COLOR UTILITIES ■ Note: The term super-white was coined to describe the disparity between the standard defini- tion of video white (100 IRE units in YUV color space) and the RGB color space used by Maya and other digital-imaging programs. Basically, Maya creates whites that are 9 percent above the color range that a television can actually display. For more details on color space and monitor calibration, see Chapter 1. For a discussion of 8-bit versus 16-bit rendering, see Chapter 10. Clamping Values The Clamp utility is designed to keep a value within a particular range. If a value is too low or too high, it “clamps” it. As an example, Table 6.2 shows what happens to inputR values if MinR is set to 0.3 and MaxR is set to 1.0. Table 6.2 Clamped Output Values Resulting from Different Input Values inputR 0 0.2 0.8 1.1 4.5 9.0 outputR 0.3 0.3 0.8 1.0 1.0 1.0 In this example, if the inputR value is less than 0.3, the outputR value is 0.3. If inputR is greater than 1.0, outputR is 1.0. If inputR is between 0.3 and 1.0, out- putR is the same value. The Clamp utility has three inputs and three output channels (inputR, inputG, inputB, outputR, outputG, and outputB); you can connect single attributes to any of these. Otherwise, you can connect vector attributes directly to Input or Output. In a similar fashion, Min and Max, which set the clamp range, are vector attributes that carry three channels each (minR, minG, minB, maxR, maxG, and maxB). You can enter negative or positive values into the Min and Max fields. Note: For an example of the Clamp utility used to drive a character bicep, see Section 6.1 of the Additional_Techniques.pdf file on the CD. For an example of the Clamp utility used to create disco ball glitter, see Chapter 7. Reading Surface Luminance During a render, the Surface Luminance utility automatically reads the luminance of every single rendered point on the surface assigned to a material that is part of the same shading network. That is, the utility can determine the total amount of light a point on a polygon face receives and outputs a value from 0 to 1 that represents this. As an example, in Figure 6.28, a custom crosshatch material is applied to a medallion model. The crosshatch pattern is generated by a Ramp texture and a Sur- face Luminance utility. The outValue of a surfaceLuminance node is connected to the colorEntryList[0]. position of a ramp texture node. The colorEntryList[n].position attribute controls the vertical position of a color handle in a ramp texture. In this case, the surfaceLuminance 92730c06.indd 194 6/18/08 11:41:24 PM 195 ■ SHIFTING COLORS node drives the black color handle up and down the ramp based on how much light a surface point receives. If a surface point receives the maximum amount of light, the outValue of the surfaceLuminance node is 1, which forces the black handle up to the top of the ramp (leaving the entire ramp field white). If a surface point receives a little light, the outValue is a lower value, which allows the black handle to stay low, thus creating a mix of black and white within the ramp color field. outValue colorEntryList[0].position outColor outColor outUV uvCoord outUvFilterSize uvFilterSize Figure 6.28 A crosshatch material is created with a standard Ramp texture and a Surface Luminance utility. This material is included on the CD as crosshatch.ma. A QuickTime movie is included as crosshatch.mov. The ramp’s Type attribute is set to UV Ramp; this allows the pattern to repeat on the surface vertically and horizontally. The ramp’s Interpolation attribute is set to None, giving the rendered lines a hard edge. The ramp’s Noise attribute is set to 0.1 and Noise Freq is set to 0.05 in order to give the lines some squiggle. The ramp node has a standard place2dTexture node with a Repeat UV set to 25, 25. Higher repeat values will produce finer lines. The place2dTexture node also has its Rotate Frame set to 45 in order to angle the pattern. Last, the outColor of the ramp node is connected to the outColor of a surfaceShader material node, which is assigned to the medallion. 92730c06.indd 195 6/18/08 11:41:28 PM 196 c h a p t e r 6: CREATING CUSTOM CONNECTIONS AND APPLYING COLOR UTILITIES ■ Note: For an additional application of the Surface Luminance utility, see Section 6.2 of the Additional_Techniques.pdf file on the CD. In Section 6.2, a stylized metal is created with super-white values. Chapter Tutorial: Creating a Custom Paint Material In this tutorial, you will create a custom material that transforms a photo into a styl- ized painting (see Figure 6.29). You will use the Smear, Remap Hsv, and Contrast utilities. Figure 6.29 (Left) A digital photo. (Right) The same photo after the application of a custom paint material. 1. Create a new Maya scene. Open the Hypershade window. 2. MMB-drag a new Layered Texture utility (located in the Other Textures sec- tion of the Create Maya Nodes menu) into the work area. 3. MMB-drag two Remap Hsv utilities (located in the Color Utilities section of the Create Maya Nodes menu). Place them to the left on the layeredTexture node. Use Figure 6.30 as a reference. Rename the top remapHsv node remapHsvA. Rename the bottom remapHsv node remapHsvB. 4. Connect the outColor of remapHsvA to inputs[1].color of the layeredTexture node. (For a review of how to create custom connections, refer to the beginning of this chapter.) 5. Connect the outColor of the remapHsvB to inputs[0].color of the layered- Texture node. 92730c06.indd 196 6/18/08 11:41:31 PM 197 ■ CHAPTER TUTORIAL: CREATING A CUSTOM PAINT MATERIAL place2dTextureA place2dTextureC fractal smear place2dTextureB FileB remapHsvB bump2d FileA remapHsvA layeredTexturecontrast Figure 6.30 The shading network of the custom paint material 6. Select remapHsvA and open its Attribute Editor tab. Click the Color check- ered Map button and select a File texture from the Create Render Node win- dow. A place2dTexture node is automatically created along with a file texture node. Rename this place2dTexture node place2dTextureA. Rename the file node FileA. 7. Select remapHsvB and open its Attribute Editor tab. Click the Color checkered Map button and select a File texture from the Create Render Node window. A second place2dTexture is automatically created along with a second file texture node. Rename the new place2dTexture node place2dTextureB. Rename the new file node FileB. 8. Select FileA and open its Attribute Editor tab. Click the File Browse button beside Image Name and choose greyhound.tif from the Chapter 6 textures folder on the CD. 9. Select FileB and open its Attribute Editor tab. Click the File Browse button beside Image Name and choose greyhound.tif from the Chapter 6 textures folder on the CD. 10. MMB-drag a Smear utility (located in the Color Utilities section of the Create Maya Nodes menu) into the work area. Place it to the left of place2dTextureB. 11. Connect the outU of the smear node to the offsetU of place2dTextureB. Con- nect the outV of the smear node to the offsetV of place2dTextureB. 12. Select the smear node and open its Attribute Editor tab. Click the In Rgb check- ered Map button and choose a Fractal texture from the Create Render Node window. A new place2dTexture node is automatically created. Name this latest place2dTexture node place2dTextureC. 13. Select the fractal node and open its Attribute Editor tab. Change the Amplitude attribute to 0.7 and the Threshold attribute to 0.2. This will wash out the 92730c06.indd 197 6/18/08 11:41:36 PM 198 c h a p t e r 6: CREATING CUSTOM CONNECTIONS AND APPLYING COLOR UTILITIES ■ fractal pattern and reduce the contrast. If the fractal node is left with default values, the distortion created by the smear node will be extremely intense and the greyhound bitmap will no longer be recognizable. Move the Color Gain attribute slider (located in the Color Balance section) until it’s barely above black. This will also reduce the intensity of the distortion. Try different posi- tions on the Color Gain slider. Small changes will produce greatly different results. 14. Select place2dTextureC and open its Attribute Editor tab. Change the Repeat UV attribute to 0.6, 0.6. When the Repeat UV value is reduced, the blobs with the Fractal become larger; this, in turn, creates larger waves in the smear node’s distortion. Try different Repeat UV values to see different variations of the effect. 15. Select remapHsvA and open its Attribute Editor tab. Change the Hue, Satu- ration, and Value gradients to roughly match the left side of Figure 6.31. To move points on a gradient, select the little circles and LMB-drag. To insert new points, click inside the dark gray area of each gradient. To delete a point, click the × box below it. These adjustments are shifting the hue, saturation, and value of the undistorted greyhound bitmap. Figure 6.31 (Left) The gradients of the remapHsvA node. (Right) The gradients of the remapHsvB node. 16. Select remapHsvB and open its Attribute Editor tab. Change the Hue, Satura- tion, and Value gradients to roughly match the right side of Figure 6.31. These adjustments are shifting the hue, saturation, and value of the distorted grey- hound bitmap. 17. Select the layeredTexture node and open its Attribute Editor tab. Click the leftmost purple box. This displays the options for remapHsvB. Change the Alpha attribute to 0.5. This allows a 50-50 mix between the remapHsvA and remapHsvB nodes. (The Blend Mode attribute should be set to Over.) 92730c06.indd 198 6/18/08 11:41:38 PM [...]... nodes, DAG objects, and instanced attributes is worth a closer look ■  E m p l oy i n g S a m p l e r s Note:   For an example of the Sampler Info utility used to create simulated iridescence, see section 7.1 of the Additional_Techniques .pdf file on the CD 207 A Transform and Shape Node Refresher In Maya, cameras, lights, and surfaces are represented by two nodes: a transform node and a shape node For... Mercator-style maps, Greenland is unnaturally large.) For more information on surface parameterization, see Chapter 9 Raster space is a coordinate system used to calculate individual pixel locations on a screen In addition, the mental ray renderer uses internal space, which relates surface points and vectors to mental ray shaders Object, world, and camera spaces within Maya are based on a “right-handed” Cartesian... reflection and the doors and fenders receive the least Additional handles are inserted into the Value gradient in order to increase the rapidity of the reflection falloff The handles are all set to Spline in order that the gradient take on a smooth shape In this case, the Color gradient of the remapValue node is not used 6/19/08 12:09:39 AM at all The shading network works equally well with the Maya Software... space, but uses the axes and origin of a parent node This is feasible due to Maya s DAG node system (See the section “A Transform and Shape Node Refresher” later in this chapter.) To determine the color of a particular pixel when rendering a surface assigned to a material that uses a texture map, the renderer compares the parametric spaces of both the texture and the surface Texture and surface parametric... materials Cloud and Tube particles derive shading information from the default particleCloud1 material (see the next section) Cloud and Tube particles cannot be assigned to any other standard material However, you can assign the particles to a new Particle Cloud or Volume Fog material (found in the Volumetric section of the Create Maya Nodes menu) 92730c07.indd 213 6/19/08 12:10:38 AM Texturing Particles... particles that have a chaotic or random motion (although the texture will be more difficult to recognize and will ultimately repeat) In addition, this technique works when the Blobby Surface particle Threshold value is raised and the particles begin to stick together The Particle Sampler utility can also command various per-particle attributes For a discussion of this feature and the Array Mapper utility,... bottom of the camera and parented to the camera itself As the camera is rotated, the colors of the symbols change in correspondence to the direction the camera points (If the colors are not visible with Hardware Texturing checked on, you will have to render out a test frame.) As with the axis display found in Maya s workspace views, red corresponds to X, green corresponds to Y, and blue corresponds... value is returned and the right side of the gradient is sampled If the angle between the two is large, a small value is returned and the left side of the gradient is sampled On a technical level, the surface normal vector and the light direction vector are put through a dot product calculation, producing the cosine of the angle between the two vectors For a deeper discussion on vectors and vector math,... transform node that carries all the light’s transform information (Translate, Rotate, Scale), and spotLightShape is a shape node that possesses all the nontransform light attributes (Intensity, Cone Angle, and so on) As for geometry, nurbsSphere is the transform node, and nurbsSphereShape is the shape node Transform and shape nodes are also known as DAG objects DAG (Directed Acyclic Graph) is a hierarchical... is placed wherever the incandescent white specks appear The Hide Source attribute of the OuterBlinn is checked on; therefore, the glow and not the surface of OuterBlinn is rendered The final result is a disco ball that produces small, intense bits of “reflected” light on the part that faces the camera Using the Light Info Utility The Light Info utility retrieves directional and positional information . objects, and instanced attributes is worth a closer look. A Transform and Shape Node Refresher In Maya, cameras, lights, and surfaces are represented by two nodes: a transform node and a shape. internal space, which relates surface points and vectors to mental ray shaders. Object, world, and camera spaces within Maya are based on a “right-handed” Cartesian space. Using the Sampler Info. most reflection and the doors and fenders receive the least. Addi- tional handles are inserted into the Value gradient in order to increase the rapidity of the reflection falloff. The handles are

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

TỪ KHÓA LIÊN QUAN