-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Contact hardening soft shadows / Percentage-Closer Soft Shadows #3643
Comments
PCSS is already implemented for all light types in the PCSS could technically be backported to the GLES3 renderer in
This is a known issue, see godotengine/godot#53534. This dithering is present by design. In most scenes with significant texture detail, it improves overall shadow rendering quality at high resolutions (reducing the typical aliasing visible in filtered shadows), but it has a noticeable performance impact. It's technically possible to add a setting to disable shadow dithering. This would improve performance slightly, but it will make shadows look worse at high resolutions in most situations: godotengine/godot#53961 |
Wow it's actually amazing that PCSS is already implemented. But I have to say, this feature is kind of buried. I had no idea that size is supposed to represent PCSS. Probably the naming could be improved a bit to indicate the presence of this feature.
Thank you for mentioning that issue. I did notice that issue before opening this thread. However, by running some tests of my own I was quite disappointed by the shadow quality. It looks much better when blurred, however still some massive aliasing is visible. Specifically where the pole touches the ground (shown below). Perhaps an idea would be to render the hard shadows with a method like stencil shadows, so they look crispy, and for soft shadows the current implementation is kept. In the |
This is because light size defines how strong the PCSS effect should be (it also modifies the attenuation a little). It's how light behaves in real life. In real life, if a point light was infinitely small (in terms of emitter size), then its shadows would always be perfectly sharp. This light size property also allows enabling PCSS on a per-light basis, and with different intensities for each light. This is important to keep performance high, as PCSS cannot be used on every light with shadows or performance will likely plummet.
The aliasing is expected when the blur is set to a low value. Therefore, I recommend keeping the Blur value to 1.0 at least. The dithering helps hide the aliasing – without dithering, it'd look even worse 🙂
There are no plans to implement stencil shadows, as they are very expensive as soon as your geometry gets remotely complex. Support for stencil in shaders is planned in a future 4.x release (so you could create stencil shadows manually), but not in 4.0. |
That's very good to know! Thanks for the detailed response :) |
Describe the project you are working on
A 3D physics based, FPS
Describe the problem or limitation you are having in your project
Poor implementation of shadows both in Vulkan
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add Contact hardening soft shadows. It means that shadows get blurrier, the further they are from a light source. Below is an example of it:
Source (Nvidia Docs)
Another neat implementation of it in Babylon.js:
Source (Babylon.js Docs)
This would be an amazing addition to the Vulkan renderer in Godot 4. It makes the scenes especially interior ones look much more realistic, also it adds a special beauty to daylight nature scenes. With the tree trunk having sharper shadows and the leaves and branches being more blurred out.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Each light source will receive a boolean option to toggle Contact hardening soft shadows on or off. By default it would be disabled as it will cost some processing power.
If this enhancement will not be used often, can it be worked around with a few lines of script?
No. This feature is not simple enough to be implemented with only a few lines of code.
Is there a reason why this should be core and not an add-on in the asset library?
This significantly improves the current state of shadows in Vulkan. As of
v4.0.dev.calinou [c1ed695f3]
, the lighting and shadows don't work as intended, but from screenshots that I have seen, the Vulkan shadows could really get some upgrades. There is a lot of dithering and soft shadows are extremely grainy. Additionally, adding such feature via an add-on might be impossible and or severely impact performance.The text was updated successfully, but these errors were encountered: