glTF Files
Supported
This glTFsection Fileprovides Versionsadditional
Sceneinformation Composer supports glTF files of format version 2.0.
Select glTF File for Import
Useon the Importuse -> glTF option from menu to open the import dialog forof glTF files.

The "Select File ..." button shows the Open dialog window allowing to select the glTF file.

For a description of the options available, refer to Import Dialog Options. The IBL options are specific to this dialogue and allow setting the textures for radiance, irradiance and BRDF integration, you need all three of those to use IBL:
SceneComposer supports following glTF file formats when importing:
For more detailed information on the file formats, please see the Khronos website: GLB File Format Specification.
Import the new glTF file by pressing the "OK" button.
The experience of modifying the scene camera can be greatly improved by using the "scene camera manipulation" feature. Transformation and look-at vector might be reset after using it for navigating in the scene (you may enable it from menu File->Preferences->Editor->Enable scene camera manipulation) while the display preview window is opened (menu View->Display->Display-0).
Use of Image Based Lighting
When importing a glTF file, it is possible to select whether Image Based Lighting (IBL) should be used. This can be done by checking the corresponding checkbox in the import dialogue shown in the image above.
If IBL should be used, these three values have to be defined before importing an glTF file. After import they cannot be defined anymore. If IBL should not be used, simply uncheck the Checkbox. Then the standard is used.
The standard IBL files can be set in the Solution Options:

There is also an own shared library in the references available which also contains BRDF (files for the light dissipation), Diffuse and Specular.
For the IBL Textures the following setting is recommended:
For the IBL Textures the following setting is mandatory:
Those settings are applied if possible (if the resources are not part of a referenced shared library).
Image Based Lighting Textures
To utilize all the features of glTF's metallic-roughness materials, knowledge about its physically based rendering model is required.
Users have to provide the IBL (Image Based Lighting) textures themselves, or rely on the example textures that come with Scene Composer.
IBL textures can be created with a tool like cmftStudio or IBL Baker. They consist of a radiance cubemap with specular pre-convolved environment built into the cubemap's mipmaps, an irradiance map and a BRDF distribution map.
Keep in mind, that the default BRDF map that comes with Scene Composer is generated for white light only. If you change the light's color, the BRDF map will no longer match, thus the end result will not be correct.
The metallic-roughness parameters from glTF translate to Scene Composer's shader and Uniform Setter as follows:
"baseColorFactor" = u_BaseColorFactor "metallicFactor" = u_MetallicRoughnessValues.x "roughnessFactor" = u_MetallicRoughnessValues.y
Limitations
The CGI Studio glTF Importer does not support the following features:
- Skinning
- Morping
- Vertex Buffer Streams
- Sparse Accessors
- Multiple UV Maps
Animations
There is a working sample available showing the usage of glTF animations. For this, please refer to Physically Based Rendering Solution
Interpolation animation is available, however Morphing and the channel path "weights" are not available.
Animation of:
- translation
- rotation
- scale is available.
Also, the follwoing Interpolation strategies are available:
- linear
- step
- cubicspline
In glTF rotation angles are specified in quaternions, for usage in CGIStudio, the values are converted to Euler-angles.
For a more detailed description on animations please refer to the Khronos website: animations. For a more detailed description on interpolation types please refer to the Khronos website: animation sampler.
SDK version
The glTF importer uses the Microsoft glTF-SDK in version v1.9.1.0. It can be downloaded from Github.
Reference models
A reference model that is being used is the boombox. The glTF file is available at the folder cgi_studio_content/3D/glTF/. Available reference models can be found at: The Khronos website: glTF Sample Models.

