Archive for the ‘displacement’ Category

I’d been wanting to do this for some time now. I wanted to create a grass shader that would work for every situation. Whether the camera was 500′ or 5′ from the ground the grass would look good.

mental ray grass shader

There were alot of factors I wanted
to consider when creating this shader. When the camera was far away from the grass I didn’t want it to look like repeated tiles of the same grass map. Rather I wanted it to have that random field look, as if you were in a plane looking down of the world. So I created an image map from an aerial photograph of what grass would look like from 500′ in the air. From this distance I also knew that having displacement on the grass would be useless from so far away, so I put a falloff in the displacement slot based on distance. So at this distance, displacement wasn’t even calculated.

When the camera came closer to the grass, then it would displace the shader. The close up grass also uses a different grass map from the far away grass. For the far away and close up grass, both of them also have a falloff that simulates atmosphere or grass blades on the horizon. So as the grass gets further from the camera the color fades out and gets lighter.

You could use this for v-ray as well, but it’s really optimized for mental ray with the mr photographic exposure control (the reason the maps in the output are so dark). I put together a diagram that shows how exactly I created this shader if you’re curious.

Here is the max file (max 2008) with the grass shader.

If you are using v-ray and don’t use the VRayDisplacmentMod, then you should switch to mental ray! I use both, but v-ray is very powerful at performing geometric displacement, and is superb at creating organic objects; even grass looks good with displacement. Mental ray is good at displacing small polygons of geometry, where V-ray is good at displacing detail over large polygons. For this reason v-ray 1.50 sp1 is much more successful at creating grass for very large sites; a big plus!

A torus-knot with VRayDisplacmentMod modifier (light cache & irradiance map with 2 vray area lights)

The shader is simply just a VRayMat, with a grass map in the diffuse slot. Then I applied the VRayDisplacementMod modifier to the object. I instanced the image map from the shader into the displacement modifier.

VRayDisplacementMod settings:

• For something like grass it’s very important to use 2D mapping rather 3D mapping.

• I instanced the image map from the shader into the Texmap.

• I changed the amount to 4” to have taller grass blades.

• I increased the resolution to 2048 for better quality.

Voila, beautiful grass!

(notice the render times)