Making Realistic Grass with Cinema 4D (with a little help from Mograph and Hair), 1st part

18.1.2008· Autor: Matúš Laco· Přidat komentář

No "Keep Off the Grass" signs here. Cinema 4D´s Hair module is a fantastic tool for creating all manner of organic objects. In this advanced tutorial Pavel Zoch, aka PZDM and Richard Powell (translation) show us a method using Hair and Mograph to go beyond simple techniques to create grass with greater realism and variety.

As the Cinema 4D world has known from the minute it was released, the Hair module is an amazing tool for more things than just hair. Both feature-rich and simple to use, it makes a powerful tool for all things organic. It's easy enough to use it for simple grass (that task is demonstrated by Maxon's beginner tutorials), but there are many other uses--trees, bushes, flowers or any kind of fauna. To create such things with an eye towards realism is another thing altogether. Like most things in Cinema 4D, it's not difficult. It just requires that the user bring to the task a good eye and a bit of finesse in using the tools.


So to our purpose here: this advanced tutorial will demonstrate a method of creating realistic, render-friendly grass. We'll do that by interspersing lower, simple grass with scattered, taller, more complex stalks. We'll also show you how to distribute the grass, both procedurally by means of the Mograph module and by pushing geometry around by hand.


Building the Tall Stalks of Grass

Start by making a B-spline curve made of 3 points. Place the first point at world origin, 0, 0, 0 and the last at 0, 85, 0. Put the middle point roughly halfway between, and then make the full spline arc gracefully to one side by going into a side viewport and moving the top point to the right and the middle point a little less to the right. In other words, make it look like a stalk of grass. But we need more than one stalk, so now we'll create two more stalks. Rather than hand-draw them, we have a trick.


Stay in the side viewport, and with all three points selected, go to Structure>Mirror. Before doing anything with the tool, turn off the 'Snap to Points' option. Now you're ready to click in the window, and viola, you've created a new segment of your spline. It's still one spline object but with two independent segments. Now do it again--you'll have a third segment. Why are we doing this rather than draw new splines? Because this way we'll end up with only one spline object, and thus we'll only need one SweepNURBS object when we come to that step. The Mirror method is more elegant and economical. Last step: set the spline to Natural with 5 Intermediate Points.




Now create a SweepNURBS object and a new N-side spline primitive. Set the N-side object to the XY plane, the radius to .25 units, and leave the subdivision at 6. Child the spline and the N-side spline primitive under the SweepNURBS object in the order shown in the image, with the N-side as topmost child. Turn off your SweepNURBS caps. Next, to the Object tab, and twirl down the Details section and make a ramp shape in the scale parameter (see image). You do this by clicking in the grid, which creates points on an 'attribute control spline' which determine how the sweep profile scales along its length. For additional control, right-click on the word 'Scale' and select 'Show Subchannels.' In this hidden miniature wonderland you'll see several options, including the ability to adjust the tension of your control spline's points. I prefer the tension low here, for a graceful curve of a B-spline interpolation. With that, we've completed our grass stems.



Now we need a seed for the top of the stems. Before we're through, this will involve a quick visit to Bodypaint for UV maintenance. But first we'll create the geometry for our seeds. We're going to use alpha-mapped images here--no need for worrying about the complex geometry of rye grass germ unless your camera is going to move within centimeters of a seed pod, which ours won't be.

Start by duplicating the stem SweepNURBS hierarchy and rename it with the word 'Seed' in its title (use whatever naming convention suits you). Then double-red the Seed SweepNURBS so that we can do some spline-work to replace its profile spline.

Go to the Front viewport and create a linear spline with two points, the first on the left, second on the right. Select both points and in the coordinates manager set the size to X: .75 and Y: 0 respectively--a flat line. Now for the Mirror trick again. With both points selected, this time reflect them across the Z axis. By doing this you'll get a cross shape. Adjust the X and Y size of this mirrored copy to .75 and the XY position to 0. See the image for reference. You've created a cross-shaped profile onto which we'll map the seed alpha.



