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

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

In the first part of our tutorial, we modeled the grass stalks and prepared our geometry for texturing. In this second part, we will complete work on our materials and learn how we can use the Mograph module for distributing our tall grass stalks around on the ground.

Tall Grass Material

We'll be creating three materials for the tall grass from last tutorial. First we'll do the stems, then the leaves, and finally the seeds. And don't worry; it will be quite easy.

First, save these two images to your local drive. The first is our grass stalk; the second our seed alpha.

0102

Create a new material, and in the Color channel load a new gradient shader, set to 2D and in the V direction. As it turns out the UVs on our SweepNURBS object are upside-down, so the right part of our gradient will line up with the bottom of the stalk, left with the top. We'll create four or five color knots. I used there next settings: 206, 221, 172 at position 0%; 139, 162, 124 at position 33.4%; 123, 125, 79 at position 65% and 89, 92, 52 at 100%. (The texture panels are shown for guidance.)

30

We're going to use Turbulence; set the value to 17% and Scale to 100%. Now go to the Specular channel. Set the width value to 100% and height to 20%. Our goal is to create a simple, dry look, so we want an undramatic specular. If we were doing close-ups on our leaves, of course, we'd be more interested in specularity and use specular maps and the likes, but in that case a number of other things would change also. Since our focus is to make grass for medium-distance viewing, we can conserve resources and time on some settings.)

31

Lastly to the Illumination settings, and set the Model to Oren-Nayer, a much better algorithm for rough surfaces like grass stems. The render hits from Oren-Nayer and its sibling Blinn were, for a long time, a deterrent to their use, but with current machines, my advice is to go for it. The visual impact is very much worth it.

32

Leaf Material

For the leaves we'll use a bitmap texture I created in Photoshop, free for use (just save the image to your disk). Make a new material and load my texture into its Color channel. At this point you might want to add some noise to the texture. Do this by creating a Fusion shader. Now look at the Base channel in the Fusion--by default C4D will have made the leaf bitmap the Base shader in the Fusion, a nice workflow gift from our friends in Friedrichsdorf. In the Blend channel at the top add a Gradient shader, set to 2D-V again, three knots at, left to right, 171, 153, 80 at 0%; 217, 130, 43 at 50%, and pure white at 100%. Back up in the Fusion settings, we'll use Multiply mode at 50%. It's also perfectly fine to use a Layer shader here; I use Fusion out of habit dating to the days of Smells Like Almonds.

33

