glTF two.0¶

Reference

Category: Import-Export
Menu: File ‣ Import/Export ‣ glTF ii.0 (.glb, .gltf)

Usage¶

glTF™ (GL Transmission Format) is used for manual and loading of 3D models in web and native applications. glTF reduces the size of 3D models and the runtime processing needed to unpack and render those models. This format is commonly used on the web, and has back up in diverse 3D engines such as Unity3D, Unreal Engine 4, and Godot.

This importer/exporter supports the post-obit glTF two.0 features:

  • Meshes
  • Materials (Principled BSDF) and Shadeless (Unlit)
  • Textures
  • Cameras
  • Punctual lights (point, spot, and directional)
  • Blitheness (keyframe, shape key, and skinning)

Meshes¶

glTF'south internal structure mimics the retentiveness buffers commonly used by graphics chips when rendering in real-fourth dimension, such that assets tin be delivered to desktop, web, or mobile clients and be promptly displayed with minimal processing. As a result, quads and north-gons are automatically converted to triangles when exporting to glTF. Discontinuous UVs and flat-shaded edges may result in moderately higher vertex counts in glTF compared to Blender, equally such vertices are separated for export. Likewise, curves and other non-mesh data are not preserved, and must be converted to meshes prior to consign.

Materials¶

The core textile system in glTF supports a metal/rough PBR workflow with the following channels of data:

  • Base Color
  • Metallic
  • Roughness
  • Baked Ambience Apoplexy
  • Normal Map
  • Emissive

../_images/addons_io-gltf2_material-channels.jpg

An instance of the various prototype maps available in the glTF ii.0 core format. This is the water bottle sample model shown alongside slices of its various image maps.

Imported Materials¶

The glTF material organization is different from Blender'due south ain materials. When a glTF file is imported, the improver volition construct a set of Blender nodes to replicate each glTF textile equally closely as possible.

The importer supports Metal/Rough PBR (cadre glTF), Spec/Gloss PBR ( KHR_materials_pbrSpecularGlossiness ) and Shadeless ( KHR_materials_unlit ) materials.

Tip

Examining the consequence of the material import procedure is a good way to see examples of the types of material nodes and settings that can be exported to glTF.

Exported Materials¶

The exporter supports Metal/Rough PBR (core glTF) and Shadeless ( KHR_materials_unlit ) materials. It will construct a glTF material based on the nodes information technology recognizes in the Blender material. The fabric export procedure handles the settings described below.

Note

When image textures are used past materials, glTF requires that images be in PNG or JPEG format. The add-on volition automatically convert images from other formats, increasing consign time.

Tip

To create Shadeless (Unlit) materials, employ the Background material blazon.

Base Color¶

The glTF base of operations color is determined by looking for a Base Color input on a Principled BSDF node. If the input is unconnected, the input'south default color (the colour field side by side to the unconnected socket) is used every bit the Base Color for the glTF material.

../_images/addons_io-gltf2_material-baseColor-solidGreen.png

A solid base colour can be specified directly on the node.

If an Image Texture node is plant to be connected to the Base of operations Color input, that image volition be used as the glTF base of operations colour.

../_images/addons_io-gltf2_material-baseColor-imageHookup.png

An image is used as the glTF base color.

Baked Ambient Apoplexy¶

glTF is capable of storing a baked ambient occlusion map. Currently there is no organisation of nodes that causes Blender to use such a map in exactly the same manner as intended in glTF. Withal, if the exporter finds a custom node group past the name of glTF Settings , and finds an input named Occlusion on that node group, information technology will look for an Image Texture attached at that place to use as the occlusion map in glTF. The effect demand non exist shown in Blender, as Blender has other ways of showing ambient occlusion, but this method will allow the exporter to write an apoplexy image to the glTF. This can be useful to real-time glTF viewers, particularly on platforms where there may not be spare power for calculating such things at render time.

../_images/addons_io-gltf2_material-occlusionOnly.png

A pre-baked ambience occlusion map, continued to a node that doesn't render but will consign to glTF.

Tip

The easiest way to create the custom node grouping is to import an existing glTF model that contains an occlusion map, such every bit the water bottle or another existing model. A manually created custom node group tin too be used.

glTF stores apoplexy in the cherry ( R ) channel, allowing it to optionally share the same paradigm with the roughness and metallic channels.

../_images/addons_io-gltf2_material-orm-hookup.png

