arrow-left

All pages
gitbookPowered by GitBook
1 of 4

Loading...

Loading...

Loading...

Loading...

Meshes and Armatures: Rigging

How everything is connected, or: why your edited mesh moves weirdly

hashtag
Summary

This page will give you a short explanation on why 3d objects are moving.

hashtag
Wait, this is not what I want!

  • To learn what a rig even is, check

  • Maybe you want the guide?

  • For a documentation of the import/export options in Wolvenkit, check .

The connection between a mesh and a rig is made via vertex groups. Any number of vertices can be assigned to a group, which is then matched to a rig's bone via name.

How much every bone influences the vertices is determined by vertex weight, which can be altered in Blender's Weight Paint perspective:

Vertex weights are assigned for every vertex group, and each vertex will move on the basis of the sum of all its weights.

circle-check

To preview the deform in Blender, you can select the mesh's parent armature and enter the "Pose Mode". There, you can either apply an , or select individual bones and rotate/move them. The Armature modifier will morph your mesh according to the pose, letting you spot errors much faster than trying to debug them in-game.

circle-info

You can see a video of the process (courtesy of Vesna).

Guides on how to transfer weights between rigs: , ,
Armatures: .rig files
Weight Painting for Gonks
herearrow-up-right
exported animationarrow-up-right
here
These vertices move with the bone "Spine3"
Weight painting
blender plugin
youtube videoarrow-up-right
wiki page

Dangle bones

What are Dangle Bones, and how do they work?

hashtag
Summary

Created by @eagul Published March 20 2023

This guide will teach you everything you need to know about dangle bones, focussing mostly on hair meshes. However, dangle bones can also be applied to any other mesh

Assumed skill level: - You are familiar with Wolvenkit and Blender. - You know what bones and weights are. - You are able to read and comprehend instructions.

hashtag
What are dangle bones?

Dangle bones are a 'chain' of linked bones which are used by the game engine to simulate physics (dangle). They're found mostly in hairs, but also in certain clothing items. For a mesh to have working dangle physics, corresponding .rig and .animgraph files are also needed The image below depicts how a dangle skeleton looks. The .animgraph will move the dangle bone chains, which are connected to the mesh using weights, which will then in turn animate the mesh.

hashtag
Transfering a skeleton and weights

The easiest way to add physics to a mesh that does not have them, is to transfer them from another mesh. If you are doing a hair port, prepare the (static) .mesh and textures first. 1) Locate a 'donor' mesh. It should have a similar mesh, and physics that you could also see working on your 'new' mesh. 2) Add both the donor mesh, together with it's .rig and .animgraph pair, and your new mesh to the project in wolvenkit. 3) Import both meshes to blender. 4) Using alt+P, clear the parent of the new mesh. Now select the new mesh, and then the armature of the donor mesh, and press ctrl+P, followed by Armature Deform with Empty Groups. 5) Select the donor mesh, and secondly the new mesh. Swap to weight paint mode. In the top-left cornet, press 'weights' and then 'transfer weights'. In the bottom-left corner, a small black window will appear. Click it. Set Vertex Mapping to nearest face interpolated, and source layers to 'by name' 6) Go into weight paint mode and manually clean up the weights, using the weight transfer as a reference. Optionally duplicate the mesh and move the copy to the side, so you keep an untouched reference. 7) Import it back into wolvenkit, and you're done!

hashtag
Some tips for editing hair meshes

1) Oftentimes, you can get away with editing a hair mesh, and not having to touch the physics at all, especially if the changes you are making are fairly small. 2) If you move the mesh away from the bones, it might move in unexpected ways. The further the mesh is from the bone, the more of a 'lever' effect will happen. This is particularly noticable when bones are rotating around an axis perpendicular to the one you moved the mesh away on. Usually small movements are fine and will not affect the dangles in a noticably bad way. If you do find yourself in a situation where you need to move the skeleton as well, check the 'Moving a Dangle Chain' section. 3) Check out UUH4V. It's an amazing resource that will allow you to load multiple hair meshes with each their own rig/anim pair simultanously. Keep in mind that you cannot have 2 of the same rig/anim pair loaded in the same hair slot simultanously, as this will cause unacceptable deforms. You need to merge any 2 meshes that use the same rig/anim pair in blender and import them as one .mesh. \

hashtag
Leverage effect

