- Jul 9, 2004
Paint Effects Overview
Paint Effects is a compelling feature that offers the CG artist a quick and easy way to add all sorts of complex elements to a 3D scene. Simple paint effects such as Airbrush, Markers, and Swirl are included in the brush sets. You can see the potential of Paint Effects in more complex brushes, such as lightning and clouds, but it's the nature effectsincluding flowers, shrubs, grasses, and treesthat show off the best of what Paint Effects can do.
All this magic comes from a feature referred to as tubes, which follow or continue the path of a stroke to simulate organic growth. By basing the 3D portion of Paint Effects on tubes that exist in 3D space, you can apply the entire gamut of changes over time and space. You can create growth, dynamics, lighting, turbulence, and so forth with the 3D effects that come from the brush's paint stroke. The paint stroke is attached to a NURBS curve, so it can be fully animated. You can edit the curve to grow, undulate, change shape, and move, and the brushes applied to the stroke will follow the curve. In the same manner, the brush type applied to a paint stroke can be changed so that a row of oaks, for example, can become a row of rose bushes. Opacity, luminosity, and other attributes can be built right into the brush; with these attributes, you can paint a luminous glowing lightning bolt just as easily as you'd paint a semitransparent raindrop or fully opaque ivy vine.
With all these varied options, the palette of available 3D brushes is bogglingstars and galaxies, fire and lightning with inherent turbulence animation, trees and grasses that can be set to rustle in the wind, flowers and bushes that can grow as though in time-lapse photography, and much more. Beginners will delight in watching an experienced animator use Paint Effects. Using Paint Effects is fast, fun, and easy.
Brushes and Strokes
A 3D brush is much different from a paintbrush. In Paint Effects, the brush is a collection of settings that control the stroke's appearance and behavior. You can find all the attributes for creating Maya brush types under the Brush section in the Attribute Editor or in the Paint Effects Brush Settings dialog box (accessed by Hotbox | Paint Effects | Template Brush Settings; referred to in this chapter as "the Brush Settings dialog box" for simplicity). However, it's easier to create a brush by modifying one of the preset types. You can view the palette of preset brushes in the Visor (hotkey: Alt+v; Window | General Editors | Visor on the menu; or Hotbox | Paint Effects | Get Brush). You might need to change the active tab in the Visor to get the brush list to appear. In Figure 14.1, the Paint Effects tab is selected, and the brush categories are listed in the Visor's left column.
If the Visor doesn't show the tabs you need, you can reconfigure it to display the full set, as shown in Figure 14.1. Choose Tabs | Revert to Default Tabs from the Visor menu.
Figure 14.1 The Visor lists all the preset brush types.
A stroke is what's created when you paint with the Paint Effects tool, and it uses the settings of the brush type you've selected. When you select a brush in the Visor, it activates the Paint Effects feature. You can paint on the grid (the ground X-Y plane) or designate any NURBS object to be paintable. The cursor becomes a pencil-like icon, and when you click and drag in the viewport, a paint stroke is created. This stroke is attached to a curve drawn over the surface of the object you're painting. You can offset the stroke from the surface curve for certain effects, such as fog patches that hover over the ground. After painting the stroke, you can adjust the settings attached to it; to do that, select the stroke, and then choose Display | Show | Show Geometry | Stroke Path Curves. As with other scene elements you've created in Maya, all the stroke and brush settings are available in the Channel Box and Attribute Editor. If you draw a curve with a pressure-sensitive tablet, the pressure values are recorded along the stroke as they change. You can also use any curve you've drawn or projected in Maya as a stroke and attach a brush to it.
There are simple strokes and strokes with tubes (or "growth strokes"). Simple strokes are like multiple stamps that, when placed close together, form a single line created by brush motion. With growth strokes, as you drag the mouse to create the stroke, this action creates tubes that grow, separate, or expand to continue outward in several directions from the stroke. For example, if you're painting a vine, tubes simulating leaves and tendrils can continue to "grow" from the main stalk. Tubes grow one segment for each step of the growth process; segments are straight, so increasing the Segments setting makes the segments in the tube smaller and thus produces a smoother appearance. Another important setting is Tube Completion. When it's enabled, the tubes continue growing automatically for their full life span (defined by the number of segments). When it's disabled, the tubes at the end of the stroke you draw will look more "cut off" than the tubes at the beginning of the stroke (as in half-grown trees or vines with no leaves). Usually, you'll want to leave this setting enabled so that the current growth completes after you stop drawing.
Enabling Paint Effects
Because using Paint Effects can require a lot of system resources, some people leave it disabled when they aren't planning to use it. If it seems as though Paint Effects hasn't been enabled on your system, you can enable it by choosing Window | Settings/Preferences | Preferences on the main menu; in the Preferences dialog box, select Modules in the Categories list box. Select the Load Paint Effects on Startup check box (if it's not already), and then close the Preferences dialog box and restart Maya. Paint Effects is then added to Maya's Rendering menu. You need to add the Paint Effects menu to the Hotbox, too. To do this, simply hold down the spacebar to open Hotbox | Hotbox Controls | Show All.
Starting Paint Effects
When you want to apply Paint Effects to a surface, you must first designate a surface to be made paintable. This action does not modify the object; rather, it simply tells Paint Effects that this surface is prepared to receive brush strokes. If you want to paint a different surface or if you have restarted Maya, you'll need to use the Make Paintable option again. This feature is in the Rendering menu under Paint Effects | Make Paintable. You can paint 3D Paint Effects only on NURBS surfaces, the view plane, or the ground plane. However, you can work around this by creating non-renderable NURBS surfaces that are similar to the polygonal surfaces you want, and then paint on these "hidden" NURBS surfaces.
Using Paint Effects
After you have designated a surface as paintable, you can then paint in one of the following three modes:
Model View mode Painting in one of the normal 3D panels (in either Wireframe or Shaded mode). When painting in this mode, you see only a wireframe representation of your stroke and brush type (see Figure 14.2).
Figure 14.2 Working with Paint Effects in Model View mode renders the strokes as wireframe.
Paint Scene mode In this mode, when you switch into the Paint Effects panel, you'll see a shaded preview of your scene file. Paint Scene mode, as shown in Figure 14.3, looks like the Perspective view and renders paint strokes as you create them, which gives you a good idea of what your paint strokes will look like (although your display updates more slowly in this mode).
Figure 14.3 Painting grass in the Paint Scene mode.
Paint Canvas mode Starts out as an empty white "canvas" when you switch into the Paint Effects panelgood for testing out brushes before using them in your scene. Paint Canvas mode works as a sort of advanced 2D paint mode to create textures or paintings that can be saved as image files and can store the depth and alpha channels of brushes. If you want to paint on the view plane, you need to use Paint Canvas mode.
To change the current panel to the Paint Effects panel, press 8 or choose Hotbox | Panels | Panel | Paint Effects. You go into Paint Scene or Paint Canvas mode (depending on the mode you were in last). To toggle between Paint Scene and Paint Canvas mode, RMB-click in the Paint Effects panel and choose Paint Scene or Paint Canvas. Paint Canvas mode is like a separate 2D painting area and has no relation to your 3D scene. Because this chapter addresses only the 3D paint options, you'll choose Paint Scene. Paint Effects then does a quick-shade rendering of your scene file and places this 2D image into the view. This image allows you to paint into the depth of your 3D scene. When you test-render, you'll notice that the brushes you use in your environment scale appropriately into the distance. When you orbit the scene to paint in another area in Paint Effects Canvas mode, the paint effects are reduced to lines. When you've found your new viewpoint, you can have Paint Effects render the previous strokes again by clicking the Redraw Paint Effects View button (refer to Figure 14.3).
If you add many strokes of different types, redrawing can become slow. You'll find it helpful to hide strokes you don't need to see for your current Paint Effects work. To do this, open the Outliner to see all the strokes listed. Maya names the strokes with the type of brush used when the stroke was made, so it's easy to find the strokes you want to temporarily hide (see Figure 14.4). After selecting the brush strokes, you can hide them with the Ctrl+h hotkey or with Display | Hide | Hide Selection on Maya's main menu or in the Hotbox.
Figure 14.4 Selecting strokes to hide in the Outliner.
While working with Paint Effects, you might want to leave the Visor open to select other brushes. After you've selected a brush, Paint Effects displays a red circle cursor (refer to Figure 14.3) to give you an idea of the global scale of the objects to be "planted" when you begin painting. This cursor follows the surface of the paintable object as you move it around and is a good indicator of whether the object you intend to paint on has truly been made paintable. You can adjust the brush size by holding down the b key and LMB-dragging left and right. You can also open the Brush Settings dialog box by choosing Brush | Edit Template Brush in the Paint Effects panel, or by clicking Hotbox | Paint Effects | Template Brush Settings. At the top of the dialog box, you'll see the Global Scale attribute.
Having trouble with seeing or sizing the Paint Effects brush is a common problem with video graphics card drivers. If you can't get a red circle to appear that follows your pointer, you might want to revisit the graphics card information in this book's Introduction. In a large scene, the default brush size can cause the circle cursor to look like a tiny red point, so you might need to increase the brush size quite a bit to see it clearly.
After scaling the brush to create your stroke at the size you want, you can adjust the brush width if needed. To adjust the brush width, press and hold Shift+B while LMB-dragging left and right. This method works only when you're creating growth strokes; simple strokes such as "snake" are just scaled, as with Global Scale adjustments. Note that with growth strokes, stroke density is adjusted elsewhere; making the brush larger simply spreads the same number of growths over a larger area.
Another attribute to adjust is the brush offset, controlled by holding down the m key while LMB-dragging left and right. This action raises the brush stroke from the Paint Effects curve so that you can create a 3D stroke above or below the surface. For brush types such as smoke or snake, this option is invaluable.
To exit Paint Scene mode, choose Panels | Perspective from the menu. To quit the Paint Effects painting mode, click the arrow pointer in the Tool Box, or use the hotkey q.
Tutorial: Learning Paint Effects
In this tutorial, you'll try some of the Paint Effects options on a NURBS surface in a small scene. Load the scene file noted next to the CD icon so that you have a starting point of a premade NURBS plane to paint on.
Load the file listed next to the CD icon, and make sure you have Paint Effects loaded (see the previous section, "Enabling Paint Effects"). The scene includes a lighting setup that's toggled off in the Layers dialog box. It also contains a NURBS plane with small hills and a large snail sitting in the middle of the scene. Select nurbsPlane1. To make the object paintable, click Hotbox | Paint Effects | Make Paintable (see Figure 14.5).
If the Perspective view doesn't display the full plane, it's likely a problem with the perspective camera's clipping plane. To fix this, choose View | Camera Attribute Editor in the Perspective view to open the perspective camera attributes, and set Near Clip Plane to 0.001 and Far Clip Plane to 10000.
Figure 14.5 The first step in Paint Effects: Making an object paintable.
Set the plane to display in high detail (hotkey: 3), set the Perspective view to Shaded mode (hotkey: 5), and tap the spacebar to return the Perspective panel to full screen.
Switch to Paint Scene mode (hotkey: 8). If you see a blank white panel, right-click in the panel and choose Paint Scene. On the Shading menu, make sure the options for Textured and Use All Lights are enabled. Choose Hotbox | Paint Effects | Get Brush on the menu in the Paint Effects panel to open the Visor (hotkey: Alt+v). Click the Paint Effects tab, expand the Brushes folder in the left-hand column if necessary, select the Grasses folder, and then click Astroturf. Minimize the Visor.
You browse the swatches in the Visor just as you do in any Maya dialog box: Alt+MMB to pan and Alt+RMB to zoom.
Hold the cursor over the ground plane and see if the Paint Effects Tool cursor appears. The astroturf's default brush size is close to what you need for this scene, so you'll need to increase it only a small amount. To increase the brush's Global Scale attribute, you could press and hold the b key while clicking and dragging to the right. However, for this tutorial, you'll manually set the size to a fixed amount: Open the Brush Settings dialog box (Hotbox | Paint Effects | Template Brush Settings) and change the Global Scale setting to 0.15. Next, open the Tubes section in the Brush Settings dialog box, expand the Creation section, and set Tubes Per Step to 300. This fills in the empty spaces between blades of grass to make each stroke seem fuller. Close the dialog box, and draw a stroke around the snail.
In the Attribute Editor (hotkey: Ctrl+a), under astroturf, you'll find the settings for the stroke you created. Expand the Shadow Effects section. In the Fake Shadow drop-down list, change the selection from None to 3D Cast. Render the scene, and you'll see that the grass has shadows applied from the real-world lighting. To check that the lights in the scene are producing the shadows, expand the Illumination section to ensure that the Illuminated and Real Lights check boxes are in fact selected.
How fast or slow you draw the stroke can affect the density, too. Because Paint Effects uses "sampling" when creating a stroke's underlying curve, a stroke drawn -quickly has fewer samples and, therefore, looks less dense than a stroke drawn more slowly.
Select the Flowers folder in the Visor. Select the Clover brush, and minimize the Visor. In the Brush Settings dialog box, set the Global Size of the brush to 325. Note that you need to adjust the Global Scale setting each time you change brushes because all the brush settings (the "template brush") change when you select a new brush. Expand the Brush Profile section, and set Brush Width to 0.5.
If the Paint Effects panel is partially covered by another dialog box while it's rendering the stroke, the image might not be displayed in the area that's covered. Click the Redraw Paint Effects View button to regenerate the view if needed. The time it takes to calculate Paint Effects generated in the Preview panel is similar to the amount of time it takes when calculating for rendering. Therefore, the time it takes for your painted effects to "pop up" onscreen is a good indicator of how long rendering will take.
In the Brush Settings dialog box, expand the Shadow Effects section and set Fake Shadow to 3D Cast, as in step 5. Next, expand the Tubes section and then the Creation section. Set Tubes Per Step to 1. Now, use this brush to paint an area around the snail without getting too close because Paint Effects brushes can pass right through geometry they're not applied to. This would make clovers seem to come directly out of the snail's body, which isn't the look you want. The first stroke created with a brush is the best time to get your settings as close as possible to the look you're trying to achieve. If you need to adjust the brush size or width, it's easier to undo (hotkey: Ctrl+z), make the adjustment in the Brush Settings dialog box, and try it again. Any subsequent strokes you make retain the same settings until you select a new brush.
To fill in the ground cover for the scene, paint in strokes covering most of the scene's open area. Under SHAPES in the Channel Box, set Sample Density to 3, and you'll see that the clover looks denser and fills up more of the stroke area, as shown in Figure 14.6.
You can set Paint Effects to automatically regenerate (Rendered mode) or to regenerate only when you click the Redraw Paint Effects View button (Wireframe mode). -This setting, under Stroke Refresh on the Paint Effects menu, is normally left at Wireframe mode to keep regeneration time to a minimum.
Figure 14.6 The scene shown in the Paint Effects view.
If you have trouble running the Paint Effects view (hotkey: 8) on your machine, or it runs slower than you'd prefer, you can always return to the Perspective view and paint in Wireframe mode. You won't be able to see exactly what the Paint Effects final result will be, but if you create a small sample of each brush before filling the scene with strokes of paint, you can check the look and avoid long render times during testing.
Exit Paint Effects by switching back to the Perspective panel (Panels | Perspective | Persp). The flowers' wireframe representation is noticeably thinner than it looked in Paint Effects. To see more lines for the clover, select the clover stroke, and set Display Percent to 100 in the Channel Box, under Shapes. If you accidentally deselect the clover stroke, open the Outliner and select the strokeClover1 item. You could increase the Display Percent setting for all the strokes, but interaction with Maya would slow down.
Close the Attribute Editor and render this view by clicking the Render button or choosing Hotbox | Render | Render Current Frame. Notice that the flowers cast shadows and seem thicker than the wireframe would imply.
Figure 14.7 The rendered view of the scene covered in clover.
Using Paint Effects can be straightforward, and it integrates well with standard geometry and lighting. To compare your scene with this tutorial, check the scene file noted next to the CD icon.