Graphics Programs Reference
In-Depth Information
Creating a grass shader
In this recipe, we will create a generic grass shader using grass leaves meshes in-
stanced on a particle system, as shown here:
Getting ready
Start Blender and open the
1301OS_07_grass_start.blend
file, where there is
an already set scene with an emitter plane working as light source, an uneven plane
to perform the ground, and several grass leaves objects grouped and instanced on
the ground plane by a particle system.
How to do it...
Let's start by assigning a ground material to the ground plane and with the creation of
the grass shader working on the grass blades meshes to be instanced:
1. Select the ground plane and click on the
New
button in the
Node Editor
window's header or in the
Material
window to the right. Rename the ma-
terial as
ground
and set the
Color
value of the
Diffuse
shader to
R 0.141
,
G 0.082
,
B 0.031
.
2. Select one of the grass leaves objects and again click on the
New
button
in the
Node Editor
window's header or in the
Material
window to the right.
Rename the material as
grass
.
3. Box-select (press
B
and drag with the left mouse button pressed) the other
grass leaves object and then press
Ctrl
+
L
. In the
Make Links
pop-up
menu select
Material
to assign the
grass
shader to all the selected ob-
jects.
4. In the
Material
window, switch the
Diffuse
shader with a
Mix Shader
node. In the first
Shader
slot, select a new
Mix Shader
node and in the
second one, a
Glossy BSDF
shader node.