wrap.nonRigidRegistration

wrap.nonRigidRegistration(geomFloating, geomFixed, controlPointsFloating = [], controlPointsFixed = [], freePolygonIndicesFloating = [], initialRadiusMultiplier = 1.0, radiusMultiplier = 4.0, minNodes = 10, smoothnessInitial = 1.0, smoothnessFinal = 0.1, multiplierControlPoints = 10.0, maxIterations = 30, mu = 1e-12, subdivisionPercentage = 1.0, scaleMultiplier = 2.0)

Wraps geomFloating around geomFixed and returns a wrapped copy of geomFloating.

Parameters:

geomFloating : wrap.Geom

Basemesh geometry to be wrapped around geomFixed. Should have manifold topology, use wrap.meshRepair to convert non-manifold topology to manifold.

Basemesh should be reasonably small (several thousands of polygons would work fine).

Meshes with hundreds of thousands of polygons would require too much time and RAM to compute.

It is highly recommended for the basemesh to contain a single piece of connected geometry. If the basemesh contains small separated parts like eyeballs or eyelashes that might lead to bad results.

The algorithm performs wrapping in several steps called levels. On each level the algorithm sub-samles vertices of basemesh to create control nodes. It warps the shape of the basemesh by changing nodes’ positions. It tries to find such position of control nodes so that basemesh match the scan. When the best possible match is found with the given number of nodes the algorithm goes to next level. It sub-samples the nodes again with smaller radius and continue wrapping with more control nodes. The more nodes the slower the computations and the more accurate the result. The final density of control nodes is controlled by initialRadiusMultiplier. radiusMultiplier controls how fast the nodes’ density will grow with each iteration.

geomFixed : wrap.Geom

Scan or other high-poly model. For better performance geomFixed should not exceed 10M polygons. If this is the case it is recommended to decimate the mesh using geomFloating = wrap.decimate(geomFloating, nPolygons)

controlPointsFloating, controlPointsFixed : sequence of wrap.PointOnTriangle, optional

A set of correspondent points on geomFloating and geomFixed. In many cases the algorithm can work without control points at all. Use control points to help the algorithm to find proper solution. controlPointsFloating and controlPointsFixed should be the same length.

freePolygonIndicesFloating : sequence of int, optional

A set of polygon indices on geomFloating that will be treated as Free polygons. Free polygons only tend to stay as rigid as possible and do not tend to stitch to target surface. That is very useful in some cases:

  • when there are some areas on scan (like back side of ears) that contain too many artifacts and noise, so it is better to leave correspondent piece of basemesh unchanged.
  • when actor has a hat or stocking on his head and wrapping basemesh’s part around the hat would make no sense, it’s better to leave it unchanged.

The polygon indices should be in range [0,geomFloating.nPolygons]

initialRadiusMultiplier : float, optional

Controls the final density of control nodes. Defaults to 1.0 which is equal to median nearest point distance across basemesh. The lower the value the more nodes will control the basemesh at last iterations, the better the quality of wrapping, the smaller details can be captured by basemesh. On the other hand it will increase the time of the computation and RAM usage.

radiusMultiplier : float, optional

Controls how fast the number of control nodes will grow with each iteration. Defaults to 4.0.

minNodes : int, optional

Defines the minimal number of control nodes at the beginning of optimization. Defaults to 10. Increase it in case of creating morph-targets and if the shape differences between basemesh and a scan are big.

smoothnessInitial : float, optional

Defines the initial rigidness of the basemesh on first iterations. The more rigid the basemesh the harder for the algorithm to deform it. Increase the value if the target mesh contains much noise and outliers. Defaults to 1.0.

smoothnessFinal : float, optional

Defines the rigidness of the basemesh on final iterations. The less the rigidness the easier for the algorithm to deform the mesh, the better it reflects the shape of the target mesh. Defaults to 0.1. Increase the value if you do not want the basemesh to capture small details of the scan.

multiplierControlPoints : float, optional

Controls the influence of control points. Defaults to 10.0.

maxIterations : int, optional

Number of iterations of the algorithm. The less the value the faster the algorithm and the less accurate the result. Defaults to 30.

mu : double, optional

Controls the precision of the algorithm. Defaults to 1e-12.

subdivisionPercentage : double, optional

Defines what percentage of control nodes should be re-sampled on each level. Defaults to 1.0. For most cases leave unchanged.

Returns:

result : wrap.Geom

Returns wrapped copy of geomFloating