public void CalculateAtmosphere() { atmosphereNoiseFilter.baseRoughness = 1.1f; atmosphereNoiseFilter.strength = 0.2f; atmosphereNoiseFilter.roughness = 5; atmosphereNoiseFilter.persistence = 0.2f; float rand = Random.value / 50 + 1; atmosphereNoiseFilter.centre.x *= rand; atmosphereNoiseFilter.centre.y *= rand; atmosphereNoiseFilter.centre.z *= rand; Color[] colors = new Color[Atmosphere.GetComponent <MeshFilter>().sharedMesh.vertices.Length]; for (int i = 0; i < Atmosphere.GetComponent <MeshFilter>().sharedMesh.vertices.Length; i++) { /*if (atmosphereNoiseFilter.Evaluate(Atmosphere.GetComponent<MeshFilter>().sharedMesh.vertices[i]) >= 0.15) colors[i] = new Color(1,1,1,1f); * else colors[i] = new Color(0, 0, 0, 0);*/ float value = Mathf.Abs(atmosphereNoiseFilter.Evaluate(Atmosphere.GetComponent <MeshFilter>().sharedMesh.vertices[i])); if (value >= 0.08 && value <= 0.15) { colors[i] = new Color(1, 1, 1, 0.6f); } else { colors[i] = new Color(0, 0, 0, 0); } } Atmosphere.GetComponent <MeshFilter>().sharedMesh.colors = colors; }
public Vector3 CalculatePointOnPlanet(Vector3 pointOnUnitSphere) { float firstLayerValue = 0; float heightElevation = 0; firstLayerValue = noiseFilter0.Evaluate(pointOnUnitSphere); heightElevation = firstLayerValue; heightElevation += noiseFilter1.Evaluate(pointOnUnitSphere) * firstLayerValue; heightElevation += noiseFilter2.Evaluate(pointOnUnitSphere) * firstLayerValue; return(pointOnUnitSphere * planetRadius * (1 + heightElevation)); }