User Tools

Site Tools


cw4:extract_a_model_from_a_cpack

Index
Tutorials

:NEW: Currently on the Beta Branch on Steam and due for inclusion in update Version 2.3

Extract a model from a CPACK

This can be used to copy a model (unit) from one CPACK to another without moving associated scripts or user settings.

Only the information the game has on the mesh data is exported. If you import a model, for example, .FBX, the game only cares about vertices, faces, normals1), and vertex colors (optionally). When you export a mesh, only that information is exported. The original model is not stored or exported in the CPACK and cannot be retrieved in any manner.

For textures, they are exported as .PNG files regardless of the original import format.

:!: Note that units created using prefabs cannot be exported.

Notes from the developer:

If you use it, note that the Bertha model and all of the other models differ in one important way. Almost all models use a texture and UV coordinates. The Bertha model doesn't use a texture - it has vertex colors. All you have to do is export it just like any other model, the game will notice the vertex color information and jam it into the exported .obj file. A subsequent import of that .obj file will also read in the vertex colors and set them properly. So it will 'just work', [even though] it can be confusing as to why you don't need a texture for the Bertha.

The exported .obj file also contains the name of the mesh you are exporting. So in import, you can just leave the name field blank and it will import the mesh with the correct name.

Lastly, windows has a built in 3D model viewer that will show .obj files. It doesn't support vertex colors, so the Bertha model won't look colored if you use the model viewer in Windows. Other models won't either unless you manually edit the .obj file to include a reference to any textures you exported. Since the game tracks textures and meshes separately, I didn't attempt to output the exported .obj file with any texture references.

Location of Export button for unit mesh (shape)

Location of export button for unit texture (color).

cw4/extract_a_model_from_a_cpack.txt · Last modified: 2022/04/23 20:09 by Karsten75