Tree Shadows Cause Slowdown

Hello Unity Community!

I finally decided, after almost a year of development and probably 5 failed attempts, to really crack down and start finding a way to put trees into my terrains without causing too much of a slowdown.

I’ve worked around the AO billboard bug, figured out how to batch the grass correctly so that the tree shadows will work correctly on it, and struggled to find trees that looked good but had few enough polys that they could be used in larger scenes without adding hundreds of thousands of tris.

It seems that I may have finally met my match, though. For some reason the trees that I am using (and truthfully it could be any tree but I can’t bring myself to use any other after all of tinkering and coloring I had to do to get this one to work) causes issues when I walk through their shadows. The FPS, surprisingly, doesn’t drop and the number of batches and tris don’t go up any, and yet the game begins to stutter as I walk through the shadows of the tree. This happens if the tree is part of the terrain system, or just an object in the scene. I’ve checked to make sure that there aren’t any God Rays or anything that may be slowing it down and have come to realize that if I look at the sun through the trees everything runs great. The slowdown is only when I actually see the shadow hit the terrain.

Any insight or help would be appreciated. I can’t believe that this is the first time that this has ever happened in Unity, and yet countless Google searches have yet to bear fruit. Please help!

-Andy

A decent method will be to have decals, these are a basic tree shadow texture that gets drawn under them, conforming to the terrain (mesh or otherwise). This will always be the fastest and best looking - just not dynamic in any way.

5.4 is working toward batching speedtrees (if you use these) and I would imagine eventually batching shadows, which it doesn’t seem to at the moment.