Skip to main content

vScriptValClampToMeshProx

Moves points that are too far from, or too close to, the mesh vertices to a set distance.

AdvancedMograph / ScriptValScriptValArrayJSON
vScriptValClampToMeshProx node

vScriptValClampToMeshProx takes an array of XYZ points and a mesh, and keeps each point at a set distance from its reference on the mesh. Clamp Mode picks whether it moves points outside or inside Max Distance.

Parameters​

ParameterTypeDefaultDescription
Max DistanceFloat1Distance that decides which points are clamped. Minimum 0 in the code, slider 0 to 2, default 1.
Clamp ModeDropdownOutside > MaxOutside > Max (default) or Inside < Max.
ReferenceDropdownSurfaceSurface (default), Vertex or Centroid. Surface and Vertex measure to the closest Mesh Points vertex. Centroid measures to the closest average of a vertex and its 7 nearest neighbors.
Clamp BlendFloat1Mix between the original (0) and the clamped position (1). Range 0 to 1, default 1.
Distance OffsetFloat0Added to Max Distance for the target distance. Slider -2 to 2, default 0.
+7 more parameters
ParameterTypeDefaultDescription
Affect XFloat1X is clamped when checked (default), otherwise it keeps the input value.
Affect YFloat1Y is clamped when checked (default), otherwise it keeps the input value.
Affect ZFloat1Z is clamped when checked (default), otherwise it keeps the input value.
Preserve Extra ValuesFloat1Copies values after the third to the output when on (default).
Pass Through If No MeshFloat1Outputs the points unchanged when there is no mesh data, if on (default). When off, the output is empty.
PointsDATATYPE—Point positions.
Mesh PointsDATATYPE—Points of the mesh that the input is compared with.
Read the full description

For each point the node finds the reference: the closest Mesh Points vertex (Surface and Vertex give the same result) or the closest patch point (Centroid), the average of a vertex and its 7 nearest neighbors. Outside > Max moves points whose distance is above Max Distance. Inside < Max moves points whose distance is below it. They are put on the line from the reference through the point at Max Distance + Distance Offset.

Clamp Blend (0 to 1) mixes between the original and the clamped position, and Affect X, Y and Z keep unchecked axes at their input value. Preserve Extra Values (on) copies values after the third. A point on its reference moves along the estimated normal in Surface mode and along +Z otherwise.

With no mesh data, Pass Through If No Mesh (on) outputs the points unchanged, otherwise the output is empty.

Example Connections​

vScriptValPointsOnGrid.Output -> vScriptValClampToMeshProx.ArrayPoints
vScriptValFromOBJ.Points -> vScriptValClampToMeshProx.MeshPoints
vScriptValClampToMeshProx.Output -> vScriptValCameraProjection.ArrayA
vScriptValCameraProjection.Output -> vScriptValShapeRender.ArrayPoint
Background.Output -> vScriptValShapeRender.Input