The Unity team has shared a new article for their blog series on the production process behind their demo Book of the Dead.
The creation of a wind system for vegetation assets and its whole pipeline is always a tricky process. There are many different kinds of vegetation assets that would need to be animated in different ways; two different trees might require completely different setup and different shader complexity.
For this reason, our team decided to create a custom vertex shader based procedural animation for the wind effect on our vegetation assets. We made it tailored to work with our specific project and the trees or bushes it contains. Allowing us to have a complete control over it.
Torbjorn Laedre, our Tech Lead built a shader that would support several different types of vegetation, using 3 different techniques:
- Hierarchy Pivot, for our trees and some plants with a very defined structure/hierarchy
- Single Pivot, for grass, small plants and for large bush with undefined structure/hierarchy
- Procedural Animation, for vegetation assets where pivots cannot be predicted.
The trees were the more complex assets to prepare, on the content side, they are using the Hierarchy Pivot type of animation and they rely on 3 distinct levels of hierarchy:
- Trunk, that rests on the ground.
- Branches Level A, that are connected to the trunk.
- Branches Level B, that are connected to the branches of Level A.
The shader needs to know the level of hierarchy and the pivot of every single vertex of the tree. I first had to author the geometry of the tree itself, and then assign the level of hierarchy for every polygon of the tree using the green vertex color channel.
- A value of 0 for the green channel of the vertex color would signify that it is the trunk
- A value between 0 and 1 would be the branches level A
- A value of 1 would be the branches level B
You can find the full article here.