This combination of nodes mimics the way glTF packs occlusion, roughness, and metallic values into a single image.

Tip

The Cycles render engine has a Bake panel that can be used to bake ambience occlusion maps. The resulting image tin exist saved and connected directly to the glTF Settings node.

Normal Map¶

To use a normal map in glTF, connect an Image Texture node'south color output to a Normal Map node's colour input, and then connect the Normal Map normal output to the Principled BSDF node'southward normal input. The Image Texture node for this should have its Color Space property fix to Non-Color.

The Normal Map node must remain on its default property of Tangent Space as this is the only type of normal map currently supported past glTF. The strength of the normal map tin be adapted on this node. The exporter is not exporting these nodes directly, but will use them to locate the right image and will copy the strength setting into the glTF.

../_images/addons_io-gltf2_material-normal.png

A normal map image continued such that the exporter volition find it and copy information technology to the glTF file.

Tip

The Cycles return engine has a Broil panel that tin be used to bake tangent-infinite normal maps from nearly any other organisation of normal vector nodes. Switch the Broil blazon to Normal. Keep the default space settings (space: Tangent, R: +10, G: +Y, B: +Z) when using this broil console for glTF. The resulting baked image can be saved and plugged into to a new material using the Normal Map node as described above, allowing it to export correctly.

Meet: Cycles Return Baking

Emissive¶

An Paradigm Texture node can exist connected to an Emission shader node, and optionally combined with properties from a Principled BSDF node by way of an Add shader node.

If the glTF exporter finds an image connected to the Emission shader node, it volition export that image as the glTF material'south emissive texture.

../_images/addons_io-gltf2_material-emissive.png

An Emission node tin can be added to existing nodes.

Note

The Emission input of the Principled BSDF node is not yet supported by this exporter. This may change in a futurity version.

Double Sided / Backface Culling¶

For materials where only the front faces will exist visible, plow on Backface Culling in the Settings console of an Eevee textile. When using other engines (Cycles, Workbench) you tin temporarily switch to Eevee to configure this setting, then switch back.

Leave this box united nations-checked for double-sided materials.

../_images/addons_io-gltf2_material-backfaceCulling.png

The changed of this setting controls glTF's DoubleSided flag.

Blend Modes¶

The Base Color input can optionally supply alpha values. How these values are treated by glTF depends on the selected blend mode.

With the Eevee render engine selected, each material has a Alloy Style on the fabric settings panel. Use this setting to define how alpha values from the Base Colour aqueduct are treated in glTF. Iii settings are supported by glTF:

Opaque
Alpha values are ignored (the default).
Alpha Blend
Lower alpha values crusade blending with background objects.
Alpha Prune
Alpha values beneath the Clip Threshold setting will crusade portions of the material to non exist rendered at all. Everything else is rendered as opaque.

../_images/addons_io-gltf2_material-alphaBlend.png

With the Eevee engine selected, a material's blend modes are configurable.

Note

Be aware that transparency (or Alpha Blend mode) is complex for existent-time engines to render, and may bear in unexpected ways after export. Where possible, use Alpha Clip mode instead, or place Opaque polygons behind only a unmarried layer of Alpha Blend polygons.

UV Mapping¶

Control over UV map selection and transformations is available past connecting a UV Map node and a Mapping node to any Paradigm Texture node.

Settings from the Mapping node are exported using a glTF extension named KHR_texture_transform . There is a mapping type selector across the tiptop. Point is the recommended type for export. Texture and Vector are also supported. The supported offsets are:

  • Location - X and Y
  • Rotation - Z simply
  • Calibration - X and Y

For the Texture type, Scale X and Y must be equal (uniform scaling).

../_images/addons_io-gltf2_material-mapping.png

A deliberate choice of UV mapping.

Tip

These nodes are optional. Not all glTF readers support multiple UV maps or texture transforms.

Factors¶

Any Image Texture nodes may optionally be multiplied with a constant colour or scalar. These volition be written every bit factors in the glTF file, which are numbers that are multiplied with the specified prototype textures. These are not common.

Instance¶

A single material may use all of the higher up at the same time, if desired. This figure shows a typical node structure when several of the above options are practical at once:

../_images/addons_io-gltf2_material-principled.png

A Principled BSDF textile with an emissive texture.

Extensions¶

The cadre glTF 2.0 format can be extended with extra data, using glTF extensions. This allows the file format to hold details that were not considered universal at the time of first publication. Not all glTF readers support all extensions, but some are fairly common.

