Exemple #1
0
        private void UpdateShaderProperties(WeatherMakerCommandBuffer b)
        {
            if (FogProfile == null || WeatherMakerScript.Instance == null || WeatherMakerScript.Instance.PerformanceProfile == null || WeatherMakerLightManagerScript.Instance == null)
            {
                return;
            }

            // temp turn off fog lights for reflection camera and save a lot of performance
            bool  origFogLights = (WeatherMakerScript.Instance == null || WeatherMakerScript.Instance.PerformanceProfile.EnableFogLights);
            int   origFogShafts = (WeatherMakerScript.Instance == null ? FogProfile.SunShaftSampleCount : WeatherMakerScript.Instance.PerformanceProfile.FogFullScreenSunShaftSampleCount);
            bool  tempFogLights = origFogLights && (b.CameraType == WeatherMakerCameraType.Normal);
            int   tempFogShafts = (b.CameraType == WeatherMakerCameraType.Normal ? origFogShafts : 0);
            float density       = FogProfile.fogDensity;

            // TODO: See if this is really necessary anymore
            //if (b.CameraType == WeatherMakerCameraType.Reflection)
            //{
            // HACK: reflection camera hack, density is not correct but this compensates
            // TODO: figure out why fog formula is wrong in reflection camera
            //FogProfile.fogDensity = Mathf.Min(1.0f, density * 100.0f);
            //}
            WeatherMakerScript.Instance.PerformanceProfile.EnableFogLights = tempFogLights;
            WeatherMakerScript.Instance.PerformanceProfile.FogFullScreenSunShaftSampleCount = tempFogShafts;
            FogProfile.UpdateMaterialProperties(b.Material, b.Camera, true);
            FogProfile.fogDensity = density;
            if (WeatherMakerScript.Instance != null)
            {
                WeatherMakerScript.Instance.PerformanceProfile.EnableFogLights = origFogLights;
                WeatherMakerScript.Instance.PerformanceProfile.FogFullScreenSunShaftSampleCount = origFogShafts;
            }
        }
 private void UpdateShaderProperties(WeatherMakerCommandBuffer b)
 {
     FogProfile.UpdateMaterialProperties(b.Material, b.Camera);
 }