Using the shaders with custom assets
Should you like to use the FAE/Branch shader on a tree outside of this package it must conform to a requirement, namely the Ambient Occlusion (AO). Which must be baked into the mesh’s vertex colors. This is used for shading and animation purposes.
Certain information is required to be baked into a tree mesh’s vertex colors:
Red: Ambient Occlusion
Green: Wind influence
Blue: Thickness (used for color transmission)
Note: As of version 1.2.1 the Blue and Alpha channel were swapped. If your custom tree uses the old layout, check the “Legacy vertex colors” checkbox. This is set to be removed in v1.3.0
Generally any software that can bake Ambient Occlusion into the RGB vertex color channels will suffice. Stiffness (Alpha channel) is less straight forward, since this represents a gradient from the base of the tree, to its tip. Without the gradient in the Alpha channel, the entire tree will appear to move. To mitigate this, set the “Trunk Weight” value on the WindController component to 0.
This information was calculated and baked using a proprietary tool, which will not be made available to end-users as it pertains source files and some third party source code.
For vegetation assets using the FAE/Foliage shader much of the same holds true. Where the AO information is used to determine which parts are not affected by wind or player interaction. As well as several other shading functions.
The tree shaders will also work with SpeedTree trees made using the Unity SpeedTree modeler.
To enable the wind animations check the “Sample SpeedTree wind” box on your branch and trunk material. The wind implementation is not the same as the SpeedTree shaders, so the animations you see in the modeler will not be the same, but similar.