So I already asked this on another section, on Unity Answers, on Reddit, Polycount and even on some YouTube videos, and literally no one has answered. This is driving me insane, I’m starting to think that the answer is some kind of government secret…
I’m gonna paste here the same thing I already explained in many other places:
I don’t think images are necessary, its apparently a well know thing on Unity.
Hope I’m lucky here.
Did you try the different shader like they suggested in that thread? In any case it sounds like definitely a shader issue. Are you using the Builtin Renderer or one of the scriptable pipelines? (URP/HDRP)
Hi, thanks for taking your time. I already tried using a different shader (I used Standard and Legacy), but none of them worked, which seems weird, since I faced the same issue in another project a long time ago. I checked the old project to see if I did something else that probably I’m missing, but I couldn’t find anything useful. Apparently I did the same before (changed the shader) and it just simply worked, however, it’s not working this time, and I don’t know why.
I’ve been trying to figure this out, too. After several days of despair, I finally found the solution. You’re gonna hate how stupid this is.
Unity specifically put a single pragma command in the shaders to make the lighting look like ass. It isn’t actually unlit. The shader is just reading directional lights only, with others being per-vertex. Which is why all the leaves light up on one side. All you have to do is remove that one command.
Download the built-in shaders for your version of the engine in Unity’s download archives. Instead of clicking on “Hub” next to it, click on your OS dropdown, and you should see the Built-In Shaders option. Navigate to DefaultResourcesExtra>Nature and Import the TreeCreator folder into your project. Find ‘TreeCreatorLeavesOptimized.shader’ and open it up.
The command to remove is: noforwardadd
It’s on line 31, at the end. Everything else can stay.
Apparently, it’s supposed to be an optimization, according to the docs. I tested a scene with hundreds of trees using both shaders, and I saw no discernable difference in performance. I’ll try thousands at some point, but I don’t expect any surprises. Just set your terrain optimization options for trees, and watch your light count.
Like a lot of things in Unity, their ancient tree shaders are yet another blotch of decay in the foundations of their engine that continues to stink up the place. I doubt anyone has touched this shader code in years.