How to add decals to existing items
Published: Jan 21 2024 by Last documented update: Mar 21 2024 by
This guide will teach you how to add decals to existing items.
You can find a #video at the end of the guide (courtesy of Island Dancer).
Any links in the guide will lead to extra information and are not required to complete it.
It will walk you through the following:
#step-1-cutting-the-decal-mesh
Adding it to the mesh entity
Setting up the material
To add new items to the game, check Adding new items
To learn about materials, check the Shaders section or follow the links from there.
This guide assumes that you have an existing Wolvenkit project with your item and just want to add the decal mesh. If you don't have one, you can grab the template project from ItemAdditions: Dynamic Appearances.
Inside your Wolvenkit project, you need an .xbm texture for your decal, and its .png export that we'll use for Blender. If you don't have a texture yet, you can
add any .xbm to your project (and put it in a custom path)
Replace this png with your decal
import the png again (premultiplyAlpha
must be checked)
For this guide, I will be using a sock mesh.
Start by exporting your mesh from Wolvenkit and importing it into Blender. You should see something like this:
In the viewport, click on the submesh that you want to have the decal.
If you want it to span multiple submeshes, you should merge them into one submesh to cut from. Shift-click to select them all, then duplicate them (Hotkey: Shift-D
) and join them together (Hotkey: Ctrl+J
).
Switch to Edit Mode (shortcut: Tab
)
Turn the viewport to the side (shortcut: Numpad 3
)
Turn on X-Ray mode (shortcut: Alt+Z
). This lets you select right through the mesh, in my example, on both sides of the leg.
Use the selection tool (shortcut: W
, it should be active) to select your decal mesh. It should look something like the left side of the screenshot below.
We will refine this later — select generously, too much is a lot better than too little!
Duplicate these vertices (Shortcut: Shift+D
)
Split them into a new submesh or new submeshes (Shortcut: P
-> Selection)
You should now have something like the right half of the screenshot.
This guide will add a new chunk to an already-existing mesh.
For more advanced cases (such as use with dynamic variants), you can split off the decal into its own file, or you can use an extra appearance that will hide all other submeshes.
If this is your first rodeo, do not do any of that.
If you take a look at the outliner, you will notice a new submesh in the scene collection. This is your decal mesh. We need to change its name to register it as a new chunk.
Switch back to Object Mode (Hotkey: Tab
)
In the Outliner, click on your meshes until your decal mesh lights up
Change the name: it needs to be the submesh with the highest number (see the red box in the screenshot below). Double-click the name, then change it to (in this example)submesh_04_LOD_1
.
Depending on your mesh, you will end up with a different number than 4!
With your new submesh selected, it's now time to clean up.
Switch back to Edit Mode (Hotkey: Tab
)
Cut away all vertices that you don't need. (Hotkey: X
)
As the decal shader supports transparency, you can be generous here as well. Having too much is better than having too little!
After cutting away everything that you don't want/need as part of your decal, select the rest (Hotkey: A
)
The decal should be one piece, so let's make sure to merge by distance now (hotkey: M
).
Now, let's make sure that our decal is above the surface of the original mesh by using the Shrinkwrap Modifier
.
I'll show you how to do this in a way that preserves potential garment support. If you run into issues with your decal mesh (being invisible or crooked), you can always delete it later.
Switch back to Object Mode (Hotkey: Tab
)
Duplicate your mesh (Hotkey: Shift+D
)
Select just one of the two meshes, and switch to the Data tab
Delete all shapekeys (starting at the bottom).
If your mesh doesn't have any, you can skip step 13 and delete your extra duplicate.
Now, switch to the Modifiers
tab. Leave the Armature modifier alone.
Add a Shrinkwrap
Modifier (Deform -> Shrinkwrap).
Configure it. Try the standard parameters below — if you have clipping, you can play around with the modifier after.
target
: The mesh you originally cut from (you can use the eyedropper symbol)
Wrap Method
: Select Nearest Vertex
Offset
: 0.0005 m
(sometimes it's necessary to increase it to something like 0.002 m
)
Your decal should be floating directly on the surface of your mesh, with just enough offset that it's not clipping. When you're satisfied, apply the shrinkwrap modifier:
Now let's merge it with the original submesh with the garment support. Select the duplicate that you made in Step 6.
Switch to Edit Mode (Hotkey: Tab
)
Select all vertices (Hotkey: A
)
Delete them (Hotkey: X)
Switch back to Object Mode (Hotkey: Tab
)
First, select your decal mesh (with the offsets) by clicking on it in the Outliner
Second, select your empty mesh (with the shapekeys) by shift-clicking on it in the Outliner
Now, join them together (Hotkey: Ctrl+J
)
You now have a decal mesh with an offset and garment support shapekeys. Awesome! Let's take care of the material now.
With your new submesh selected in Object Mode, switch to the Shading perspective. Delete the existing material assignment and create a new material:
Click the X above the node browser to delete the existing material assignment
Create a new material
In the node browser, add a new image texture (Hotkey: Shift+A, Texture -> Image Texture)
Click on "open" in the orange node and point the path to your decal png
Drag-and-drop the "Color" dot on the orange box to the "Base Color" dot on the green one
If your mesh's surface hasn't changed yet, you need to assign the material:
Open the Material tab
Switch to Edit mode (Hotkey: Tab
)
Select all vertices (Hotkey: A
)
Assign them to your new material
For more information on this, check UV Mapping: texturing a 3d object (but the page will only send you back here).
Our decal is now showing our new material. Make sure that it has exactly one UV map by checking the Data
tab:
Time to change to the UV Editing
perspective. You should be in Edit Mode (Hotkey: Tab
if not) and have all pixels of your decal mesh selected (Hotkey: A
if not).
You will see something like this (to learn more about UV maps, look up our theory page):
We will now unwrap our decal. I'll do both UV islands at once - if you have only one (because your decal is on a jacket or something), then your life will be easier.
You should be unwrapping a roughly rectangular 2d surface that has undergone merge by distance
. If you haven't done that yet, refer to Step 3, item 4 — or read up on UV seams.
With everything selected in the UV Editor
on the left, select UV -> Unwrap -> Unwrap (Hotkey: Ctrl+U
)
This will unwrap the mesh. Hopefully, you get nice and clean UV islands. If not, you may have to play puzzle
I'll show you a simple example of doing it by hand. If you want anything more complex, you should hit up Google, as there are plenty of best practices and even Blender add-ons.
At the end, we want a nice and straight grid over the full width and height of the decal, with the correct orientation. Let's start by fixing up the UV islands.
Select a row or column. From the right-click menu, select one of the following:
Straighten
: Will put them all in a line
Align Auto
, which does one of the following:
Align Horizontally
: Will put them all on the same Y-axis
Align Vertically:
Will put them all on the same X-axis
Keep doing that until you have a nice grid.
While straightening out your UV layout, keep an eye on your decal in the viewport on the right. Sometimes, vertices need to be crooked, or your mapping will look like shit.
If you can't get a grip on your OCD, you can shift vertices over the mesh's surface by clicking on them, then pressing G
twice and sliding them along the edges.
If you have multiple UV islands, you can move them on top of each other.
Make sure to keep a little offset between the vertices, because Blender's glb export does not play nice with shared UV coordinates — it will split your mesh into a million individual triangles.
If you need an exact identical layout, know that the UV mapping tiles infinitely, so you can simply select one of the islands and move it by a full tile in any direction (G -> X -> 1)
Check the individual decals in your viewport and fix up any that are flipped/rotated:
Click on a vertex in the viewport
Select linked (Hotkey: Ctrl+L
)
Fix the UV mapping (Right-click: Flip horizontal/vertical, or rotate)
When you are done, export your mesh from Blender to glb. Include all submeshes.
Now it's time to head back to Wolvenkit and activate our new decal chunk.
This guide will add a new chunk to an already-existing mesh.
For more advanced cases (such as use with dynamic variants), you can split off the decal into its own file, or you can use an extra appearance that will hide all other submeshes.
If this is your first rodeo, do not do any of that.
After successfully importing your new submesh into Wolvenkit and open it.
First, we need to add your new chunk to each of your appearances. For this example, we will use the material decal
.
Find the appearances
array at the top of the file and expand it.
Under each appearance, find the chunkMaterials
array and expand it.
If you already have an entry for your new submesh, change its value to decal
. If you don't, right-click on the last entry to duplciate it. You should now have something like this:
If you save your mesh now, file validation will complain that the decal
material doesn't exist. It's right; we haven't added a material definition yet. Let's do that.
Find the materialEntries
array inside your mesh and duplicate the last entry
Change its name
to decal
Make sure that isLocalInstance
is checked
Increment its index
by one (e.g. 29 -> 30)
Now that our chunk knows which material it's supposed to look up, we need to provide the actual material.
Find the array localMaterialBuffer
Find the array materials
(directly underneath)
If it's empty, go back up and find preloadMaterialBuffer
instead
Duplicate the last entry. This is your new decal material. Now we need to make sure it behaves like a decal, too.
Change its baseMaterial to base\materials\mesh_decal.mt
.
This will tell the game which shader to use, and mesh_decal is for exactly this.
As of now, your decal will be completely transparent. Let's change that.
Now we need to get the right material properties. The easiest way is to find another material that uses mesh_decal and steal them from there:
Sort the results by file type by clicking on the column, then find and open a .mi
or .mesh
Switch back to your own mesh and copy these values into your mesh_decal material's values
array (the one from step 3.3)
If you don't have one, go back to #prerequisites -> #the-rest
The other properties should be numbers only. If you don't know what they do, you can delete them for now.
Consider converting your mod to use ArchiveXL: Patching appearancesfor much better compatibility and smaller mod size!
See Textures: Importing, editing, exporting -> #troubleshooting
See Troubleshooting your mesh edits
See Materials: troubleshooting
Tool/Software | Version |
---|---|
Unless your previous material was already using mesh_decal, right-click on the values
array and
Open the and search for base\materials\mesh_decal.mt
Right-click on the file and select
Find the decal material inside the other file, and
Adjust the properties. Find the one that says DiffuseTexture
and point its DepotPath
to your decal's .xbm
(right-click it and select )
. If you have done everything right, then your mesh should now have a decal!
>= 8.12 for Cyberpunk 2.1
>= 4.0
the most recent one, but at least 1.5.2.2