Friday, June 27, 2008

Creating Shadows For Maya Paint Effects

Maya paint effects is a very powerful feature in Maya which you can use to create animated plants and grass without useing any third party plug-in. However Maya paint effects has its own drawbacks. The main drawback is you cannot render shadows with paint effects.

So I found this nifty little trick that you can use to render shadows. This tutorial will show you how to do this in a couple of simple steps.

You can download the completed scene file by clicking here.



Start a new scene in Maya. Press F6 to reach the rendering menu set. On the paint effects menu select get brush to open the visor window.

Under the flowers folder select DaisyLarge.mel and close the visor window.

Draw the mesh on the view grid. Press “a” on your keyboard to zoom in. Now your screen should look something like this. Press “q” to return to the select tool and press “5” on the numeric pad to turn on shading.


There are not enough flowers in our stroke so we will increase the number of flowers by changing some of the attributes. Select the stroke for the flower. And press “ctrl+a” to open the attribute editor. On the node named “strokeShapeDaisyLarge1” increase the sample density as shown below.


To cast the shadows we need a light and a surface. Create a polygon plane object by selecting create>polygon primitives>plane.



Use the scale tool (hot key “r”) to scale up the plane so it looks something like this.


Next we’ll create a light. Select create>lights>directional light.



Press “e” and use the rotate tool to rotate the light so it lightens from the side as shown below. I have moved the light to a side so you can clearly see it. You don’t need to move the light because it’s a directional light and where you place the light doesn’t really matter.



Ok so now we have the light but we need to enable shadows. If your attribute editor is already open locate the depth map shadow attributes section and turn on turn on depth map shadows (otherwise you need to open the attribute editor to do this).



Let’s do a test render. As you can see although you turn on shadows paint effects strokes doesn’t cast shadows. Now for the best part.



Select the paint effects stroke again and select modify>convert>paint effects to polygons.



Now the paint effects strokes has been converted to polygons. And you can try rendering a frame and see for your self.

You can also try making the stroke animate and rendering a movie. Here’s the final animation with shadows.

video