In this recipe, we'll write a simple particle shader demonstrating how to create leaves in wind. We can do so using a Particle Emitter combined with a Material Shader that "shades" our leaves to give them the appearance of blowing in the wind.
To begin, you'll need a leaf texture as well as a scene in which to place the falling leaves. In the Chapter11
code package, you'll find a scene called LeavesAndTree
that contains a deciduous tree that you can use.
Create a new particle emitter by right-clicking in the Content Browser, and choosing Particle System.
Construct a new Material shader by right-clicking in the Content Browser and choosing Material. Your leaf material should contain a texture of a leaf in the
BaseColor
component. We'll edit the World Position of the leaf in a later step to represent a jitter in motion represented by the wind.Add a couple of parameters to modify the Leaves particle emitter:
Spawn should have a nice high rate of about...