Skip to content
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

WebGLRenderer: Ignore map alpha in opaque materials #18631

Merged
merged 2 commits into from
Feb 13, 2020
Merged

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Feb 13, 2020

@mrdoob mrdoob added this to the r114 milestone Feb 13, 2020
@mrdoob mrdoob mentioned this pull request Feb 13, 2020
@mrdoob mrdoob merged commit a7d66b0 into dev Feb 13, 2020
@mrdoob mrdoob deleted the material_opaque branch February 13, 2020 23:43
@donmccurdy
Copy link
Collaborator

Additions to #15483 look right to me, thanks!

export default /* glsl */`
#ifndef TRANSPARENT

diffuseColor.a = 1.0;
Copy link
Collaborator

@WestLangley WestLangley Feb 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.transparent === false only disables blending if .blending is NormalBlending.

See #14171.

So with custom blending, blending is still enabled even if .transparent is false.

You are changing the user's data. I'm not sure about this change -- so, raising a red flag...


Also, if you choose to retain this, then I'd call this file opaque_fragment.glsl.js since that is what it applies to.

EDIT: I don't think this can be retained. I think you will have to implement something different -- something specific to the glTF alphaMode setting.

Maybe create alpha_mode_fragment.glsl.js.

/ping @mrdoob @donmccurdy

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed. This breaks AdditiveBlending when texture.a < 1 and material.transparent is false.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good points, thanks — I'd assumed .transparent = false implied that all blending was disabled.

One short-term fix would be to treat the material as if .transparent === true automatically, if any non-default blend mode is set. That sounds like it would cover the intended uses of the API, or at least I don't know why the user would intentionally use .transparent = false and a non-default blend mode? However, we are short on time to test a change like that before r114, and I'm not sure I understand the conceptual differences between:

  • .transparent = true vs. .blending = NormalBlending
  • .transparent = false vs. .blending = NoBlending

I think some changes to the transparency API might be worth considering later, but we certainly can't get that done in time for r114...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about #14171 (comment)? Was this feedback ever honored? Would it be also a solution to revert #14171?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid I don't understand what is meant in #14171 by "clearly not correct", or what transparency-related problems @jbaicoianu was referring to. These other blending modes seem (to me) to fit under the umbrella of semitransparency, and I would think you do want the sorting behavior that .transparent=true provides, even for other blend modes.

@jbaicoianu do you remember what problems you were referring to?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrdoob Also see #18631 (comment).

I'm too confused now. What about it?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted: 4361a31 8582c74

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He referred to #18579, too.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, reverted #18579 too. Thanks! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GLTFLoader: Texture alpha should be ignored on opaque materials
5 participants