Hot answers tagged

6

While creating a set of glTF models for a tutorial, I also intended to create THE minimal glTF file. Update: The following referred to glTF 1.0/1.1. See below for an update of this example to glTF 2.0. As already mentioned in the answer by 5chdn, one issue may be the material. According to the Appendix A: Default Material of the specification, an asset ...


5

For what it's worth, the glTF Tutorials contain a section on Skinning that shows how the raw vertex and joint weight data feed into a vertex shader to distort the mesh. If you do design your own format to hold this, you'll need tooling to export it from 3D content creation software, as well as software to read the new format into your application. Using an ...


4

You can put the data into a data uri to store the data inline in base64 format. "buffers": { "a-buffer-id": { "byteLength": 1024, "type": "arraybuffer", "uri"="data:application/octet-stream;base64,..." } }, It's still a bit bloated compared to storing the data in a binary file though.


3

Embedding human readable data is not supported. However you can put the data into a data uri to store the data inline in base64 format. "buffers": { "a-buffer-id": { "byteLength": 1024, "type": "arraybuffer", "uri"="data:application/octet-stream;base64,..." } },


3

You're seeing channels and samplers there, not individual keyframes. In this case, one animation is simultaneously targeting the translation, rotation, and scale channels of the same node, with three separate "samplers" (sets of keyframes per channel). Not shown above, your glTF file has a section called accessors that tells viewers how to slice out ...


3

After spending a hard time to understand the way how the binary buffers work in the gltf files I finally managed to generate a truely minimal gltf file. It's a single yellow triangle (demo). I tried to remove everything which is not needed from the gltf. This is what is required it seems (github): { "accessors": { "accessor0": { "...


3

Also check out the glTF models used in Cesium: https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Apps/SampleData/models https://github.com/AnalyticalGraphicsInc/cesium/tree/master/Specs/Data/Models Patrick


2

Ok sometimes you have to ask a question to figure out the answer already. Example datasets are available in the same repository as linked in the question already. Here are some: supermurdoc.gltf duck.gltf etc. pp.


2

The min and max values provide an outer bounding box for all POSITION data within a given accessor. Accessors typically contain multiple vertices, for example all of the vertices of a particular primitive, and then min: [x, y, z] and max: [x, y, z] will offer the bounding box for that primitive. For your second question, let's look at the mesh structure ...


2

In addition to @russ' answer, I was able to decode the buffer with the gltf Utilities. let uri = "data:application/octet-stream;base64,AAABAAIAAwACAAEABAAFAAYABwAGAAUACAAJAAoACwAKAAkADAANAA4ADwAOAA0AEAARABIAEwASABEAFAAVABYAFwAWABUAAAAAvwAAAL8AAAA/AAAAPwAAAL8AAAA/AAAAvwAAAD8AAAA/AAAAPwAAAD8AAAA/AAAAPwAAAL8AAAA/AAAAvwAAAL8AAAA/AAAAPwAAAL8AAAC/AAAAvwAAAL8AAAC/...


2

The information you're looking for is defined in the 'accessors' and 'bufferViews' near the top of the source file you linked. Bufferviews simply divide the buffer up into sub ranges and define broadly what kind of data lives there using some obscure shortcodes. In this case, target 34963 means index data and 34962 means vertex data. So from the other ...


2

Technically any file format where you can dump the entire file into a VBO and then render from that will work for the .bin files. Unfortunately those formats are less well known than they should be. Then you only need to adjust the bufferview elements to reference the proper subset of the file


2

Not 3D as such, but it seems in 1963 Ivan Sutherland's seminal "Sketchpad" (and wikipedia) had instancing. eg. See "Chapter VI RECURSIVE FUNCTIONS" of the 2nd reference. IIRC somewhere there's a video of it in action - it made me annoyed as to how some of today's vector drawing tools don't seem to be able to do some of what sketchpad ...


1

The accessor (model.accessors[accessor_index]) has its own byteOffset and count values that you need to account for here. The input and output accessors are allowed to share a bufferView, and your output is showing a dump of the same entire bufferView twice. The first five values in that dump are the input accessor with the times (in seconds, since the ...


1

It's not possible to store the plain text array buffers in gltf, however, here is the code I use to generate buffers in JavaScript: let vtx = [ 0.0857, 0.0759, 0.0367, 0.9726, 0.9678, 0.0318, 0.9754, 0.9327 ]; let idx = [ 0, 2, 2, 4, 4, 0, 0, 1, 1, 4 ]; let buf = new ArrayBuffer(52); let dat = new DataView(buf, 0, 52); for (var i = 0; i ...


1

There isn't a bounding box for the whole glTF file, but individual primitives have POSITION accessors that indicate min and max values. This is specified in the Meshes section, with the following text: POSITION accessor must have min and max properties defined. For a concrete example of this, take a look at the Box sample model, which assigns accessor 2 ...


1

The .bin file that goes with a .gltf only includes mesh data (position, normal, uv, other vertex attributes as needed). It does not normally include any images (unless you're using the base64 export "glTF Embedded", but don't use that for this, use "glTF Separate" instead). If you look in the JSON text of the .gltf file, you'll see an images array, where ...


1

Perhaps Assimp will work for you? In particular, it has a command line tool for converting between formats.


1

Blender appears to have a .X importer. It's a plugin that ships with Blender, but is disabled by default, so you have to enable it in User Preferences. See: https://blender.stackexchange.com/a/8749/18161 Blender also has a glTF exporter. For now that's a separate download, from here: glTF-Blender-Exporter


1

I've finally managed to write the buffers myself using JavaScript. The result is a base64 encoded String, like: data:application/octet-stream;base64,AAACAAIABAAEAAAAAAABAAEABAB7g689dnGbPb1SFj1Q/Hg/vsF3P7hAAj3Qs3k/bcVuPw== If you paste this Data URI into the browser, you can download a binary blob which is exactly what the glTF files can use. The 52 bytes ...


Only top voted, non community-wiki answers of a minimum length are eligible