3D模型

本页面讲述的内容长期有效
(重定向自3D models

Crusader Kings III uses 3d models to represent objects in the game such as portraits, units and holdings, as well as map objects such as trees. This guide is intended to help CK3 modders with some existing knowledge of 3d modelling and materials. This guide is similar to other 3d modelling guides for Clausewitz like Imperator: Rome. To create a 3d model, you will need modelling software like Autodesk Maya or Blender. You will also need an addon to import and export Crusader Kings III models. To create a texture, you will need image-editing software like Adobe Photoshop or GIMP with an addon to import and export DDS textures.

《十字军之王III》使用3D模型来表现游戏中的物体,如肖像、单位和财产,以及地图物体,如树木。本指南旨在帮助CK3模组制作者掌握一些现有的3D建模和材质知识。本指南类似于克劳塞维茨系统的其他3D建模指南,如 Imperator: Rome(帝皇:罗马)。↵要创建一个3D模型,您将需要像Autodesk Maya或Blender这样的建模软件。您还需要一个插件来导入和导出《十字军之王III》的模型。↵要创建一个纹理,您将需要像Adobe Photoshop或GIMP这样的图像编辑软件,以及一个导入和导出DDS纹理的插件。

Overview 概况[编辑 | 编辑源代码]

All models and their respective textures and animations can be found in /Crusader Kings III/gfx/models/

所有模型及其各自的纹理和动画都可以在/Crusader Kings III/gfx/models/中找到。

A typical model will have the following files:

  • <model>.mesh - The 3d model itself.
  • <model>.asset - The script adding the model to the game.
  • <model>_diffuse.dds - The diffuse texture for the model.
  • <model>_normal.dds - A normal map texture.
  • <model>_properties.dds - A joint texture with specular, metalness and roughness.

More textures for other 3d models include:

  • <model>_unique.dds - Used with the standard_atlas shader. The B channel is the models’ ambient occlusion texture

一个典型的模型将有以下文件。

  • <model>.mesh - 模型本身文件【可打开MESH文件的软件:  Medit for Mac OS X,  Medit for Windows,  Medit for Linux,  TetGen.】
  • <model>.asset - 将模型添加到游戏中的脚本文件。
  • <model>_diffuse.dds - 模型的漫反射纹理
  • <model>_normal.dds - 法线贴图纹理
  • <model>_properties.dds - 一个具有高光、金属性和粗糙度的关节纹理

更多用于其他3D模型的纹理包括:

  • <model>_unique.dds - 与standard_atlas着色器一起使用。B通道是模型的环境遮蔽纹理。

Tutorial: Setup 教程:设定[编辑 | 编辑源代码]

Tools 工具[编辑 | 编辑源代码]

  • Autodesk Maya. A program used to create 3d models and animation. Needs the Clausewitz Maya Exporter installed.
  • Clausewitz Maya Exporter. A Maya plugin from Paradox. Setup models based on installed games and exports model and asset. Installation instructions linked in the forum post and below.
  • Blender. A free program used to create 3d models and animation.
  • IO PDX Mesh addon. Addon that can be installed to Blender or Autodesk Maya. Setup models from compatible games. Installation instructions on their page.
  • Autodesk Maya。一个用于创建3D模型和动画的程序。需要安装Clausewitz Maya导出器。
  • Clausewitz Maya Exporter来自Paradox的一个Maya插件。基于已安装的游戏设置模型并导出模型和资产。安装说明链接在论坛帖子和下面。
  • Blender。一个用于创建3D模型和动画的免费程序。
  • IO PDX Mesh addon可以安装到Blender或Autodesk Maya的插件。从兼容的游戏中设置模型。安装说明在其页面上。

Setup Clausewitz Maya exporter 设置 Clausewitz Maya 导出器[编辑 | 编辑源代码]

There is a full setup guide for the exporters. The below guide is shortened.

To setup CK3 for the exporter, open the clausewitz.settings file using a code editor, edit the folder paths and then save. The folder paths for CK3 are as follows:

  • "name": "CrusaderKingsIII"
  • "path": "C:/SteamLibrary/steamaps/common/Crusader Kings III/game/tools"
  • "export_path": "Your personal mod’s folder"
  • "target_exe": "C:/SteamLibrary/steamaps/common/Crusader Kings III/binaries/ck3.exe"

Notes:

  • Your mod’s gfx/models folder can be anywhere on your C drive. You can choose to edit the settings for every mod you edit, or use one folder and copy your models from there to your mod.
  • The / slash (forward slash) is important, Windows Explorer uses \ (backwards slash). If you copy from Windows Explorer, you will need to edit the folder paths to use /.
  • The name must be one word, no spaces.


制作商有一个完整的设置指南。下面的指南是简短的。

要为导出器设置 CK3,请使用代码编辑器打开 clausewitz.settings 文件,编辑文件夹路径,然后保存。 CK3的文件夹路径如下:

  • "name": "CrusaderKingsIII"
  • "path": "C:/SteamLibrary/steamaps/common/Crusader Kings III/game/tools"
  • "export_path": "Your personal mod’s folder"
  • "target_exe": "C:/SteamLibrary/steamaps/common/Crusader Kings III/binaries/ck3.exe"

注意:

  • 您的mod的gfx/models文件夹可以在你C盘的任何地方。你可以选择为你编辑的每一个mod编辑设置,或者使用一个文件夹,从那里复制你的模型到你的mod。
  • "/"斜线(正斜杠)很重要,Windows Explorer使用的是"\"(反斜杠)。如果你从Windows Explorer中复制,你将需要编辑文件夹路径以使用"/"(正斜杠)。
  • The name must be one word, no spaces.(空格可以用"_"代替)

Preparing Maya 3d model 准备Maya 3D模型[编辑 | 编辑源代码]

UVs 纹理贴图[编辑 | 编辑源代码]

Order of UV maps for the standard_atlas shader:

  1. map1 - uv mapped to AO "<model>_unique"
  2. map2 - uv mapped material atlas

standard_atlas着色器的UV贴图顺序:

  1. map1 -uv渲染到环境光遮蔽(Ambient Occlusion) "<model>_unique"
  2. map2 - uv贴图材质图集

Issues with UV maps 关于UV贴图的问题[编辑 | 编辑源代码]

This can catch you off guard when creating your model, map1 must be above map2, map1 must be the default uv set in Maya. If you’re importing the model from Blender as a .dae file, the uv maps must be in the correct order in Blender too. If your uvs are not in the correct order, then use this method to rearrange them. I do not know a method to delete the default uv set in Maya. The issue is that map1 is mapped to your material atlas.

  1. UV - UV Set Editor. Copy map1.
  2. Select map2 in the UV Set Editor.
  3. UV - UV Editor. Then in the UV Editor, UV Sets – Copy UVs to UV Set. Choose map1.
  4. In the UV Set Editor delete map2.
  5. Rename UVSet1 (originally copied from map1 in step 1) to “map2”.
  6. Select map1 and click Update.

这在创建模型时可能会让您措手不及,map1必须在map2之上,map1必须是Maya中的默认uv设置。如果你从Blender导入模型为.dae文件,uv贴图在Blender中的顺序也必须是正确的。我不知道有什么方法可以删除Maya中的默认uv集。问题是map1被映射到你的材质图集上。

  1. UV - UV Set Editor。复制到map1。
  2. 在 UV Set Editor 中选择 map2。
  3. UV - UV Editor. 然后在 UV Editor中点击UV Sets – Copy UVs to UV Set. 选择 map1。
  4. 在 UV Set Editor 中删除 map2。
  5. 将UVSet1(最初在步骤1中从map1复制的)重命名为 "map2"。
  6. 选择map1并点击更新。

Broken normals 破损的法线[编辑 | 编辑源代码]

使用 Maya 的 Mesh Cleanup 工具(使用默认设置)来解决Error! Mesh contains broken normals, tangents and/or bitangents.

Tutorial: Getting them on the map 教程:让它们出现在地图上[编辑 | 编辑源代码]

You'll want to make building models appear in the game; this requires editing a few other files.

First off, the asset file for a building must contain an entity-block and a pdxmesh-block, the former essentially containing just a reference to the latter. You'll want to reference either the mesh or the entity in different places.

您想让建筑模型出现在游戏中;这需要编辑一些其他文件。

首先,建筑物的asset文件必须包含一个实体和一个pdxmesh(模型),前者基本上只包含对后者的引用。你要在不同的地方引用网格或实体。

Holdings 持有物[编辑 | 编辑源代码]

To make holding buildings for your modded religion or culture, you must first make sure they are considered as entities to be placed on the map: you will need to reference them by editing the vanilla file all_buildings.asset, under gfx/models/buildings. It is unclear what all the settings do here, but you can just follow the pattern and add a locator and attach-block for each of your new holding models, e.g. like so:

要想为您修改后的宗教或文化制作持有建筑,您必须首先确保它们被认为是可以放在地图上的实体。您需要通过编辑vanilla文件来引用它们。all_buildings.asset 要放在 gfx/models/building里

目前还不清楚这里的所有设置是做什么的,但你可以按照这个模式,为你的每一个新的持有模型添加一个定位器和附加块,例如像这样。

locator = { name = "pos_11_a" position = { @[gap *  6.5] 000 @[gap * -1.5 ] } }
locator = { name = "pos_11_b" position = { @[gap *  6.5] 000 @[gap * -0.5 ] } }
locator = { name = "pos_11_c" position = { @[gap *  6.5] 000 @[gap *  0.5 ] } }
locator = { name = "pos_11_d" position = { @[gap *  6.5] 000 @[gap *  1.5 ] } }
attach = {         "pos_11_a" = "building_[mymod]_city_01_entity" }
attach = {         "pos_11_b" = "building_[mymod]_city_02_entity" }
attach = {         "pos_11_c" = "building_[mymod]_temple_01_entity" }
attach = {         "pos_11_d" = "building_[mymod]_temple_02_entity" }

Now, for the second part there's a distinction between temple holdings and castle/city holdings. The choice of temple holding is primarily determined by a religion, and for castles and cities it is culture. In order to have a culture make use of your new city and castle holdings, you define a new graphical_culture for your culture. This is just a tag and does not need to be declared anywhere; just put e.g. [mymod]_building_gfx in the graphical_cultures block at the top of your culture definition. Religions, on the other hand, define a graphical_faith. It is similarly defined at the top of a religion definition.

Then to string everything together, you edit the vanilla file for the buildings (not holdings as one would expect). E.g. to add a new temple holding mesh, you edit 00_temple_buildings.txt. Each of the four tiers of the holding (of the core building, really) has a series of asset blocks defining potential meshes to use for that building. You add one for your own new holding model like this:

现在,对于第二部分,有一个持有寺庙和城堡/持有城市的区别。寺庙的选择主要是由宗教决定的,而对于城堡和城市来说,则是文化。为了让文化使用你的新城市和持有城堡,您要定义一个新graphical_culture的来表示您的文化。这只是一个标签,不需要在任何地方声明;只要把:例如[mymod]_building_gfx放在文化定义顶部的graphical_cultures块中。另一方面,宗教定义了一个graphical_faith。它同样在一个宗教定义的顶部。

asset = {
	type = pdxmesh
	name = "building_[mymod]_temple_01_mesh"
	illustration = "gfx/interface/illustrations/holding_types/temple_[mymod].dds"
	soundeffect = { soundeffect = "event:/SFX/Ambience/3DMapEmitters/Holdings/Temples/[mymod]_temple" soundparameter = { "Tier" = 0 } }
	graphical_faiths = { "[mymod]_gfx" }
	graphical_regions = { "graphical_[mymod]_region" }
}

In name you reference the mesh tag from your asset file. illustration specifies the art forming the background of the holding UI (in vanilla a variable is used instead, with the underlying path at the top of the file). soundeffect references ambient sound you hear when you hover over the holding in the game. And here graphical_faiths references one or multiple graphical_faiths that you can define for your new religion.

Finally, graphical_region is a fully optional way to restrict the geographic usage of the model. It can be used if you have several versions of the same model, using e.g. different materials so they blend in with different locales. They reference to a graphical_region in map_data/geographical_regions.txt, where you can add new ones too.

This syntax works the same for cities and castles; just use graphical_cultures in the place of graphical_faiths.

name中,您引用了asset文件中的mesh网格标签。illustration指定形成用户界面背景艺术(在vanilla中使用一个变量来代替,底层路径在文件的顶部).soundeffect引用了您在游戏中悬停时听到的环境音效。graphical_faiths引用一个或多个 graphical_faiths可以定义您的新宗教。

最后,graphical_region是一种完全可选的方式来限制模型的地理用途。如果您有同一型号的几个版本,可以使用它。例如使用不同的材质,使它们与不同的地方融为一体。它们引用了 map_data/geographical_regions.txt 中的 graphical_region,您也可以在其中添加新的内容。

这种语法对城市和城堡的作用是一样的;只是用graphical_cultures代替graphical_faiths