Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effect disabling entirely when no shadows present near camera #5

Closed
AshkoreDracson opened this issue Nov 20, 2016 · 2 comments
Closed

Comments

@AshkoreDracson
Copy link

Hello!

I'm having an issue that to be quite frank i've been having virtually in all assets of volumetric lights, atmospheric scattering, height fog, global fog, volumetric fog etc...

The effect works great, however whenever there are no shadows being casted near the camera, the effect disables itself entirely.

GIF of problem

Just wanted to know if this is intended behaviour (and by extension intended behaviour of all volumetric effect assets), or if i'm just doing something terribly wrong or anything I might be missing for the proper scene setup, or maybe even if there's something wrong with my GPU drivers.

@SlightlyMad
Copy link
Owner

Yes, this is a known Unity issue (reported ages ago). Unity stops rendering shadows if there are no visible shadow casters. That's a good thing. But it also stops executing command buffers at that moment. This breaks the effect. There is no way how to detect it happened and so we can't do anything about it.

There is a simple workaround though. Place your camera inside a small shadow-casting 3d cube. The cube won't be visible from your camera because the back faces will be discarded by the rasterizer. This way there is a shadow-casting object in front of your camera at all times and Unity will be forced to keep updating shadows and executing our command buffers.
You could probably find a more elegant solution but the goal is always the same - force Unity to update shadows at all times. Hope this helps.

@AshkoreDracson
Copy link
Author

Alright, good to know i'm not the only one haha! And many thanks for the workaround!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants