8

I decided to try out gltf format for rendering models in Three.js and I'm using this converter (http://cesiumjs.org/convertmodel.html) to convert the model from Collada to GlTF. It spits out a *.gltf file, however in the examples in Three.js they pass a *.json file. How can I load the *.gltf file or how can I get the proper set of files to load? Thanks

emackey
  • 11,818
  • 2
  • 38
  • 58
Hamabama
  • 253
  • 1
  • 3
  • 10

2 Answers2

2

You can use THREE.glTFLoader which can be found in the examples/js/loaders directory.

For a demo, see http://threejs.org/examples/webgl_loader_gltf.html.

three.js r.95

WestLangley
  • 102,557
  • 10
  • 276
  • 276
  • Sorry. The question is what file to pass to the loader? In the example they pass *.json, but none of the collada-to-gltf converters produce a json file. I'm getting files like *.gltf, *.bin and so on, but no json... – Hamabama Aug 19 '14 at 20:56
  • 3
    Good question. There appear to be other issues: https://github.com/mrdoob/three.js/issues/5161 – WestLangley Aug 19 '14 at 21:35
  • At least as of r83-r84, the `.json` versions are outdated and not needed. You can use a `.gltf` file directly with THREE.GLTFLoader. – Don McCurdy Jun 12 '17 at 23:53
1

The gltf file is a valid json file as far as I understand it. I opened a file converted from collada to gltf and it is just plain json. I put it also through the validator at JSONLint. I would suggest to change the file ending from .gltf to .json .

jteichert
  • 527
  • 1
  • 4
  • 20