CesiumGS / obj2gltf

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

convert issue #41

Closed xuncanzhe closed 7 years ago

xuncanzhe commented 7 years ago

I try to convert some files from obj to gltf.prompt "[TypeError: Object has no method 'fill']" . Looks like the tool has a problem. All steps use npm install. How can i fix it?

lilleyse commented 7 years ago

What version of node are you using? obj2gltf and gltf-pipeline are written for Node 4 and above, and I believe Array.prototype.fill is not implemented in some earlier versions of Node.

xuncanzhe commented 7 years ago

Thank you, I tested 0.1.6 version is working now. But this gltf file display in cesium is very strange. Looks like it flipped(Exchange y and z). modelMatrix is Cesium.Transforms.eastNorthUpToFixedFrame. I check the source file(obj =>v x y z). I do not have this problem with the COLLADA2GLTF tool from dae to gltf.

lilleyse commented 7 years ago

Is your original model z-up? Usually dae files will have some metadata that specifies which direction is up and will add a rotation accordingly, but this isn't possible with obj.

According to the glTF spec models should be y-up. Cesium always applies a y-up to z-up transform which is why you are seeing it flipped.

I would suggest either changing the source model or adding a z-up to y-up transform to your glTF model (like COLLADA2GLTF does). Longer term we could support this conversion directly in obj2gltf and gltf-pipeline given some command line flag.