What it does
Writes a random per-point @pscale so that copies or instances placed on those points come out at varied sizes. rand(@ptnum) gives a stable 0..1 value per point, and fit01 remaps it into the size range you want.
When to use it
Use it on the target points before a Copy to Points or when rendering points as instances - scattered rocks, foliage, debris, any time uniform copies look too regular.
The VEX code
// Run on the TARGET points, before Copy to Points.
@pscale = fit01(rand(@ptnum), 0.5, 1.5);
Inputs and assumptions
- Runs on the points you will copy onto, in an Attribute Wrangle over points.
@pscaleis a float; Copy to Points and the points render read it as a uniform scale.- The range
0.5, 1.5is min and max scale - adjust to taste.
Common mistakes
- Setting
@pscaleon the copied geometry instead of the target points - it belongs on the points you copy onto. - Seeding off something that changes each frame, so sizes flicker;
@ptnumis stable per point. - Wanting non-uniform scale but using
@pscale(a float) - usev@scale(a vector) for per-axis scaling. - Forgetting that a huge max makes copies intersect; keep the range sensible for your layout.
Frequently asked questions
Where do I set pscale for copy to points?
On the target points - the points you copy onto - before the Copy to Points SOP. It reads @pscale from each point as a uniform scale.
How do I get non-uniform random scale?
Use a vector v@scale instead of the float @pscale, for example v@scale = set(1, fit01(rand(@ptnum),1,3), 1) to stretch vertically.