# Wrapping

Non-rigidly fits one geometry to another. For example wraps a generic basemesh around a specific 3D-scan. Lets you control fitting process by providing user-defined point correspondences. Also allows excluding certain polygons from fitting process.

Wrapping is a very efficient approach when dealing with big set of similar objects like human scans so that all of them can be described with the same topology.

## Basemesh Limitations

- Manifoldness
The basemesh topology should be manifold.

If the basemesh has non-manifold topology, use RepairGeom node to convert it to manifold.

- Connectivity
All the polygons should be interconnected, no disconnected pieces like eyeballs, teeth are allowed.

If the basemesh contains multiple disconnected pieces, you have several options.

If changing vertex order is acceptable, use SelectPolygons or SelectSmallComponents node to select the pieces and DeletePolygons to remove them.

If vertex order should be preserved, you can wrap a model without those disconnected pieces and then apply this deformation to original model using Lattice node.

- Pre-alignment
The basemesh should be roughly pre-aligned to a target geometry.

If the models are not aligned you can use RigidAlignment node to align them by translation, orientation and scale.

Tip

If a head basemesh contains eye- or mouth-socket, select corresponding polygons and pass them as fourth input of wrapping node. That will exclude them from fitting process.

## Wrapping Under the Hood

Wrapping uses coarse-to-fine approach. The basemesh is deformed by a set of control nodes (displayed as white dots during wrapping process). The process is divided into several steps. Each step a set of control nodes is generated on the basemesh with specific density which increases with each new step. The algorithm tries to find such position of control nodes so that the basemesh fits the target geometry as close as possible. When a solution is found, it proceeds to the next step. It samples the basemesh with bigger number of control nodes and repeat the fitting again. The bigger the number of control nodes in current step the more precise the result.

## Editor

Wrapping node has an editor which displays floating geometry, fixed geometry, points and free polygons as you plug the inputs.

## Inputs

- floating geometry
`Geometry`

Geometry to be deformed (a basemesh)- fixed geometry
`Geometry`

Target geometry to fit to- point correspondences
`PointCorrespondences`

*(optional)*A set of point correspondences between the**floating**and the**fixed geometry**- free polygons floating
`PolygonSelection`

*(optional)*A set of polygons that will be excluded from wrapping process, i.e they will not try to fit the**fixed geometry**but will be deformed as rigid as possible to match the rest of the polygons.

## Output

`Geometry`

Wrapped geometry

## Parameters

- auto-compute:
if set, the node will be recomputed each time some parameter or input data is changed

- compute:
if

**auto-compute**is off, starts wrapping process in preview window

### Parameters tab

- subdivisions:
number of fitting steps

- ICP iterations:
number of alignment sub-steps inside each fitting step

- optimization iterations:
maximal number of optimization sub-steps inside each fitting step

- sampling initial:
density of control nodes during the first fitting step

- sampling final:
density of control nodes during the last fitting step

### Advanced parameters tab

- smoothness initial:
mesh rigidness during the first fitting step

- smoothness final:
mesh rigidness during the last fitting step

- control points weight:
how much force is applied to stitch user-defined corresponding points to each other

- max optimization iterations:
maximal number of optimization interations

- normals threshold:
don’t try to fit floating and fixed vertices if the angle between their normals is bigger than a specific value in radians

- Dp initial:
optimization delta during the first fitting step

- Dp final:
optimization delta during the last fitting step

Note

For accurate wrapping of clean scans with minimal noise

Decrease

**sampling final**and**smoothness final**parametersIncrease

**ICP iterations**and**optimization iterations**

For robust wrapping of noisy scans with a lot of artifacts

Increase

**sampling final**and**smoothness final**parameters