Included is an image of what i mean by the leverage effect. I used a handy little trick here to make bones visible in-game. Overlay a simple mesh over each of the bones in blender and weight paint it completely red. Load the boxes instead of a hair mesh. Edit the material used by the mesh to make it better visible. I used plastic_red here. Congratulations, you can now clearly see what bones are doing in-game. Hiding the body mesh helps with visibility. Green circle includes the true location of the dangle bone chain. Meshes in the yellow circle are rigged to the same bones as those in the green circle. Bone 3 is invisible. Upon moving bone 3 to the right (by editing the .rig), bone/mesh 1 rotated slightly, making mesh 2 do a huge leap. If you were to load a hair mesh in the same location as indicated by the yellow circle, you would end up with horrible stretching and deformations, even without exxagerating the effect by moving bone 3.

Modern_bob mesh with it's dangle skeleton
Sorry for my terrible drawing skills and cursed image.

Moving a Dangle Chain

hashtag
Summary

Created: March 20 2023 by @eagul Last documented update: Dec 19 2024 by

This guide will go deep into detail about moving dangle bones. Still unknown: changing bone parenting, rotating bones, editing the animgraph physics, adding new mirrored dangle chains for better coverage. If anyone has done tests on any of these topics, please contact @eagul via Discord!

hashtag
Assumed skill level:

- You understand what you are doing, and know why you need to move dangle bones - You are able to read and comprehend instructions.

hashtag
Video tutorial

Visual learners, rejoice! Here is a more up do date guide in a video form with some helpful tools as well:

hashtag
MATH WARNING

Okay.... Let's get started. If you are doing physics stuff, and need to move the dangle bones to fix the leverage effect, or for any other reason, you are in the right place. I will be using my long hair dangles project for examples here. Read 'Leverage effect' section in 'Dangle Bones' page for the reasoning behind why this process is necessary. (Using a normal hair dangle skeleton is not an option because it is parented to the 'head' bone, which causes horrible clipping and unnatural movements when the head turns. It might be possible to change the parenting to spine3 bone, but i have yet to test. Even if it is possible, the process described below would still be usefull to move the chains into the right positions) You will need to do a couple things: 1) Get everything into blender. 2) Isolate the bones you need to move. Hide other bones in armature edit mode. 3) Duplicate the bones and move them to the desired position. 4) Edit the bone positions in both the .mesh and .rig, sometimes editing the collision hitboxes in the .animgraph will also be required. I would also recommend having a rigged and weight painted mesh ready, for testing purposes. I will explain each step of the process more in-detail below.\

hashtag
MultiMesh Export

Usually, you can get the skeleton in it's real form into blender by using WithRig export on the mesh. However, if the .mesh contains bones that are not present in the .rig, you will need to use MultiMesh Export. You need to find a second (or even more) .rig file, so all the bones that are present in the mesh have a counterpart in the .rig. You then need to also add the meshes that correspond to the new .rigs and then export. Attached images show settings i used to export base\characters\garment\citizen_formal\torso\t1_072_shirt__netwatch\t1_072_ma_shirt__netwatch_dangle.mesh with rig, which i used for long hair dangles.

hashtag
Editing the .rig

Open the .rig file in Wolvenkit. Under boneNames you can find which index corresponds to which bone. Expand boneTransforms. Locate the bones you want to move. Moving a bone in a chain will also move every bone that's parented to it (located lower than it in the chain). In the case of the image above, moving the bone selected in yellow, also moved the entire chain. In this case i moved bone 8 (selected in yellow) by 0.283076668 on the Y axis.

hashtag
Animgraph edit

As you can see, the skeleton exploded. This is (to my understanding) caused by collision hitboxes on the spine bones. It will only happen if you have moved the dangle chain inside of those hitboxes. If this happens to your skeleton/mesh, follow these steps to fix it: 1) Open the .animgraph file in Wolvenkit. Expand the 'rootNode' array, and keep expanding untill you see collisionRoundedShape and then lower the roundedCornerRadius for each of the bones untill your skeleton no longer explodes. Here i set the value to 0, the animations work fine, but a correctly set value might reduce clipping in some poses.

Notice how editing the bone positions in the .rig also deformed/moved the mesh in-game. At least it's dangling nicely now, and it no longer explodes :copium:

hashtag
Editing the .mesh

The .mesh also contains bone matrices. To my understanding, these are used to map the bones from the .rig to the vertices. You will need to move the bones in the .mesh to match the changes You did to the .rig skeleton, and this will fix the mesh deform. In this case, I'm editing bones 79-83. The goal is to move each of them by -0.283076668 on the Y axis. Open the .mesh in Wolvenkit and navigate to boneRigMatrices.

