0

I am reading a book: Programming 3D Applications with HTML5 and WebG , it involve a Vizi framework.

All the examples load the *.json file instead of *.gltf file. Why?

When I load *.gltf, it doesn't load any result, and the collada2gltf converters only produce *.gltf, *.bin, *.glsl files and so on.

What should I do?

emackey
  • 11,818
  • 2
  • 38
  • 58
red
  • 11
  • 2
  • 1
    Can you please try and format your question better? it's hard to read when everything is a single block of text. Also, some information is missing. maybe include the example? – Thatkookooguy Aug 11 '16 at 09:34

1 Answers1

1

.gltf is a JSON file. Try to open it with a text editor and see for youself. .bin and .glsl files are just additional resources, linked from .gltf file. Those are geometry buffers and shaders respectively. So to make it work you should make sure that all the files produced with the converter are also available to a web browser you running your code in.

Also you can try to add -e CLI flag to collada2gltf and it'll embed all the resources into result .gltf file.

Kirill Dmitrenko
  • 3,474
  • 23
  • 31
  • I know *.gltf file is json format file,but how to get the extention-name *.json file, instead of *.gltf.what should I do ? – red Aug 12 '16 at 08:32
  • In the Programming 3D Applications with HTML5 and WebG, all examples files are *.json, *.bin, *.glsl and so on. when I use collada2gltf tool, produce *.gltf, *.bin, *.glsl and so on, then rename *.glsl to *.json, and load it by the example program of the book, but it failed! why? – red Aug 12 '16 at 08:40
  • That's because [Vizi doesn't use glTF](https://github.com/tparisi/Vizi/blob/master/engine/src/loaders/loader.js#L44), it uses Three.js JSON. However, there is, for example, [a Blender exporter](https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender). – Kirill Dmitrenko Aug 12 '16 at 11:07
  • how to get the *.json, *.bin, *.glsl files at the same time? Can you give me a detailed procedure? for example, how to get the *.json file, how to get *.bin file, how to get *.glsl file? I will appreciate! – red Aug 14 '16 at 04:46
  • In the Programming 3D Applications with HTML5 and WebG, it always includes three files:*.dae file, *.json file, *.bin file and so on in the models directory. How I get that? – red Aug 14 '16 at 04:49
  • Why are you so keen on including all files? I've gave you links to a way to convert COLLADA to Three.js JSON (via Blender). – Kirill Dmitrenko Aug 14 '16 at 10:52
  • thank you very much, but most examples in the book, every directory includes *.json, *.bin, *.dae, *.glsl files. now I need know how to generate them. for example, I can get the *.json file, but how to get the *.bin file? I need a detailed procedure! – red Aug 15 '16 at 00:17
  • At the same time, I need the most important three files, including *.json, *.bin, *.dae files in my application. So I am so keen on including all files. – red Aug 15 '16 at 00:21