New: Nature Shaders

Interaction, Wind, Dynamic Masking, and Better Shading for your vegetation.

Learn more
This page may not work correctly inside the Unity editor. Open in browser

Detail colors are not updated when changed in material

Problem

The colors of the detail objects on the terrain are not updated or do not have the same color as the color set in the material.

Solution

The color for detail objects is loaded from the Healthy and Dry colors in the detail settings. Change the Healthy and Dry colors to change the color of the details on the terrain.

Read more about colors in this article: Change the color of detail objects.

Colors from materials are not automatically refreshed at runtime due to performance reasons. If you need to refresh the colors at runtime (for seasonal changes for example) then you can use the following code:

Nature Renderer 1.1.8 and higher:

using VisualDesignCafe.Rendering.Nature;
GetComponent<NatureRenderer>().FlushMaterials();

Older Versions:

using VisualDesignCafe.Rendering.Nature;
var camera = Camera.main;
var natureRenderer = GetComponent<NatureRenderer>(); var detailPrototypes = GetComponent<Terrain>().terrainData.detailPrototypes; for( int i = 0; i < natureRenderer.TerrainData.DetailPrototypes.Length; i++ ) { natureRenderer.TerrainData.DetailPrototypes[i].CopyFrom( detailPrototypes[i], camera != null ? camera.fieldOfView : 60f, out bool flushEverything, natureRenderer.BillboardGrassMaterial ); }

 

Was this article helpful?
0 out of 1 found this helpful