Being trying to get this to function for a while now, and finally with my enhanced understanding of Niagra, I was able to use the FX system to spawn leaves on static tree based meshes, based on the meshes underlying vertex paint. Once I got the system working, I put this “Little Red Riding Hood” scene together to show case the Niagara Particle Leaves System.
The system uses Blueprint to randomly (deterministically) place tree static meshes throughout the world and then add the corresponding Niagara Emitter to the static mesh in order to add leaves to the scene.
The system use 3 base tree static meshes and 15 (5 per tree / emitter) leaves to create an endless variety of trees. In order to place the leaves on the tree, the Niagara emitter, samples the static mesh and then uses the vertex color in order to place allocate the leaves to the mesh or allocate them to world zero (where they are then killed). This means that on a per emitter basis, a vertex color can be sampled and an specified mesh can be rendered at a location matching that vertex color. The leaves can therefore, be placed on the ends on the branches, assisting in creating a realistic tree. In this example this, the vertex color could be used as follows: leaves for white, fruit for red and flowers for blue. What is more, is that the vertex colors can be painted directly in editor in order in order to deliver the look at feel required.
In the examples below the following have been randomized on a per tree basis:
[li]The Trees (between 3 meshes)[/li][LIST]
[/LIST] Because the system use blueprint and Niagara, almost any variable can be exposed and then randomized either in the particle system or the blueprint. In addition, because the leaves are particles, additional behavior can be added. For example, based on the lifetime of the particle / emitter, the particles can grow (through scale and rotation), exist on the tree, moving in the wind, age through a color lerp and then finally fall to the ground with wind effects and collision before disappearing (not shown here).
Challenges with putting together the blueprint & system included the following:
[li]System required a custom modules to sample the mesh and vertex color in order to move particles to world zero (to be killed)[/li][li]In the Blueprint, the For Loop appeared to be unable to add an instanced static mesh (tree) and then add a Niagara particle system at the correct static mesh location (might have been the coding, but it did not seem like it, because the loop worked for the first index). This resulted in a separate blueprint being used for the trees and a separate blueprint being used for the leaves placement[/li][li]Lastly, i had to create 3 particle systems in order to sample each of the separate tree static meshes. The reason for this is because the Niagara Data Interface Static Mesh override function is not exposed are part of the add Niagara Particle System function / node well called in blueprint. It is however exposed when you add a Niagara particle System Component via the green add component button. Because of this, you cant set the sampled mesh as a user parameter utilizing the set Niagara Static Mesh Directly Function / Node.[/li][/ul]
I hope you like to resulting image which was put together using:
[li]Unreal Engine[/li][li]UE4: Niagara Particle Effects[/li][li]Quixel Suite[/li][li]Blender[/li][/ul]
Make something EPIC,