feat: randomize grass height

This commit is contained in:
2026-06-01 17:02:05 -03:00
parent 10543bba89
commit cad47f07bd
+9
View File
@@ -191,6 +191,15 @@ export default function Grass({
meshRef.current.setColorAt(instanceIndex, color); meshRef.current.setColorAt(instanceIndex, color);
const macroHeightBonus = (noiseVal + 1.0) * 0.2;
const grassWidth = grassSize * (0.8 + Math.random() * 0.4);
const grassHeight = grassSize * (0.6 + Math.random() * 1.2 + macroHeightBonus);
dummy.scale.set(grassWidth, grassHeight, grassWidth);
dummy.updateMatrix();
meshRef.current.setMatrixAt(instanceIndex, dummy.matrix);
instanceIndex++; instanceIndex++;
} }
meshRef.current.count = instanceIndex; meshRef.current.count = instanceIndex;