ProceduralPlanets

◆ MeshLODSteps

int ProceduralPlanets.PlanetManager.MeshLODSteps
staticgetset

Specifies the number of LOD steps that should be used if MeshDetailMode.LOD is used. Valid values = 2-5.

Default value is 5 (max).

When changed to a new value the LOD meshes are automatically recreated with the new number of steps. Note that you may need to update MeshLODSubdivisions and MeshLODSizes arrays.



using System.Collections;
// This example requires a PlanetManager instance to be present in the scene.
// Add the "Procedural Planets/Prefabs/PlanetManager" prefab to the scene first.
// Then create another gameobject and attach this example script to it.
public class Example : MonoBehaviour
{
void Start()
{
// Create a random planet at the center of the scene
PlanetManager.CreatePlanet(Vector3.zero);
// Set the Mesh Detail Mode to Level of Detail (LOD)
PlanetManager.MeshDetailMode = PlanetManager.MeshDetailModes.LOD;
// Set number of LOD levels to 5
PlanetManager.MeshLODSteps = 5;
// Set the mesh detail levels by using an array of subdivision levels
// The first value in the array is the highest level of detail and the last value in the array is the lowest quality
PlanetManager.MeshLODSubdivisions = new int[5] { 6, 5, 4, 3, 2 };
// Set the planet sizes used to transition between mesh LOD levels
// Note: There are only 4 entries in this array because it specifies the size *between* the LOD levels.
// The float values in the array represent the ratio between screen height and the height of a planet as seen by the camera.
// E.g. the value 0.5f = when the planet takes up half the screen height.
PlanetManager.MeshLODPlanetSizes = new float[4] { 0.6f, 0.4f, 0.2f, 0.05f };
}
}
See also
MeshDetailMode, MeshLODSubdivisions, MeshLODPlanetSizes