feat: randomize grass height
This commit is contained in:
@@ -191,6 +191,15 @@ export default function Grass({
|
||||
|
||||
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++;
|
||||
}
|
||||
meshRef.current.count = instanceIndex;
|
||||
|
||||
Reference in New Issue
Block a user