Sure Blender features can only be exported to glTF via these extensions. The following glTF 2.0 extensions are supported direct by this improver:

Import

  • KHR_materials_pbrSpecularGlossiness
  • KHR_lights_punctual
  • KHR_materials_unlit
  • KHR_texture_transform

Export

  • KHR_draco_mesh_compression
  • KHR_lights_punctual
  • KHR_materials_unlit
  • KHR_texture_transform

Animation¶

glTF allows multiple animations per file, with animations targeted to particular objects at time of export. To ensure that an animation is included, either (a) make information technology the active Action on the object, (b) create a single-strip NLA runway, or (c) stash the activity.

Supported

But sure types of animation are supported:

  • Keyframe (translation, rotation, calibration)
  • Shape keys
  • Armatures / skinning

Blitheness of other properties, like lights or materials, will be ignored.

Custom Backdrop¶

Custom backdrop on most objects are preserved in glTF export/import, and may be used for user-specific purposes.

File Format Variations¶

The glTF specification identifies different ways the data can be stored. The importer handles all of these means. The exporter will ask the user to select 1 of the following forms:

glTF Binary ( .glb

This produces a single .glb file with all mesh data, epitome textures, and related information packed into a single binary file.

Tip

Using a single file makes it like shooting fish in a barrel to share or copy the model to other systems and services.

glTF Separate ( .gltf + .bin + textures)¶

This produces a JSON text-based .gltf file describing the overall construction, along with a .bin file containing mesh and vector data, and optionally a number of .png or .jpg files containing image textures referenced by the .gltf file.

Tip

Having an assortment of carve up files makes it much easier for a user to get back and edit any JSON or images later on the consign has completed.

Note

Be enlightened that sharing this format requires sharing all of these separate files together as a group.

glTF Embedded ( .gltf

This produces a JSON text-based .gltf file, with all mesh information and image data encoded (using Base64) within the file. This grade is useful if the asset must be shared over a patently-text-only connection.

Warning

This is the least efficient of the available forms, and should only be used when required.

Properties¶

Import¶

Pack Images
Pack all images into the blend-file.
Shading
How normals are computed during import.

Consign¶

General Tab¶

Format
See: File Format Variations
Selected Objects
Export selected objects but.
Employ Modifiers
Use modifiers (excluding armatures) to mesh objects.
Y Up
Export using glTF convention, +Y upwards.
Custom Properties
Consign custom properties equally glTF extras.
Remember Consign Settings
Store export settings in the Blender file, and so they will be recalled adjacent time the file is opened.
Copyright
Legal rights and weather condition for the model.

Meshes Tab¶

UVs
Consign UVs (texture coordinates) with meshes.
Normals
Consign vertex normals with meshes.
Tangents
Export vertex tangents with meshes.
Vertex Colors
Export vertex colors with meshes.
Materials
Consign materials.
Draco mesh compression
Shrink meshes using Google Draco.
Pinch level
Higher compression results in slower encoding and decoding.
Position quantization bits
Higher values upshot in better compression rates.
Normal quantization bits
Higher values result in amend compression rates.
Texcoord quantization bits
Higher values result in improve compression rates.

Objects Tab¶

Cameras
Consign cameras.
Punctual Lights
Export directional, signal, and spot lights. Uses the KHR_lights_punctual glTF extension.

Animation Tab¶

Apply Current Frame
Export the scene in the current animation frame.
Animations
Exports active actions and NLA tracks as glTF animations.
Limit to Playback Range
Clips animations to selected playback range.
Sampling Rate
How often to evaluate animated values (in frames).
Always Sample Animations
Apply sampling to all animations.
Skinning
Consign skinning (armature) information.
Bake Skinning Constraints
Utilize skinning constraints to armatures.
Include All Os Influences
Allow >four joint vertex influences. Models may appear incorrectly in many viewers.
Shape Keys
Export shape keys (morph targets).
Shape Fundamental Normals
Export vertex normals with shape keys (morph targets).
Shape Key Tangents
Export vertex tangents with shape keys (morph targets).

Contributing¶

This importer/exporter is developed through the glTF-Blender-IO repository, where you can file bug reports, submit feature requests, or contribute code.

Discussion and evolution of the glTF 2.0 format itself takes identify on the Khronos Grouping glTF GitHub repository, and feedback there is welcome.