NodeIcon StickToSurface

StickToSurface keeps the position of the vertices of Deformable Geometry at the same positions relative to the surface of Deformation Source Geometry with Deformation Target Geometry deformation.


How it works

StickToSurface for each vertex in a Deformable Geometry finds closest triangle in a Deformation Source Geometry using its normals and stores vertices position relative to that triangles.

After that it places all Deformable Geometry vertices at the same positions realtive to Deformation Target Geometry triangles.

It is mainly used to quickly convert blendshapes or 4d sequence from one topology to another. In this case, the wrapped neutral model in the new topology is fed into the Deformable Geometry input, the neutral model in the old topology is fed into the Deformation Source Geometry input, and the blend from the old topology is fed into the Deformation Target Geometry input. At the output, the node produces a blend in the new topology.

../../_images/StickToSurfacePipeline.png

Since the node saves the position of the vertices of Deformable Geometry relative to the surface of the Deformation Source Geometry, it allows you to keep the details of the Deformable Geometry.

Tip

If Deformation Geometry has a denser mesh than Deformation Source Geometry and contains details that need to be preserved after deformation, it is recommended to increase the Surface Subdivisions parameter (only works when Deformation Source Geometry and Deformation Target Geometry has manifold topology).

This will smooth out the surfaces of Deformation Source Geometry and Deformation Target Geometry so that all details from Deformation Geometry are more accurately transferred to the output geometry.

Also, if the Deformable Geometry surface area is larger than the Deformation Source Geometry surface area, the node keeps the position of the Deformable Geometry outer vertices relative to the nearest Deformation Source Geometry triangles (And these outer vertices will no longer be placed on surface if Place on Surface set).

Deformable Geometry with details and larger surface area
../../_images/StickToSurfaceDeformableGeomFlat.png
Deformation Source Geometry with a smaller surface area
../../_images/StickToSurfaceDeformationSourceFlat.png
Deformation Target Geometry with a smaller surface area
../../_images/StickToSurfaceDeformationTargetFlat.png
Output with default params
../../_images/StickToSurfaceOutputDefaultFlat.png
Output with Surface Subdivisions is set to 2
../../_images/StickToSurfaceOutputSubdividedFlat.png
Output with PlaceOnSurface set
../../_images/StickToSurfaceOutputPlaceOnSurfaceFlat.png

Attention

If Deformable Geometry has mouth socket or eye sockets, but Deformation Source Geometry doesn’t, these sockets will be corrupted after deformation.

This is because when the node tries to find the closest triangles in Deformation Source Geometry for Deformable Geometry socket’s vertices, it will find them in different places on the head.

And when triangles in these places move or deform, that will move or deform the socket accordingly, thereby undesirably changing our socket.

Attention

If your Deformable Geometry or Deformation Source Geometry has self-intersections (e.g. between lips) it is recommended to first use the FixIntersections node to Deformable Geometry and Deformation Source Geometry for removing any self-intersections.

The presence of self-intersections in Deformable Geometry or Deformation Source Geometry may cause incorrect finding of nearest triangles. For example, when upper lip intersect lower lip for lips vertices from Deformable Geometry the closest triangle from Deformation Source Geometry can be found on both the upper and lower lip, which will lead to lip sticking on blends with an open mouth.

Editor

StickToSurface uses normals to calculate vertices position relative to the surface of Deformation Source Geometry.

Therefore, for its work, it is important to have vertex normals that directs into same direction as triangle normals.

In order to simplify the task of finding triangles with vertex normals directed in the opposite directions from the normals of triangles StickToSurface node has a visual editor in which you can find out the number of “triangles with bad normals” and their location.

../../_images/StickToSurfaceVisualEditor.png

Tip

The presence of “triangles with bad normals” will not necessarily lead to problems in the calculation, but if such triangles are present in Deformation Source Geometry or Deformation Target Geometry, then it will not be superfluous to check the result of the node computation in the nearby area of these triangles to make shure that every vertices are positioned correctly.

Attention

If after computing the node there are problems in the areas next to “triangles with bad normals”, then you can increase the Surface Subdivisions parameter, which will smooth the surface and reduce the area of such triangles or reduce their count.

For the Surface Subdivisions parameter to work, Deformation Source Geometry and Deformation Target Geometry must have manifold topology.

Inputs

Deformable Geometry

Geometry Geometry that will be deformed relative to surface of Deformation Source Geometry (Wrapped neutral geometry in the new topology)

../../_images/StickToSurfaceDeformableGeom.png
Deformation Source Geometry

Geometry Geometry that will be used as base deformation for Deformable Geometry (Neutral geometry in the old topology)

../../_images/StickToSurfaceDeformationSource.png
Deformation Target Geometry

Geometry Geometry that will be used as target deformation for Deformable Geometry, must have the same topology as Deformation Source Geometry (Blend in the old topology)

../../_images/StickToSurfaceDeformationTarget.gif

Output

Geometry Deformed Deformable Geometry with deformation as in a Deformation Target Geometry relative to Deformation Source Geometry (Blend in the new topology)

../../_images/StickToSurfaceOutput.gif

Parameters

Surface Subdivisions:

number of subdivisions applying to Deformation Source Geometry and Deformation Target Geometry for additional accuracy. For usage, Deformation Source Geometry and Deformation Target Geometry must have manifold topology

Place on Surface:

if set, the vertices of Deformable Geometry are placed on the surface of Deformation Target Geometry, otherwise the vertices will be placed at the same distance they were placed from the Deformation Source Geometry surface

Scale Distance:

if set, scales distances of result vertices from Deformation Target Geometry surface in relative of triangles scale from Deformation Source Geometry to Deformation Target Geometry