Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 105 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
105
Dung lượng
3,47 MB
Nội dung
76 | CHAPTER 2 VIrtual FIlMMakIng WIth Maya CaMeras Camera Sequencing Maya 2011 introduces the Camera Sequencer tool, which allows you to create a sequence of shots for scenes that use multiple cameras. You can arrange and edit the camera sequence using the non- linear camera sequence editor, which is similar to the Trax Editor. For more information on how to use this feature watch the CameraSequencer.mov movie in the BonusMovies folder on the DVD. Applying Depth of Field and Motion Blur Depth of field and motion blur are two effects meant to replicate real-world camera phenomena. Both of these effects can increase the realism of a scene as well as the drama. However, they can both increase render times significantly, so it’s important to learn how to efficiently apply them when rendering a scene. In this section, you’ll learn how to activate these effects and the basics of how to work with them. Using both effects effectively is closely tied to render-quality issues. Chapter 12 discusses render-quality issues more thoroughly. Rendering Using Depth of Field The depth of field (DOF) settings in Maya simulate the photographic phenomena where some areas of an image are in focus and other areas are out of focus. Artistically this can greatly increase the drama of the scene, because it forces the viewers to focus their attention on a spe- cific element in the composition of a frame. Depth of field is a ray-traced effect and can be created using both Maya software and mental ray; however, the mental ray DOF feature is far superior to that of the Maya software. This sec- tion describes how to render depth of field using mental ray. Depth of Field and Render Time Depth of field adds a lot to render time, as you’ll see from the examples in this section. When work- ing on a project that is under time constraints, you will need to factor DOF rendering into your schedule. If a scene requires an animated depth of field, you’ll most likely find yourself re-rendering the sequence a lot. As an alternative, you may want to create the DOF using compositing software after the sequence has been rendered. It may not be as physically accurate as mental ray’s DOF, but it will render much faster, and you can easily animate the effect and make changes in the com- positing stage. To do this, you can use the Camera Depth Render Pass preset (discussed in Chapter 12) to create a separate depth pass of the scene and then use the grayscale values of the depth pass layer in conjunction with a blur effect to create DOF in your compositing software. Not only will the render take less time to create in Maya, but you’ll be able to fine-tune and animate the effect quickly and efficiently in your compositing software. There are two ways to apply the mental ray depth of field effect to a camera in a Maya scene: Activate the Depth Of Field option in the camera’s Attribute Editor •u Add a mental ray physical_lens_dof lens shader or the mia_lens_bokeh to the camera •u (mental ray has special shaders for lights and cameras, as well as surface materials) aPPlyIng dePth oF FIeld and MotIon Blur | 77 Both methods produce the same effect. In fact, when you turn on the DOF option in the Camera Attributes settings, you’re essentially applying the mental ray physical DOF lens shader to the camera. The mia_lens_bokeh lens shader is a more advanced DOF lens shader that has a few additional settings that can help improve the quality of the depth of field render. For more on lens shaders, consult Chapter 10. The controls in the camera’s Attribute Editor are easier to use than the controls in the physi- cal DOF shader, so this example will describe only this method of applying DOF. 1. Open the chase_v05.ma scene from the chapter2/scenes directory on the DVD. 2. In the viewport, switch to the DOF_cam camera. If you play the animation (which starts at frame 100 in this scene), you’ll see the camera move from street level upward as two helicopters come into view. 3. In the Panel menu bar, click the second icon from the left to open the DOF_cam’s Attribute Editor. 4. Expand the Environment settings, and click the color swatch. 5. Use the Color Chooser to create a pale blue color for the background (Figure 2.28). 6. Open the Render settings, and make sure the Render Using menu is set to mental ray. If mental ray does not appear in the list, you’ll need to load the Mayatomr.mll plug-in (Mayatomr.bundle on the Mac) found in the Window Settings/Preferences Plug-in Manager window. 7. Select the Quality tab in the Render settings, and set the Quality preset to Preview:Final Gather. Figure 2.28 A new background color is chosen for the DOF_cam. 78 | CHAPTER 2 VIrtual FIlMMakIng WIth Maya CaMeras 8. Switch to the Rendering menu set. Choose Render Test Resolution 50% Settings. This way, any test renders you create will be at half resolution, which will save a lot of time but will not affect the size of the batch-rendered images. 9. Set the timeline to frame 136, and Choose Render Render Current Frame to create a test render (see Figure 2.29). The Render View window will open and render a frame. Even though there are no lights in the scene, even lighting is created when Final Gather is activated in the Render settings (it’s activated automatically when you choose the Preview:Final Gather Quality preset). The pale blue background color in the current camera is used in the Final Gather calcula- tions. (Chapter 10 discusses more sophisticated environmental lighting.) This particular lighting arrangement is simple to set up and works fine for an animatic. As you can see from the test render, the composition of this frame is confusing to the eye and does not read very well. There are many conflicting shapes in the background and foreground. Using depth of field can help the eye separate background elements from foreground elements and sort out the overall composition. 10. In the Attribute Editor for the DOF_cam, expand the Depth Of Field rollout panel, and activate Depth Of Field. 11. Store the current image in the Render Preview window (from the Render Preview win- dow menu, choose File Keep Image In Render View), and create another test render using the default DOF settings. Figure 2.29 A test render is cre- ated for frame 136. aPPlyIng dePth oF FIeld and MotIon Blur | 79 12. Use the scroll bar at the bottom of the Render View window to compare the images. There’s almost no discernable difference. This is because the DOF settings need to be adjusted. There are only three settings: Focus Distance This determines the area of the image that is in focus. Areas in front or behind this area will be out of focus. F Stop This describes the relationship between the diameter of the aperture and the focal length of the lens. Essentially it is the amount of blurriness seen in the rendered image. F Stop values used in Maya are based on real-world f-stop values. The lower the value, the blurrier the areas beyond the focus distance will be. Changing the focal length of the lens will affect the amount of blur as well. If you are happy with a camera’s DOF settings but then change the focal length or angle of view, you’ll probably need to reset the F Stop setting. Typically values range from 2.8 to about 12. Focus Region Scale This is a scalar value that you can use to adjust the area in the scene you want to stay in focus. Lowering this value will also increase the blurriness. Use this to fine-tune the DOF effect once you have the Focus Distance and F Stop settings. 13. Set Focus Distance to 15, F Stop to 2.8, and Focus Region Scale to 0.1, and create another test render. The blurriness in the scene is much more obvious, and the composition is a little easier to understand. The blurring is very grainy. You can improve this by adjusting the Quality settings in the Render Settings window. Increasing the Max Sample level and decreasing the Anti-Aliasing Contrast will smooth the render, but it will take much more time to ren- der the image. For now you can leave the settings where they are as you adjust the DOF (see Figure 2.30). Chapter 12 discusses render-quality issues. 14. Save the scene as chase_v06.ma. To see a version of the scene so far, open chase_v06.ma from the chapter2\scenes directory on the DVD. Figure 2.30 Adding depth of field can help sort the elements of a composition by increasing the sense of depth. 80 | CHAPTER 2 VIrtual FIlMMakIng WIth Maya CaMeras Creating a Rack Focus Rig A rack focus refers to a depth of field that changes over time. It’s a common technique used in cinematography as a storytelling aid. By changing the focus of the scene from elements in the background to the foreground (or vice versa), you control what the viewer looks at in the frame. In this section, you’ll set up a camera rig that you can use to interactively change the focus dis- tance of the camera. 1. Continue with the scene from the previous section, or open the chase_v06.ma file from the Chapter2\scenes directory of the DVD. 2. Switch to the perspective view. Choose Create Measure Tools Distance Tool, and click two different areas on the grid to create the tool. Two locators will appear with an annotation that displays the distance between the two locators in scene units (meters for this scene). 3. In the Outliner, rename locator1 to camPosition, and rename locator2 to distToCam (see Figure 2.31). 4. In the Outliner, expand the DOF_cam_group. MMB-drag camPosition on top of the DOF_cam node to parent the locator to the camera. 5. Open the Channel Box for the camPosition locator, and set all of its Translate and Rotate channels to 0; this will snap camPosition to the center of the camera. 6. Shift-select the camPosition’s Translate and Rotate channels in the Channel Box, right- click the fields, and choose Lock Selected so that the locator can no longer be moved. 7. In the Outliner, MMB-drag distToCam on top of the camPosition locator to parent distToCam to camPosition. 8. Select distToCam; in the Channel Box, set its Translate X and Y channels to 0, and lock these two channels (see Figure 2.32). You should be able to move distToCam only along the z-axis. 9. Open the Connection Editor by choosing Window General Editors Connection Editor. 10. In the Outliner, select the distanceDimension1 node, and expand it so you can select the distanceDimensionShape1 node (make sure the Display menu in the Outliner is set so that shape nodes are visible). Figure 2.31 A measure tool, consisting of two locators, is created on the grid. aPPlyIng dePth oF FIeld and MotIon Blur | 81 11. Click the Reload Left button at the top of the Connection Editor to load this node. 12. Expand the DOF_Cam node in the Outliner, and select DOF_camShape. Click Reload Right in the Connection Editor. 13. From the bottom of the list on the left, select Distance. On the right side, select FocusDistance (see Figure 2.33). Figure 2.32 The Translate X and Y channels of the distToCam node are locked so that it can move only along the z-axis. Figure 2.33 The Distance attribute of the distance DimensionShape1 node is linked to the focusDistance attribute of the DOF_camShape node using the Connection Editor. 82 | CHAPTER 2 VIrtual FIlMMakIng WIth Maya CaMeras 14. Look in the perspective view at the distance measured in the scene, select the distToCam locator, and move it so that the annotation reads about 5.5 units. 15. Select the DOF_camShape node, and look at its focusDistance attribute. If it says some- thing like 550 units, then there is a conversion problem: a. Select the distanceDimensionShape node in the Outliner, and open the Attribute Editor. b. From the menu in the Attribute Editor, click Focus, and select the node that reads unit- Conversion14. If you are having trouble finding this node, turn off DAG Objects Only in the Outliner’s Display menu, and turn on Show Auxiliary Nodes in the Outliner’s Show menu. You should see the unitConversion nodes at the bottom of the Outliner. c. Select unitConversion14 from the list to switch to the unitConversion node, and set Conversion Factor to 1. Occasionally when you create this rig and the scene size is set to something other than centimeters, Maya converts the units automatically, and you end up with an incorrect number for the Focus Distance attribute of the camera. This node may not always be necessary when setting up this rig. If the value of the Focus Distance attribute of the cam- era matches the distance shown by the distanceDimension node, then you don’t need to adjust the unitConversion’s Conversion Factor setting. 16. Set the timeline to frame 138. In the Perspective window, select the distToCam locator, and move it along the z-axis until its position is near the position of the car (about -10.671). 17. In the Channel Box, right-click the Translate Z channel, and choose Key Selected (see Figure 2.34). 18. Switch to the DOF_cam in the viewport, and create a test render. The helicopters should be out of focus, and the area near the car should be in focus. 19. Set the timeline to frame 160. Figure 2.34 The distToCam locator is moved to the position of the car on frame 138 and keyframed. aPPlyIng dePth oF FIeld and MotIon Blur | 83 20. Move the distToCam node so it is at about the same position as the closest helicopter (around -1.026). 21. Set another keyframe on its Z translation. 22. Render another test frame. The area around the helicopter is now in focus (see Figure 2.35). If you render a sequence of this animation for the frame range between 120 and 180, you’ll see the focus change over time. To see a finished version of the camera rig, open chase_v07.ma from the chapter2\scenes directory on the DVD. Adding Motion Blur to an Animation If an object changes position while the shutter on a camera is open, this movement shows up as a blur. Maya cameras can simulate this effect using the Motion Blur settings found in the Render settings as well as in the camera’s Attribute Editor. Not only can motion blur help make an ani- mation look more realistic, it can also help smooth the motion in the animation. Like depth of field, motion blur is very expensive to render, meaning it can take a long time. Also much like depth of field, there are techniques for adding motion blur in the composit- ing stage after the scene has been rendered. You can render a motion vector pass using mental ray’s passes (render passes are discussed in Chapter 12) and then adding the motion blur using the motion vector pass in your compositing software. For jobs that are on a short timeline and a strict budget, this is often the way to go. In this section, however, you’ll learn how to create motion blur in Maya using mental ray. There are many quality issues closely tied to rendering with motion blur. In this chapter, you’ll learn the basics of how to apply the different types of motion blur. Chapter 12 discusses issues related to improving the quality of the render. Figure 2.35 The focus distance of the camera has been animated using the rig so that at frame 160 the helicopter is in focus and the back- ground is blurry. 84 | CHAPTER 2 VIrtual FIlMMakIng WIth Maya CaMeras mental ray Motion Blur The mental ray Motion Blur setting supports all rendering features such as textures, shadows (ray trace and depth map), reflections, refractions, and caustics. You enable the Motion Blur setting in the Render Settings window, so unlike the Depth Of Field setting, which is activated per-camera, all cameras in the scene will render with motion blur once it has been turned on. Likewise, all objects in the scene have motion blur applied to them by default. You can, and should, turn off the Motion Blur setting for those objects that appear in the distance or do not otherwise need motion blur. If your scene involves a close-up of an asteroid whizzing by the camera while a planet looms in the distance surrounded by other slower-moving asteroids, you should disable the Motion Blur setting for those distant and slower-moving objects. Doing so will greatly reduce render time. To disable the Motion Blur setting for a particular object, select the object, open its Attribute Editor to its shape node tab, expand the Render Stats rollout panel, and deselect the Motion Blur option. To disable the Motion Blur setting for a large number of objects at the same time, select the objects, and open the Attribute Spread Sheet (Window General Editors Attribute Spread Sheet). Switch to the Render tab, and select the Motion Blur header at the top of the column to select all the values in the column. Enter 0 to turn off the Motion Blur setting for all the selected objects (see Figure 2.36). Figure 2.36 You can disable the Motion Blur setting for a single object in the Render Stats section of its Attribute Editor or for a large number of selected objects using the Attribute Spread Sheet. aPPlyIng dePth oF FIeld and MotIon Blur | 85 Motion Blur and Render Layers The Motion Blur setting can be active for an object on one render layer and disabled for the same object on another render layer using render layer overrides. For more information on using render layers, consult Chapter 12. There are two types of motion blurs in mental ray for Maya: No Deformation and Full. No Deformation calculates only the blur created by an object’s transformation—meaning its transla- tion, rotation, and scale. A car moving past a camera or a helicopter blade should be rendered using No Deformation. The Full setting calculates motion vectors for all of an object’s vertices as they move over time. Full should be used when an object is being deformed, such as when a character’s arm geometry is skinned to joints and animated moving past the camera. Using Full motion blur will give more accurate results for both deforming and nondeforming objects, but it will take a longer time to render than using No Deformation. Motion Blur for Moving Cameras If a camera is moving by a stationary object, the object will be blurred just as if the object were moving by a stationary camera. The following procedure shows how to render with motion blur: 1. Open the scene chase_v08.ma from the chapter2\scenes directory of the DVD. 2. In the Display Layer panel, right-click the buildings display layer, and choose Select Objects. This will select all the objects in the layer. 3. Open the Attribute Spread Sheet (Window General Editors Attribute Spread Sheet), and switch to the Render tab. 4. Select the Motion Blur header to select all the values in the Motion Blur column, and turn the settings to Off (shown in Figure 2.36). Do the same for the objects in the street layer. 5. Switch to the Rendering menu set. Choose Render Test Resolution Render Settings. This will set the test render in the Render View window to 1280 by 720, the same as in the Render Settings window. In the Render Settings window under the Quality tab, set Quality Preset to Preview. 6. Switch to the shotCam1 camera in the viewport. 7. Set the timeline to frame 59, and open the Render View window (Window Rendering Editors Render View). 8. Create a test render of the current view. From the Render View panel, choose Render Render ShotCam1. The scene will render. Setting Quality Preset to Preview disable Final Gathering, so the scene will render with default lighting. This is okay for the pur- pose of this demonstration. [...]... scale down and reposition it so that it matches the drawing Enter the following settings in the Channel Box: Translate X: 0 Translate Y: 9.678 Translate Z: 1 .24 5 Rotate X: 1 02 Rotate Y: 0 Rotate Z: 0 Scale X: 2. 124 Scale Y: 2. 124 Scale Z: 2. 124 12 Right-click the rear part of the sphere, and choose Control Vertex 13 You’ll see the CVs of the helmet highlighted Drag a selection marquee over the vertices... Figure 2. 42) 12 In the perspective view, switch to a top view, and make sure the NURBS sphere is directly in front of the center camera and at the same position as the zero parallax plane (Translate Z = -10) As you change the Zero Parallax value, the left and right cameras will rotate on their y-axes to adjust, and the Zero Parallax Plane will move back and forth depending on the setting Figure 2. 42 A... instantaneously, and therefore there’s no time to calculate a blur 88â•… | Chapter 2 •… Virtual Filmmaking with Maya €Cameras Figure 2. 39 Different settings for Shutter Open and Shutter Close affect how motion blur is calculated From left to right, the Shutter Open and Shutter Close settings for the three images are (0, 1), (0 .25 , 1), and (0 .25 , 0.75) The length of time the shutter is open for the last image is... camera to the list of renderable cameras in the Render Settings window The Orthographic Width is changed when you dolly an orthographic camera in or out (see Figure 2. 41) 90â•… | Chapter 2 •… Virtual Filmmaking with Maya €Cameras Figure 2. 41 The Orthographic option for the perspective camera is activated, flattening the image seen in the perspective view Stereo Cameras You can use stereo cameras when... on the camera’s shape node The default setting for Maya cameras is 144 If you set this value to 72 and render, the resulting blur would be similar to setting Shutter Angle to 144, Shutter Open to 0 .25 , and Shutter Close to 0.75 (effectively halving the total time the shutter is open) The Shutter Angle setting on the camera is meant to be used with Maya Software Rendering to provide the same functionality... shape of the helmet in the side view (see Figure€3.16) Enter the following settings in the Channel Box: Translate X: 0 Translate Y: 9.76 Translate Z: 0.845 Rotate X: 1 02 Rotate Y: 0 Rotate Z: 0 Scale X: 2. 547 Scale Y: 2. 547 Scale Z: 2. 547 | Modeling NURBS Surfaces â•… 109 Figure€3.16 A NURBS sphere is created and positioned in the side view to match the drawing of the helmet 5 To see the sphere and... method or the other—try not to mix the two techniques, or the math will start to get a little fuzzy 20 Return the Shutter settings to 0 for Shutter Open and 1 for Shutter Closed 21 In the Quality section below the Motion Blur settings, increase Motion Steps to 6, and render the helicopter region again 22 Store the image, and compare it to the previous renders Notice that the blur on the helicopter blade... used as a basis for a surface When rebuilding a curve, you have the option of changing the degree of the curve so that a linear curve can be converted to a cubic curve, and vice versa Bezier Curves Maya 20 11 introduces a new curve type: Bezier curves These curves use handles for editing as opposed to CVs that are offset from the curve To create a Bezier curve, choose Create Bezier Curve tool Each... Understanding NURBS â•… 99 Importing Curves You can create curves in Adobe Illustrator and import them into Maya for use as projections on the model For best results, save the curves in Illustrator 8 format In Maya, choose File Import Options, and choose Adobe Illustrator format to bring the curves into Maya This is often used as a method for generating logo text Understanding NURBS Surfaces NURBS surfaces... pressing 1, 2, or 3 on the keyboard •u Pressing the 1 key displays the surface at the lowest quality, which makes the angles of the surface appear as corners •u Pressing the 3 key displays the surface as smooth curves •u Pressing the 2 key gives a medium-quality display None of these display modes affects how the surface will look when rendered, but choosing a lower display quality can help improve Maya s . 76 | CHAPTER 2 VIrtual FIlMMakIng WIth Maya CaMeras Camera Sequencing Maya 20 11 introduces the Camera Sequencer tool, which allows you to create. helicopter (around -1. 026 ). 21 . Set another keyframe on its Z translation. 22 . Render another test frame. The area around the helicopter is now in focus (see Figure 2. 35). If you render a. Quality preset to Preview:Final Gather. Figure 2. 28 A new background color is chosen for the DOF_cam. 78 | CHAPTER 2 VIrtual FIlMMakIng WIth Maya CaMeras 8. Switch to the Rendering menu