Creating tree shaders – the leaves

In this second tree recipe we will create the leaves shaders, as shown here:

Creating tree shaders – the leaves

Getting ready

Carrying on with the blend of the previous recipe, now press Shift and activate the second and the eleventh layers also and select the leaf_generic_mid object.

How to do it...

Let's go straight to creating the leaves shader:

  1. Click on the New button in the Node Editor window's header or in the Material window and rename the material as leaf_alpha.
  2. In the Material window switch, the Diffuse BSDF shader with a Mix Shader node and rename it as Mix Shader Cutout. In the first Shader slot, select a Transparent BSDF shader node and in the second one, a new Mix Shader node that will be renamed as Mix Shader Add Translucency.
  3. Add an Image Texture node (press Shift + A and go to Texture | Image Texture), rename it as MASK, and connect its Alpha output to the Fac input socket of the Mix Shader Cutout node.
  4. Click on the Open button of the Image Texture node, browse to the textures folder, and load the leaf_generic_mask.png image (which actually is a simple black silhouette of a leaf, with a transparent alpha channel). Set the Color Space to Non-Color Data.
  5. Add a Diffuse BSDF node (press Shift + A and go to Shader | Diffuse BSDF), a Glossy BSDF node (press Shift + A and go to Shader | Glossy BSDF), and a Translucent BSDF node (press Shift + A and go to Shader | Translucent BSDF).
  6. Add two new Mix Shader nodes (press Shift + A and go to Shader | Mix Shader) and rename them as Mix Shader1 and Mix Shader2.
  7. Connect the output of the Diffuse shader to the first Shader input socket of the Mix Shader1 node and the output of the Glossy shader to the second one. Set the Glossy shader's Color value to R 0.794, G 0.800, B 0.413 and the Roughness value to 0.500.
  8. Connect the output of the Mix Shader1 node to the first Shader input socket of the Mix Shader2 node and the output of the Translucent node to the second one. Connect the output of the Mix Shader2 node to the second Shader input socket of the Mix Shader Add Translucency node.
  9. Connect the output of the Diffuse shader node to the first Shader input socket of the Mix Shader Add Translucency node. Set its Fac value to 0.300 (this value establishes the amount of translucency in the shader).
  10. Add an Image Texture node (press Shift + A and go to Texture | Image Texture), rename it as TRANSLUCENCY, and connect its Color output to the Fac input socket of the Mix Shader2 node. Click on the Open button, browse to the textures folder, and load the leaf_generic_trans.png image. Set the Color Space to Non-Color Data.
  11. Add a Fresnel node (press Shift + A and go to Input | Fresnel), connect it to the Fac input socket of the Mix Shader1 node and set the IOR value to 1.500.
  12. Add an Image Texture node (press Shift + A and go to Texture | Image Texture), rename it as COLOR, and connect its Color output to the Color input socket of the Diffuse shader node and to the Color input socket of the Translucent node. Click on the Open button, browse to the textures folder, and load the leaf_generic_col.png image.
  13. Add a Hue Saturation Value node (press Shift + A and go to Color | Hue Saturation Value) and paste it between the COLOR node and the Translucent shader node. Set the Hue value to 0.350 and the Value to 2.000.
  14. Add a last Image Texture node (press Shift + A and go to Texture | Image Texture) and rename it as BUMP. Add a Bump node (press Shift + A and go to Vector | Bump) and connect the Image Texture node's Color output to the Height input socket of the Bump node and the Normal output socket of the latter to the Normal input sockets of the Diffuse, Glossy, and Translucent nodes.
  15. Click on the Open button, browse to the textures folder, and load the leaf_generic_bump.png image. Set the Color Space to Non-Color Data and the Bump node's Strength value to 0.002.
    How to do it...

How it works...

  • From step 1 to step 11, we built the basic shader of the leaf, using an alpha channeled image to "cut-out" the leaf shape on the plane and a gray-scale image to drive the translucency effect.
  • From step 12 to step 15, we added the color of the leaf, using it also with a hue and intensity variation for the translucency effect. Then, we added the bump, keeping the amount very low.

There's more...

Now, assign the same material to both the leaf_generic_low and leaf_generic_hi meshes on the eleventh layer.

The modeled leaf mesh doesn't need the alpha channel. So, select the leaf_generic_hi object and in the header of the Node Editor window, click on the user data number to make it single user. Rename the new material as simply leaf and delete the MASK and Transparent BSDF nodes. Press Alt + D to remove the Mix Shader Cutout node from the link and delete it as well.

Remember that the examples in the preceding and following images are made with very stylish models coming from the Big Buck Bunny short movie. Real objects have more subtle details and more randomly repeating patterns, but in this case this just depends on the image textures you are going to use for your material.

There's more...

Such a shader is of good use not only for leaves but also for other kinds of plants. In many cases, it's enough to give variations to the color.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.249.37