Now to the Luminance channel. Again load our leaf bitmap (it'll be in the Bitmaps submenu), and again create a Fusion shader. This time in the Blend channel we're going to use a Backlight shader (Effects>Backlight), which was purpose-built for situations like this. Set the color in the shader to white and all other parameters at default. Back up in the Fusion set the Mode to multiply again. The best quick explanation for using the Backlight shader is that it creates a good full-object translucency fake. Imagine an Indonesian puppet show. In nature, many leaves exhibit this kind of translucency with respect to shadows, thus the Backlight shader.

37

Next to the Bump channel. Load a Noise shader and leave the type as the default, Noise (as opposed to Poxo, Pezo, Buya, etc.). Set the Projection to UV (2D) and the Global Size value to 320. Set the X size to 20, Y to 800. Back up to the main Bump window, set the intensity to 15%.

34

Down to the Specular channel now. Set width to 75% and height to 15%, same reason as above.

35

Finally to the Illumination settings, and again we're going to use Oren-Nayer.

36

Seed Material

This last material is quite easy. Rather than create a new material, simply copy the Leaf material we just created. In the Alpha channel, load up the second bitmap texture you saved above, the black-and-white image. Untick the Soft setting. Copy that texture channel (Texture>Copy Channel), and in the Luminance channel delete the Backlight and do a Texture>Paste Channel to drop in our copied bitmap. All other settings leave the same.

38

Now apply your materials to all your objects, leaf mat to the leaves, stem mat to the stems, and seed mat to the seeds (which should map perfectly because of the work we did in Bodypaint in the last lesson and the fact that I created the Photoshop file to proportion).

Last check: at this point make sure that your stem material isn't mapping upside-down. If it is, go into the texture tag and set the Y length to -100 percent.

Preparing to Clone

Before distributing our stalks, we should take a few steps to add some realism. First, nest your tall grass hierarchy in a Null object, named appropriately (pay attention to naming--it'll save your life).

If we clone our tall stalks across our landscape now, we risk having it all look too regular. Fortunately we can easily vary our tall grass. Simply create a few new copies and make changes here and there. In some copies, remove the seeds from one or more of the stems. In others the bend can be different. In others you could have two stems, in others four. In still others the leaf arrangement can be different. Once you have the stems built and textured, it's quite simple to do variations on the theme. The only caveat is to leave all your objects at 0, 0, 0.

Lastly, here we have an option: to convert to polygons or not to convert to polygons. Once you're happy with the looks of your stalks, and once you've saved backup copies (by all means don't forget that), you gain two advantages by hitting the magic C key: firstly it's easier to scale them, and secondly its easier to share with other people who may not have the Hair module. In the case of scaling, some of the Hair material settings require you to root deep into the settings for thickness, length, etc., when scaling. Just one note if you decide to convert to polygons: make sure to delete the Hair tag from your objects after converting them.

Cloning the Tall Grass

Now that we have our variations, distributing them is simple. The secret is the brilliant Mograph module. Make a new Landscape object with an X and Y size at 400 and subdivisions at 30. Convert this to polygons.

Now create a new Cloner object. Save your file. Saving first is important whenever using Cloner because you can easily find yourself with a polygon count that chokes your machine's RAM, with no option but to force-quit and no hope but that you saved just before adjusting your cloner settings. Which you now have. As another aside, I'll clear up in advance a possible source of confusion: there are two settings named 'Mode' in the Cloner object's Object tab. Odd, eh? I'll refer to them below as 'cloning Mode' and 'distribution Mode' respectively.

Having saved first, child your Tall Stalk nulls under the Cloner, cloning Mode as 'object,' the Landscape object into the Object field, distribution Mode as Random, and use your own judgment as to the Count. Be conservative at first--no need to crash your machine until you know what it can handle. Maybe try 40 to start with, a good count even for older machines.

39

Why all this tweaking? The goal is to have our Cloner work as randomly as possible. It'd look wrong to have our stalks arranged according to how they're arranged top-to-bottom in the Object Manager (as would be the case with the Iterate distribution Mode). The Random distribution mode tells the cloner to pull randomly from the children inside it rather than in order.

Having done this, right away you'll see that your clones are aligned wrong. To fix this select the Cloner and create a new Target Effector. Because you had the Cloner selected, the Target goes right into the Cloner's 'Effector' space; if not, drag it there manually. In the Target effector's attributes, set the Target mode to Object and switch off the Use Pitch tickbox. Now the clones are doing the right thing.

40

Select the Cloner again and create a Random Effector (again this makes the Effector active for the cloner). Select the Random effector and in the Parameter tab turn off the Position tickbox and turn on Scale and Rotation. Set Scale to Uniform and Absolute, and set the Scale factor to -.35. Set rotation to H: 360, P: 15 and B: 15. The upshot of this? Now our clones are even more varied. We just added scaling variation and rotation variation, mostly around the H axis. And now our first test is complete. How do your clones look?

41

Cloning only Where We Want to Clone

Now as a more cultured approach to cloning, let's go a step further. On the Landscape object, use the Polygon mode/tool and the Live Selection tool to select the actual polygons in the areas where you want the grass to be. In a sense, this is just a 'best practice' for optimization, because if we have a cow on the grass, for example, there's no reason to have our grass cloning under the cow where it's not seen. That's a waste of polygons not to mention prickly for the cow. Once you've selected your polygons, do a Selection>Set Selection. Select the Cloner and drag the Polygon Selection tag you created into the Cloner's Object tab's Selection field. Finally, to change how your clones are arranged, just change your Seed number in the Cloner's Object tab.

Did nothing happen? Not surprising, as this is a little quirk in the system. Just set the Clone count up +1 and then back down, and the scene should refresh.

Another possible quirk: Why don't you have 40 instances? Well, we're using less of the total area now. Let's say we selected 50% of the Landscape object's polygons. That means we're getting 50% of the clones, or 20. Strange, yes, but the answer is simply adjusting your clone count.

42

Now you have a field of tall grass. Congratulations! Quite a good start to a scene. And with that we finish our work today. The last task before us is to make our low grass, which will be fully generated via the Hair module, as we'll describe in the third and final part of our tutorial.

Matúš Laco

Komentáře k článku  

Přihlášení uživatele