A Terrain might have grass clumps and other small objects (such as rocks) covering its surface. Unity renders these objects using textured quads or full Meshes, depending on the level of detail and performance you require.
You can enable the Billboard property of a textured quad so that it automatically faces the camera. This is a very common way to achieve a good grass effect in game development.
For detail Meshes, you can set the Render Mode property as either Vertex Lit or Grass.
To enable grass and detail painting, select the Paint Details button on the toolbar.
Initially, a Terrain has no grass or details available. In the Inspector, click the Edit Details button to display a menu with the Add Grass Texture and Add Detail Mesh options. Click either option to bring up a window that lets you choose Assets to add to the Terrain for painting.
对于草,该窗口如下所示:
Detail Texture is the Texture that represents the grass. You can download Textures from the Asset Store, or create your own Textures. A Texture is a small image with alpha set to zero for the empty areas. Note that “Grass” is a generic term; it is possible for a Texture to represent flowers or man-made objects such as barbed wire coils.
The Min Width, Max Width, Min Height, and Max Height values specify the upper and lower size limits grass clumps that are generated. To create an authentic look, the grass is generated in random “noisy” patterns with bare patches interspersed.
The Noise Spread value controls the approximate size of the bare and grassy patches, with higher values indicating more variation within a given area. Unity uses the Perlin noise algorithm to generate noise, and Noise Spread refers to the scaling it applies between the x,y position on the Terrain and the noise image. The alternating patches of grass are considered “healthier” at the centers than at the edges, and colors set in the Healthy Color and Dry Color settings represent the health of the grass.
Finally, when you enable the Billboard option, the grass images rotate so that they always face the Camera. This is useful when you want to show a dense field of grass because clumps are two-dimensional, and not visible from the side. However, with sparse grass, the rotations of individual clumps might become apparent to the viewer, creating a strange effect.
For detail meshes such as rocks, the window looks like this:
Use Add Detail Mesh to select a Prefab from your Project. Unity scales this randomly between the Min Width and Max Width values, and the Min Height and Max Height values. Unity uses width scaling for both the x and z axes, and height scaling for the y axis. The Noise Spread, Healthy Color and Dry Color values work the same as they do for grass.
You can set the Render Mode to Vertex Lit or Grass.
2019–04–19 Page published with no editorial review
Updated screenshot and made minor changes to wording