3d objects: .mesh files

Documentation on .mesh files and their properties.

This page contains information on .mesh files and their properties.

  • If you want to export or import mesh files, see here.

  • If you want to learn how to edit a mesh's appearance, check this guide.

  • If you want to mess with a .mesh's materials, see here.

  • A mesh file's shadow is defined in via .component

In the context of Cyberpunk, a mesh is the file that defines the and the of an object in the game world.

A mesh can have several submeshes, each of which has own material assignments.

Material assignment

Step 1: Appearances

This page only contains mesh-specific information. Find more details on materials, the corresponding section.

This is how to determine which parts of the mesh have which material:

Example: A mesh with two materials, one of them a local instance, one of them an external .mi file

ChunkMaterials

You assign materials based on the "chunks" (the individual submeshes) inside a mesh. Open the mesh file in Wolvenkit and open the "appearances" array, then make sure that each of your submeshes has an entry inside the array.

You may have to create additional entries in "chunkMaterials": Either duplicate an existing entry from the right-click menu, or select the array and use the yellow (+) in the side panel.

Material definition

Materials are defined in the array materialEntries inside your mesh:

For a detailed example, see re-using materials
Property
Description

index

numerical index of corresponding material in target list (as defined by isLocalInstance)

isLocalInstance

Selects the material target list. True: local material in localMaterialBuffer.materials or preloadLocalMaterialInstances False: material reference inexternalMaterials or preloadExternalMaterials For more information on this, see the page for local/external materials.

name

unique name of material, used to select the material via chunkMaterial

Preload… what?

Many of CDPR's early meshes use preloadLocalMaterialInstances instead of localMaterialBuffer.materials. As far as we are concerned, you can use the two interchangeably, but:

If you are using a mix of local and external materials, you must use the corresponding lists:

local
external

localMaterialBuffer.materials

externalMaterials

preloadLocalMaterialInstances

preloadExternalMaterials

If you mix the two, the materials outside of preload… will appear as transparent the first 1-2 times you trigger your item's appearance.

Step 3: Material definition

A material definition can be in a CMaterialInstance inside the mesh or in a .mi file in the project. For local materials, Wolvenkit will display material names as defined in the materialEntries.

For more details on material definitions, check here.

MaterialInstance: The local material

The materials themselves are inside the array localMaterialBuffer.materials (or preloadLocalMaterials in case of older meshes).

A material instance looks like this:

baseMaterial picks the material (shader), while "values" contains properties to adjust it.

For an overview of materials that you might want to use for something, check here.

For how to find out which properties a material has, check here.

Material reference: reusing materials

A relative path to an external material, usually encapsulated in a .mi file. Use this if you don't need to add extra properties.

Last updated

#647: Add info on downloading Phantom Liberty DLC files for rollback

Change request updated