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

Fix mesh materials not getting loaded properly. #63

Merged
merged 2 commits into from
Sep 7, 2019

Conversation

keunhong
Copy link

@keunhong keunhong commented Aug 22, 2019

The input argument material was getting overwritten in the loop so
when multiple meshes with different materials were present the logic
thought that a material override had been passed.

Fixed by renaming inner loop variable and making a deep copy if the
passed in material is used.

Fixed at least some causes of #23

The input argument `material` was getting overwritten in the loop so
when multiple meshes with different materials were present the logic
thought that a material override had been passed.

Fixed by renaming inner loop variable and making a deep copy if the
passed in material is used.
@@ -305,9 +308,15 @@ def _get_trimesh_props(mesh, smooth=False):
alphaCutoff=mat.alphaCutoff
)
elif isinstance(mat, trimesh.visual.texture.SimpleMaterial):
Copy link

Choose a reason for hiding this comment

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

Hey, I recently added a SimpleMaterial.to_pbr method that might be useful for this too, so GLB exports of OBJ imports look nice. That glossiness/roughness conversion looks great, is there a reference for that somewhere? I'd love to add better logic to to_pbr.

Copy link
Author

Choose a reason for hiding this comment

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

Here are the references I used for this conversion. It seems like there's no real standard conversion but a best effort to try to get the curves to line up.

http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
https://computergraphics.stackexchange.com/questions/1515/what-is-the-accepted-method-of-converting-shininess-to-roughness-and-vice-versa

@mmatl mmatl merged commit fcf4191 into mmatl:master Sep 7, 2019
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.

None yet

3 participants