VFX of Walking Through Leaves





VFX of Walking Through Leaves

Today’s focus is on having the player interact with leaves when running or walking. The goal of this
effect is to add more engagement with the environment. Since one of the main focuses of the game is on aesthetics, small things like interacting with leaves are important.


Brainstorming
Starting off, there really aren’t any game references online for walking through leaves. After a quick brainstorm, Unreal’s Cascade system seemed to be just the tool I needed. Using camera facing quads makes it more efficient than using individual leaf meshes. Having a simple collision system also minimizes CPU overhead. To start, I used a brute force approach by running through a ton of leaf particles on the ground. The effect didn't look great and this is why:

Cascade’s collision system is great for static or slow moving objects however, it doesn't work well on fast moving objects like a running player. The collision calculations aren’t as complex and of high priority compared to those of non-particle objects.




After trying different values and approaches, the outcome was still the same. In this case, when the realistic effect doesn't work, I just fake it and make it believable. The next question I asked was “How can I fake the effect, but make it look realistic, purposeful, and engaging?” After contemplating I came to the conclusion that emitting leaves from the actor's foot whenever she takes a step should work. Let’s jump in!



Materials



The particle materials are pretty simple. The important part here is multiplying the particle color correctly. This allows for material parameter manipulation in Cascade for fading the leaves.




Creating the dust materials circular shape is a little overkill. There’s no need to procedurally create circles using a sphere mask unless there’s a need for crisp and perfect circles. Definitely would recommend using a white circle texture instead. The details settings are identical to the leaf except for the shading model is set to unlit. Unlike the leaves, these dust particles don’t need to be a part of the lighting pipeline.




Particle Emitters

The cascade system consists of four individual emitters, that can be sectioned into 3 parts.



Kicking Leaves: This emitter simulates the player pushing leaves forward with their feet. Due to the restrains of using collisions with a dynamic object, this emitter is key to tricking the player in thinking they’re kicking up leaves with their feet. The first second the leaves are spawned, their velocity is at its peak. This mimics the pushing motion of feet against light leaves. Then for the last two seconds before they hit the ground the leaves should tumble downward at a slow constant velocity. (reference 1.1)

1.1




Trailing Leaves: This emitter simulates the displacement of leaves against the side of your foot. It uses a cylinder spawn location to displace the leaves using both its positive and negative X-axis. There’s also an added initial velocity force for some randomness. (reference 1.2)


1.2





Dust Particles: The dust particles are in for experimental purposes. They resemble excess dust or leaf debris being irritated and left floating in the air. There’s a dark and light dust emitter. The light emitter is gray which replicates light bouncing off a dust particle in the air. This is usually visible when looking at a beam of light in a dark room.



The darker emitter resembles leaf debris and gives more contrast to the lighter dust particles. The dust emits from individual leaves and floats downward at a consistent velocity.



Blueprints

The overarching blueprint consists of two different custom Event triggers and Arrow references, that connect to the same function. The events and arrows are situated separately for both feet.




The Custom event is an animation trigger. This trigger is called when the animation of the foot reaches the ground in its walk and run cycle. *There’s a separate trigger for each foot.
















The function also takes in a reference to an arrow. The arrows are used for orienting where to check when line tracing for physical materials. The physical material helps determine if leaves need to be emitted.






The main blueprint system consists of three different parts.

  1. Get the location of the foot using the arrow. Then displace the location to get a start and end point for a line trace. Using an arrow allows for a more accurate line trace since it’s relative to the foot location.

  1. Get the display name of the physical material from the line trace. Compare the returned name with strings identical to the physical materials used to trigger the leaf emitter. 



  1. If the returned name matches, get the world location of the capsule component and displace relative to the ground. Also, get the world rotation of the capsule and plug both the location and rotation into the emitter spawner.


DONE!




Final Thoughts


Things I would do different….
  • Instead of utilizing a string check in the blueprints I would rather use a list of materials to check against. String checks tend to be inefficient.
  • To better sell the effect, I would add displacement of leaf foliage meshes. This would displace leaves on the ground whenever the player walks over them.

Follow me @edgelesscorner for updates


Comments

Popular Posts