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

GLTFExporter: Fixed alphaMode handling #17433

Merged
merged 1 commit into from
Sep 5, 2019
Merged

GLTFExporter: Fixed alphaMode handling #17433

merged 1 commit into from
Sep 5, 2019

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Sep 5, 2019

I think the current logic is broken.

@fernandojsg @donmccurdy let me know if this looks good to you.

@mrdoob mrdoob added this to the r109 milestone Sep 5, 2019
Copy link
Collaborator

@donmccurdy donmccurdy left a comment

Choose a reason for hiding this comment

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

Agreed, this change is more intuitive and supports cases where material.transparent = true but material.opacity = 1.0 (e.g. the transparency is in .map instead).

examples/js/exporters/GLTFExporter.js Show resolved Hide resolved
@donmccurdy
Copy link
Collaborator

Aside, I do like the idea of having an .alphaMode setting on the threejs material, similar to glTF or Blender's equivalents, to make this more explicit and perhaps support future cases like Alpha Hash or TRAA. Maybe just in NodeMaterial for starters..

@mrdoob
Copy link
Owner Author

mrdoob commented Sep 5, 2019

Agreed, this change is more intuitive and supports cases where material.transparent = true but material.opacity = 1.0 (e.g. the transparency is in .map instead).

Yeah, I was re-exporting the Flight Helmet and it was setting alphaTest to 0.5 incorrectly.

Aside, I do like the idea of having an .alphaMode setting on the threejs material, similar to glTF or Blender's equivalents, to make this more explicit and perhaps support future cases like Alpha Hash or TRAA. Maybe just in NodeMaterial for starters..

Hmm, yeah. We may have to refactor a few things.

@mrdoob
Copy link
Owner Author

mrdoob commented Sep 5, 2019

Another aside... In the GLTFLoader, what do you think about setting material.premultipliedAlpha to true when alphaMode is set to BLEND?

I don't know if there is anything in the spec about it, but it will make three/model-viewer look closer to Filament.

I think the glass will look more similar here:
Screenshot 2019-09-04 at 22 32 56

@donmccurdy
Copy link
Collaborator

... what do you think about setting material.premultipliedAlpha to true when alphaMode is set to BLEND?

glTF doesn't specify, although it probably should. In the meantime I have no objection to changing it. 😇

@mrdoob
Copy link
Owner Author

mrdoob commented Sep 5, 2019

Hmm... Just tried locally, doesn't seem to change that much... 🤔

Before:

Screenshot 2019-09-04 at 23 32 24

After:

Screenshot 2019-09-04 at 23 32 35

@mrdoob
Copy link
Owner Author

mrdoob commented Sep 5, 2019

Seems better though.

@mrdoob
Copy link
Owner Author

mrdoob commented Sep 5, 2019

I'll continue testing. Merging this for now.

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.

2 participants