Your comments
Hmm honestly, the lushLOD trees should do better than this on their shadow colors. I'll see if I can improve it some for you.
For anyone else interested, the shadow shaders for the leaves is found in the Shaders->Partials folder
Yes, it will be upgraded as Unity makes changes that affect the trees. The current version of Unity 2017 is not significantly different than Unity 5.6, so the trees will continue to use the Unity 5.6 version for now. But when Unity makes any change that affects the trees, then LushLOD will be upgraded at that time. :)
You can probably solve this error by adding this line of code:
if (Camera.main == null) return;
So that the code looks like this (line 1273 to 1275):
//Get the current distance from the camera to this tree. Probably the same as using Vector3.Distance():
if (Camera.main == null) return;
curDistance = (curPosition - Camera.main.transform.position).sqrMagnitude;
Adding this line of code should solve the error you are seeing.
You can also create new topic for different issues. Also, in your screenshot above, I see the tree trunks appear to be visible through the leaves on the distant trees. That's not supposed to happen, if this is happening and you want you can send me a video of it so I can see it a little more clear, and perhaps I can help you get that fixed as well if you wish.
Great! It should already be in the 0.79 update, so if you update to 0.79 and you see the black boxes come back, let me know. I'll mark this topic and solve for now but you can reopen this topic by posting here again if you see this issue again.
Here I've updated the Leaves4 shader to remove the fallback option:
https://drive.google.com/open?id=0BwgYAMPsk3tXUUNjUUwtWWpLNUU
https://drive.google.com/open?id=0BwgYAMPsk3tXWmFkRnBpSkdOTFk
Please download both of those shaders, and copy them into the folder located at "Assets->LushLOD Trees->Internal Files->Shaders->Resources". it will overwrite the file(s) that are there.
This should either fix the problem, or else the trees should turn into pink boxes instead of dark boxes.
Oh, be sure to check if you have any shader named "Tree_Leaves Far4_edited.shader" in your project folder at "LushLOD Trees->Internal Files->Shaders->Resources". If you have this edited shader in your folder, it needs to be deleted and you should try the build again to the device after deleting the edited shader. I accidentally released that edited shader in the last LushLOD update, so if you have it in your project, it could be that the far away trees are using that edited shader, which could explain why the far away trees are not black. If so, then that would be very helpful information, so check if it is possible that you have that edited shader. I will delete that edited shader in the next update.
Thanks for screenshots, and I apologize for slow responses. We probably live in different countries / different time zones, so I am asleep when you are awake!
The error isn't related to the camera script at all. The billboards are never supposed to fully turn off, because the shadows are still supposed to be cast by the billboards even when up close to the camera. Instead, the billboards are supposed to become fully transparent when the camera comes close. However, due to an error, the billboards up close are black. This is not a camera script error, but a shader error.
On your device, it appears that the far away trees render good. But when they are close, the billboards become dark and do not disappear as expected. This is helpful information because this means the "LeavesFar4" shader is working correctly, but the "Leaves4" shader is not.
The video you gave is helpful because I can see exactly where in the transition the billboards begin to turn dark. I will look again at the code and see if I can guess what might be the cause.
It's difficult for me to reproduce this issue on my end, because I do not have exactly the same phone to test it on.
NIGE's last comment said that the fallback shader was being used. That means an error is occuring. I've modified the shader and removed the fallback option.
Here is the modified shader:
https://drive.google.com/open?id=0BwgYAMPsk3tXOWVwNF9ObHJFYTQ
https://drive.google.com/open?id=0BwgYAMPsk3tXQ0o3V3RUWmxxSTg
Please download both of those shaders, and copy them into the folder located at "Assets->LushLOD Trees->Internal Files->Shaders->Resources". it will overwrite the file(s) that are there.
Also, if you see a shader in that folder named Tree_Leaves_Far4_edited.shader, please DELETE that file. It's not supposed to be there, and it could cause errors (it will be removed in the next update).
After you do this, you can try building it again, and see how it looks on the phone. It may look like pink boxes instead of dark boxes. This is because I removed the fallback option, so instead of fallback to deferred, it doesn't fallback anymore so it could be pink.
Customer support service by UserEcho
I took a look at it, and you are correct, it only darkens the shadows, it does not colorize them based on the ambient light color. This would be a somewhat extensive update to add this feature in, mainly because the trees use fully "fake" shadows, which are designed to work even when the lighting in the scene is fully baked. But the way Unity handles lights is that, when the lights are baked, the shadows cannot access the information of the main directional light AT ALL. Which means my manager script must check the lighting, and trasnfer that information to the shaders. And there's two shaders that would need that information, the leaves shader, and the bark shader. Then those shaders would need to check the intensity value of the shadow, and if the pixel is being darkened by a shadow, then apply the ambient light color so that the shadows will look blue. I'd have to edit all the shaders to make this work, plus I'd have to edit the manager to tell it to extract the ambient light color from the scene and send that information to the shaders. Then I'd have to run a bunch of tests to ensure that none of this did anything to mess up scenes that are baked, because when scenes are baked, lighting information behaves different. So basically, this would take some work. And considering that we are 14 days into November and I've only made two sales so far this month, I just can't justify the time spent to do all of this. However, if you're interested in doing all of this yourself, I can definitely point you in the right directions and/or you can pick my brain for any info you need. All of this is doable, and almost all of the shaders are editable in Shader Forge.