-
Notifications
You must be signed in to change notification settings - Fork 593
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
Merge primitive materials #1246
Merge primitive materials #1246
Conversation
…n for a mesh storing a PBRMaterial for each face
Thanks for the PR! Could you add an example model that does this for unit tests? My one thought is that do we need a new visual type? What if we just used |
Yeah, I thought about that too. I opted for creating a new visual type, because otherwise we have to change a bit the TextureVisuals. I'm not entirely sure if it's a good idea to change the P.S. In the mean time I will add a simple cube with multiple primitives as a test material. |
… color for testing the merge_primitive option with materials
Thanks for adding the model! Yeah seems like the options are:
I'd personally kind of lean towards 4 though am definitely open to others, what do you think? |
Hi, so I believe that 1 will cause a lot of conflicts as it will change the visual API. 2 is essentially the same as 1 or am I missing something? 3 won't break the API, but as I mention earlier I find it confusing. I'm not entirely sure I understand 4. The idea is to keep the |
Apologies for the delay. Looks like there's a linked issue for people asking for this too. Yeah I would strongly prefer a "multi-material" material rather than a separate visual object if possible. If you have cycles to do that here it would be awesome otherwise I can hopefully take up the torch on this one 😄. I think the unit test this needs regardless of implementation is:
|
I hear you. Two more things though. First what do you think should the
The second option may be a bit confusing as the materials_face is related to the mesh, but I believe that it is the cleaner way to go. What do you think? As on the test. I totally agree, but the aim should be the export to create a valid gltf, not the same one. So if we have a mesh with multiple primitives in the same color after import/export it should be single mesh and if we have a mesh with multiple primitives each in different color after import/export it should be the same. Are you okay with that? While working on that I spot a bug with the naming of the primitives, but I will open a separate PR for that. |
Awesome sounds good!
My inclination would be to have
Agreed! Producing the same input is definitely not necessary as long as it passes the validators (run in unit tests).
Sounds good! Yeah the |
…of Materials; Removing the FaceMaterails visual and adding a new field to the TextureVisual - face_materials
…the values of the baseColorFactor to be floating point, so that they are loaded correctly in Trimesh
…and test for a roundtrip
Thanks for the changes! Let me know when you're ready to merge and I'll make a pass before releasing in #1271 |
…s there was a not used mesh leftover. Updating the mesh name in the test, so that it does not have index
I believe that I have fixed things for the time being. One think to mention is that the test file I use was created with Blender having red, blue and green materials. Once exported the Another thing that is unresolved issue is the naming of the primitives. Let's say we have two nodes named |
Looks great thanks for the updates! Yeah the primitive:mesh mapping is a bit rough.. I also don't know what the best way to handle that is. Maybe a key we can check in metadata? Or possibly add metadata to the nodes in the scene graph? I'll merge this and make a pass and see if anything jumps out. Thanks for all the work on this! |
Initial implementation of a merge of the primitive's materials when loading gltf with merge_primitive=True