Doing archviz work, you're bound to run in a situation where you're going to need some natural / organic elements to fill up your scene. Of course, there's a quite a few plant libraries available to buy, but sometimes it's nice to have techniques to make your own stuff. Not only is it cheaper, but it grants you more control over the final look of your renders.
Rather than modeling each individual blade, I found a way to get similar results using just modifiers. This, in turn, allowed for the process to be automated into a script. And so the Grass Generator was born.
Scattering individual grass blades however, isn't very optimal in scenes where large areas need to be covered in grass. So after the blade creation algorithm was finished, it was time to add functionality to create patches of grass ready to be scattered with plugins such as Multiscatter or Forest Pack.
The Grass Generator interface
At first glance, there's two sets of controls present in the interface. Grass Blade Settings and Grass Patch Scatter Settings.
Grass Blade Settings
With the parameters in the Grass Blade Settings you can control the look of the grass blades themselves.
Amount of Unique Blades controls how many different blades will be generated, the more of these are present in your grass patch, the more randomness you'll have.
Length, Width and Bend will control the look of the individual blades. Random values between the set minimum and maximum will be used. The Lock button allows use to use a set value (min) instead of a random one.
Cut Grass allows you to simulate a mowed lawn type of look. UV's are also automatically cut off at the specified length. Note that the cut length can never be longer than the blade length.
Grass Patch Scatter Settings
These parameters will control how the individual blades are scattered to create a grass patch. The checkbox on the right turns scattering on and off, allowing you to keep the individual created grass blades if you so desire.
Grass Patch Scatter Radius does exactly what it sounds like. This setting will control how large your patch of grass will be.
Grass Patch Scatter Density gives three options for how many blades are created per patch. This amount scales automatically depending on how big the patch is and how dense you want it to be.
Blade Random Rotation controls the rotation of the blades in the patch starting from their base.
Blade Random Scale adds a random scale percentage to the individual blades, again starting from the base of each blade.
Random Material ID's allows for each blade to be assigned a random material ID starting from 1 to the selected number. (ie. If the standard of 3 is selected the grass blades will have ID's 1, 2 and 3)
- Run the script in Max.
- Look for the category "DAZE" in the "Customize user interface" section.
- Add the "GrassGen" command to a toolbar / quadmenu.
- Click it and have fun!
Grass Generator v1.0 has been tested in 3ds Max 2013 and 2014, but should work in a few earlier versions too.
If you've come this far, congratulations! In the next section I'll explain how the grass is generated. This is the technique I mentioned earlier.
Step 1: Setting up the plane
First you'll create a plane with 1 width segment and a few (in this case 5) length segments. Using this method ensures you have correct UV's for use with a basic grass texture (such as the one linked in Part 2 of Peter Guthrie's tutorial), without having to set them manually. (Make sure "Generate mapping Coordinates" is enabled in the plane's options.) After centering it in the scene, you'll then turn it 90 degrees on the X axis.
Move the plane up until a small part of the bottom is sitting under 0 on the Z-axis. Then position the pivot point of the plane on [0,0,0]. (See screenshot)
Step 2: Adding modifiers for the basic shape
In this step you'll add the first two modifiers to start giving our grass the right shape. The first one is a Taper, with the amount set to a negative value (-0.8 in my case). Make sure to set it' primary axis to the Y-axis, otherwise the plane won't deform at all.
Next, add a bend modifier to simulate gravity making the grass blade hang down a little. For this to give you the correct result, you'll have to change the Bend Direction to -90 and the Bend Axis to Y. Setting the Bend Direction to -90 is important as the front facing polygons will be aligned correctly. Bend Angle is, of course, set to your preference. Your plane should now look like the screenshot.
Step 3: Meshsmooth
As the name of the step suggests, next you're going to add a "Meshsmooth" modifier. Not a Turbosmooth!
Meshsmooth has a Subdivision Method called "Quad Output". When this is used on the geometry you created it will add a "dip" in the middle of the mesh, which brings you closer to the shape of a grass blade.
If you turn off the "Isoline Display" option in the "Local Control" rollout, you'll be able to see the effect more clearly. This little dip really adds to the detail of the grass reflection.
You can leave the Subdivisions set to 1 and the Smoothness set to 1.0
BONUS 1: You can add a "Relax" modifier to accentuate the dip even further. In the script the Relax Value is set to 1.0 and the iterations to 1. Make sure you leave "Save Outer Corners" checked or your mesh will start to deform, losing the blade's shape.
BONUS 2: Add a Turbosmooth modifier to smooth out the final shape.
And that's it! :)
Now, you might ask yourself what the advantages of this method are, rather than just modeling it yourself. In my opinion, flexibility. Doing things this way allows you to quickly generate different variations, without having to model each one individually. It also allowed me to automate the process into a script, making the process even faster.
If you've read this far, thanks, that's it for now. I hope you enjoy using the script and I look forward to seeing your results. If you'd ever like to suggest features or would like to work with me on improving the script, be sure to click on the version number for my details.