Hello everyone.
I have a problem with culling my trees in my scene. Trees is culling, but with them shadows culls too. And i see that shadows disappear in game view. How i can cull tree only if i don’t see tree and shadow from it?
Thanks.
Hello everyone.
I have a problem with culling my trees in my scene. Trees is culling, but with them shadows culls too. And i see that shadows disappear in game view. How i can cull tree only if i don’t see tree and shadow from it?
Thanks.
Did you figure out how to do this? I have the same problem. I read one should add the shadow to the AABB volume, but then I have no idea how to do this in Unity. I’d be happy if I could simply use a bigger virtual field of view for frustum culling… Is this possible?
Ok, in my case I got wrong frustum culling in portrait because I was setting the camera projection matrix and probably not setting the culling matrix right. When I stopped doing all this and simply set a new orthographic size, everything worked correctly for me.
So I guess if you really need to set a wider/smaller frustum culling, it could be done by setting a culling matrix. I also read before this feature was available in Unity, you would change mesh bounds to make them bigger or moving their center to the frustum’s center so as to not get culling, but (luckily) I didn’t need to try this anymore
Same problem, Unity 2021.3.1 LTS, in both URP and HDRP.
First of all, There is nothing to fix in here and Second, no matter what version you are using, This will happen since the shadows cannot be rendered without the shadow caster which is in the mesh renderer component of the culled mesh. And since the mesh is culled(disabled), all it’s components would get disabled too. This is not a bug. It’s just how frustum culling works. One thing you could do is disable the shadow caster component but you wouldn’t get the shadows.
The solution I use is to set mesh .bounds large enough that the shadows will still be there even when the object is behind the camera… with exactly how far behind determined by how much larger than the mesh you’ve set the bounds to be. However, there is a cost to these objects not being culled… so for mobile games you might not want to consider it. Also if you have very long shadows you’d have to adjust the bounds so much that your performance would take a noticeable hit where lots of extra objects are being “kept alive” that way.