Sample

Evaluate fields, sample curves, or query spatial relationships at positions.

What it does

Sample reads a value at a position. Wire in a field, a curve or shape, or a set of points, and Sample evaluates it at the positions given, walks along it, or asks a spatial question about it: how far, how many nearby, what the nearest one looks like. Mode switches between these behaviours, and the node relabels its own controls to match.

With nothing wired to Position, Field mode passes the source field straight through unchanged, so a bare Noise or Distance Field into Sample previews exactly like the source alone.

When to use it

ParameterTypeDefault
sourceOneOf([Field, Curve, Collection, FieldOf(Color)])
positionOneOf([Collection, Vec3, Vec3Array])
modeString"Field"
cameraOneOf([Camera3D])
screen_pointVec2(0, 0)
aspect_ratioNumber1.778
attributeString"Cd"
neighborsNumber1
max_radiusNumber100
density_modeString"Normalized"
field_attributeString"sampled"
source_channelString""
apply_modeString"Set"
timeNumber0
channelString"All"
parameterizationString"Arc Length"
t_attributeString"t"
alignBooleantrue
curve_offsetNumber0
curve_loop_modeString"clamp"
opacityNumber1

Gotchas

Field mode has two shapes depending on whether Position is wired. Left empty, the source field comes back unchanged, which previews a field node through a Sample without committing to positions. Wired, the field is evaluated at those points and written onto them as the Field Attribute.

Distance and Nearest Index are filled in by the point-query modes only: Nearest Attribute, Nearest Distance, Density and KNN Blend. In Field, Curve and Splat Pick mode they are left empty; use the primary output.

Density needs a real search radius. A Max Radius of 0 is treated as unlimited for the nearest-neighbour modes, but Density requires a radius greater than zero to have an area to count within.

Splat Pick needs both Source and Camera wired to project splats into screen space. With Camera unconnected there is nothing to project against and no result is produced.

Worked example

  1. Add a Sample node and wire a Noise field into Source.

  2. Wire a Points node into Position, and set Mode to Field.

  3. Set Field Attribute to density and leave Apply Mode on Set. Each point now carries a density value read from the noise at its location.

  4. Switch Mode to Nearest Attribute, wire a second point set into Position, and set Attribute to Cd to copy colour from the nearest source point onto the new set instead.

See also

Attribute Reader · Fetch · Lookup · Fields