Foliage Shader Brief Overview

The Foliage shader is a specialized shader to be used with the models to give them a foliage look. We’re talking not only about the ones made entirely using the Foliage Generator tool, but also other models run through Foliage Generator, including primitives, letters, monkeys, everything you usually want to cover with leaves.

Quibli Foliage Shader Interface. Quibli Foliage Shader Interface

It is highly recommended that you opened, for example, the Plants demo scene, located any of the plants in the Hierarchy panel and experimented with its own material, which carries the Foliage Shader. Please, remember that all parameters have mouseover tooltips. If you find any of them unclear, please, shoot us an email an we’ll try to improve them.

A brief tutorial on creating and shading a basic plant in non-billboard, billboard ‘Each Face’ and billboard ‘Whole Object’ modes

Beginning to Work with the Foliage Shader

  1. Create a material;
  2. In the Inspector panel, in the Shader drop down menu choose Quibli ▶︎ Foliage;
  3. Now you can apply this material to an object on the scene or to a prefab.

Parameters of the Foliage Shader

Coloring Parameter (Gradient)

Shading Gradient Opens the Gradient Editor where you can choose the colors for the material.

The same Gradient Editor is available for the following shaders: Stylized Lit, Foliage, Skybox, Cloud3D, Cloud2D. You can find the detailed explanation of the Gradient in the ‘Gradient’ sub-chapter of ‘Stylized Lit shader’ chapter

Texturing Parameters

  • Shape Texture Here you can choose the texture by which the alpha is cut out using the Alpha Clip parameter. You can view this texture as the overall shape of the plant’s branch (a particle — the particles are described in the ‘Parameters’ section of the Foliage Generator chapter in this manual). Only red channel of the texture is used, which can be set in the texture’s import settings (select the texture and set it in the Inspector panel).
  • Alpha Clip Sets how much to cut out from the texture. The slider is a color darkness threshold at which the texture is being clipped. The texture should be black and white — where the black-colored part is being cut out by the shader. It is better if the black part is around the leaf / branch part and has some gradual spots inside. It is better to see the examples in the included Common Textures folder.
  • Fill Texture This is a detail texture to be used over the branch / particle defined by Shape Texture.
  • Fill Impact Sets how visible the Fill Texture is. Higher values make the texture more visible and shift the Shader Gradient.

Apart from its texturing purpose, Fill Impact is useful for making the Particles intersections less visible, particularly, in Billboards in Each Face mode.

  • Fill Scale Sets the scale of the Fill Texture.
  • Offset Along Normal Slides the particles along the normals. Visually it ‘inflates’ or ‘deflates’ the mesh. Offset Along Normal works only when billboards are active: when in the Billboard Rotation parameter Each Face or Whole Object are selected.

Additional Coloring Parameters

  • Fresnel Power Sets the visibility of the fresnel property of the object. The fresnel effect provides stronger reflection on the flatter view angles (think edges of mesh, contour of the sphere) and weaker reflection in the steeper view angles (center of a mesh).

A chart about fresnel

Fresnel effect

  • Fresnel Color Defines the color of the fresnel effect.
  • Shadow Strength Controls the intensity of the self-shadowing effect. In the Shader Graph, there is no easy possibility to reduce the self-shadowing phenomenon. This parameter is our attempt at overcoming this limitation.

Wind Parameters

The Wind part of the shader allows you to apply a shader-based displacement to the mesh(-es) the material is applied to. The movement is reminiscent of grass bending in the wind.

  • Wind Toggles the Wind section of the shader.
  • Wind Direction The direction of the motion.
  • Wind Speed How fast the material displaces the object.
  • Wind Turbulence Introduces nonlinearities to the object’s motion.
  • Wind Strength The amount of deviation of the object from its initial position. In other words, it is how strong the movement is.

Global Billboard Parameters

‘Billboard’ means that the meshes always face the camera regardless of the camera’s position and/or rotation. It is a handy feature because you can make up the plant model from only a handful of planes to spare resources, and this plant will often create an impression of a more complex one. Also, sometimes it is possible to achieve a specific look only if using billboard plants.

  • Billboard Scale Sets the scale of the branch textures aka particles (particles are described here). Effectively, using this parameter, you can scale the whole mesh. Billboard Scale works only when billboards are active: when in the Billboard Rotation parameter Each Face or Whole Object are selected.
  • Billboard Rotation Defines whether the model will to act as a billboard or a non-billboard (regular mesh). If in Each Face or Whole Object mode, the model becomes a billboard. This parameter sets how the particles / branches are being rotated with the movement of the camera. Billboard Rotation parameter has three options:

Foliage Shader Billboard Rotation parameter options
Foliage Shader Billboard Rotation parameter options

  • Nothing — bypasses the billboard rotation, meaning, the model is a non-billboard;
Billboard: Nothing. The entire object and its Particles rotate as in real world
  • Each Face — rotates each individual face, while the overall object shape stays non-rotating. It is one of the billboarding methods;
Billboard: Each Face; Billboard Face Camera Position: No. The particles follow camera plane Billboard: Each Face; Billboard Face Camera Position: Yes. The Particles follow camera position
  • Whole Object — rotates the whole object; the individual faces don’t change relative rotation. Like the Each Face mode, this mode is one of two billboarding methods.
Billboard: Whole Object; Billboard Face Camera Position: No. The whole mesh follows camera plane Billboard: Whole Object; Billboard Face Camera Position: Yes. The whole mesh follows camera position
  • Billboard Face Camera Position If Billboard Rotation is enabled, the billboard will face the camera position. Otherwise, the billboard will face the camera plane. This makes billboards look nicer when camera rotates but is more expensive to render. Basically, if you have an unpleasant rotation effect of your plants, try enabling this parameter. This is most visible when using a VR headset.

Billboard: Face Camera Position Disabled. Visible flicker between particles. View from Oculus VR headset

Billboard: Face Camera Position Enabled. The flicker between particles is not visible. View from Oculus VR headset