-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Implement MSAA per-sample shading option to improve rendering quality #76073
base: master
Are you sure you want to change the base?
Conversation
Really nice improvement in quality and performance. I notice some lost in texture quality. The wall bricks looks blurier like in FXAA, Is that expected? Edit: Only in 1152×648 |
I'm not sure why this is happening. This likely has to do with SDFGI reflections looking different depending on the actual viewport resolution, but not per-sample shading sample count (which is strange). I've tried using a mipmap LOD bias of I've added a "ground truth" example to OP to show what would be the best possible appearance. |
dbe149c
to
90bad0f
Compare
90bad0f
to
b148c45
Compare
b148c45
to
b1e99a5
Compare
Compared to setting Scaling 3D > Scale above 1.0, this provides better quality (thanks to MSAA's superior sampling pattern) with better performance and lower VRAM utilization. This also works on 2D rendering, which can be useful to maximize sharpness of downscaled 2D textures without graininess when not using mipmaps. In 2D, this also provides antialiasing for hard Light2D shadows. Per-sample shading is mainly targeted at Movie Maker mode usage, although modern high-end GPUs can handle per-sample shading with 2× or 4× MSAA during gameplay while staying above 60 FPS.
b1e99a5
to
b781d30
Compare
Not functional yet.
I'm not sure this is worth supporting. It is limited to Vulkan, and hardware support is not very good. It is a cool feature, but the limitations make it pretty hard to justify supporting in a cross platform engine. |
about the support on DirectX 12, I found that NVIDIA can do per-sample shading at driver level for DirectX11 games. I'm not sure how they did this but it can be helpful, they called it "variable rate supersampling" |
@izarii-dev That feature is only meant to be used in VR. There also exist driver-specific MSAA settings that act as supersampling (SGSSAA or "16x MSAA"), but these are not available at an application level without using proprietary APIs.1 16x MSAA (which was typically 4x SSAA + 4x MSAA) was available in OpenGL, but not in Vulkan or Direct3D 12 🙁 Footnotes
|
unless I'm very confused, per-sample shading is a standard feature supported even with gles3.2 and metal... although you may need to trigger it implicitly with a gl_SampleID read (or equivalent) rather than being able to set minSampleShading? |
glMinSampleShading is available in gles3.2 at least |
It seems like I was the one confused, I thought we were talking about We already expose the |
Compared to setting Scaling 3D > Scale above 1.0, this provides better quality (thanks to MSAA's superior sampling pattern) with better performance and lower VRAM utilization.
This also works on 2D rendering, which can be useful to maximize sharpness of downscaled 2D textures without graininess when not using mipmaps. In 2D, this also provides antialiasing for hard Light2D shadows.
Per-sample shading is mainly targeted at Movie Maker mode usage, although modern high-end GPUs can handle per-sample shading with 2× or 4× MSAA during gameplay while staying above 60 FPS.
This is supported in Forward+ and Forward Mobile. However, most mobile GPUs don't support per-sample shading as a hardware limitation (this includes Apple Silicon).
TODO
Performance
Tested at https://github.com/Calinou/godot-reflection's spawn location.
OS: Fedora 37
CPU: Intel Core i9-13900K
GPU: NVIDIA GeForce RTX 4090
Preview
1152×648
3840×2160
Footnotes
Performance wildly fluctuates at the default resolution, likely due to a CPU bottleneck. ↩ ↩2 ↩3
Render in a window twice as large, then downsample in an image editor. ↩