Total Pageviews

Saturday, February 5, 2011

vray grass


Here is a tutorial on how to make grass within Max, based of Peter Guthrie’s excellent example (www.peterguthrie.net/blog/2009/03/vray-grass-tutorial-part-1/), but taking it a little further and applying this idea in bulk with Max’s built in tools.
The basic work flow is to model a very simple grass blade, make a cluster of grass and scatter across any object. Here is a example we (www.squintopera.com)used this technique in to give you an idea of the finished effect;www.jamesshaw.co.nz/#/content/Film/Cairo.flv/
Here is a couple of base CG beauty passes to give you an idea of the raw result before any post work has been done on it;
shot080shot110

MAKING GRASS STRANDS
As previously mentioned this is based off Peter Guthrie’s tutorial with a few variations or notes to expand on this idea.
Firstly make a plane with 1 segment across and several in the length direction. Then add a length-ways UVW mapping, taper and using an edit mesh above this with soft select on vertex warp to a shape you like or several variations you can make into a group.
grass_01

MATERIALS
Collapse the stack into an edit mesh. Then rotate the 4 strands into different directions by selecting and rotating the different elements. Then randomly set 4 id’s for them. This is so you can subtly change the colour with a colour correction within you multi-sub material.
grass_02
Then make a multi-sub object material with 4 vray materials.
grass_03
And within each multi sub make a VRay2SidedMtl like the following. You can also use the following grass textures by clicking on them and right click and save image. There’s a black and white one that you can use as an option for the translucency channel. But you can just leave this blank if the grass is at a distance and leave it grey.
The VRay2SidedMtl really is one of the most important things to use to get the light illuminating through the blades. Otherwise your grass will tend to look very flat.
grass_04grass_bladegrass_blade_opacity
Inside this VRay2SidedMtl sits a pretty simple vray material with the above grass blade in the diffuse channel (thank you Peter Guthrie for originally making this), with reflect set to white and Fresnel checked so it doesn’t look like chrome. Then adjust the Hilight glossiness to 0.6 which will help to spread the specular light you get off the grass. Again this is another very important part to make the grass look convincing. And unlike Refl. glossiness it will not be costly in render time and look almost identical, especially at typical grass distance.
grass_05
To get variation in the grass tone change the bitmap diffuse channel to “Colour Correction” with the grass blade jpeg as the map, then shift the hue and saturation as follows differently for each of the 4 material id’s.
grass_colour_correct

MAKING AN AREA OF GRASS
Now you have your clump of grass you can use this to populate surface. I found using individual strands was difficult, as the scatter we will use only really does up to around 70,000 instances before becoming a bit unstable. So if you use a clump of grass then you can spread further with less. Other options of scattering grass include pFlow and vray scatter; which I’ll go over later.
So now make a plane or use splines to create a free form extruded shape, or even detach a polygon from a surface to make a start. Remember when you extrude though to extrude 0 amount and only cap one end otherwise the grass will go underground as well. Also watch with way your normals go.
To make a scatter object of grass do the following:
  • Make a compound object (on the create tab) with the grass selected and choose scatter.
  • Then pick the plane as the distribution object.
  • Change the duplicates to 1000
  • Distribute using area
  • Change rotation to 360 in the Z to mix up the direction. You can just limit this to 180 or 90 to simulate wind in a particular direction depending on the way your grass clump faces.
  • Change scaling to 25% for all XYZ to give some variation
  • Show Mesh with 100% to see exactly what will render, and when happy with the result change this to 10% and proxy to speed up your viewport.
Now you have a grass patch. The following is an example of how you can change the grass size on the sub-object scale and even add other simple plane flowers etc to add detail (click on it to enlarge). You can even mix grasses and flowers by using the same distribution object. Simple and no money spent… apart from Max of course.
grass_varieties

ALTERNATIVES TO SCATTER
There are other ways of distributing grass. Peter Guthrie mentions the excellent VRay Scatter (www.rendering.ru/index.php/plugins/vrayscatter/), which has the advantage of varying colours more randomly then a multi-sub will do, and also varies the scale by a greyscale bitmap. The scatter method above has no method like this for varying and blending heights. The only problem is it’s a bit buggy (as if Max isn’t!), and it costs.
You could also use PFlow. I’ve had a quick go with this, but haven’t managed to vary the scale by a bitmap yet like VRay Scatter will do, just done density by material.
You will need a group of different grasses and some type of mesh as a distribution object. And obviously create a PF source and click on Particle View to get the following image.
Here’s how you might do this…
grass_pflow
  • Birth 3000
  • Add a Position object, and add distribution object and you can use a greyscale image on a standard material to drive the density of the plants. You will have to view this standard material in a shaded viewport then activate. Weird I know.
  • Rotation random horizontal, divergence at 180 and tick restrict diverg. to axis Z (1.0)
  • Add Shape Instance and pick the group and tick “group members”. Scale variation 50%, and if animated tick animated shape and offset the timing by random 7 frames or whatever suits your animation.
Hope that may help someone out there! Enjoy.

No comments:

Post a Comment