[3D] Add multisample anti aliasing (MSAA) #65829
[3D] Add multisample anti aliasing (MSAA) #65829ViperMiniQ wants to merge 11 commits intoqgis:masterfrom
Conversation
| double mEyeDomeLightingStrength = 1000.0; | ||
| int mEyeDomeLightingDistance = 1; | ||
|
|
||
| bool mMsaaEnabled = false; |
There was a problem hiding this comment.
Could we default to enabling this? I'd love it if it was "opt out" rather then in
There was a problem hiding this comment.
Maybe in a separate PR, there will probably be many tests to correct.
🪟 Windows Qt6 buildsDownload Windows Qt6 builds of this PR for testing. 🍎 MacOS Qt6 buildsDownload MacOS Qt6 builds of this PR for testing. |
wonder-sk
left a comment
There was a problem hiding this comment.
Please add a rendering test with MSAA enabled - but generally looking good!
(Now I see one can set number of samples for the multisample textures during their creation - but we could as well leave that hardcoded to 4x for the time being - and not overwhelm users with extra options)
@wonder-sk, the max value is apparently limited by If you go over the limit the GPU is able to handle, you would get a warning |
wonder-sk
left a comment
There was a problem hiding this comment.
can you please also check whether EDL, AO and shadows still work? (i.e. depth buffer is handled correctly at all times)
I am not able to get the offscreen engine to render with MSAA on. QGIS/src/3d/qgsoffscreen3dengine.cpp Line 42 in 467af3b I tried explicitly adding the number of samples here, but that failed as well. |
wonder-sk
left a comment
There was a problem hiding this comment.
Maybe I'm missing something, but the MSAA on/off is not connected to the global options: 1. new 3D view does not use the MSAA even if it is enabled in global options, 2. when I change the global options, this is not reflected in existing 3D views
|
@ViperMiniQ the code looks good, now we just need to rebase after the merge of gradient PR |
- gui checkbox for toggling on orr off in settings under effects - introduce regular target and msaa target - 4 samples only, not configurable
This PR adds multisample anti-aliasing to 3D map.
Inspired by: https://github.com/wonder-sk/qt3d-experiments/tree/master/msaa
More here: https://learnopengl.com/Advanced-OpenGL/Anti-Aliasing
MSAA is hardcoded to 4 samples and checkbox for toggling it on or off is located in

Settings under Effectsin global 3D settings:A simple rough example (with 2 px edge):
OFF

ON
