xeokit / xeokit-sdk

Open source JavaScript SDK for viewing high-detail, full-precision 3D BIM and AEC models in the Web browser.
https://xeokit.io
Other
715 stars 286 forks source link

Need to load different MTL loading the same .obj with ObjLoaderPlugin #1403

Closed erikwski closed 6 months ago

erikwski commented 6 months ago

Is your feature request related to a problem? Please describe. I load an xkt model and need to append the same obj model multiple time. If i do that and my .mtl file use the keyword newmtl for create new Material, i will get an error for same material id on PhongMaterial.

Describe the solution you'd like I would like to doesn't need to make manual changes loading different .mtl or use diffent id. Maybe the id of the Material can become id=${newMtlId}-${objId}.

Describe alternatives you've considered Load different .mtl, one using newmtl, and the second time use the file with usemtl and retrieve PhongMaterial instance and set to it

xeolabs commented 6 months ago

If I understand correctly:

Unfortunately we don't currently support this use case, where we don't support loading multiple copies of the same OBJ model.

If anyone wants to extend OBJLoaderPlugin to enable the PhongMaterials to get non-clashing IDs for this case, we'd consider a PR.

I hope this helps..