description |
---|
How to replace an in-game item with your custom mesh |
Published: Oct. 14 2023 by manavortex
Last documented Update: Mar. 20 2024 by manavortex
This page will give you information on how to get a 3d object into Cyberpunk.
If you'd like to watch a video about the whole process, feel free to address the video version of this guide - https://www.youtube.com/watch?v=r3nyFm-9h9o
You can find other relevant guides scattered across this wiki, for example
- Wolvenkit: The latest version the latest stable (stable | nightly)
- wolvenkit-blender-io-suite(>= 1.5.5.2 for Wolvenkit 8.14)
- Blender (>= 4.1 for Wolvenkit 8.14)
- A Wolvenkit project, so that you can pack your mod
To bring 3d data into Cyberpunk, Wolvenkit needs a .mesh file to import into. Read here why.
For the purpose of this guide, it doesn't matter if you are trying toreplace-a-player-item-with-an-npc-item, creating custom-props or adding-new-items. You will overwrite an existing in-game mesh, the file path doesn't matter.
If you are creating props, you use a mesh from the template project or grab any static mesh from the game.
{% hint style="warning" %} Do not take equipment item or weapon meshes — those include a bunch of extra data that you don't need (the armature). You don't need it, and it can have side effects. {% endhint %}
As this guide will focus on equipment items, you can skip Step 3 and 4 completely.
If you want V to wear the item that you're currently porting, it needs to move with the player. For that, you need an armature. This guide will show you how to acquire one.
{% hint style="info" %} You will delete fewer meshes if you read all of the sections below before starting. {% endhint %}
Why are we doing this?
Items move because they are tied to the armature's bones. For that to work, the armature you're working needs to have those bones in the first place. Most shoe meshes won't include head bones, which means that they won't work for sunglasses.
Every piece of equipment needs its own armature, or it will just vaguely float around V's position.
The default fallback mesh that people use in this case is the Netrunner Suit.
You can use the Wolvenkit search in the Asset Browser to find meshes.
Begin by picking a game mash from the right slot. If you're porting shoes, pick a shoe mesh, if you're porting glasses, pick a glasses mesh – you get it.
For the sake of future you, pick an in-game item that is as close to your new garment as possible. If you're porting boots, take boots and not slippers. If you're using a baggy sweater, pick one of those or a jacket rather than a skin-tight t-shirt.
Make sure to use an item with the correct armature. You can identify them by prefix in the path:
body gender | Player | NPC |
---|---|---|
male rigged | _pma_ | _ma_ |
female rigged | _pwa_ | _wa_ |
Search for something like this:
namespace > slot > gender > .mesh
player: player > torso > pwa > .mesh
npc: common > torso > pwa > .mesh
For torso items, you can add t1
for inner torso items (tight-fitting) or t2
for outer torso items (worn above t1).
For where to export a mesh, see Tools: Import/Export UI
For how to export a mesh, see wkit-blender-plugin-import-export.md -> #meshes -> #export-from-wolvenkit
{% hint style="info" %} If your mesh won't export from Wolvenkit, try unchecking the following box(es) in the export settings (by unchecking the boxes):
- Export Materials (default)
- Export Garment Support (default) {% endhint %}
Once you are done, you can find the exported glb in your project's raw folder (see Project Explorer Tabs orFile Structure: the raw folder for details).
For how to import a mesh into Blender see wkit-blender-plugin-import-export.md -> #meshes -> #importing-into-blender
The mesh count in Blender corresponds to the submesh/chunk count in Wolvenkit. In Cyberpunk, we have one submesh per material that we want to use.
If you don't know what that means, ignore the information for now - but few meshes use more than five. The current maximum is the player base body with a total count of ten submeshes per LOD1, so to be on the safe side, we need to stay below that.
If you want to get fancy, check out Step 2 in the guide about ported items and Cyberpunk materials. Otherwise:
- Select all meshes but one by shift-clicking them in the Outliner at the topright of your viewport
9000 of these have to go
- Select the last mesh
- Join the meshes together (Shortcut:
Ctrl+J
)
This section will show you how to get the following end result:
- one or more mesh(es) with names from
submesh_00_LOD_1
, consecutively numbered - parented to the right armature
There are two strategies that you can use. Personally, I use #strategy-1-replacing-the-3d-data, since it will retain most of the original mesh's properties.
By the end of this section, you should have something like this:
Read on to find out how to get there
No matter which strategy you use, we need to get the prerequisites done first. We need an original Cyberpunk armature.
- Import the result of Step 1 into Blender (see the wolvenkit-blender-io-suite's documentation about #importing-into-blender)
Clean up any residual modifiers and transforms (we don't want them):
- If your mesh has an armature modifier with a non-Cyberpunk armature, delete it
- (click on the
x
in the modifier panel)
- (click on the
- If your mesh is parented to anything that is not a Cyberpunk armature, unparent it:
- Select the mesh(es)
- Select Unparent (Hotkey:
Alt+P
) - Select the second option "Clear Parent and Keep Transforms"
{% hint style="info" %} If you are doing this, you can skip#strategy-2-parenting-the-meshes. {% endhint %}
We start by deleting the original's vertex data.
- In Object Mode2, select all of the original meshes.
- Switch to Edit Mode (Hotkey:
Tab
) - Make sure that all vertices are selected (Hotkey:
A
) - Delete all vertices (Hotkey:
x
, option: Vertices)
- Switch back to Object Mode (Hotkey:
Tab
)
We'll merge our new meshes into the empty containers now:
- Click on your new mesh
- Click on the empty original mesh in the Outliner (yes, order matters)
- Join them (Hotkey:
Ctrl+J
)
The new mesh should be from the Outliner and its data should be in one of the original meshes. If it's the other way around, Undo (Hotkey: Ctrl+Z
) and select them in the right order. (You could've listened!)
Repeat the same for all meshes that you want to import to Cyberpunk.
{% hint style="info" %}
If you need more submeshes, simply duplicate an existing one (Hotkey: Ctrl+D
, ESC
) and change its name by incrementing the number. Make sure it still ends in LOD_1
, not in LOD_2
— that will tell the game it's low-poly, and cause it to be hidden until you're further away.
{% endhint %}
That's it. All your meshes are parented to the armature now.
{% hint style="info" %} If you are doing this, you can skip #strategy-1-replacing-the-3d-data. {% endhint %}
We can simply parent the meshes to our existing armature:
- Click on your mesh
- Click on the Armature object in the Outliner
- Select Parent (Hotkey:
Ctrl+P
) - Select "Armature Deform"
- Make sure to rename your mesh: Wolvenkit doesn't know what to do with meshes that aren't part of the sequence starting at
submesh_00_LOD_1
. (Blender's .000 suffixes will be ignored)
You can delete the original meshes, or you keep them for Step 4.
Start by deleting all vertex groups from your new mesh, as we will now replace these and don't want anything funky to stick around to destroy our re-import:
You now need to transfer the weights from your original game mesh. If you deleted or overwrote the armature's original meshes during #step-3-parenting-the-mesh-es, you can simply import it again for a second copy.
{% hint style="info" %} The wolvenkit-blender-io-suite has a function to do this for you. For the sake of completeness, the box below contains the full manual process, but we recommend using the plugin's Mesh Tool panel to do this. {% endhint %}
Transferring weights by hand
- Select the original mesh
- Select your mesh
- Select "Object -> Link Mesh Data" (Hotkey: Ctrl+L) alternatively: the Weight Transfer menu in the Weight Painting perspective
- Select "Transfer Mesh Data" (second from the bottom)
- Open the little popup at the bottom left of your viewport. Select the following options:
- Data Type: Vertex Group(s)
- Vertex Mapping: Nearest Face Interpolated
- Source Layers Selection: By Name
- Repeat that process for all of your meshes.
{% hint style="info" %} Nobody likes weight painting. {% endhint %}
This is what you need to do if your mesh moves unevenly or if parts of it are clipping through the body although things are fitting correctly. Pray that you don't have to do it, because it sucks.
If you're unfortunate, you can find a guide on weight-painting-for-gonks.md!
See the wolvenkit-blender-io-suite's documentation about #exporting-from-blender
See the WolvenKit wiki about Importing mesh files
… or maybe not. Maybe you should try troubleshooting-your-mesh-edits.md now.
If everything worked, here are a few more guides that you might want to look into:
- r-and-r-refitting-step-by-step.md will teach you how to refit for a certain body mod
- adding-new-items will walk you through the steps of adding your mesh as a new piece of equipment
- textured-items-and-cyberpunk-materials.md will tell you how materials work, and how you can use them to texture your item