Next, open and copy paste each of the entries of the bone matrix into the calculator. Then press inverse.

Notice how the bottom row of the inverse matrix corresponds to the coordinates of the bone, which you can see in Blender.

Next, copy the new Y coordinate from the bone you duplicated and moved.

After that, return to the calculator, and press 'Insert in B', and then replace the matrix entry corresponding to the Y position of the bone with the new coordinate.

Then, press 'inverse'

Next, press the 3 small lines below the output, click on Show LaTeX, and copy the top row entries back into wolvenkit.

And now repeat all of those steps for each of your bones... enjoy... After that, you should be finished! \

https://www.youtube.com/watch?v=kojfyn_6jv4arrow-up-right
https://matrixcalc.org/arrow-up-right
Isolated netwatch shirt dangle skeleton. The original dangle chain is selected. The spine column, and the duplicated and moved dangle chain are also visible.
Original
Edited
Result
Result
Not edited bone matrix of bone 79.
Finished bone matrix edit in Wolvenkit

Weight Painting for Gonks

How to check weights directly in Blender

hashtag
Summary

Created: ??? by PinkyDude 🦝 Last documented edit: Sep 22 2024 by

This guide will show you Pinky's weight painting workflow, sharing tips and tricks on how to fix weights on garments for both refits and custom ports. You can find the original tutorial on Google Docsarrow-up-right.

This guide will use a masc garment, but the process works the same regardless of rig or body type.

hashtag
Wait, that's not what I want!

  • For porting objects altogether, see

  • For help with refitting, see

  • For converting between bodies, see

hashtag
Requirements

For this guide, you need:

Tool
Version

You also need a Wolvenkit project with an item where you want to fix the weights.

hashtag
Step 1: Exporting your weight source

For this example, I’ll be starting the weight from scratch for my Tracksuit Jacket:

hashtag
1.1: Finding a donor mesh

It's best practice to stealcopy the weights from an existing in-game item.

A good candidate is the tight version of T-Bug's netrunner suit, as it has the required bones for almost everything:

Add the correct version for your body gender to your Wolvenkit project.

circle-info

Since this is a jacket, using the Netrunner Suit will result in useless leg bones. That's not a problem, but you can use a different mesh, if you want.

If you are changing the weights of an existing or ported item, you might run into export errors in Blender. We'll fix these when we get there.

hashtag
Why this is a good mesh

It is really tight. This has a few nice side effects:

  • If it clips, it will clip into the body — that is perfect for weights!

  • It will avoid "bat wings" around the armpits, where parts of the sleeves or sides will stretch next to the chest

Unfortunately, a perfect fit does (usually) not exist. But don't worry, we can fix this!

hashtag
Step 2: Transferring weights

hashtag
2.1.: Importing the Netrunner suit

  1. the Netrunner suit to glb

  2. it into your Blend file

  3. You'll notice it has 3 submeshes. Merge them into a single submesh:

hashtag
2.2: Preparing your own mesh

If your refitted garment is already broken down into multiple submeshes, you’ll have to do the same thing here. The result will be called "weight container" or "target mesh" in the rest of the guide:

Create a joined duplicate “weight container”:

hashtag
Merging by distance

Even if we merged the submeshes, the actual models themselves are still separated. Editing and smoothing the weights will cause them to detach from each other, creating holes and gaps along the seams.

For that reason, you should now clean up your mesh and merge the vertices by distance:

❓ Edit Mode > Mesh > Clean Up > Merge by Distance

hashtag
Cleaning existing vertex groups

When porting assets from other games, a good habit is to always clean the Vertex Groups before transferring weights :\

hashtag
Step 3: Transferring weights

circle-info

You can use the Wolvenkit Blender IO Suite's for step 1-5. However, this guide will show you the full manual process.

  1. Click the weight source (the Netrunner suit)

  2. Ctrl+Click on your merged weight container (the target mesh)

  3. Switch Blender to Weight Paint mode:

circle-exclamation

Before proceeding, you must have the armature in the rest position! This can be done by selecting the armature, going into data (the green stick man icon on the right sidebar), then clicking 'Rest Position'.

  1. Select Weights -> Transfer Weights

  1. A pop up will appear in the bottom left corner of your viewport window. Make the following changes:

    • Vertex Mapping - Nearest Face Interpolated

    • Ray Radius - 5m

You have now successfully transferred the weights from the Netrunner suit to your ported garment. Let's clean this up.

