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

BuMP and norMal MaPPIng

105 635 0
Tài liệu đã được kiểm tra trùng lặp

Đ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 105
Dung lượng 3,1 MB

Nội dung

BuMP and norMal MaPPIng

BuMP and norMal MaPPIng | 601There are two types of normal maps, object space and tangent space:Object space maps These are used for nondeforming objects, such as walls, spaceships, trash cans, and the like. They are calculated based on the local object space of the object. Up in object space means toward the top of the object. If the object is rotated upside down in world space, the top is still the top—so a robot’s head is still the top of the object in object space even if it’s hanging upside down.Tangent space maps These are used for deforming objects, such as characters. Tangent space maps record the normal’s vector relative to the object’s surface. In tangent space, up means up away from the surface of the object. Tangent space maps appear more blue and purple since the direction in which the normal is being bent is always relative to the surface along the tangent space z-axis. The z-axis corresponds with the blue channel (XYZ = RGB). Object space maps, on the other hand, have more variation in color.In practice, most artists use tangent space maps for everything. In fact, prior to Maya 2008, tangent space maps were the only type of normal maps that Maya supported. Tangent space maps actually work well for both deforming and nondeforming objects.The most common way to create a normal map is to use a high-resolution, detailed version of the model as the source of the normal map and a low-resolution version of the model as the target for the map. The difference between the two surfaces is recorded in the colors of the map, which is then used to alter the appearance of the low-resolution model. This is a typical process when creating models for games where low-resolution models are required by the real-time ren-dering engine but the audience demands realistically detailed objects.Creating Normal MapsIn this exercise, you’ll create a normal map for the giraffe. A high-resolution version of the model will be used as the source of the map. To create a normal map in Maya, you’ll use the Transfer Maps tool. This tool can be used to create a number of different texture map types, including normal maps. 1. Open the giraffeTransferMaps_v01.ma file from the chapter11\scenes folder of the DVD. 2. In the Display Layer panel, you’ll see two layers: one labeled LORES, the other HIRES. Turn off the LORES layer, and turn on the HIRES layer. You’ll see a higher- resolution detailed version of the giraffe, as shown in Figure 11.35. 3. Turn off the HIRES layer. The geometry does not need to be visible in order to extract maps, so if the high-resolution geometry is slowing down your computer, you can hide it. 4. Right-click the LORES layer, and choose Select Objects. 5. Under the Rendering menu set, choose Lighting/Shading  Transfer Maps to open the Transfer Maps interface (see Figure 11.36). 6. Expand the Target Meshes rollout. The loresGiraffe object is listed since it was selected when you opened the interface. If it does not appear, select it and click the Add Selected button. No other objects should be listed; if they are, select them in the list, and click the Remove Selected button. 602 | CHAPTER 11 texture MaPPIngFigure 11.35 The high-resolution giraffeFigure 11.36 The Transfer Maps interface BuMP and norMal MaPPIng | 603 7. Expand the Source Meshes rollout, right-click the HIRES layer, and choose Select Objects. 8. Click the Add Selected button to add it to the list. 9. Expand the Output Maps section; you’ll see icons representing all the different types of maps that can be created. 10. Click the Normal button to add normal map to the list. If other types of maps are listed, click the Remove Map button in the section for the map you want to remove. 11. Click the folder next to the Normal Map field, and set the location and filename for the location of the map that will be created. 12. Choose the sourceimages directory of the current project, and name the file giraffeHead_Nrml.There are a number of file format options to choose from. The two best choices are Maya IFF and EXR. Both are 32-bit formats that will ensure a detailed smooth map. 13. Choose EXR; this way you can open the map in Photoshop (CS1 and higher) for viewing if you need to. If the file format in the name of the file is something other than .exr, it will be automatically updated.Open EXR Loader Plug-inWhen using the EXR format in Maya, you’ll need to make sure the OpenEXRLoader plug-in is currently loaded; otherwise, you’ll get an error when you try to connect the file to a shader. Choose Window  Settings And Plug-ins  Plug-in Manager. In the list of plug-ins, make sure OpenEXRLoader.mll is currently selected. 14. The Include Materials check box is extremely useful if you want to include a bump map as part of the normal map. For now, deselect it since there is no bump map applied to the high-resolution mesh material. However, make a note of this option—you can add more detail to your normal map, such as pores and fine wrinkles, by applying a bump texture to the shader for the high-resolu-tion mesh object and then activating this option when using the Transfer Maps tool. Baking Bump MapsWhen baking a bump map into the normal map using the Include Materials option, the Bump Depth setting on the shader of the source mesh will determine the intensity of the bump as it’s baked into the normal map. If you need to change this later, you’ll need to adjust Bump Depth on the source mesh and rebake the normal map. 15. Set Map Space to Tangent Space. You should always use tangent space maps for charac-ters. Actually, as stated before, you can use them for any type of object. 604 | CHAPTER 11 texture MaPPIng 16. The Use Maya Common Settings check box makes the tool use the settings specified in the Maya Common Output. If this is deselected, sliders will appear that will allow you to set the size of the map in this section. For now, keep this box selected. 17. In the Connect Output Maps settings, you can connect the map to a shader automatically. Deselect the Connect Maps To Shader option for now. Later you’ll learn how to make the connection manually. Once you understand how the connection is made, you can use the Connect Maps To Shader option in the future to make things more convenient. 18. In the Maya Common Output settings, enter the following: a. Set the size of the map to 2048 in width and height. b. Set Transfer In to Object Space, and set Sampling Quality to High. c. Set Filter Size to 3. d. Set Filter Type to Gaussian.Leave Fill Texture Seams at 1 and the remaining three check boxes (Ignore Mirrored Faces, Flip U, and Flip V) deselected. Select Bake and Close to complete the tool. The settings are shown in Figure 11.37.Sometimes maps do not transfer properly. Errors usually look like solid pools of color. Often this is caused by the geometry not matching properly. To fix this, you can adjust the search enve-lope Maya uses to extract the differences between the models. The search envelope specifies the volume of space that Maya uses to search when creating the transfer map. Maya compares the target geometry (the low-resolution map) with the source geometry (the high-resolution map) and records the difference between the two as color values in the normal map. The search enve-lope sets the limits of the distance Maya will search when creating the map. The envelope itself is a duplicate of the target geometry that’s offset from the original. The offset distance is specified Figure 11.37 The transfer map’s options BuMP and norMal MaPPIng | 605by the Search Envelope slider in the Target Meshes section of the Transfer Maps tool. What’s more, you can edit the Target Mesh geometry itself to improve the results of the final map.Use Low-Quality Settings When TestingNormal maps can take a while to calculate, so it’s a good idea to create a few test maps at lower quality and then raise the quality settings once you’re happy that the map is free of errors.You can bake out the rest of the UV shells by selecting each group and swapping their place-ment into the 0 to 1 texture space. Each group of shells is centered so you can snap the group to 0.5 and 0.5. Extending the grid helps keep things situated (see Figure 11.38).Some third-party applications like Mudbox read outside the 0 to 1 texture space and can transfer all the maps in one operation, instead of having to move the UV shell groups.When the maps are finished, you can close the scene without saving, since no adjustments were made. The next exercise takes you through the process of applying the normal maps.The Transfer In option has three choices: World Space, Object Space, and UV Space. These specify how the map will be calculated and transferred from the high-resolution version to the low-resolution version. If the models were different sizes, then the World Space option would be appropriate, and the models would need to be directly on top of each other. The objects used in this tutorial are the same size and very similar except for their resolutions and level of detail, so the Object Space option is more appropriate. The UV Space option works best for objects of fairly similar but not exactly the same shape, such as a female human character and a male human character.Figure 11.38 Extend the grid to keep the UV shell groups organized. 606 | CHAPTER 11 texture MaPPIngApplying Normal MapsNormal maps are applied to an object’s shader in the Bump channel, and they can be viewed in the perspective window. In this section, you’ll see how the map looks when it’s applied to the model as well as a few suggestions for fixing problems. 1. Open the giraffeUV_v07.ma file from the chapter11\scenes folder of the DVD. 2. Open the Hypershade window (Window  Rendering Editors  Hypershade). 3. Select the giraffe Head_Mat shader, and open its Attribute Editor. 4. Click the checkered box next to the Bump Mapping channel, and choose a file from the Create Render Node pop-up. 5. When you add the file node, the Attribute Editor will open to the bump2D node. Set the Use As option to Tangent Space Normals. This tells Maya the texture you’re applying is a normal map and not a bump map. You can leave the Bump Depth at 1; it has no effect on the strength of the normal map. 6. Switch to the file1 node, and click the folder next to the Image Name field. 7. Browse your computer’s file directory, and find the giraffeHead_Nrml.exr file; it should be in the sourceimages directory (if you get an error when loading the image, make sure the openEXRLoader plug-in is selected in the preferences).Once the file is loaded, you should see a preview in the texture sample icon. The texture should appear mostly blue and purple. If it is completely flat blue, then there was an error during the creation process—most likely the source mesh was not selected in the Transfer Maps options, so you’ll need to remake the map. 8. In the perspective view, choose High Quality Rendering from the Renderer menu at the top of the panel. After a few seconds, you should see a preview of the normal map in the perspective view. (Make sure you have Texture Shaded activated; press the 6 key to switch to this mode.)The normal map should make the low-resolution model look very similar to the high-resolution model. You can see in the silhouette of the geometry that the blockiness of the profile indicates that geometry is still low resolution, but those areas facing the camera look highly detailed. This workflow is very popular when creating models for games. The models end up looking much more realistic and detailed without taxing the processor of the game console. 9. Apply the rest of the maps in the same manner. Figure 11.39 shows the giraffe with all of its normal maps applied. 10. Inspect the model for errors in the texture. Most likely you’ll find some errors around the lips, ears, and eyes. If large portions of the model look wrong, you’ll need to try creating the map again. Sometimes just editing the geometry of the search envelope can fix the errors when you regenerate the map. Other times you may need to change the actual generation settings such as the Search Method and Max Search Depth values in the Advanced settings. dIsPlaCeMent MaPPIng | 607Normal maps are difficult but not impossible to edit in a 2D paint program such as Photoshop. If the normal map has just a few small glitches, you can open them in Photoshop and paint each color channel (Red, Green, and Blue) separately to clean up the maps. This can be faster than trying to regenerate a whole new map just to fix a tiny spot.For a completed version of the scene, open the giraffeNormalMaps_v01.ma file from the chapter11\scenes folder on the DVD.Displacement MappingDisplacement maps are like bump maps in that they use a grayscale texture to add detail to a model. However, rather than just perturb the normal of the surface, displacement maps actu-ally alter the geometry at render time. Unlike normal and bump maps, the silhouette of the geometry reflects the detail in the map. Displacement maps can be used with NURBS, polygon, and subdivision surfaces and can be rendered in both mental ray and Maya Software. The best results are usually achieved by rendering displacement maps on a polygon surface in mental ray using mental ray’s Approximation Editor to subdivide the surface appropriately during render. Figure 11.39 The low-resolution model with all of its normal maps. 608 | CHAPTER 11 texture MaPPIngViewing DisplacementsDisplacement maps can be viewed only in a software render; they can’t be previewed in the per-spective window.Displacement maps are tricky to use and require some practice to master; however, the results are often worth the time invested. Recent advances in digital sculpting programs such as ZBrush and Mudbox have enabled modelers to bring an unprecedented amount of realism and detail to digital characters. The detail created in these high-density meshes is often brought into Maya in the form of displacement maps (and normal maps as well). In addition to aiding in creating detail on creatures, displacement maps have a wide variety of creative applications and innovations. You can use animated displacements to simulate roll-ing waves on an ocean surface, fissures opening in the earth, or veins crawling beneath the skin. In this section, you will apply displacement maps to the giraffe.Converting Displacement to PolygonsIf you decide you want actual geometry to be created from the displacement, you can convert the displacement to a polygon object. This might be helpful as a stand-in object if you need to position objects in the scene near the displaced plane or if you want to model terrain using a procedural texture. 1. Select the plane, and choose Modify  Convert  Displacement To Polygons. There are no options for this action. A second object will be created based on the original displaced plane. Any animation of the texture will not be reflected in the converted object; it derives its displacement from the current state of the displacing texture. 2. To increase the resolution of the converted object, increase the subdivisions in Height and Width on the original plane. The conversion will take longer to calculate, and the result-ing geometry will be denser.Displacement Maps for CharactersUsing displacement maps to add detail to characters is becoming increasingly common. This allows a low-resolution version of the model to be rigged and animated and then converted into a highly detailed mesh at render time. The end result can be quite spectacular. The render time involved, however, makes this workflow usable only for film and television; game engines are beginning to use displacements in real time but in a very limited capacity.Since a displacement map is a grayscale texture, it can be painted much like a bump map. A displacement map should be used for larger details that need to be seen in the silhouette of the geometry, such as large folds and wrinkles in the flesh, bumps on the nose, and large veins. Smaller details, such as pores, should be reserved for bump or normal maps that can be used in conjunction with displacement maps. Furthermore, with characters and complex objects, the geometry to be displaced should be fairly close in shape to the displaced version and have just enough subdivisions to allow for the additional detail. Maya’s Transfer Maps tool also allows for the creation of displacement maps. Generating a workable displacement map using this tool takes a little more work than if you used a third-party application, and it generally falls short of their precision. Through trial and error, you dIsPlaCeMent MaPPIng | 609need to establish the proper displacement height. Second, the low-resolution geometry needs to be smoothed to avoid low-resolution shading (see Figure 11.40). In addition, do not use the .exr format to transfer the maps. The best format to use for transferring displacement maps is Maya’s native .iff format.The only difference between the settings in transferring normal maps and displacements is the Maximum Value attribute. This controls the range of values the displacement is gauged on. With the giraffe, a smaller value increases the contrast between low and high areas (see Figure 11.41).The best possible way to generate a displacement map for a character or creature is to use a digital sculpting program such as ZBrush or Mudbox. Although it involves learning another application, the results are excellent. This is becoming the workflow of choice for many major studios. When generating maps in a third-party application, it’s always best to create 32-bit Figure 11.40 This map was transferred with-out first smoothing the surface on the low-polygon version.Figure 11.41 The options used for transferring displacement 610 | CHAPTER 11 texture MaPPIngfloating-point maps. This will ensure that the displacement is smooth and free of the stair- stepping artifacts that can appear in 16-bit maps. In this exercise, mental ray’s Approximation Editor is used to tessellate the geometry of the giraffe’s hind legs. 1. Open the giraffeDisp_v01.ma scene from the chapter11\scenes folder on the DVD. The giraffe has all of its UV texture coordinates set for applying the displacement maps. It is the same file used in applying normal maps except the materials have been changed to Blinns. 2. Select the giraffe, and create an approximation node. Choose Window  Rendering Editors  mental ray  Approximation Editor (if mental ray does not appear in the list, you’ll need to load the Mayatomr.mll plug-in using the Plug-in Manager). 3. In the Approximation Editor, click the Create button in the Subdivisions (Polygon And Subd. Surfaces) section. You do not need to create a displacement approximation node; the subdivision approximation provides enough geometry for displacement and smoothes the surface. 4. In the Attribute Editor for the mentalRaySubdivApprox1 node, do the following: a. Change the Approx Method set to Length/Distance/Angle. b. Set Max Subdivisions to 3. c. Set the Length to 0.01.This subdivides the model so the detail created by the displacement texture is more refined. Higher values allow more of the detail in the map to come through but also add more triangles. The Length/Distance/Angle efficiently adds triangles where they are needed the most. Figure 11.42 shows the settings. 5. Set the renderer to mental ray. Create a test render of the giraffe’s hind legs. It should look nice and smooth (see Figure 11.43). 6. In the Hypershade, select giraffeHindLegs_Mat, and choose Graph  Input And Output Connections, or click its icon. 7. Open Blinn2SG in the Attribute Editor. 8. Click the checkered box next to Displacement Mat. Figure 11.42 The settings used for the subdivision approximation node [...]... Head_Mat shader, and open its Attribute Editor. 4. Click the checkered box next to the Bump Mapping channel, and choose a file from the Create Render Node pop-up. 5. When you add the file node, the Attribute Editor will open to the bump2 D node. Set the Use As option to Tangent Space Normals. This tells Maya the texture you’re applying is a normal map and not a bump map. You can leave the Bump Depth... directory, and add giraffeHead_Overall.iff. 12. Set Diffuse Weight to 0.5; you’ll probably want to adjust this more later. 13. In the Textures area of the Hypershade, find the giraffeHeadBump_Text node (this is the texture used to create the bump texture), and MMB-drag it to the work area. 14. Expand the Bump Shader rollout in the giraffeHeadSSS_Mat, and MMB-drag the giraffeHeadBump_Text (giraffeHead _Bump. iff)... version of the scene, open the giraffeNormalMaps_v01.ma file from the chapter11\scenes folder on the DVD. Displacement Mapping Displacement maps are like bump maps in that they use a grayscale texture to add detail to a model. However, rather than just perturb the normal of the surface, displacement maps actu- ally alter the geometry at render time. Unlike normal and bump maps, the silhouette of the geometry... scale adjuster for scenes and objects of different sizes. 6. Save your scene file as giraffeSSS_v03.ma. To see a version of the scene so far, open the giraffeSSS_v03.ma file from the chapter11\ scenes folder on the DVD. If you are dealing with a human head, it generally has cooler colors around the mouth and eyes and in the recesses of the neck and ears (for both male and female and across races). Warmer... out- DoorLighting layer. BuMP and norMal MaPPIng | 605 by the Search Envelope slider in the Target Meshes section of the Transfer Maps tool. What’s more, you can edit the Target Mesh geometry itself to improve the results of the final map. Use Low-Quality Settings When Testing Normal maps can take a while to calculate, so it’s a good idea to create a few test maps at lower quality and then raise the quality... giraffeHeadBump_Text (giraffeHead _Bump. iff) texture on top of this channel. 15. Select the bump2 d node, and set Bump Depth to 0.05. 16. In the Materials tab of the Hypershade, find the giraffeHead_Disp shader. MMB-drag this shader on top of the shading group labeled misss_fast_skin_maya3SG node, and choose Default. These are the same displacement node, file texture, and settings created earlier in... and the lighting no longer matches the original studioLighting render. The reason for this is not because of render layers per se but because of the Physical Sun and Sky network that was added to the scene. Remember from Chapter 9 that when you add a Physical Sun and Sky network, a number of nodes are added to the scene and attached to the renderable cameras. Normally this feature saves time and. .. object made of a single material, such as candle wax. Likewise, the Scatter Radius slider and related attributes in the mental ray section of Maya shaders add a quick -and- dirty subsurface quality to simple objects. However, these options fall far short when you’re trying to create a complex material such as human skin. Figure 11.46 The displacement and bump maps are used together to create realistic... with- out first smoothing the surface on the low-polygon version. Figure 11.41 The options used for transferring displacement 606 | CHAPTER 11 texture MaPPIng Applying Normal Maps Normal maps are applied to an object’s shader in the Bump channel, and they can be viewed in the perspective window. In this section, you’ll see how the map looks when it’s applied to the model as well as a few suggestions... cheeks, and forehead, and some yellows are seen in places where bone is close to the surface of the skin, such as in the temples and cheekbones. These col- ors would be represented in the subdermal and back scatter maps. 644 | CHAPTER 12 renderIng For CoMPosItIng Render Multiple Passes from a Single Render Layer In this example, you’ll create multiple passes for reflection, specular, depth, and shadow . BuMP and norMal MaPPIng | 601There are two types of normal maps, object space and tangent space:Object space maps. 11 texture MaPPIngFigure 11.35 The high-resolution giraffeFigure 11.36 The Transfer Maps interface BuMP and norMal MaPPIng | 603 7. Expand the Source

Ngày đăng: 27/08/2012, 14:32

TỪ KHÓA LIÊN QUAN

w