How (and why) to split up meshes
Published: January 06 2024 by
In Cyberpunk, you can assign one material per submesh.
Material assignment is done in the .mesh file's appearances
array via chunkMaterials.
The chunkMaterial entries correspond to material entry names.
You can see which submesh is wich in the #mesh-preview tab.
At first, this seems a bit counter-intuitive, but keep in mind that Cyberpunk's entire material system is geared for flexibility. By altering a single submesh material, a black Arasaka helmet with red lights and a Hello Kitty hologram can become a black Militech helmet with red lights and a Hello Kitty hologram!
To learn how materials work, check the parent page: 3d objects: .mesh files
In Blender, our helmet would look like this:
You can create more submeshes by splitting off parts of a mesh, and incrementing the submesh index.
You want red and blue glowing tubes on the example helmet.
Split parts of submesh_04_LOD_1
into submesh_04_LOD_1.001
Re-name submesh_04_LOD_1.001
to submesh_05_LOD_1
Export the new geometry and import it into Wolvenkit
Your mesh will now have six submeshes instead of its previous five
For each appearance that you have defined, add a chunkMaterial entry. If you skip this step, the new submesh will have no material assigned, and be invisible.
To hide parts of the body, you can also use ArchiveXL tags. See #base-game-tags-and-archivexl-tags-visual-guides and the corresponding wiki page for more information.
Imagine you want to hide the helmet's glowing parts (because you are being stealthy). You could just define another appearance where the glowing tubes are turned off — but you would have to add one for every variant you make. arasaka_hellokitty_glow
and arasaka_hellokitty_noglow
, the same for Militech, NightCorps and NCPD… ain't nobody got time for this.
That's why CDPR came up with chunkmasks.
The mesh is loaded via component in an .ent or .app file. Here, you will find the chunkMask
attribute, which looks like this:
The numbers in the dropdown correspond to the submeshes: unchecking an entry will hide it, regardless of the assigned materials.
You can only use chunkMasks to hide submeshes. If you want to conditionally show them, you have to use custom ArchiveXL tags (see ArchiveXL: Tags -> #adding-custom-tags)
To learn about hiding other items with chunkmasks, check out #partsoverrides-hiding-chunks
You have two options, (for NPCs, including V) and RedHotTools.
You can download Appearance Creator Mod on Nexus. It requires Codeware, Cyber Engine Tweaks, and all of their requirements.
With ACM installed, make sure that the target is under the cursor in the middle of the screen (you can use photo mode to look at V). Then, find the correct mesh/component in the UI and click on the correct button:
Find RedHotTools -> #installation-guide for instructions on how to install this.
See #inspecting-chunkmasks for a guide.
If a submesh does not end in LOD1, that means it's intended for lower resolutions (for example, if an object is far away).
Under The whole world: .streamingsector, you can find an explanation of how cyberpunk handles world sector Level of Detail (LOD).
Documentation on .mesh files and their properties.
Published: ??? by Last documented edit: Sep 19 2024 by
This page contains information on .mesh files and their properties.
See -> for a guide on export/import
To edit a mesh's appearance, check
If you just want to use a textured material, check
To learn about mesh materials, see
To hide parts of a mesh under different circumstances, check
To stop copy-pasting so much, check
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. You can learn more about this on the sub-page for .
Mesh files for inanimate objects also tend to contain extensive physics parameters governing their physical weight and general behavior.
There are two ways of adding shadows to meshes:
To make a mesh cast a real-time shadow, set the component's property castShadows
to Always
.
Depending on your geometry, this can impact performance.
Many meshes have dedicated shadow meshes, which have a much lower level of detail and will be hidden by default. You can open any clothing item's mesh entity to see this in action.
You can see which submesh is which in the Mesh Preview
tab after opening the mesh file:
With the boxes on the left, you can toggle submeshes on and off.
An appearance
is the entry point into a mesh.
One appearance
has a number of chunkMaterials
, which tell Cyberpunk how they are supposed to look:
Wolvenkit will follow these entries to materialEntries, where they are defined:
Summary:
Assign material for submesh in appearance -> chunkMaterials
Register the material by name in materialEntries
Define the material in either localMaterialInstances.materials
or externalMaterials
Here's an overview:
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.
Materials are registered in the array materialEntries
inside your mesh:
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:
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.
The materials themselves are inside the array localMaterialBuffer.materials
(or preloadLocalMaterials
in case of older meshes).
A material instance looks like this:
By default, Wolvenkit these low-resolution meshes on export, since you don't normally want them for modded characters or items.
Meshes are loaded via (e.g. ). Components are defined either in files or in an , where each has its own array.
For more information on this, please check ->
Submesh numbers correspond directly to a component's property. For technical reasons, the chunkmask dropdown supports up to 64 entries — just ignore the missing numbers.
This section describes how materials are assigned inside each mesh. To learn more about submeshes and chunkmasks, check .
This page only contains mesh-specific information. Find more details on materials under .
The index
property in materialEntries will finally point at the material's instance, where you can find its properties. Depending on isLocalInstance
, that can be one of several places — find a list in .
You can find more information on this under .
While you can mix external and local materials, you can not mix preloaded and non-preloaded ones. For details, see .
Property | Description |
---|
local | external |
---|
A material's actual definition (instance) can be in a CMaterialInstance
inside the mesh or in a in the project. Wolvenkit will display material names as defined in the materialEntries
, making it easier for you to see what's what.
For more details on material instances, check ->
You can't go wrong by using those. However, if you don't have any properties that are unique to your mesh or appearance (for example a custom normal map), you might consider .
You can find a guide about and in the Modding Guides section.
For an overview of existing materials, check .
For how to find out which properties a material has, check .
A relative path to an external material, usually encapsulated in a . Use this if you don't need to add extra properties.
|
|
|
|
index | numerical index of corresponding material in target list (as defined by |
isLocalInstance |
name | unique name of material, used to select the material via |
Shady biz
Published: Mar 02 2024 by Last documented update: Mar 02 2024 by
This page explains how meshes are casting shadows.
Find information about shadows in the environment under
To learn more about , check the corresponding wiki page.
There are two different ways to cast shadows: real-time (generated) shadows, and proxy shadows.
Most in-game items use both.
Your mesh casts an actual shadow.
The real-time shadow will be extremely detailed, but it can impact performance, and it can glitch out or cause spectacular raytracing bugs. es avoid these issues.
You activate real-time shadows by checking the following properties in your (which you can find in your or file):
Due to the less complex geometry, a shadow mesh is much less prone to raytracing glitches, and it will be much eaiser on performance.
Shadow meshes are usually added as entMeshComponents
.
Your average shadow mesh has only one default material with a blank local instance of engine\materials\metal_base.remt
. If the shadow mesh is loaded in a scene, it will lead to white, marshmallow-y overlays.
To make sure that it's only used for shadow generation, check the renderMask
:
To create a low-poly mesh, you can build a cage, subdivide it a few times and use a Shrinkwrap modifier to shape it like your mesh. Then, you can reduce the poly count by decimating.
Selects the material target list.
True: in localMaterialBuffer.materials
or preloadLocalMaterialInstances
False: inexternalMaterials
or preloadExternalMaterials
For more information on this, see the page for .
The proxy shadow, by contrast, will use an invisible mesh to cast a shadow (the shadow mesh
). It has a lower than the original and often features a simplified geometry or even a .
Check and make sure that RenderInScene
is unchecked.