Realistic Grass in Maya

Hi everybody!  My name is Isidro, and I am from Costa Rica. Some time ago I was trying to find out how to create realistic grass and plants for a university project, but I could not find anything. Later I learned how to do it, and now I have created a tutorial on the subject.

You can find this tutorial in the officialCommunity of Autodesk-Maya User

In this tutorial, I will describe how to create realistic 3d grass using Maya's Paint Effects.  Here is the final image that we will create


First, we need to understand what grass looks like in reality.  See this photo.

This photo contains many different colors, sizes, and types of grass. You will almost never have a single kind of grass in your scene, because in reality there are always other plants mixed in with the grass. There are some flowers, some weeds, some dried-out (dead) grasses, and so on.  So, if you want realistic grass, you must use several different kinds of plants in your image. In addition, you must vary the size and color of your plants throughout the scene.

Take a close look at this photograph:

Notice how many different kinds of grass and other plants there are in this little space! There are also some pieces of wood mixed in. Also, observe the shadows in the grass:

The red arrows show how the shadows work, and the blue ones show where the light goes.  You can see that the top of the grass gets plenty of light, and the bottom of the grass has dark, irregular shadows.   Each stalk of grass casts a shadow on the ground and on its neighboring stalks.  As a result, very little light reaches the ground.   We need lots of contrast between the top and the bottom of the grass to produce a really realistic image.  I am not saying that the individual shadows need to be very strong, just that there needs to be a distinct contrast between the tip of each stalk and the root.   This gives the grass a sense of depth.  Look at this series of images:

You can see how the shadows (the second image) are random and have many different sizes and shapes.  In the third image you can see that the light is more uniform (mainly because the grass has uniform size).   In places with strong light, we see strong shadows; but where the light is softer the shadows are softer and more transparent.   This combination of soft, semi-transparent shadows and harsh shadows gives the image realism.

The first stage

Now that you understand how light and shadow work in a more theoretical sense, let's open Maya and start actually creating our image. This is the image we will create in this tutorial.

I use Maya 7 with a Dell Precision workstation (Athlon Duron processor, 949 MHz, 768 megabytes of RAM). This image took 2.00 seconds to render at 640״80 resolution.

First, let's create a simple scene. Create a plane (either NURBS or poly I'll use NURBS for this tutorial) and sculpt it a little to give it variations in height. This will be our terrain.

Now, let's explore Paint Effects. This is what the Paint Effects shell looks like.

Some of the icons are for selecting different brushes; others are for configuring the brush, or for painting with the current brush, or using the Visor. I will not go too deep into the options here, so feel free to experiment on your own. This is what the Visor looks like.

And, of course, we have the Paint Effects panel in the Rendering set.  This is an important feature, it lets you copy the configuration of one brush to another so two brushes can work simultaneously.

As you will see, you can create a little piece of grass and a large section of it.  You can then configure the small part of grass and update the larger piece's configuration.   This speeds up rendering tests considerably.

Now go to your Visor and select a Grass brush.  Let's start with the grassBermuda.mel brush, this will be our first kind of grass. (I told you before that we need at least two kinds of grass to get a realistic image.

Now we can start the fun part.  Make your terrain paintable (from the Paint Effects shell and the second icon or from the Paint Effects menu option "Make Paintable").   Then, adjust your brush size and start painting on the terrain.  Create two parts, one really small and another the final size; we will configure and test-render the small part until we are happy with the look, and then share brushes between the two to update the large section.

You will need to create a simple material for the ground.  I used a bind with a bump and a single mapped texture something like this.

Don't worry about the light and the shadow at this stage. Focus on the shape of grass that we want. Here's what we have so far.

Well, that's not too realistic, is it?  The individual blades of grass are too wide and too uniform. We need some variations in the shapes of the top of the blade should be thin and the base should be wider.  And we also need to change the shapes and the colors of the grass; but we can leave the shape alone for now so we can see the colors more easily.

I am going for a "mountain" look, so I need randomly placed plants and a somewhat dried, "end of summer" color scheme.   We'll use some dark greens and yellows for the highlights and the top of each blade of grass. But before we change the colors, let's increase the density of the grass to cover the whole terrain. We can do this by opening the Attribute Editor, selecting the general grassBermuda configuration panel, and increasing the density option

