Models and Meshes

Overview page on meshes

Type Extension

.mesh

Definition

In the context of Cyberpunk, a mesh is an entity that holds the following information:

  • the 3d object (as a number of submeshes)

  • movement and deform information (rigging for the rig/armature, and weights)

  • Materials (as in which part of the 3d object will look how)

Morphtargets

Morphtargets are a special kind of mesh used for alternate and additional shapes beyond the static shape a .mesh can define. If your source is a .morphtarget, you need to primarily work with that rather than the .mesh. Read more in the Morphtargets section.

Materials

This page only contains mesh-specific information. Find more details on materials here.

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

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

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 list:

local
external

localMaterialBuffer.materials

externalMaterials

preloadLocalMaterialInstances

preloadExternalMaterials

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

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.

Import/Export: _doubled

Normally, a mesh's backfaces are invisible/transparent - you aren't supposed to see a mesh from below, so it doesn't matter. But some, like hair and eyelashes, are different, and need to be doubled.

When importing via Noesis, you need to do this by hand: duplicate all the vertices in the mesh, and flip the normals. When importing via WolvenKit, it will automagically do that for you if a mesh name ends with _doubled.

The suffix also indicates that Wolvenkit de-duplicated a mesh on export!

Thanks to Na for the screenshot

Last updated

#380: add 2 methods of mesh sculpting that can affect multiple meshes at the same time

Change request updated