JPEG from the world of 3D. What is glTF?
Definition and brief history
GLTF (GL Transmission Format) is a file format for storing 3D scenes and models, which is extremely simple to understand (the structure is written in the JSON standard), extensible and easily interacting with modern web technologies. This format compresses 3D scenes well and minimizes processing during execution of applications using WebGL and other APIs. glTF is now actively promoted by Khronos Group as a JPEG from the 3D world.
It is assumed that glTF will be an efficient, compatible format for asset delivery, which compresses the size of three-dimensional scenes and minimizes processing at runtime by applications using WebGL and other APIs. glTF also defines a common publication format for 3D content tools and services.
The first mentions of glTF are dated 2012m year, but it came into use since October 19, 2015, together with the announcement of the specification glTF 1.0. At the moment, the 2nd version of the specification (glTF 2.0) is used, which was released on March 3, 2017. Further, it will be discussed only about glTF 2.0.
A detailed description of the internals of this format can be found in my subsequent publications: the first part and the second part.
The basis of glTF and its advantages
glTF is based on 2 files: JSON to describe the structure of the entire 3D scene and the binary file, to store all the data from the scene, including texture maps, which can be "stitched" into a binary file or stored by external files. There is also a binary version of glTF, which is called GLB, the only difference of which is that everything is stored in the 1st file with the GLB extension.
As additional advantages in glTF can be identified:
- Clear hierarchy of objects in the 3D scene structure
- Store scene information such as light sources and cameras
- Skeletal animation support (joints animation)
- More reliable materials and shaders
If you compare glTF and COLLADA, then the functions they support are very similar, but, recalling that glTF is, first of all, the "transfer format", then its undeniable advantage will be good compatibility with web technologies. If we give an analogy, I would use .PSD (Adobe Photoshop) and .JPG formats. The first is good for editing source material, but for storage and use on the Internet, they use, nevertheless, JPG.
Today, 3D comes to the client from completely different sources, each with its own format. Not all information is needed by the user, not all formats can be opened in his application. The structure of the scene must be analyzed, the data of three-dimensional geometry are converted to the format required by the graphics API. 3D data must be transferred to the video card's memory, then the rendering process can be described using successive calls to the graphics API. As a result, each executable application must create its own importers, loaders or converters for all file formats it will support, as shown on the slide.
The GLTF format defines a standard for presenting 3D content in a form suitable for use in an application at runtime. Existing formats are poorly suited for transmission over the Internet: some contain only information about geometry, some contain absolutely everything and are too cumbersome in size and difficult to analyze, let alone run in real time (runtime).
GLTF was designed to solve this problem. This is not “another file format”, of which there are already very many, it is the definition of the format of the transmission of 3D scenes!
The scene structure described by JSON can easily be analyzed, 3D data is stored in a form that is easily readable and used directly by graphical APIs, and therefore there is no need to decode or preprocess 3D data. In this way, GLTF can help bridge the gap between content creation and rendering.