CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.7k stars 307 forks source link

include .mtl and textures in node js? #283

Closed codepushed closed 1 year ago

codepushed commented 1 year ago

Hey, I want to convert obj to glb, i am using node. How to do I include .mtl and textures?

lilleyse commented 1 year ago

.mtl and textures are handled automatically as long as the paths in the .obj / .mtl are correct.

E.g. in the .obj there should be mtllib like https://github.com/CesiumGS/obj2gltf/blob/b135598dd8896c94418a5503ae0211c74c1fb5e3/specs/data/box-textured/box-textured.obj#L3

And in the .mtl there should be texture paths like https://github.com/CesiumGS/obj2gltf/blob/b135598dd8896c94418a5503ae0211c74c1fb5e3/specs/data/box-textured/box-textured.mtl#L13