[Solved] Custom terrain trees leaves not animating.

I’ve imported some of our artists trees into Unity for painting on the terrain, set them up with the right material/shader combos, and the leaves on the trees won’t animate. I’ve tried re importing, different export settings, etc. and about the only difference I can see between these trees and the Unity provided trees and that the two materials use two separate textures in the Unity trees, and our artist has only used one texture that is being used on both materials.

The trees are built in 3DS Max with the following setup.

  • Multi-sub object material setup, using material ID’s.
  • Material ID 1 set to the trunk polygons.
  • Material ID 2 set to leaf polygons.

Then Import settings into Unity

  • Material Generation : Per Material

I’ve tried setting Material generation to per texture, but it creates only one material (as expected) and then applies that material to the two ID’s, which means I can’t set them up for leaves/bark materials.

This isn’t just causing an animation problem, as we are using replacement shaders, and the replacement shader doesn’t seem to be picking up the leaves at all, and so the post processing effect isn’t being applied.

Is there anything obviously wrong I’m doing? I’ve done a fair bit of searching and can’t find any answers.

So I imported the trees into a separate project, made a new terrain, and the leaves animate properly, which leads me to think there is something wrong with my terrain asset in my other project.

Remaking the terrain isn’t an option right now, so is there something about the terrain engine I’m missing? I’ve tried refreshing the tree and detail prototypes and that doesn’t seem to work.

Alright, so I found the problem, but I’m confused as to why it caused the problem.

The actual shader code downloaded from the Unity website was in the project for the Nature/Soft Occlusion Leaves shader. This version of the shader was being assigned to new tree models being imported into the project, but for whatever reason the terrain engine wasn’t calling the animation part of the shader, and our replacement shaders weren’t picking up on the RenderType.

This seems like a strange bug to me, but it’s fixed now.