- Home /
Can you disable shadows that are not seen by the camera ?
I am wondering if you can make so that shadows are not shown only if they are in the camera range. Something like occlusion culling for objects but for shadows. If there is something like that in Unity please let me now.
Answer by M-Hanssen · Aug 07, 2018 at 02:17 PM
My first question is: Why do you need this?
Shadows disappear together with the occlusion culling of objects. So occluded objects will not render any shadows, static or realtime this doesn't even matter.
If you just want the shadows not to be rendered when not visible by camera, you can implement custom logic to turn off the casting of shadows per MeshRenderer.
Look into "Renderer.isVisible" and "Cast Shadows" within the MeshRenderer
@$$anonymous$$-Hanssen As you can see in this video : https://www.youtube.com/watch?v=2gyYhO7b9HE even tho i have occlusion culling on my shadows are still rendered. If you can help me out I would be glad to reward this answer. Thank you for your time!
I have figured it out myself. The problem was that the shadow distance was too big and it was rendering the shadows from a big distance. Thank you sir and have a good day!
Your answer
Follow this Question
Related Questions
(3D) Generating avatar masks automatically from animation 0 Answers
Light probe still exists in the scene after being deleted, cannot be selected. 3 Answers
Lightmapping Shadows Jagged 1 Answer
How do i access the MeshExtrusion.cs from Unity's PE? 1 Answer
I want to rotate an object towards mouse position on screen in 3d environment. How can I do this? 4 Answers