Skip to main content

vScriptValScatterOnMesh

Scatter points randomly over the surface of a mesh loaded from a file, URL or text.

IntermediateMograph / ScriptValScriptValArrayJSON
vScriptValScatterOnMesh node

vScriptValScatterOnMesh reads a mesh and outputs Number of Points points sampled on its triangles. Seed makes the result repeatable and Surface Offset moves points along the surface normal.

Parameters​

ParameterTypeDefaultDescription
Input SourceDropdownFileSelects the mesh source. File, URL or Text.
FilenameText—Mesh file to load when Input Source is File. Also available as a socket.
URLText—Mesh URL when Input Source is URL. Hidden until URL is selected.
InputText—Mesh text when Input Source is Text. Available as a socket.
Scale File Units ByFloat1Multiplier applied to the mesh coordinates. Default 1.
+3 more parameters
ParameterTypeDefaultDescription
Point CountInteger1000Number of points to scatter. Minimum 2, default 1000.
Random SeedInteger0Random seed. Same seed gives the same points. Default 0.
Surface OffsetFloat0Distance to move each point along the triangle normal. Default 0.
Read the full description

The mesh source is set by Input Source: File, URL or Text. File uses the Filename socket, URL uses the URL control (hidden until URL is selected) and Text uses the Text input socket. The Scale File Units By control multiplies the mesh coordinates.

Triangles are picked with probability proportional to their area, so large triangles receive more points. Within a triangle the position uses barycentric coordinates built from two random numbers: u = 1 - sqrt(r1), v = sqrt(r1) * (1 - r2), w = sqrt(r1) * r2. This gives a uniform distribution over the triangle.

The random generator is seeded with Random Seed, so the same Random Seed, mesh and Number of Points give the same points. Change Random Seed for a different scatter. Surface Offset moves each point along its triangle normal by that distance; 0 keeps points on the surface.

If the mesh has no triangles, the output is an empty array. Number of Points has a minimum of 2.

Example Connections​

vScriptValScatterOnMesh.Output -> vScriptValCameraProjection.ArrayA
vScriptValCameraProjection.Output -> vScriptValShapeRender.ArrayPoint
Background.Output -> vScriptValShapeRender.Input