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

duplicate materials #251

Closed
loadpixels opened this issue Jun 25, 2019 · 11 comments · Fixed by #266
Closed

duplicate materials #251

loadpixels opened this issue Jun 25, 2019 · 11 comments · Fixed by #266

Comments

@loadpixels
Copy link

When converting a file I'm getting an input .dae with ~21 materials converted to ~169 materials. It appears that the converter creates a new identical material for every object it finds in the scene rather than just assigning an existing one to the object.

Obviously this has problems for further down the pipeline where reducing drawcalls by limiting materials is desirable.

@lasalvavida
Copy link
Contributor

Hi @loadpixels. I would need to see the source model to say anything definitively, but the converter does not create a new identical material for every object in the scene.

I suspect what you are seeing is COLLADA instance materials with different overriden properties being split out as new materials in glTF, which is expected and unavoidable.

Feel free to attach your model if you'd like me to take a closer look.

@loadpixels
Copy link
Author

Hi @lasalvavida - please find attached the original and the converted file. You can see multiple materials with the exact same properties, which I would have imagined would generally be best collapsed down to a single material. I don't believe that the geometry has any attributes that would affect the different materials, but perhaps I'm wrong.

Is this in anyway related to pull request #100 ?

test dae and gltf.zip

@lasalvavida
Copy link
Contributor

Definitely something strange going on here. As far as I can tell, it looks like something may be tripping up OpenCOLLADA. There are some elements here that have the same id in the COLLADA, which isn't valid, they need to be unique within the document. For example, there are a bunch of nodes with the id "IfcWindow". Will look into this a bit closer later.

@loadpixels
Copy link
Author

Thanks for looking at this, I've tried reexporting the DAE (using https://github.com/IfcOpenBot/IfcOpenShell) to enforce GUIDs on every element, but I still appear to get the same issue.

Test files attached

test ifc dae gltf.zip

@KermMartian
Copy link
Contributor

I'm able to replicate this. I have a single COLLADA material set to two pieces of geometry, each of which has unique ids and names, and two identical GLTF materials are being created, each with the same name field. Let me know if there's anything I can provide to assist.

@lasalvavida
Copy link
Contributor

Hi @KermMartian, if you could attach the model, that would be much appreciated. More data always helps.

@KermMartian
Copy link
Contributor

Please find attached a sample model in DAE and GLB format. If I'm counting correctly:

DAE:

  • 2 images
  • 6 effects
  • 6 materials
  • 12 meshes
  • 8 nodes in node library
  • 125 instance_nodes or instance_geometrys

GLTF:

  • 4 textures
  • 12 materials
  • 12 meshes
  • 12 primitives
  • 165 nodes

struct.dae.zip

@KermMartian
Copy link
Contributor

bump Anything I can do to further assist with this?

@freeinform
Copy link

freeinform commented Dec 13, 2019

Same problem, materials are duplicated,
as well as something with numbers:
COLLADA:
<effect id="Стекло-fx"> <profile_COMMON> <technique sid="common"> <lambert> <diffuse> <color>0 0.5019608 0.7529412 1</color> </diffuse> <specular> <color>0.5 0.5 0.5 1</color> </specular> <shininess> <float>12</float> </shininess> <transparency> <float>0.1</float> </transparency> </lambert> </technique> </profile_COMMON> </effect>
GLTF:
{ "pbrMetallicRoughness": { "baseColorFactor": [ 0.0, 0.501960813999176, 0.7529411911964417, 1.0000005993542468e-22 ], "metallicFactor": 0.0 }, "alphaMode": "BLEND", "name": "Стекло-fx" }

@KermMartian
Copy link
Contributor

bumpity bump Anything I can do to help with this? It's a serious problem for us.

@lasalvavida
Copy link
Contributor

Fixed in #266

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 a pull request may close this issue.

4 participants