Pyhsically Based Shading (PBS)
On the imported 3d model the metal roughness material model is applied. If no IBL textures are defined a default material is applied. The shaders are provided for OpenGL ES 2.0 and 3.0.
In SceneComposer the properties are called differently from the glTF standard:
- the standard property baseColor is called u_Base Color Factor
- the standard property metallic is determined by the X value in the u_Metallic Roughness Values
- the standard property roughness is determined by the Y value in the u_Metallic Roughness Values
The following properties of the appearance and shader are automatically set by the Importer, but can also be configured manually: Uniforms:
- "u_MetallicRoughnessValues" holds the metallic factor in X, and roughness factor in Y. These values are multiplied with the metallic and roughness values from the metallic-roughness texture on a per pixel basis. If there is no such texture, the values from the uniform are used instead.
- "u_BaseColorFactor" (RGBA) is multiplied with the value from the albedo texture on a per pixel basis. If there is no such texture, the values from the uniform are used instead.
- "u_MipmapCount" The number of mipmaps (excluding level 0) from the specular/radiance texture.
- (Optional) "u_NormalScale" is a factor that is multiplied with the X and Y component of the normal. This uniform is only available if HAS_NORMALMAP has been defined in the fragment and vertex shader.
- (Optional) "u_OcclusionStrength" is a factor for the linear interpolation between the color and the color times ambient occlusion. This uniform is only available if HAS_OCCLUSIONMAP is defined in the fragment and vertex shader.
- (Optional) "u_EmissiveFactor" (RGB) is multiplied with the value from the emissive texture on a per pixel basis. This uniform is only available if HAS_ HAS_EMISSIVEMAP is defined in the fragment and vertex shader.

Textures:
- (Optional) The albedo texture (RGBA) must be set at texture unit 0, and HAS_BASECOLORMAP must be defined in the fragment shader.
- (Optional) The metallic-roughness texture (GB) must be set at texture unit 1, and HAS_METALROUGHNESSMAP must be defined in the fragment shader. The metallic values must be stored in blue channel. The roughness values must be stored in the green channel of the texture.
- (Optional) The tangent-space normal (RGB) texture must be set at texture unit 2, and HAS_NORMALMAP must be defined in the fragment and vertex shader.
- (Optional) The occlusion texture (R) must be set at texture unit 3, and HAS_OCCLUSIONMAP must be defined in the fragment and vertex shader. The occlusion values are stored in the red channel of the texture.
- (Optional) The emissive texture (RGB) must be set at texture unit 4, and HAS_EMISSIVEMAP must be defined in the fragment and vertex shader.
- (Optional) IBL textures. The following textures must be present for IBL to work correctly.
- The diffuse/irradiance cubemap (RGB) must be set at texture unit 5, and USE_IBL must be defined in the fragment shader.
- The specular/radiance cubemap (RGB) must be set at texture unit 6, and USE_IBL must be defined in the fragment shader. The specular pre-convolved environment must be built into the mipmaps. The number of mipmaps (excluding level 0) is set in the shader uniform "u_MipmapCount" automatically by the importer, or must be configured manually if this cubemap is set manually.
- The BRDF texture (RG) must be set at texture unit 7, and USE_IBL must be defined in the fragment shader.
Details of the imported appearance are shown in the scene tree:

Mesh:
- Position is mandatory.
- (Optional) If the mesh has normals, HAS_NORMALS must be defined in the fragment and vertex shader.
- (Optional) If the mesh has tangents, HAS_TANGENTS must be defined in the fragment and vertex shader.
- (Optional) If the mesh as a uv set, HAS_UV must be defined in the vertex shader.
Uniform Setter:
- Model View Projection matrix is mandatory.
- Model matrix is mandatory.
- Normal model matrix is mandatory if HAS_NORMALS and HAS_TANGENTS are defined in the shader.
Optimization tips:
- Use one texture for occlusion, roughness, and metallic values, stored as an RGB texture.
- Providing tangents in the mesh avoids calculating the tangent space matrix on a per pixel basis.
For a more detailed description on Pysically Based Rendering please refer to the Khronos website: metallic roughness.
Useful links
Khronos References
- glTF Overview (https://www.khronos.org/gltf/)
- glTF 2.0 Specification (https://github.com/KhronosGroup/glTF/tree/master/specification/2.0)
- glTF 2.0 Sample Models (https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0)
Khronos Specification
- Specification (https://github.com/KhronosGroup/glTF)
Viewers
- BabylonJS Sandbox (https://sandbox.babylonjs.com/)
- donmccurdy glTF viewer (https://gltf-viewer.donmccurdy.com/)
- Khronos glTF Sample Viewer (https://github.khronos.org/glTF-Sample-Viewer/)
