API

Grass Procedural Texture

Grass Procedural texture

Using the Grass procedural texture

Grass procedural texture can be found here:

A demo can be found here: https://www.babylonjs-playground.com/#KM3TC#1

This texture has 2 parameters:

  • grassColors is an array of 3 (BABYLON.Color3/4) values for the grass. These should be green, but you can create red grass if you want to
  • groundColor is the base color for the ground (BABYLON.Color3/4)
import { StandardMaterial } from "@babylonjs/core/Materials/standardMaterial";
import { GrassProceduralTexture } from "@babylonjs/procedural-textures/grass/grassProceduralTexture";
var grassMaterial = new StandardMaterial("grassMat", scene);
var grassTexture = new GrassProceduralTexture("grassTex", 256, scene);
grassMaterial.ambientTexture = grassTexture;