hashtag
3.1 Cleaning up

  1. Select Weights -> Limit Total.

  2. In the pop-up at the bottom left, change the limit from 4 to 8.

  1. Finally, select Weights -> Normalize All

  2. In the pop-up at the bottom left, un-check Lock Active:

hashtag
Step 3: Testing on an animated body

We could now transfer the garment's weight to our submeshes, import the result into the game, notice that something is off with the weights, fix it in Blender, rinse, repeat, and waste a lot of time.

Instead of doing that, we'll simply hook our garment to an animated body.

hashtag
3.0: Using the prepared resources

circle-info

To learn how to add these things by hand, read 3.1 - 3.3

I took the time to merge and weight-fix two full bodies who are also already hooked to the inventory “Jacket Check” animation

You can download them from my Resources folder, here:

🔻 - Man Average RIG

🔻 - Woman Average RIG

To add it to your .blend file, select File -> Append, and select the collection [MA/WA]_weightCheck:\

You can now skip to

hashtag
3.1: Getting a rig

  1. From the Blender AddOn's Animation Tools Panel, select the correct rig for your mesh. You'll most likely want man_base or woman_base:

  1. Change your weight container's armature modifier to point at the rig you just imported:

hashtag
3.2 Getting a body

You can use the same body that you've already used for refitting. This tutorial won't cover this — look it up in .

  1. Import your body mesh into Blender

  2. Join all the submeshes together

  3. Change the body's armature modifier to point at the rig you added in 3.1

hashtag
3.3 Getting an animation

You can see that our added armature already has A-Pose and T-Pose hooked up:

We need a bit more than that, so let's grab ourselves an .anim from the game files.

For fitting clothes, you might want to use the inventory idle animations:

Otherwise, you can get creative with the (something like .anims > !fpp)

  1. Pick an animation and add it to your project.

  2. from Wolvenkit

  3. the glb into Blender

This will populate the Animsets list.

We can use the play button to make everything move. Now, time to hook everything up.

hashtag
3.4 Connecting the bits

  1. Select your merged weight container and change its Armature modifier: aMa / aWa if you used the prepared resources, the armature from 3.1.2 otherwise

  1. Rotating your body, you might already notice holes or clipping:

  1. Let’s check the animation by pressing the Play ▶ button on the timeline or in the Animation Tools:

  1. Arms and collar will need some fixing. Let's go and do that.

hashtag
3.5 Weight Painting Prep

  1. Use the Play button at the bottom of Blender's viewport or in the Animation Tools

  2. Let the animation play to a point where your issues are clearly visible, then hit the button again to pause it

  3. Hide any armatures and collections, so that only the jacket mesh is visible.

hashtag
Step 4: Manual weight painting

From experience, we know which bones are responsible for the bat wings, but we'll go through the list one by one. If you want the more target-oriented approach, skip ahead through

  1. Enter Weight Paint mode (at the top left of the Blender viewport)

  2. Open and expand the Vertex Group list on the right:

  1. On the right, select the first vertex group (Hips)

  2. Use the Blur tool to fix anything that looks janky

  3. Select the next vertex group on the list (Spine)

circle-info

This is where you fuck around and find out! You can always use the

hashtag
4.1 Fixing the bat wings

  1. Smoothing out the Spine groups helps a bit, but the mesh is still being pulled:

  1. We’ll start tackling the actual Arm bones now:

  1. We’ll need to clean the armpit on the [l/r]_SHL_0_JNT group. You can do this by using the Brush tool (with the Weight slider down to 0), or with the Radial Gradient tool:

  1. Drag the gradient tool near the armpit to remove all the excessive weight, and then use the blur brush to smooth the area:

  1. We’ll do the same with the [l/j]_triceps_mscl_JNT group:

  1. ...and the [l/j]_biceps_A_mscl_JNT group:\

\

That’s much better! \

  1. Scroll down to the [l/r]_latissimusDorsi_mscl_JNT group and smooth out the area a bit.

circle-info

You can go back to Object mode and check your weights with the animation at any time!\

This isn’t too bad, we removed most of the stretching and the sleeves behave in a natural-ish way, considering this is a large jacket :> \

hashtag
4.3 Fixing the collar

The garment's collar is also a troublesome area; we can see how mine stretches and clips in all kind of weird way.

  1. We'll go over the list in order again, starting from the Spine bones and adding weights here to harmonize the whole collar:

    1. Select the Sample Weight tool

    2. Click on any light blue area\

triangle-exclamation

Be careful when using the Gradient tool

