CristianQiu / Unity-URP-Volumetric-Light

Unity package for versions 2022.3 and Unity 6. Adds support to render volumetric lighting for both the main and additional lights in URP. Compatible with URP render graph in Unity 6.
MIT License
165 stars 14 forks source link

Compatibility with render Scale #1

Closed LinusSwahn closed 1 month ago

LinusSwahn commented 2 months ago

Hi! I was testing out your implementation of volumetric light which I found very apealing.

We are experimenting with a graphical style involving lowering Render Scale for a more low res aesthetic but noticed that emphazises noise flickering with object shadows:

In this clip I'm lowering Render Scale from 1 to 0.25 which is what we are targeting.

https://github.com/user-attachments/assets/0c67d4f5-95ec-4686-b513-37d26994e5e5

I just thought I'd get your opinion on it. I totally understand if the flickering is just the way it is.

LinusSwahn commented 2 months ago

Actually just experimenting with density and additional light radius gives a better effect at even low Render Scales.

CristianQiu commented 2 months ago

Hey, thanks for the feedback!

I think this is mostly due to jitter more than anything else. The most important volume parameters to try to reduce flicker, other than the game resolution, are "Distance" (the lower, the better) and "Max Steps" (the higher the better but more costly performance wise, although since you are rendering at such low resolution it shouldn't be a problem).

I understand that depending on your type of game you might want to keep "Distance" at a reasonable high value, but try to keep it as low as you need it to be. Another issue that I found with spotlights, is that very bright ones tend to produce more noise towards the origin of the spotlight, so I added that "Additional Light Radius" as way to add some kind of falloff and mitigate that issue.

You can also try increasing 'Blur Iterations', although I guess that it may become too blurry, specially at such low resolution. Other than that, it is mostly about the final brightness of the light and the contrast it produces with the background. Darker backgrounds with your bright spotlight will make the noise more noticeable. For that, you can tweak the light either changing its intensity, or tweaking the volume parameters.

I also pushed a small change to double the 'Max Steps' maximum value that can be tweaked through the volume if you want to try it.

Hope it helps!