3D模型

本頁面講述的內容長期有效

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