When weight painting with the gradient tool, the weight will apply on BOTH side of the mesh; front and back! To avoid this, rotate the camera and angle your model so your gradient only affect the desired area\

  1. Check the following vertex groups. Smooth out jagged edges, and remove incorrect weights.

  2. Main vertex groups (avoid editing them too much, if you can avoid it):

    1. [Left/Right]Shoulder

circle-info

After manually fixing weights, always do “Limit All” and “Normalize All” from the Weights tab!

It’s important to aim for Correct over Perfect, otherwise you’ll get stuck and frustrated really fast, trust me 🧡

Don't worry about the clipping, we'll fix that in .

hashtag
Step 5: Transferring back

  1. Change your weight container’s rig in the Armature modifier back to its original armature :\

  1. Hide the MA_weightCheck collection and un-hide your garment’s submeshes

  2. Transfer the weight from your weight container to each of your garment’s submeshes. You can use the Mesh Tools, or do it by hand (one by one).

hashtag
5.1 Fixing clipping

circle-info

You can toggle proportional editing on and off by pressing o. This guide won't cover proportional editing in detail, but you can look it up under in the R&R guide.

  1. For each of your (now weighted) submeshes, change the rig in the armature modifier to animate them.

  1. Entering Edit Mode will reset our model back to the default pose. To fix that, we have to check the On Cage and Edit Mode buttons on the armature modifier:

  1. Repeat the step for each of your submeshes

  2. Select them all, then enter edit mode by hitting tab

  3. With proportional editing on, simply select the vertex in the area and slightly pull away from the body:\

  1. Use the bar at the bottom of the viewport and move the cursor to change the animation. You'll find and fix more clipping here.

  2. Once you're done, change the armature modifier back to the original one.

  3. Delete the weight container mesh (you don't need it anymore)

hashtag
Step 6: Finishing up

You can now your mesh from Blender, then back into Wolvenkit.

And that’s about it for this tutorial/workflow on how I handle weight painting!

hashtag
Author's remarks

Don’t let weight painting occupy your entire brain while working on a project; it will never be perfect, a lot of vanilla garments have weight paint problems with stretching crotch and armpits area, it’s not something we can 100% control or avoid\

As long as it’s not too visible or mesh breaking, clipping and stretching are easily dealt with in Photoshop or other post-render editing softwares 🤏\

Again, I’m no expert, but I hope this tutorial will help you tackle some annoying aspects of Weight painting!\

Have fun and happy modding y’all! 💛\

Thank you for reading -Pkd \

\

Click into the viewport to deselect everything
  • Hold the shift key and click on each of the three meshes

  • Press Ctrl+J

  • Source Layers Selection - By Name

    I’ll once again use the Radial Gradient tool to apply weights in an equal way

    Neck, Neck1

  • Head

  • [l/r]_sternocleidomastoid_[top/bot]_mscl_JNT

  • [l/r]_butterfly_top_CRV_bot_out_JNT

  • Remove weights from the following arm and torso related groups (depending on the length of your collar):

    1. [l/r]_chest_front_[A/B/C]_[bot/top]_out_JNT

    2. [l/r]_deltoid_[top/front/back]_[top/bot]_out_JNT

  • WolvenKitarrow-up-right

    >= 8.14

    The Wolvenkit Blender IO Suite

    >= 1.5.5.2, recommended: 1.6.0 develop

    Blender

    >= 4.1, recommended: 4.2

    Porting 3d objects to Cyberpunk
    R&R: Refitting (step by step)
    RIG Swapping Garments - other body conversion
    Export
    Import
    Mesh tools
    MA Bodyarrow-up-right
    WA Bodyarrow-up-right
    R&R: Refitting (step by step)
    Export it
    Import
    export
    import it
    My jacket has two different sleeves states; long and rolled. I’ll only duplicate and merge the long sleeves since they cover the arms
    I rename this merged model as “weight” to make it stand out in the list
    Notice the arms, this is the previously mentioned Bat Wings issue
    This is where you'll check each bone's area of effect, and the "pull" it has on the mesh - the weight painting.
    Weight Painting for Gonks
    4.1 Fixing the bat wings
    5.1 Fixing clipping
    base\characters\garment\player_equipment\torso\t0_005_pma_body__t_bug\t0_005_pma_body__t_bug_tight.mesh
    base\characters\garment\player_equipment\torso\t0_005_pma_body__t_bug\t0_005_pwa_body__t_bug_tight.mesh
    base\animations\ui\male\ui_male.anims
    base\animations\ui\female\ui_female.anims
    Shota Meipariani
    Final result \
    mana vortex
    Step 4: Refitting
    Wolvenkit Search