godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.19k stars 21.21k forks source link

Alpha to coverage doesn't work in Compatibility Renderer #98173

Open michaelharmonart opened 1 month ago

michaelharmonart commented 1 month ago

Tested versions

Tested in Godot 4.3 Stable (arch linux)

System information

Godot v4.3.stable unknown - Manjaro Linux #1 SMP PREEMPT_DYNAMIC Thu Oct 10 19:03:24 UTC 2024 - X11 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3060 (nvidia; 560.35.03) - Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz (6 Threads)

Issue description

When enabling the alpha anti-aliasing settings in a standard material or custom shader with MSAA enabled, no change shows when in the compatibility renderer, bumping up to the mobile renderer shows proper alpha anti-aliasing with alpha to coverage or alpha to coverage and 1

This is extremely unfortunate as the compatibility renderer is currently preferred for standalone XR use cases (inlcuding webXR) and heavy aliasing caused by alpha test materials is visually distracting and intrusive in VR. Ideally the alpha to coverage could be properly supported in the compatibility renderer so that it could be used for these cases. Even better would be to make sure it works for WebXR as well (where performance targets are even tighter and the use of textured alpha planes is vital to making anything that will look good and perform at a decent level)

Steps to reproduce

enable 4x MSAA for 2d and 3d in project settings set to compatibility renderer create multiple intersecting planes with a material with transparency as such image set editor to half resolution to better see anti-aliasing effects notice that there is heavy aliasing

switch to mobile renderer notice aliasing is now solved properly through alpha to coverage

Minimal reproduction project (MRP)

see above. If you are unable to reproduce I can trim down my project and include here.

michaelharmonart commented 1 month ago

@marstaik @clayjohn I believe you guys are the resident experts on the A2C implementation

@BastiaanOlij @dsnopek perhaps you will know what to do on the VR side of things

clayjohn commented 1 month ago

Alpha to Coverage was never implemented in the compatibility renderer.

I haven't looked into the details, but I suspect it could be added at some point, but someone needs to investigate if the relevant features are available in OpenGL 3.3/ ES 3.0.

Calinou commented 1 month ago

To my knowledge, alpha to coverage only exists in desktop OpenGL 3.3, not OpenGL ES 3.0/WebGL 2.0.

This means that if it's implemented, it would only work on desktop platforms and only in PCVR (not standalone XR).