# glTF 2.0¶

File ‣ 导入/导出 ‣ glTF 2.0 (.glb, .gltf)

## 用法¶

glTF™(GL传输格式)用于在 Web 和本机应用程序中传输和加载 3D 模型。glTF 减小了 3D 模型的大小以及解压缩和渲染这些模型所需的运行时处理。此格式通常用于网页上,并支持各种 3D 引擎,如 Unity3D、虚幻引擎 4 和Godot。

• 网格

• 材质(Principled BSDF)和无阴影(无光照)

• 纹理

• 相机

• 精确光源(点光，聚光和定向光源)

• Extensions (listed below)

• Extras (custom properties)

• 动画(关键帧，形态键及蒙皮)

## 网格¶

glTF的内部结构模拟了图形芯片在实时渲染时常用的内存缓冲区，这样资产可以交付到桌面、网页或移动终端，并以最少的处理进行迅速显示。 因此，当导出为glTF时，四边形和多边形会自动转换为三角形。 与Blender相比，不连续的UV和平面阴影边缘可能导致glTF中的顶点数适度增多，因为这样的顶点会被分开以导出。 同样，曲线和其他非网格数据不会保留，必须在导出之前转换为网格。

## 材质¶

glTF中的核心材质系统通过一下信息通道支持金属/粗糙 PBR 工作流：

• 基础色

• 金属度

• 粗糙度

• 烘培的环境光遮蔽

• Normal Map (tangent space, +Y up)

• 发射

Some additional material properties or types of materials can be expressed using glTF extensions:

• Clearcoat, Clearcoat Roughness, Clearcoat Normal (uses KHR_materials_clearcoat)

• Transmission (uses KHR_materials_transmission)

• "Shadeless" materials (uses KHR_materials_unlit)

glTF 2.0核心格式中可用的各种图像贴图的示例。这个 水瓶示例模型 一起显示了各种贴图切片样本。

### 导入的材质¶

glTF材质系统与Blender自己的材质不同。 导入glTF文件时，此插件将构造一组Blender节点，以尽可能接近地复制每个glTF材质。

Tip

### 导出的材质¶

Note

#### 烘培的环境光遮蔽¶

glTF能够存储烘焙的环境光遮蔽图。 目前没有任何节点安排导致Blender以与glTF中预期完全相同的方式使用这样的映射。 但是，如果导出器找到名为“glTF Settings”的自定义节点组，并在该节点组上找到名为“Occlusion”的输入，它将查找附加在其上的图像纹理以用作遮蔽在glTF中映射。 该效果不需要在Blender中显示，因为Blender有其他方式显示环境光遮蔽，但此方法将允许导出器将遮挡图像写入glTF。 这对于实时glTF查看器非常有用，特别是在渲染时可能没有多余能力进行计算这些东西的平台上。

Tip

glTF将遮蔽存储在红色 (R) 通道中，允许它选择与粗糙度和金属度通道共享相同的图像。

Tip

Cycles渲染引擎有一个烘焙面板，可用于烘焙环境遮挡贴图。 生成的图像可以保存并直接连接到“glTF Setting”节点。

#### 法线贴图¶

Tip

Cycles渲染引擎有一个烘焙面板，可用于从几乎任何其他法向量节点排列中烘焙切线空间法线贴图。 将Bake类型切换为Normal。 将此烘烤面板用于glTF时，请保留默认空间设置(空间：切向，R: +X, G: +Y, B: +Z)。 如上所述，可以保存生成的烘焙图像，并将其用于使用上述法线贴图节点的新材质，从而使其可以正确导出。

#### 发射¶

An Image Texture node can be connected to the Emission input on the Principled BSDF node to include an emissive map with the glTF material. Alternatively, the Image Texture node can be 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 emissive map is alone in the material, it is best to set the Base Color default to black, and the Roughness default to 1.0. This minimizes the influence of the other channels if they are not needed.

This arrangement is supported for backwards compatibility. It is simpler to use the Principled BSDF node directly.

#### Clearcoat¶

When the Clearcoat input on the Principled BSDF node has a non-zero default value or Image Texture node connected, the KHR_materials_clearcoat glTF extension will be included in the export. This extension will also include a value or Image Texture from the Clearcoat Roughness input if available.

If Image Textures are used, glTF requires that the clearcoat values be written to the red (R) channel, and Clearcoat Roughness to the green (G) channel. If monochrome images are connected, the exporter will remap them to these color channels.

