-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Material: Add alphaToCoverage. #21383
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
Conversation
237f751 to
3f914c1
Compare
|
Maybe restoring this would help |
|
@WestLangley I've added your improvements to the PR. |
This is part of the wireframe style and also present original demo. |
It is not present in the current three.js demo, or any three.js wireframe shaders. I'd hate to lose the current shader as an example. |
|
Maybe there is a shader that combines the best features of both the new and the old shader... :-) |
|
I've restored the original shader and just added the new option as a third mesh. |
|
Pragmatism FTW! |
|
To clarify. You closed the |
|
Thanks! |
|
@Mugen87 Thinking about this a bit more... What do you think about hiding this from the user and enabling it automatically like this? if ( material.transparent === true && gl.getContextAttributes().antialias === true ) {
enable( gl.SAMPLE_ALPHA_TO_COVERAGE );
} else {
disable( gl.SAMPLE_ALPHA_TO_COVERAGE );
} |
|
The thing is that you can use AtC even without |
|
I see... Was trying to avoid having to expose this in the editor and co. |
I believe alpha to coverage has to be specifically accommodated when making a shader, texture, or material. I don't think it will "just work" in the general case. If you use it on just a basic transparent material you can see that the opacity seems to jump to bands as you animate it up and down as the alpha is mapped to MSAA blending from coverage. It's best used when trying to smooth something like an alpha clip edge. |
|
Okay. Sounds good 👍 |
|
@gkjohnson Yes, this is also my understanding. |
|
@WestLangley What do you think about removing the old shader now? https://raw.githack.com/mrdoob/three.js/dev/examples/webgl_materials_wireframe.html |
EDIT: Apparently, reverting to GLSL1 is going to be sufficient, so I think removing the old shader is OK. |
|
Looking at the MDN constants page it looks like The shaders in the example won't work in WebGL2 / Safari because they were set to GLSL3 but I don't think it's a requirement?
|
Like @gkjohnson said, it also works with WebGL 1.
No it's not. I've just used the more modern GLSL3 syntax out of pure habit. It is not a big deal to go back to GLSL1. |






Related issue: Fixed #12438.
Description
Added
Material.alphaToCoverage. The custom shader inwebgl_materials_wireframewas modified similar to @mattdesl wireframe code in order to demonstrate the feature.