-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Closed
Labels
Milestone
Description
Feature: Support Alpha To Coverage
It would be nice to support a flag for Alpha to Coverage. This feature has existed in WebGL contexts for a while, however, it seems hardly used in practice.
It can be used to create really crisp alpha cutouts with MSAA-enabled contexts.
When enabled, you no longer need to specify alphaTest or perform a discard in the fragment shader, you simply output the frag alpha and the GL context will handle cutouts. You can read more about it here, including some tricks to make things even smoother.
// enable alpha to coverage with current ThreeJS renderer
const gl = renderer.getContext();
gl.enable(gl.SAMPLE_ALPHA_TO_COVERAGE);This feature assumes MSAA is enabled and supported (i.e. may not work in external monitors).
Here is an example wireframe shader using alpha to coverage:
https://mattdesl.github.io/webgl-wireframes/app/

Browser
- All of them
- Chrome
- Firefox
- Internet Explorer
OS
- All of them
- Windows
- macOS
- Linux
- Android
- iOS
fernandojsg, tentone, FabienMotte, haroldiedema, Mugen87 and 6 more