GrassComponent struct in Thread

Procedural grass spawned from a sibling TerrainComponent. Blade positions are baked once into per-chunk instance buffers sampled against the terrain's splat weights, so grass only grows on the layer you pick. Wind, colour gradient and distance fade are evaluated per-frame in the vertex shader — the bake cost is paid once.

Placement

EnabledboolMaster switch.
SplatLayerIndexintWhich terrain layer gates growth.
SplatThresholdfloatSkip blades where that layer's weight is below this.
DensityfloatBlades per square metre.
Seeduint32RNG seed for repeatable placement.

Appearance

MinHeight / MaxHeightfloatPer-blade height range (m).
WidthfloatBlade width (m).
ColorBottom / ColorTopVec3Root-to-tip colour gradient.
ColorVariationfloatPer-blade hue jitter amplitude (0 = uniform).
WindStrength / WindFrequencyfloatSway amplitude and speed.
MaxDistance / FadeStartfloatCutoff distance and the fraction of it where fade begins.

For meshed props (rocks, bushes) rather than blades, use a ScatterComponent.

GrassComponent struct w Thread

Proceduralna trawa wyrastająca z sąsiedniego TerrainComponent. Pozycje źdźbeł są raz wypiekane do buforów instancji per fragment, z uwzględnieniem wag warstw terenu, więc trawa rośnie tylko na wybranej warstwie. Wiatr, gradient koloru i zanikanie z odległością liczy co klatkę vertex shader — koszt wypiekania płacisz raz.

Rozmieszczenie

EnabledboolGłówny przełącznik.
SplatLayerIndexintKtóra warstwa terenu warunkuje wzrost.
SplatThresholdfloatPomijaj źdźbła tam, gdzie waga tej warstwy jest niższa.
DensityfloatŹdźbła na metr kwadratowy.
Seeduint32Ziarno losowania dla powtarzalnego rozmieszczenia.

Wygląd

MinHeight / MaxHeightfloatZakres wysokości źdźbła (m).
WidthfloatSzerokość źdźbła (m).
ColorBottom / ColorTopVec3Gradient koloru od nasady do czubka.
ColorVariationfloatAmplituda losowej zmiany odcienia źdźbła (0 = jednolite).
WindStrength / WindFrequencyfloatAmplituda i szybkość kołysania.
MaxDistance / FadeStartfloatOdległość odcięcia i ułamek, od którego zaczyna się zanikanie.

Do obiektów z siatek (kamienie, krzaki) zamiast źdźbeł użyj ScatterComponent.