public static class GrassScatterScattering one cell of one grass type — the CPU reference the compute pass mirrors.
Remarks
[docs/plan/31 § D8], and it is the half a test can run. A cell entering range is scattered over a fixed grid of candidates; each one hashes its cell and its slot, jitters itself off the grid, asks the surface what is underneath, and survives if the ground is gentle enough and the layer is painted enough. Nothing about the result is written anywhere: a cell leaving range drops its blades and re-scatters to the identical ones when it comes back.
⚠ Deterministic from the cell coordinate and the slot, never from an iteration order. That is what makes a cell re-entering range produce the grass it had, what makes two machines agree, and what makes this comparable to the dispatch at all — the seam test [§ Part 4] asks for is impossible against a counter. Hash is the whole of that contract and GrassScatter.rvn contains it transliterated.
⚠ The grid is fixed and the weight thins it. The device runs one invocation per slot, so the candidate count cannot depend on anything sampled; what the painted weight decides is what fraction of the candidates survive. See DensityAt.
⚠ No spacing check, and its absence is the difference from FoliageScatter. A minimum spacing is a query against what is already placed, which makes a candidate's fate depend on the order the others were tested in — and an order is what a dispatch of sixty-five thousand parallel invocations does not have. The grid is the spacing: a candidate cannot leave its own slot.
Fields and properties (7)
public const uint CellSeedXWhat a cell's X coordinate is mixed by.
public const uint CellSeedZAnd its Z coordinate.
public const int JitterXStreamThe stream a candidate's jitter along X is drawn from.
public const int JitterZStreamAnd along Z.
public const int DensityStreamThe stream the density test draws its verdict from.
public const int TintStreamThe stream a blade's tint comes from.
public const int PhaseStreamAnd its wind phase.
Methods (4)
public static uint Hash(FoliageCellKey cell, int index)The hash a candidate's every random draw comes from.
public static int Scatter(in GrassType type, FoliageCellKey cell, FoliageCellGrid grid, IFoliageSurface surface, ICollection<GrassBlade> blades, float densityScale = 1)Scatters one cell of one type.
public static Vector2 CandidateAt(in GrassType type, FoliageCellKey cell, FoliageCellGrid grid, int index)Where one candidate slot's blade would stand, before anything is sampled.
public static GrassScatter.Refusal Consider(in GrassType type, FoliageCellKey cell, FoliageCellGrid grid, IFoliageSurface surface, int index, float densityScale, out GrassBlade blade)Whether one candidate becomes a blade, and what it would be.
Used by (5)
- GrassDispatchTestsVixen.Rendering.Terrain.Tests
- GrassRendererVixen.Rendering.Terrain
- GrassScatterParityTestsVixen.Rendering.Terrain.Tests
- GrassScatterTestsVixen.Foliage.Tests
- TerrainSurfaceTestsVixen.Rendering.Terrain.Tests