private void UpdateShaderProperties(Material m) { bool gamma = (QualitySettings.activeColorSpace == ColorSpace.Gamma); m.SetTexture("_NightTex", NightTexture); Shader.SetGlobalFloat("_NightMultiplier", WeatherMakerScript.Instance.DayNightScript.NightMultiplier); Shader.SetGlobalFloat("_NightSkyMultiplier", Mathf.Max(1.0f - Mathf.Min(1.0f, SkyAtmosphereThickness), WeatherMakerScript.Instance.DayNightScript.NightMultiplier)); Shader.SetGlobalFloat("_NightVisibilityThreshold", NightVisibilityThreshold); Shader.SetGlobalFloat("_NightIntensity", (gamma ? 2.0f * NightIntensity : NightIntensity)); Shader.SetGlobalFloat("_WeatherMakerSkyDitherLevel", (gamma ? DitherLevel : DitherLevel * 0.5f)); Shader.SetGlobalFloat("_WeatherMakerSkyYOffset", SkyYOffset); Material.DisableKeyword("ENABLE_NIGHT_TWINKLE"); if (NightTwinkleRandomness > 0.0f || (NightTwinkleVariance > 0.0f && NightTwinkleSpeed > 0.0f)) { Shader.SetGlobalFloat("_NightTwinkleSpeed", NightTwinkleSpeed); Shader.SetGlobalFloat("_NightTwinkleVariance", NightTwinkleVariance); Shader.SetGlobalFloat("_NightTwinkleMinimum", NightTwinkleMinimum); Shader.SetGlobalFloat("_NightTwinkleRandomness", NightTwinkleRandomness); Material.EnableKeyword("ENABLE_NIGHT_TWINKLE"); } WeatherMakerSkySphereScript.SetGlobalSkyParameters(SkyAtmosphereMie, SkyMieMultiplier, SkyRayleighMultiplier, SkyAtmosphereThickness, SkyTintColor, SkyOuterRadius, SkyInnerRadius, SkyCameraHeight); }