Delete the N-side profile spline in your Seed SweepNURBS and replace it with this cross shape. Reactivate the Sweep (i.e., double-grey it). In the Attributes Manager, go again to the Object tab>Details. In the Scale section, click on the curve with your right mouse button (RMB). Select the Maximum option. This will remove the scaling of our Seed SweepNURBS along its path, which was necessary for the stem but not for the seed.


Now select the Seed SweepNURBS in the OM and hit the C button to convert it to polygons. We don't need the full length of the sweep, just the top, so using the Live Selection tool in point tool mode, select and delete the bottom points so that your remaining geometry looks like what you see in the image. This is the 3d staple known as 'crossed billboards,' used since the beginning of time for alpha images of trees, leaves, and other objects too dense for real-time rendering. We're going to use the crossed billboards for our seed pods.


Now for the BodyPaint. Why BP? Because SweepNURBS have sideways UVs, so we need to rotate them 90 degrees. First switch to the BP 3D UV Edit layout. Though we're in BodyPaint now, we need to select the polygons of our seed pod, so up in the Tools menu, go to C4D Tools>Polygons. We're using the modeling polygon tool. Switch to the Live Selection tool and tick the 'Only Visible Elements' option. In the viewport, select any polygon and do a U>W (select connected) command. Now in the UV Canvas, choose Show UV Mesh. In the UV Mapping>UV Commands tab hit the 'Fit UV to Canvas' button. In the Transform tab, rotate 90 degrees. Repeat these quick steps for each of the polygons remaining, i.e., repeat six times. We're prepared to apply the alpha texture of the seed cap, but we'll put that step aside for a moment and go into the leaves.


Select the first SweepNURBS object we created, the Stem SweepNURBS, and go to Hair>Add Hair. In the AM for this new Hair Object, go to the Guides tab and pull the number of guides down to something between 30-35, set guide segments to 8, and lastly set Guides Length to 8. The mess of guides in your viewport should be somewhat reduced now.



But creating guides is not enough; we need to create the actual hair. Specifically, we need to generate one Hair object on each Guide. Go to the Generate Tab and change the Type option to Flat. In the Alignment settings, pull the Align menu down to Look Y. All the leaves now aim at the sky. Close, but we need to change the Hair count also. So lastly, go to the Hairs tab and in the Roots section and set the Root pulldown to 'As Guides.' The hair is very close to becoming a leaf.



Back when we created the Hair object, Cinema also created a Hair material by default. Open this material and go to the Thickness channel. Set the Root and Tip size to the same value, say, 1.2. Below we have our old friend the Curve grid, where we can create a spline shape that will determine the shape of our leaves. Like before, you can go to Subchannels and change the tension of the curve if you like. Look at the image for the rough shape you're trying to achieve.


Now let's vary the leaves a bit more. One of the brilliant features of the Hair module is that we can easily vary things for more reality. In this case, let's make the lower leaves thicker than the higher leaves. All it takes is a 2D gradient. In the Thickness tab of the Hair material, load a gradient shader into the Texture field. See the image for how to arrange the knots, and make it a V-direction shader (which you can do by pounding down into the Gradient control, same place you adjust the knots).


Now copy your gradient and paste it into the Length channel. It works the same way--varying the lengths of the leaves based on how high they are along the stem. These are the only channels we need in the Hair material; you can switch off all the others.


Now for the last task. Go to the Hair>Tools>Brush tool. We're going to do some 3D hair sculpting. Start out by putting the Brush on Delete mode and carefully remove the hairs that protrude from the tips and the roots. We don't want leaves coming out of those places. Next go to Move mode and sculpt your leaves. This is a time to play around and free-form with the tool, and don't forget that you can work in many different modes by going to the Hair menu at the top and choosing from Mode>Tips, Roots, Points, Guides, Vertices, etc. If Undo doesn't give you enough permission to play to your heart's content, you can also use the Smooth or Straighten mode to put things back the way they were. You can look at the final images in this tutorial to see how you might want to make your leaves look.




Once you're happy with this improvisational brush portion, the model is finished, as is this first portion of the tutorial. Next up: we'll solve a materials issue and distribute the grass.

Bye, Pavel, and Richard Powell

Matúš Laco

Komentáře k článku  

Přihlášení uživatele