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

Loading gltf with merge_primitives=True and materials? #1229

Open
ibozhilov opened this issue Apr 27, 2021 · 3 comments
Open

Loading gltf with merge_primitives=True and materials? #1229

ibozhilov opened this issue Apr 27, 2021 · 3 comments

Comments

@ibozhilov
Copy link
Contributor

I'm trying to load a GLTF with the option merge_primitives set to True. Once the model is loaded all of the face_colors to all of the Trimesh objects are set to [102, 102, 102, 255], which seems to be some default value set in the ColorVisuals class. I took a look at the code and it seems that the materials of the GLTF aren't loaded into the kwargs when loading with merge_primitives=True. Is that right or am I missing something?

@mikedh
Copy link
Owner

mikedh commented Apr 27, 2021

Yeah, it's probably not concatenating face colors in merge_primitives- PR's welcome!

@ibozhilov
Copy link
Contributor Author

Okay, so I saw that you have defined an array called face_colors in the ColorVisuals class where you define the color for each face. Would it be possible to have the same thing but instead have the material for each face, as otherwise a lot of the information would be lost? The concatenation of the materials itself is easy, but the tricky part I believe is how you store the materials, as you have thousands of faces per mesh and probably only few materials if not just one.
So would it be reasonable to create a new class inheriting from the Visuals that possibly contains an array of PBRMaterial instances and then another array face_materials that contains the indexes of the corresponding material in the first array? I am down for creating PR for that just want to hear your thoughts about such an implementation.

@ibozhilov
Copy link
Contributor Author

Hi, so I went a head and implemented a new class that can store materials for each face (#1246 ). There is a lot of things to be done in order to visualize the new visual and etc. but its an initial idea that can be build on. Is it something that sounds reasonable, so that I can polish it a bit and integrate it better with the rest of the library?

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

No branches or pull requests

2 participants