The Clearcoat Normal input accepts the same kinds of inputs as the base Normal input, specifically a tangent-space normal map with +Y up, and a user-defined strength. This input can reuse the same normal map that the base material is using, or can be assigned its own normal map, or can be left disconnected for a smooth coating.

All Image Texture nodes used for clearcoat shading should have their Color Space set to Non-Color.

An example of a complex clearcoat application that will export correctly to glTF. A much simpler, smooth coating can be applied from just the Principled BSDF node alone.

#### Transmission¶

When the Transmission input on the Principled BSDF node has a non-zero default value or Image Texture node connected, the KHR_materials_transmission glTF extension will be included in the export. When a texture is used, glTF stores the values in the red (R) channel. The Color Space should be set to Non-Color.

Transmission is different from alpha blending, because transmission allows full-strength specular reflections. In glTF, alpha blending is intended to represent physical materials that are partially missing from the specified geometry, such as medical gauze wrap. Transmission is intended to represent physical materials that are solid but allow non-specularly-reflected light to transmit through the material, like glass.

glTF does not offer a separate "Transmission Roughness", but the material's base roughness can be used to blur the transmission, like frosted glass.

Tip

Typically the alpha blend mode of a transmissive material should remain "Opaque", the default setting, unless the material only partially covers the specified geometry.

Note

In real-time engines where transmission is supported, various technical limitations in the engine may determine which parts of the scene are visible through the transmissive surface. In particular, transmissive materials may not be visible behind other transmissive materials. These limitations affect physically-based transmission, but not alpha-blended non-transmissive materials.

Warning

Transmission is complex for real-time rendering engines to implement, and support for the KHR_materials_transmission glTF extension is not yet widespread.

#### 双面/背面剔除¶

Leave this box unchecked for double-sided materials.

Alpha混合

Alpha钳制

Note

• 位置 - X和Y

• 旋转 - 仅限Z

• 缩放 - X和Y

Tip

### Exporting a Shadeless (Unlit) Material¶

To export an unlit material, mix in a camera ray, and avoid using the Principled BSDF node.

One of several similar node arrangements that will export KHR_materials_unlit and render shadeless in Blender.

## 扩展(名)¶

• KHR_materials_pbrSpecularGlossiness

• KHR_lights_punctual

• KHR_materials_unlit

• KHR_texture_transform

• KHR_materials_clearcoat

• KHR_mesh_quantization

• KHR_draco_mesh_compression

• KHR_lights_punctual

• KHR_materials_clearcoat

• KHR_materials_transmission

• KHR_materials_unlit

• KHR_texture_transform

### Third-party glTF Extensions¶

It is possible for Python developers to add Blender support for additional glTF extensions by writing their own third-party add-on, without modifying this glTF add-on. For more information, see the example on GitHub and if needed, register an extension prefix.

## 自定义属性¶

Custom properties are always imported, and will be exported from most objects if the Include ‣ Custom Properties option is selected before export. These are stored in the extras field on the corresponding object in the glTF file.

Unlike glTF extensions, custom properties (extras) have no defined name-space, and may be used for any user-specific or application-specific purposes.

## 动画¶

• 关键帧(平移，旋转，缩放)

• 形态键

• 骨架/蒙皮

NLA 片段动画 由一起播放的多个物体上的多个动作组成。要创建名称为"My Animation"的 NLA 片段动画，请将应播放每个物体的动作推到该物体的一个名为"My Animation" 的NLA 轨道上。

NLA Strip animations will be exported if the Animation ‣ Group by NLA Track option is selected (on by default). All glTF animations are imported as NLA Strip animations.

Note

In order to sample shape key animations controlled by drivers using bone transformations, they must be on a mesh object which is a direct child of the bones' armature.

## 文件格式变体¶

glTF规范确定了数据存储的不同方式。 导入器可处理所有存储方式。 导出器将要求用户选择以下几种形式之一：

Tip

Tip

Note

Warning

## 属性¶

### 导入¶

Guess Original Bind Pose

Determines the pose for bones (and consequently, skinned meshes) in Edit Mode. When on, attempts to guess the pose that was used to compute the inverse bind matrices.

Bone Direction

Changes the heuristic the importer uses to decide where to place bone tips. Note that the Fortune setting may cause inaccuracies in models that use non-uniform scaling. Otherwise this is purely aesthetic.

### 导出¶

Y 向上

UV

#### 动画¶

##### 动画¶

Group by NLA Track

##### 蒙皮¶

Allow more than 4 joint vertex influences. Models may appear incorrectly in many viewers.

## 贡献¶

Discussion and development of the glTF 2.0 format itself takes place on the Khronos Group glTF GitHub repository, and feedback there is welcome.