There are several other important options available in the Attribute Editor. "Seed" controls the algorithm that created the form and positions of the grass in the terrain. "Display quality" lets you decrease the number of blades of grass displayed in the viewport, but does not affect the actual density. It reduces the real-time load on your computer. Here is the terrain with the density set at 3.2.

Now, let's get back to coloring the grass.  In the attribute editor, open the shading options for the "grassBermuda" stroke.

Shading Options

This panel contains the materials properties for the selected object.  We have both "shading" and   "tube shading" option; keep in mind that Paint Effects involve a lot of experimentation, so go ahead and adjust settings to see how they change the image.  We will set the basic color of the grass here, and if you like, you can set transparency and incandescence attributes as well.



One interesting feature is the ability to use ramps or other texture files in the color, incandescent, or transparency slots; we can even animate the textures. I will not be covering this here, but again, if you would like a tutorial, send me an email.
Past the Shading attribute is Texturing. We will create a texture and apply it to our Paint Effects grass; here we can give it transparency (from a ramp or a fractal), change the color, and add displacement. Feel free to experiment with settings here; perhaps try a checker pattern for the color texture, or anything else that you want.

Here are some renders using different Opacity values

Checker texture (repeat u=3, v=).

The next setting is for illumination, which changes the way light affects the grass. We can either use the scene's lighting or override it with a custom setting. I will not go too deep into this option because I will be working with scene lighting (the "Use Real Lights" option), but you can manipulate settings like translucence and specular reflections if you like.

But what does "Lighting Based Width" do?  Let's experiment with using values of 0, 0.5, and 0.8.

Lighting Based Width = 0

Lighting Based Width = 0.5

Lighting Based Width = 0.8

I am now satisfied with the colors of the grass, so here is the final texture.

The Second Stage

This is a very experimental stage, where we manipulate many attributes and combine values to get a realistic image. This part of the process is largely trial and error; sometimes the default values will work adequately, but you will likely want to change quite a few values. I will explain how to manipulate the shape and form of the grass, as well as what each attribute modifies.

You can see explanations of every attribute if you browse your help panel

You can see how I manipulated my settings to create a thin cross-section at the top of the blade and a wide one at the base.

I also changed the density settings, as well as the thickness of the branches and the little lefts that are in the end of the large blades' branches. I also changed the elevation angles so that I could simulate gravity or wind. A little twist in the branches and some variation in the size and length of each blade and branch also aids realism. Keep experimenting with settings until you are satisfied with the look of your grass

Now we need to add realistic lighting to our scene.  We can either simulate lighting or use "real" illumination.  I personally never simulate lights, but if you want to do so, you can manipulate the "specular power", "translucency" and "specular colour" attributes in the "Illumination Attributes" section, under "Texturing".

About the shadows:  We can simulate shadows, instead of calculating them. This can be useful for large scenes where you want to minimize rendering time. Also, you must use Depth Map shadows (not Ray-Traced), because only Depth Map shadows generate shadows for Paint Effects. Of course, you could always convert the Paint Effects to polygons and use ray tracing, but that would result in a very heavy scene.

Use these settings for shadows:

  • Turn on "Cast Shadows" in the Shadows attribute
  • Use Depth Map shadows - NOT Ray-Traced
  • Turn off "Use Mid Dist" in your light attributes - otherwise you won't get any shadows

You can improve the quality of the strokes by checking "Oversample" and "Oversample Post Filter" in the Render Globals panel

Here you can see the rendered image with basic light and shadows.

Now that our grass is ready, we will share the brushes so that the whole terrain has the same configuration.  I work this way to save memory during the configuration process.

Before Share brushes:

After Share brushes:

' '

Final Stage

The scene is almost complete! We still have another kind of grass to add, so use the same method as before and put in a second variety. Use any kind of brush you like

Now you can change the camera view and adjust the render settings in the Render Globals panel. I used "intermediate quality" with Maya Software, with the "Oversample" and "Oversample Post Filter" options turned on, along with some basic shadow settings

It still needs a little tweaking, so I adjusted the light and shadows and some colors.  I also created a simple animation.   (If you want a tutorial on Paint Effects animation, just send me an email and ask for it.)  Here's the final result


I created this image in less than three hours, and the render time was two and a half minutes. Paint Effects is a really useful tool, as you can create not only terrain but also fluids and particles -- or just about anything you can think of.
I hope you enjoyed this tutorial. Please send any comments, suggestions or corrections to Thanks

Fetching comments...

Post a comment