ProceduralPlanets

◆ MeshDetailMode

MeshDetailModes ProceduralPlanets.PlanetManager.MeshDetailMode
staticgetset

Sets or gets if a static (MeshDetailModes.Static) sized mesh or 2 or more Level Of Detail (MeshDetailModes.LOD) meshes should be used for planets.

When set to a new value, the procedural meshes are recreated based on the new mode and the properties MeshStaticSubdivisions or MeshLODSubdivisions.



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
MeshLODSteps, MeshLODSubdivisions, MeshLODPlanetSizes