Your comments

Sounds good :)


I did notice something weird; all the (unoptimized) trees that came with the asset were different in that they didn't have certain settings in the inspector (for the tree's root node), that my own trees has - I think some of them had to do with ambient occlusion, but I don't quite remember. Anyway, I actually did try to convert the trees with ambient occlusion disabled, but it didn't affect the flickering.


Also, just remembered that I found two minor bugs that I meant to tell you about:


  1. Converting trees that has no leaf nodes will cause the converter to crash before finishing (because it's looking for the tree's (missing) leaf material). A quick and dirty fix for this is to add a single leaf with an invisible material to the tree's root node.
  2. Converting trees that has leaves of the "billboard" type will create a bad LOD billboard for the tree, because the leaf texture for some reason stretches and takes up the entire altas square for that tree.

Update: uncommeting the two Cull off lines in the shader does indeed eliminate the flicker problem. Also, I forgot to add that the flicker problem also happens for the trees that came with the asset.

Something must definitely have changed in the wind system. I made a fresh scene, added a plane and a wind zone, then added the following trees:


  • Alder (converted to LushLOD, shipped with asset, unmodified)
  • Alder (converted to LushLOD by me, from "Unoptimized trees")
  • Alder (unconverted, from "Unoptimized trees")
  • Birch (made by be, converted to LushLOD)
  • Birch (same, but unconverted)

I then tested out how they react to varying levels of wind (main wind, no turbulence):



As you can see, especially from the last picture, only the unconverted trees are affected by wind. For the converted trees, only leaves and some of the smaller branches are affected.


I'm using Unity 2017.3.0f3, by the way.


I'll look into the shadow issues immediately, and let you know what I find.

I've implemented the hack, and I have to say it all runs way smoother than I'd have ever hoped for!!! So thank you for making this awesome plugin :) And thanks for the amazing support!!!

Indeed, it runs a lot better now!

However, it's still quite laggy, and the main lags seem to be a combination of the _LushLODTree instances and camera culling.



It's most prelavent when generating new trees. I already told the manager to return out of RecalculateParents, until my tree instantiation queue is 0. During runtime, I'm instantiating maybe 20 trees per update frame and although the RecalculateParents isn't executed until all trees have been placed, there's still a lot of _LushLODTree activity for each update frame.


Edit: Somehow I got better performance by using forward rendering instead of deffered. Also, I forgot to set the quality from ultra to low the last time I transfered the project from my powerful desktop to my not so powerful laptop (which I'm on now), so that helped as well.


Still, it's running unacceptably slow and the heavy load seems to originate from each LushLOD tree's update function, every single frame. There are around 3000-5000 trees at any given time.

Wait a second, perhaps I should disable the logging function and try again - obviously that would cause a huge lag!! :D

I tried implementing the if(ByPassChangedChecks == false) to all the 3 places where ShaderSettingsChanged gets incremented. Now, after a while, the game runs! And the trees appears as they should!


However, it's extremely laggy, and I don't know why because according to the log, the only thing that happens for each frame is that the manager's update method is called, followed by the update method for each tree, but nothing besides that (well, the manager calls GetBillboardShadowCastingMode a few times during the frame, but that's it!)

I tried commenting out the if (ByPassChangedChecks == false) ShaderSettingsChanged += 1; line, so that both that and the original if ShaderSettingsChanged += 1; is commented out. Doesn't change the problem, so it seems like ShaderSettingsChanged gets incremented elsewhere.

Here's the dump. I added a frame counter to make sure that it's indeed all happening in the same frame:

Current frame: 1
Trees to go through: 256
Value of ShaderSettingsChanged: 1
Value of ShaderSettingsChanged_PREVIOUS: 1
Was this a specifictree?: true
Value of ByPassChangedChecks: true
>
Current frame: 1
Trees to go through: 256
Value of ShaderSettingsChanged: 2
Value of ShaderSettingsChanged_PREVIOUS: 2
Was this a specifictree?: true
Value of ByPassChangedChecks: true
>
Current frame: 1
Trees to go through: 256
Value of ShaderSettingsChanged: 3
Value of ShaderSettingsChanged_PREVIOUS: 3
Was this a specifictree?: true
Value of ByPassChangedChecks: true
>
Current frame: 1
Trees to go through: 256
Value of ShaderSettingsChanged: 4
Value of ShaderSettingsChanged_PREVIOUS: 4
Was this a specifictree?: true
Value of ByPassChangedChecks: true
>
(etc..)

I've uploaded my version here: https://drive.google.com/open?id=1VzCNGeoyDsiIyRn0imvcLQI8G4hM7t0c


I forgot to disable the writing of each method name to the log file, but you can just comment out the WriteToLog method, which is right below the properties.


Edit: sorry, it's called WriteToLogFile - it's on line 378