> For the complete documentation index, see [llms.txt](https://mrcmodding.gitbook.io/arma-3-object-builder/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mrcmodding.gitbook.io/arma-3-object-builder/tools/vertex-mass-editing.md).

# Vertex Mass Editing

Tools to edit the vertex masses of Geometry LODs

{% embed url="<https://youtu.be/eu5FBFX_RpU>" %}

## Object Builder equivalent

<figure><img src="https://418903991-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNJv4RINtC1OtMV3u9E73%2Fuploads%2FjkD34ePE5o0tVeMu6Hx2%2Fimage.png?alt=media&amp;token=77436d51-ffc8-42a2-809f-5a927e600b5b" alt="Object Builder mass"><figcaption></figcaption></figure>

***

## Tool panel

<figure><img src="https://418903991-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNJv4RINtC1OtMV3u9E73%2Fuploads%2FtWLrhXw22XAxbBewRaRQ%2Ftool_vertex_mass_panel_1.png?alt=media&amp;token=6c5a3769-495f-43ce-8450-8ca9433ea162" alt="Vertex mass editing tool panel"><figcaption></figcaption></figure>

<figure><img src="https://418903991-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNJv4RINtC1OtMV3u9E73%2Fuploads%2Fmz9l5q8RwvSA33exPDn4%2Ftool_vertex_mass_panel_3.png?alt=media&amp;token=2fbf86b6-5c72-48a1-9206-f22e90099fe4" alt=""><figcaption><p>sub-panel</p></figcaption></figure>

### Location

**Object Builder** tab in the 3D viewport sidebar.

### Properties

* Live Editing: enable dynamic editing of selection masses
* Current Mass: sum of masses of selected vertices
* Value Type: type of data in Value
  * Mass: mass value in kg units
  * Density: density value in kg/m3 units
* Value: mass or density value to use in calculations
* Distribution: method  to use when distributing mass among vertices
  * Uniform: mass is divided equally
  * Weighted: mass is divided proportional to the volume belonging to each vertex

Sub-panel:

* Empty Color: color to assign to vertices/components with 0 mass
* Color Ramp: colors to represent masses from lowest to highest (intermediate values are interpolated)
* Layer: name of the vertex color layer to use/create
* Method:
  * Vertex: visualize per-vertex masses
  * Component: visualize per-component masses (sum of vertex masses on each component)

### Operators

* Set Mass On Each: set the mass of each selected vertex to the value set in the **Mass** property
* Distribute Mass: distribute the value of the **Mass** property equally among all selected vertices
* Mass From Density: calculate the volume of each geometry component and set vertex masses according to the **Density** property
* Clear All Masses/Remove Mass: remove masses set on the object/vertex

Sub-panel:

* Visualize: create a vertex color layer to visualize vertex mass distribution
* Center Of Mass: move 3D cursor to the center of mass defined by the vertex masses

***

## Process

In order to display and edit the **Current Mass** value, the vertices of the currently edited mesh are looped through upon every draw call of the UI property. To save computing power, the tool panel is disabled by default.

### Current mass

#### Display

On every draw call of the **Current Mass** UI property, the vertices of the currently edited mesh are looped through, and the masses summed.

#### Change

When the **Current Mass** property is changed, the sum of the masses on the selected vertices is calculated, then the difference of that sum and the new target mass is equally distributed among all selected vertices (the mass ratios between points are not equal before and after the change, the vertices; vertex masses can move away from 0, or become 0).

### Set Mass On Each

The mass of each selected vertex (or all vertices in Object mode) is set to the value of the **Value** property.

### Distribute Mass

With uniform **Distribution**, the **Value** is divided by the number of selected vertices (or all vertices in Object mode), and each selected vertex is assigned this value.

With weighted **Distribution**, 3D Voronoi cells around each closed component vertex are generated. The **Value** is divided up in a way that is weighted by the volumes of these cells.

{% hint style="warning" %}
The calculation only considers closed components, when used with weighted **Distribution**. When used in Edit mode, only fully selected components are used.
{% endhint %}

### Mass From Density

With uniform **Distribution**, the overall volume and mass of the closed components is calculated, then the mass is equally split among the vertices of the component.

With weighted **Distribution**, 3D Voronoi cells around each closed component vertex are generated. Mass is then calculated for each vertex from the given density and the corresponding cell volume.

{% hint style="warning" %}
The calculation only considers closed components. When used in Edit mode, only fully selected components are used.
{% endhint %}

### Clear All Masses/Remove Mass

In Object mode, the data layer containing the vertex masses is removed, effectively setting the mass of each vertex of the currently edited object to 0.

In Edit mode, the mass of all selected vertices is set to 0.

### Visualize

Depending on the **Method** setting, the function goes through all vertices or components, and collects their mass data. The non-zero values are linearly converted to the \[0.001 - 1.0] range, and colors are calculated on the color ramp. A new vertex color layer is created (or the existing one is used) with the name set in the **Layer** setting, then each vertex is set to the calculated color.

## Tips

<div><figure><img src="https://418903991-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNJv4RINtC1OtMV3u9E73%2Fuploads%2FVcFPaeboc6QjHiYWTqpH%2Ftool_vertex_mass_tip_1.png?alt=media&amp;token=855a28d8-1cdd-43ba-a120-702fdfbd1245" alt=""><figcaption></figcaption></figure> <figure><img src="https://418903991-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNJv4RINtC1OtMV3u9E73%2Fuploads%2FxT1qgcwcIVHYbakA61YX%2Fimage.png?alt=media&amp;token=5c60f3a7-cc2c-4523-bff8-1f0aa6e93f8d" alt=""><figcaption></figcaption></figure></div>

The best way to utilize the **Visualize** function is setting the **Lighting** to `Flat` and the **Color** to `Vertex` (or `Attribute` as it is called in the latest versions of **Blender**) in the **Viewport Shading** settings, and enabling X-Ray view. Also make sure that the appropriate vertex color layer is active.

<figure><img src="https://418903991-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNJv4RINtC1OtMV3u9E73%2Fuploads%2Fxg5wW5GCW2378Zgvi9JG%2Fimage.png?alt=media&amp;token=d987199e-3389-43f1-8e27-7567bade958c" alt="" width="375"><figcaption></figcaption></figure>
