Model export considerations

Before exporting a 3D model from a 3D modeling application, such as Blender, there are some considerations that should be taken into account to ensure that the model follows the conventions and best practices for Godot.

3D 资产方向约定

Godot 使用 Y 朝上的右手坐标系,-Z 轴是相机的前方。这是与 OpenGL 一致的。即对于相机而言,+Z 为后方、+X 为右侧、-X 为左侧。

传统上,3D 资产的朝向与相机相对,所以角色和其他资产默认应该面朝相机。这种约定在 3D 建模软件中极其常见,在 glTF 2.0 规范中对 glTF 有相关成文的规定。这意味着确定 3D 资产(例如角色)朝向时,3D 资产的 +Z 轴是前方、-Z 轴是后方、+X 为左侧、-X 为右侧。在 Blender 中,也就是 +Y 为角色后方、-Y 为角色前方。

在 Godot 中旋转 3D 资产时,请为 look_at 函数指定 use_model_front 选项,使用 Vector3.MODEL_* 常量在资产的局部空间中进行计算。

对于地图、地形等没有正反、前后概念的资产,请改用东南西北等基本方向。Godot 和大多数其他程序都约定 +X 为东、-X 为西。由于 Godot 使用的是 Y 朝上的右手坐标系,所以 +Z 为南、-Z 为北。在 Blender 中,这意味着 +Y 为北、-Y 为南。

单独导出纹理

While textures can be exported with a model in certain file formats, such as glTF 2.0, you can also export them separately. Godot uses PBR (physically based rendering) for its materials, so if a texturing program can export PBR textures they can work in Godot. This includes the Substance suite, ArmorPaint (open source), and Material Maker (open source).

备注

关于 Godot 材质的更多信息见 标准 3D 材质与 ORM 3D 材质

导出注意事项

由于 GPU 只能渲染三角形,所以包含四边形或 N 边形的网格必须在渲染前进行三角剖分。Godot 可以在导入时对网格进行三角剖分,但结果可能无法预测或不正确,特别是对于 N 边形。无论目标应用是什么,在导出场景之前进行三角剖分会得到更一致的结果,因此应该尽可能地进行三角剖分。

To avoid issues with incorrect triangulation after importing in Godot, it is recommended to make the 3D modeling software triangulate objects on its own. In Blender, this can be done by adding a Triangulate modifier to your objects and making sure Apply Modifiers is checked in the export dialog. Alternatively, depending on the exporter, you may be able to find and enable a Triangulate Faces option in the export dialog.

To avoid issues with 3D selection in the editor, it is recommended to apply the object transform in the 3D modeling software before exporting the scene.

备注

在输出时,网格不会被骨骼变形很重要。在使用你喜欢的 3D 编辑器进行导出之前,请确保将骨架重置为其 T 姿势或默认的放松姿势。

Lighting considerations

While it’s possible to import lights from a 3D scene using the glTF, .blend or Collada formats, it’s generally advised to design the scene’s lighting in the Godot editor after importing the scene.

This allows you to get a more accurate feel for the final result, as different engines will render lights in a different manner. This also avoids any issues with lights appearing excessively strong or faint as a result of the import process.

Previous Next


© 版权所有 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision b1c660f7.

Built with Sphinx using a theme provided by Read the Docs.