diff --git a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs index bd1f40e5..895ccd31 100644 --- a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs @@ -92,20 +92,29 @@ namespace NewHorizons.Builder.Atmosphere cloudsBottomGO.transform.localScale = Vector3.one * (atmo.Size * 0.9f); TessellatedSphereRenderer bottomTSR = cloudsBottomGO.AddComponent(); - bottomTSR.tessellationMeshGroup = GameObject.Find("CloudsBottomLayer_GD").GetComponent().tessellationMeshGroup; + bottomTSR.tessellationMeshGroup = GameObject.Find("CloudsBottomLayer_QM").GetComponent().tessellationMeshGroup; var bottomTSRMaterials = GameObject.Find("CloudsBottomLayer_QM").GetComponent().sharedMaterials; - var bottomTSRTempArray = new Material[bottomTSRMaterials.Length]; - - // It's a bit too green - var bottomColor = atmo.CloudTint.ToColor32(); - bottomColor.g = (byte)(bottomColor.g * 0.5f); - for (int i = 0; i < bottomTSRMaterials.Length; i++) + + // If they set a colour apply it to all the materials else keep the default QM one + if (atmo.CloudTint != null) { - bottomTSRTempArray[i] = new Material(bottomTSRMaterials[i]); - bottomTSRTempArray[i].SetColor("_Color", bottomColor); - bottomTSRTempArray[i].SetColor("_TintColor", bottomColor); + var bottomColor = atmo.CloudTint.ToColor32(); + + var bottomTSRTempArray = new Material[2]; + + bottomTSRTempArray[0] = new Material(bottomTSRMaterials[0]); + bottomTSRTempArray[0].SetColor("_Color", bottomColor); + bottomTSRTempArray[0].SetColor("_TintColor", bottomColor); + + bottomTSRTempArray[1] = new Material(bottomTSRMaterials[1]); + + bottomTSR.sharedMaterials = bottomTSRTempArray; } - bottomTSR.sharedMaterials = bottomTSRTempArray; + else + { + bottomTSR.sharedMaterials = bottomTSRMaterials; + } + bottomTSR.maxLOD = 6; bottomTSR.LODBias = 0; bottomTSR.LODRadius = 1f;