예제 #1
0
 private static void WriteMB(List <string> lines, MotionBlurModel.Settings settings)
 {
     lines.Append("Motion_Blur", 1);
     lines.Append("{", 1);
     lines.Append("Shutter_Angle = " + settings.shutterAngle, 2);
     lines.Append("Sample_Count = " + settings.sampleCount, 2);
     lines.Append("Frame_Blending = " + settings.frameBlending, 2);
     lines.Append("}", 1);
 }
 public void Lock()
 {
     PPbehavior.enabled  = true;
     locked              = true;
     motionBlurText.text = "Motion Blur: MLG";
     MotionBlurModel.Settings a = motionBlurScript.motionBlur.settings;
     a.frameBlending = MLGModeStrengthValue;
     a.shutterAngle  = MlGModeAngleValue;
     motionBlurScript.motionBlur.settings = a;
 }
    private static void ConvertMotionBlurSettings(PostProcessProfile ppp, MotionBlurModel.Settings mb)
    {
        var mb2 = ppp.AddSettings <MotionBlur>();

        mb2.sampleCount.overrideState  = true;
        mb2.sampleCount.value          = mb.sampleCount;
        mb2.shutterAngle.overrideState = true;
        mb2.shutterAngle.value         = mb.shutterAngle;
        // Not supported: mb.frameBlending
    }
예제 #4
0
    void ResetBlurAmount()
    {
        PostProcessingProfile profile = Camera.main.gameObject.GetComponent <PostProcessingBehaviour>().profile;

        MotionBlurModel.Settings motionBlurSettings = profile.motionBlur.settings;
        motionBlurSettings.frameBlending = 0f;
        profile.motionBlur.settings      = motionBlurSettings;

        ColorGradingModel.Settings colorGradingSettings = profile.colorGrading.settings;
        colorGradingSettings.basic.saturation = 1;
        profile.colorGrading.settings         = colorGradingSettings;
    }
예제 #5
0
    protected override void SetupEffects()
    {
        //Model Settings
        motionBlurModel = profile.motionBlur.settings;
        bloomModel      = profile.bloom.settings;
        vignetteModel   = profile.vignette.settings;

        InitialEffectsSettings();

        //Parameters Compensation
        motionBlurFrameBlending -= initialMotionBlurFrameBlending;
        bloomIntensity          -= initialBloomIntensity;
    }
예제 #6
0
    IEnumerator ProcessBeerEffect()
    {
        while (true)
        {
            MotionBlurModel.Settings settings = profile.motionBlur.settings;

            settings.frameBlending = player.GetComponent <BeerEffect>().intoxication / 30f;
            settings.shutterAngle  = (player.GetComponent <BeerEffect> ().intoxication / 75f) * 360f;

            profile.motionBlur.settings = settings;

            yield return(new WaitForSeconds(0.25f));
        }
    }
예제 #7
0
    protected override void SetupEffects()
    {
        //Model Settings
        motionBlurModel = profile.motionBlur.settings;
        grainModel      = profile.grain.settings;
        vignetteModel   = profile.vignette.settings;

        InitialEffectsSettings();

        //Parameters Compensation
        motionBlurFrameBlending -= initialMotionBlurFrameBlending;
        grainIntensity          -= initialGrainIntensity;
        vignetteIntensity       -= initialVignetteIntensity;
    }
예제 #8
0
    protected void LerpBlur(float rate)
    {
        float BLUR_ACTIVATION_LIMIT = 0.05f;

        transitionProfile.motionBlur.enabled = EnableOrDisableEffect(oldProfile.motionBlur.enabled, futureProfile.motionBlur.enabled, rate, BLUR_ACTIVATION_LIMIT);

        MotionBlurModel.Settings currentSettings = oldProfile.motionBlur.settings;
        MotionBlurModel.Settings futureSettings  = futureProfile.motionBlur.settings;

        currentSettings.shutterAngle  = Mathf.Lerp(currentSettings.shutterAngle, futureSettings.shutterAngle, rate);
        currentSettings.sampleCount   = (int)Mathf.Lerp(currentSettings.sampleCount, futureSettings.sampleCount, rate);
        currentSettings.frameBlending = Mathf.Lerp(currentSettings.frameBlending, futureSettings.frameBlending, rate);

        transitionProfile.motionBlur.settings = currentSettings;
    }
    public void Unlock()
    {
        locked = false;
        motionBlurText.color = Color.white;
        int tempValue = (int)Mathf.Repeat(rotateValue, shutterAngleValues.Length);

        if (tempValue == 0)
        {
            PPbehavior.enabled = false;
        }
        motionBlurText.text = TextList[tempValue];
        MotionBlurModel.Settings a = motionBlurScript.motionBlur.settings;
        a.shutterAngle  = shutterAngleValues[tempValue];
        a.frameBlending = MFBStrengthValues[tempValue];
        motionBlurScript.motionBlur.settings = a;
    }
예제 #10
0
        void Start()
        {
            // Replace the profile with its clone.
            var postfx = GetComponent <PostProcessingBehaviour>();

            _profile       = Instantiate <PostProcessingProfile>(postfx.profile);
            postfx.profile = _profile;

            // Initialize the public structs with the current profile.
            enableAntialiasing = _profile.antialiasing.enabled;
            antialiasing       = _profile.antialiasing.settings;

            enableAmbientOcclusion = _profile.ambientOcclusion.enabled;
            ambientOcclusion       = _profile.ambientOcclusion.settings;

            enableScreenSpaceReflection = _profile.screenSpaceReflection.enabled;
            screenSpaceReflection       = _profile.screenSpaceReflection.settings;

            enableDepthOfField = _profile.depthOfField.enabled;
            depthOfField       = _profile.depthOfField.settings;

            enableMotionBlur = _profile.motionBlur.enabled;
            motionBlur       = _profile.motionBlur.settings;

            enableEyeAdaptation = _profile.eyeAdaptation.enabled;
            eyeAdaptation       = _profile.eyeAdaptation.settings;

            enableBloom = _profile.bloom.enabled;
            bloom       = _profile.bloom.settings;

            enableColorGrading = _profile.colorGrading.enabled;
            colorGrading       = _profile.colorGrading.settings;

            enableUserLut = _profile.userLut.enabled;
            userLut       = _profile.userLut.settings;

            enableChromaticAberration = _profile.chromaticAberration.enabled;
            chromaticAberration       = _profile.chromaticAberration.settings;

            enableGrain = _profile.grain.enabled;
            grain       = _profile.grain.settings;

            enableVignette = _profile.vignette.enabled;
            vignette       = _profile.vignette.settings;
        }
예제 #11
0
        //public void Reset()
        //{
        //    OnEnable();
        //}
        internal void SetProfile(PostProcessingProfile __profile)
        {
            enableAntialiasing = __profile.antialiasing.enabled;
            antialiasing       = __profile.antialiasing.settings;

            enableAmbientOcclusion = __profile.ambientOcclusion.enabled;
            ambientOcclusion       = __profile.ambientOcclusion.settings;

            enableScreenSpaceReflection = __profile.screenSpaceReflection.enabled;
            screenSpaceReflection       = __profile.screenSpaceReflection.settings;

            enableDepthOfField = __profile.depthOfField.enabled;
            depthOfField       = __profile.depthOfField.settings;

            enableMotionBlur = __profile.motionBlur.enabled;
            motionBlur       = __profile.motionBlur.settings;

            enableEyeAdaptation = __profile.eyeAdaptation.enabled;
            eyeAdaptation       = __profile.eyeAdaptation.settings;

            enableBloom = __profile.bloom.enabled;
            bloom       = __profile.bloom.settings;

            enableColorGrading = __profile.colorGrading.enabled;
            colorGrading       = __profile.colorGrading.settings;

            enableUserLut = __profile.userLut.enabled;
            userLut       = __profile.userLut.settings;

            enableChromaticAberration = __profile.chromaticAberration.enabled;
            chromaticAberration       = __profile.chromaticAberration.settings;

            enableGrain = __profile.grain.enabled;
            grain       = __profile.grain.settings;

            enableVignette = __profile.vignette.enabled;
            vignette       = __profile.vignette.settings;

            enableDither = __profile.dithering.enabled;

            enableFog = __profile.fog.enabled;
            fog       = __profile.fog.settings;
        }
예제 #12
0
    void addMotionBlur()
    {
        if (!ppProfile.motionBlur.enabled)
        {
            ppProfile.motionBlur.enabled = true;
        }
        MotionBlurModel.Settings mbSettings = ppProfile.motionBlur.settings;

        if (tMotionBlur < 1)
        {
            tMotionBlur += seuil;

            //Change the parameters
            mbSettings.shutterAngle  = Mathf.Lerp(0, 100, tMotionBlur);
            mbSettings.frameBlending = Mathf.Lerp(0f, 50f, tMotionBlur);
        }

        //Set the motion blur settings in the actual profile to the temp settings with the changed values
        ppProfile.motionBlur.settings = mbSettings;
    }
예제 #13
0
    void BlurVision()
    {
        PostProcessingProfile profile = Camera.main.gameObject.GetComponent <PostProcessingBehaviour>().profile;

        //copy current bloom settings from the profile into a temporary variable
        MotionBlurModel.Settings   motionBlurSettings   = profile.motionBlur.settings;
        ColorGradingModel.Settings colorGradingSettings = profile.colorGrading.settings;
        //change the intensity in the temporary settings variable
        motionBlurSettings.frameBlending += .2f;

        colorGradingSettings.basic.saturation -= .15f;
        if (colorGradingSettings.basic.saturation < .2f)
        {
            colorGradingSettings.basic.saturation = .2f;
        }

        //set the bloom settings in the actual profile to the temp settings with the changed value
        profile.motionBlur.settings   = motionBlurSettings;
        profile.colorGrading.settings = colorGradingSettings;
    }
예제 #14
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetButtonDown("VaporMode"))
     {
         Time.timeScale = 0.5f;
         cam.GetComponent <PostProcessingBehaviour> ().profile.bloom.enabled = true;
         blurSettings = cam.GetComponent <PostProcessingBehaviour> ().profile.motionBlur.settings;
         blurSettings.frameBlending = 0.5f;
         cam.GetComponent <PostProcessingBehaviour> ().profile.motionBlur.settings = blurSettings;
     }
     if (Input.GetButtonUp("VaporMode"))
     {
         Time.timeScale = 1f;
         //cam.GetComponent<PostProcessingBehaviour> ().enabled = false;
         cam.GetComponent <PostProcessingBehaviour> ().profile.bloom.enabled = false;
         blurSettings = cam.GetComponent <PostProcessingBehaviour> ().profile.motionBlur.settings;
         blurSettings.frameBlending = 0.1f;
         cam.GetComponent <PostProcessingBehaviour> ().profile.motionBlur.settings = blurSettings;
     }
 }
 public void clicked()
 {
     if (!locked)
     {
         PPbehavior.enabled = true;
         rotateValue++;
         int tempValue = (int)Mathf.Repeat(rotateValue, shutterAngleValues.Length);
         motionBlurText.text = TextList[tempValue];
         MotionBlurModel.Settings a = motionBlurScript.motionBlur.settings;
         a.shutterAngle  = shutterAngleValues[tempValue];
         a.frameBlending = MFBStrengthValues[tempValue];
         if (tempValue == 0)
         {
             a.sampleCount      = 0;
             PPbehavior.enabled = false;
         }
         else
         {
             a.sampleCount = 8;
         }
         motionBlurScript.motionBlur.settings = a;
     }
 }
예제 #16
0
    internal void RefreshDeprivationUX(SurvivalTimer survivalTimer)
    {
        bool isPowerDeprived  = survivalTimer.Data.Power.DeprivationSeconds > 0f,
             isOxygenDeprived = survivalTimer.Data.Oxygen.DeprivationSeconds > 0f,
             isFoodDeprived   = survivalTimer.Data.Food.DeprivationSeconds > 0f,
             isWaterDeprived  = survivalTimer.Data.Water.DeprivationSeconds > 0f;

        ShowingDeprivationUX = isPowerDeprived || isOxygenDeprived || isFoodDeprived || isWaterDeprived;

        //sounds
        if (isOxygenDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.VocalSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.Gasping;
            PlayerInput.Instance.VocalSource.Play();
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowToDeathHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (isPowerDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.VocalSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.Chattering;
            PlayerInput.Instance.VocalSource.Play();
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (isFoodDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (isWaterDeprived && !PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.HeartbeatSource.clip = PlayerInput.Instance.HeartbeatsAndVocals.SlowHeartbeat;
            PlayerInput.Instance.HeartbeatSource.Play();
        }
        else if (!ShowingDeprivationUX && PlayerInput.Instance.HeartbeatSource.isPlaying)
        {
            PlayerInput.Instance.HeartbeatSource.Stop();
            PlayerInput.Instance.VocalSource.Stop();
        }

        //colorgrading
        if (isOxygenDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Oxygen.DeprivationSeconds / survivalTimer.DeprivationDurations.OxygenDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.saturation = Mathf.Min(1f, Mathf.Lerp(1f, 0f, lerpT) + .25f);
            newBasics.contrast   = Mathf.Lerp(1f, 2f, lerpT);
            newSettings.basic    = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else if (isPowerDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Power.DeprivationSeconds / survivalTimer.DeprivationDurations.PowerDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.temperature             = Mathf.Lerp(0f, -40f, lerpT);
            newSettings.basic                 = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else if (isWaterDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Water.DeprivationSeconds / survivalTimer.DeprivationDurations.WaterDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.temperature             = Mathf.Lerp(0f, 35f, lerpT);
            newBasics.saturation              = Mathf.Lerp(1f, 0f, lerpT);
            newSettings.basic                 = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else if (isFoodDeprived)
        {
            PostProfile.colorGrading.enabled = true;
            float lerpT = survivalTimer.Data.Food.DeprivationSeconds / survivalTimer.DeprivationDurations.FoodDeprivationSurvivalTimeSeconds;
            ColorGradingModel.Settings      newSettings = ColorGradingModel.Settings.defaultSettings;
            ColorGradingModel.BasicSettings newBasics   = ColorGradingModel.BasicSettings.defaultSettings;
            newBasics.contrast   = Mathf.Lerp(1f, 1.5f, lerpT);
            newBasics.saturation = Mathf.Lerp(1f, 0f, lerpT);
            newSettings.basic    = newBasics;
            PostProfile.colorGrading.settings = newSettings;
        }
        else
        {
            PostProfile.colorGrading.enabled = false;
        }

        //motion blur
        if (isFoodDeprived)
        {
            PostProfile.motionBlur.enabled = true;
            float lerpT = survivalTimer.Data.Food.DeprivationSeconds / survivalTimer.DeprivationDurations.FoodDeprivationSurvivalTimeSeconds;
            MotionBlurModel.Settings newSettings = MotionBlurModel.Settings.defaultSettings;
            newSettings.frameBlending       = Mathf.Lerp(1f, 0.5f, lerpT);
            newSettings.shutterAngle        = Mathf.Lerp(0f, 360f, lerpT);
            newSettings.sampleCount         = 4;
            PostProfile.motionBlur.settings = newSettings;
        }

        //depth of field
        if (isWaterDeprived)
        {
            PostProfile.depthOfField.enabled = true;
            float lerpT = survivalTimer.Data.Water.DeprivationSeconds / survivalTimer.DeprivationDurations.WaterDeprivationSurvivalTimeSeconds;
            DepthOfFieldModel.Settings newSettings = DepthOfFieldModel.Settings.defaultSettings;
            //DepthOfFieldModel.BasicSettings newBasics = DepthOfFieldModel.BasicSettings.defaultSettings;
            newSettings.aperture              = Mathf.Lerp(5f, 0.05f, lerpT);
            newSettings.useCameraFov          = true;
            newSettings.focusDistance         = 1f;
            newSettings.kernelSize            = DepthOfFieldModel.KernelSize.VeryLarge;
            PostProfile.depthOfField.settings = newSettings;
        }

        //vignetting
        if (isOxygenDeprived)
        {
            PostProfile.vignette.enabled = true;
            float lerpT = survivalTimer.Data.Oxygen.DeprivationSeconds;
            lerpT -= (float)Math.Truncate(lerpT);

            VignetteModel.Settings newSettings = VignetteModel.Settings.defaultSettings;
            newSettings.color             = new Color(51f / 255f, 51f / 255f, 51f / 255f);
            newSettings.intensity         = Mathf.PingPong(lerpT, .5f);
            newSettings.smoothness        = 1f;
            newSettings.roundness         = 1f;
            PostProfile.vignette.settings = newSettings;
        }
        else if (isPowerDeprived)
        {
            PostProfile.vignette.enabled = true;
            float lerpT = survivalTimer.Data.Power.DeprivationSeconds / survivalTimer.DeprivationDurations.PowerDeprivationSurvivalTimeSeconds;

            VignetteModel.Settings newSettings = VignetteModel.Settings.defaultSettings;
            newSettings.color             = new Color(68f / 255f, 108f / 255f, 255f / 255f);
            newSettings.intensity         = Mathf.Lerp(0f, 0.76f, lerpT);
            newSettings.smoothness        = 0.169f;
            newSettings.roundness         = 1;
            PostProfile.vignette.settings = newSettings;
        }
        else if (isFoodDeprived)
        {
            PostProfile.vignette.enabled = true;
            float lerpT = survivalTimer.Data.Food.DeprivationSeconds / survivalTimer.DeprivationDurations.FoodDeprivationSurvivalTimeSeconds;

            VignetteModel.Settings newSettings = VignetteModel.Settings.defaultSettings;
            newSettings.color             = new Color(32f / 255f, 32f / 255f, 32f / 255f);
            newSettings.intensity         = Mathf.Lerp(0f, 0.4f, lerpT);
            newSettings.smoothness        = Mathf.Lerp(0f, 0.5f, lerpT);
            newSettings.roundness         = 1;
            PostProfile.vignette.settings = newSettings;
        }
        else
        {
            PostProfile.vignette.enabled = false;
        }
    }
예제 #17
0
    private void Update()
    {
        if (this.postProcessingProfile)
        {
            ColorGradingModel.Settings settings = this.postProcessingProfile.colorGrading.settings;
            float num      = PlayerPreferences.GammaWorldAndDay;
            float contrast = PlayerPreferences.Contrast;
            if (Clock.Dark || LocalPlayer.IsInCaves)
            {
                num = PlayerPreferences.GammaCavesAndNight;
            }
            bool flag = LocalPlayer.Inventory != null && LocalPlayer.Inventory.CurrentView == PlayerInventory.PlayerViews.Pause;
            if (flag || float.IsNaN(settings.basic.postExposure) || float.IsInfinity(settings.basic.postExposure) || Mathf.Abs(num - settings.basic.postExposure) < 0.001f)
            {
                if (!settings.basic.postExposure.Equals(num))
                {
                    settings.basic.postExposure = num;
                }
            }
            else
            {
                settings.basic.postExposure = Mathf.SmoothDamp(settings.basic.postExposure, num, ref this.gammaVelocity, 3f);
            }
            if (flag || float.IsNaN(settings.basic.contrast) || float.IsInfinity(settings.basic.contrast) || Mathf.Abs(contrast - settings.basic.contrast) < 0.001f)
            {
                if (!settings.basic.contrast.Equals(contrast))
                {
                    settings.basic.contrast = contrast;
                }
            }
            else
            {
                settings.basic.contrast = Mathf.SmoothDamp(settings.basic.contrast, contrast, ref this.contrastVelocity, 1f);
            }
            this.postProcessingProfile.colorGrading.settings = settings;
        }
        if (this.farShadowCascade)
        {
            bool flag2 = TheForestQualitySettings.UserSettings.FarShadowMode == TheForestQualitySettings.FarShadowModes.On && !LocalPlayer.IsInClosedArea;
            if (this.farShadowCascade.enableFarShadows != flag2)
            {
                this.farShadowCascade.enableFarShadows = flag2;
            }
        }
        if (this.postProcessingProfile && PlayerPreferences.ColorGrading >= 0 && PlayerPreferences.ColorGrading < this.AmplifyColorGradients.Length)
        {
            this.postProcessingProfile.userLut.enabled = true;
            UserLutModel.Settings settings2 = this.postProcessingProfile.userLut.settings;
            settings2.lut = this.AmplifyColorGradients[PlayerPreferences.ColorGrading];
            this.postProcessingProfile.userLut.settings = settings2;
        }
        if (this.frostEffect)
        {
            this.frostEffect.enabled = (this.frostEffect.coverage > 0f);
        }
        if (this.bleedEffect)
        {
            if (Application.isPlaying)
            {
                this.bleedEffect.enabled = (BleedBehavior.BloodAmount > 0f);
            }
            else
            {
                this.bleedEffect.enabled = (this.bleedEffect.TestingBloodAmount > 0f);
            }
        }
        TheForestQualitySettings.AntiAliasingTechnique antiAliasingTechnique = TheForestQualitySettings.UserSettings.AntiAliasing;
        if (SystemInfo.systemMemorySize <= 4096 || PlayerPreferences.LowMemoryMode)
        {
            antiAliasingTechnique = TheForestQualitySettings.AntiAliasingTechnique.None;
        }
        if (this.postProcessingProfile)
        {
            bool flag3 = !ForestVR.Enabled && antiAliasingTechnique != TheForestQualitySettings.AntiAliasingTechnique.None;
            this.postProcessingProfile.antialiasing.enabled = flag3;
            if (flag3)
            {
                AntialiasingModel.Settings settings3 = this.postProcessingProfile.antialiasing.settings;
                if (antiAliasingTechnique != TheForestQualitySettings.AntiAliasingTechnique.FXAA)
                {
                    if (antiAliasingTechnique == TheForestQualitySettings.AntiAliasingTechnique.TAA)
                    {
                        settings3.method = AntialiasingModel.Method.Taa;
                    }
                }
                else
                {
                    settings3.method = AntialiasingModel.Method.Fxaa;
                }
                this.postProcessingProfile.antialiasing.settings = settings3;
            }
        }
        if (this.postProcessingProfile)
        {
            bool flag4 = !ForestVR.Enabled && !this.SkipMotionBlur && TheForestQualitySettings.UserSettings.MotionBlur != TheForestQualitySettings.MotionBlurQuality.None;
            this.postProcessingProfile.motionBlur.enabled = flag4;
            if (flag4)
            {
                MotionBlurModel.Settings settings4 = this.postProcessingProfile.motionBlur.settings;
                switch (TheForestQualitySettings.UserSettings.MotionBlur)
                {
                case TheForestQualitySettings.MotionBlurQuality.Low:
                    settings4.sampleCount = 4;
                    break;

                case TheForestQualitySettings.MotionBlurQuality.Medium:
                    settings4.sampleCount = 8;
                    break;

                case TheForestQualitySettings.MotionBlurQuality.High:
                    settings4.sampleCount = 16;
                    break;

                case TheForestQualitySettings.MotionBlurQuality.Ultra:
                    settings4.sampleCount = 32;
                    break;
                }
                this.postProcessingProfile.motionBlur.settings = settings4;
            }
        }
        if (this.postProcessingProfile)
        {
            bool flag5 = !ForestVR.Enabled && TheForestQualitySettings.UserSettings.screenSpaceReflection == TheForestQualitySettings.ScreenSpaceReflection.On;
            flag5 = (flag5 && LocalPlayer.IsInEndgame);
            this.postProcessingProfile.screenSpaceReflection.enabled = flag5;
        }
        if (this.postProcessingProfile)
        {
        }
        if (this.postProcessingProfile)
        {
            bool enabled = !ForestVR.Enabled && TheForestQualitySettings.UserSettings.Fg == TheForestQualitySettings.FilmGrain.Normal;
            this.postProcessingProfile.grain.enabled = enabled;
        }
        if (this.postProcessingProfile)
        {
            bool enabled2 = TheForestQualitySettings.UserSettings.CA == TheForestQualitySettings.ChromaticAberration.Normal;
            this.postProcessingProfile.chromaticAberration.enabled = enabled2;
        }
        if (this.postProcessingProfile)
        {
            bool enabled3 = TheForestQualitySettings.UserSettings.SEBloom == TheForestQualitySettings.SEBloomTechnique.Normal;
            this.postProcessingProfile.bloom.enabled = enabled3;
        }
        if (Application.isPlaying)
        {
            if (!this.SunshineAtmosCam)
            {
                this.SunshineAtmosCam = base.GetComponent <TheForestAtmosphereCamera>();
                if (!this.SunshineAtmosCam)
                {
                    this.SunshineAtmosCam = base.gameObject.AddComponent <TheForestAtmosphereCamera>();
                }
            }
            this.SunshineCam.enabled = true;
            this.SunshinePP.enabled  = true;
            if (Sunshine.Instance)
            {
                Sunshine.Instance.enabled                = true;
                Sunshine.Instance.ScatterResolution      = TheForestQualitySettings.UserSettings.ScatterResolution;
                Sunshine.Instance.ScatterSamplingQuality = TheForestQualitySettings.UserSettings.ScatterSamplingQuality;
                if (this.SunshineOccluders.value != 0)
                {
                    bool flag6 = TheForestQualitySettings.UserSettings.SunshineOcclusion == TheForestQualitySettings.SunshineOcclusionOn.On || LocalPlayer.IsInCaves;
                    Sunshine.Instance.Occluders = ((!flag6) ? 0 : this.SunshineOccluders.value);
                }
                else
                {
                    this.SunshineOccluders = Sunshine.Instance.Occluders;
                }
            }
        }
        TheForestQualitySettings.SSAOTechnique ssaotechnique = TheForestQualitySettings.UserSettings.SSAO;
        if (SystemInfo.systemMemorySize <= 4096 || PlayerPreferences.LowMemoryMode)
        {
            ssaotechnique = TheForestQualitySettings.SSAOTechnique.Off;
        }
        if (this.amplifyOcclusion && (TheForestQualitySettings.UserSettings.SSAOType == TheForestQualitySettings.SSAOTypes.AMPLIFY || !this.postProcessingProfile))
        {
            this.amplifyOcclusion.enabled = (!ForestVR.Enabled && ssaotechnique != TheForestQualitySettings.SSAOTechnique.Off);
            if (this.postProcessingProfile)
            {
                this.postProcessingProfile.ambientOcclusion.enabled = false;
            }
            if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.Ultra)
            {
                if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.High)
                {
                    if (ssaotechnique == TheForestQualitySettings.SSAOTechnique.Low)
                    {
                        this.amplifyOcclusion.SampleCount = AmplifyOcclusionBase.SampleCountLevel.Low;
                    }
                }
                else
                {
                    this.amplifyOcclusion.SampleCount = AmplifyOcclusionBase.SampleCountLevel.Medium;
                }
            }
            else
            {
                this.amplifyOcclusion.SampleCount = AmplifyOcclusionBase.SampleCountLevel.High;
            }
        }
        else if (this.postProcessingProfile && (TheForestQualitySettings.UserSettings.SSAOType == TheForestQualitySettings.SSAOTypes.UNITY || !this.amplifyOcclusion))
        {
            this.postProcessingProfile.ambientOcclusion.enabled = (!ForestVR.Enabled && ssaotechnique != TheForestQualitySettings.SSAOTechnique.Off);
            if (this.amplifyOcclusion)
            {
                this.amplifyOcclusion.enabled = false;
            }
            AmbientOcclusionModel.Settings settings5 = this.postProcessingProfile.ambientOcclusion.settings;
            if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.Ultra)
            {
                if (ssaotechnique != TheForestQualitySettings.SSAOTechnique.High)
                {
                    if (ssaotechnique == TheForestQualitySettings.SSAOTechnique.Low)
                    {
                        settings5.sampleCount = AmbientOcclusionModel.SampleCount.Lowest;
                    }
                }
                else
                {
                    settings5.sampleCount = AmbientOcclusionModel.SampleCount.Low;
                }
            }
            else
            {
                settings5.sampleCount = AmbientOcclusionModel.SampleCount.Medium;
            }
            this.postProcessingProfile.ambientOcclusion.settings = settings5;
        }
        if (LocalPlayer.WaterEngine)
        {
            if (LocalPlayer.IsInClosedArea)
            {
                Scene.OceanFlat.SetActive(false);
                Scene.OceanCeto.SetActive(false);
                this.CurrentOceanQuality = (TheForestQualitySettings.OceanQualities)(-1);
            }
            else if (TheForestQualitySettings.UserSettings.OceanQuality != this.CurrentOceanQuality)
            {
                this.CurrentOceanQuality = ((!PlayerPreferences.is32bit) ? TheForestQualitySettings.UserSettings.OceanQuality : TheForestQualitySettings.OceanQualities.Flat);
                TheForestQualitySettings.OceanQualities oceanQuality = TheForestQualitySettings.UserSettings.OceanQuality;
                if (oceanQuality != TheForestQualitySettings.OceanQualities.WaveDisplacementHigh)
                {
                    if (oceanQuality != TheForestQualitySettings.OceanQualities.WaveDisplacementLow)
                    {
                        if (oceanQuality == TheForestQualitySettings.OceanQualities.Flat)
                        {
                            Scene.OceanFlat.SetActive(true);
                            Scene.OceanCeto.SetActive(false);
                            this.waterBlurCeto.enabled = false;
                        }
                    }
                    else
                    {
                        Scene.OceanFlat.SetActive(false);
                        Scene.OceanCeto.SetActive(true);
                        this.waterBlurCeto.enabled = true;
                        if (OceanQualitySettings.Instance != null)
                        {
                            OceanQualitySettings.Instance.QualityChanged(CETO_QUALITY_SETTING.LOW);
                        }
                    }
                }
                else
                {
                    Scene.OceanFlat.SetActive(false);
                    Scene.OceanCeto.SetActive(true);
                    this.waterBlurCeto.enabled = true;
                    if (OceanQualitySettings.Instance != null)
                    {
                        OceanQualitySettings.Instance.QualityChanged(CETO_QUALITY_SETTING.HIGH);
                    }
                }
            }
        }
    }
예제 #18
0
    private IEnumerator ITransition()
    {
        Camera newCamera = ((GameObject)Instantiate(Camera.main.gameObject, transform)).GetComponent <Camera> ();

        newCamera.transform.localPosition = Vector3.zero;
        newCamera.targetTexture           = transitionTexture;
        newCamera.GetComponent <AudioListener> ().enabled = false;

        yield return(null);

        newCamera.enabled       = false;
        newCamera.targetTexture = null;

        meshRenderer.gameObject.SetActive(true);
        float meshWidth = Camera.main.orthographicSize * 2f * 1.7778f;

        meshRenderer.transform.localPosition = new Vector3(0f, 0f, 0.35f);
        meshRenderer.transform.localScale    = new Vector3(meshWidth, Camera.main.orthographicSize * 2f, 1f);

        meshRenderer.material.SetTextureOffset("_MainTex", new Vector2(0f, 0f));
        meshRenderer.material.mainTextureScale = new Vector2(1f, 1f);


        meshRenderer.material.SetTextureOffset("_MainTex", Vector2.zero);

        yield return(new WaitForSeconds(pauseTime));

        ChromaticAberrationModel.Settings chromeSettings = new ChromaticAberrationModel.Settings();
        MotionBlurModel.Settings          blurSettings   = new MotionBlurModel.Settings();

        float time = 0f;

        while (time < transitionTime)
        {
            time += Time.deltaTime;

            float theta = time / transitionTime;

            meshRenderer.transform.localPosition = new Vector3(theta * meshWidth / 2f, 0f, 0.35f);
            meshRenderer.transform.localScale    = new Vector3(meshWidth - (theta * meshWidth), meshRenderer.transform.localScale.y, 1f);

            meshRenderer.material.SetTextureOffset("_MainTex", new Vector2(theta, 0f));
            meshRenderer.material.mainTextureScale = new Vector2(1f - theta, 1f);

            chromeSettings.intensity = Mathf.Sin(theta * Mathf.PI);
            post.profile.chromaticAberration.settings = chromeSettings;

            blurSettings.frameBlending       = Mathf.Sin(theta * Mathf.PI);
            post.profile.motionBlur.settings = blurSettings;

            yield return(null);
        }

        chromeSettings.intensity = 0f;
        post.profile.chromaticAberration.settings = chromeSettings;

        blurSettings.frameBlending       = 0f;
        post.profile.motionBlur.settings = blurSettings;

        meshRenderer.gameObject.SetActive(false);
        Destroy(newCamera.gameObject);
        transitionCo = null;
    }
예제 #19
0
            static void Postfix(ref VignetteComponent ___m_Vignette, ref BloomComponent ___m_Bloom, ref EyeAdaptationComponent ___m_EyeAdaptation, ref DepthOfFieldComponent ___m_DepthOfField, ref MotionBlurComponent ___m_MotionBlur, ref ColorGradingComponent ___m_ColorGrading, ref TaaComponent ___m_Taa, ref FxaaComponent ___m_Fxaa, ref AmbientOcclusionComponent ___m_AmbientOcclusion)
            {
                if (enabled && settings.customVignette)
                {
                    VignetteModel.Settings vSettings = new VignetteModel.Settings
                    {
                        mode       = VignetteModel.Mode.Classic,
                        intensity  = settings.vignetteIntensity,
                        color      = new Color(settings.vignetteColorRed, settings.vignetteColorGreen, settings.vignetteColorBlue, settings.vignetteColorAlpha),
                        center     = new Vector2(settings.vignetteX, settings.vignetteY),
                        smoothness = settings.vignetteSmoothness,
                        roundness  = settings.vignetteRoundness,
                        rounded    = settings.vignetteRounded
                    };
                    ___m_Vignette.model.settings = vSettings;
                }
                else
                {
                    ___m_Vignette.model.settings = defaultVignetteSettings;
                }

                if (enabled && settings.customBloom)
                {
                    BloomModel.BloomSettings bbSettings = new BloomModel.BloomSettings
                    {
                        intensity   = settings.bloomIntensity,
                        threshold   = settings.bloomThreshold,
                        softKnee    = settings.bloomSoftKnee,
                        radius      = settings.bloomRadius,
                        antiFlicker = settings.bloomAntiFlicker
                    };

                    BloomModel.LensDirtSettings blSettings = new BloomModel.LensDirtSettings
                    {
                        texture   = ___m_Bloom.model.settings.lensDirt.texture,
                        intensity = settings.bloomLensDirtIntensity
                    };
                    BloomModel.Settings bSettings = new BloomModel.Settings
                    {
                        bloom    = bbSettings,
                        lensDirt = blSettings
                    };

                    ___m_Bloom.model.settings = bSettings;
                }
                else
                {
                    ___m_Bloom.model.settings = defaultBloomSettings;
                }

                if (enabled && settings.customEyeAdapt)
                {
                    EyeAdaptationModel.Settings eSettings = new EyeAdaptationModel.Settings
                    {
                        lowPercent      = settings.eyeAdaptLowPercent,
                        highPercent     = settings.eyeAdaptHighPercent,
                        minLuminance    = settings.eyeAdaptMinLuminance,
                        maxLuminance    = settings.eyeAdaptMaxLuminance,
                        keyValue        = settings.eyeAdaptKeyValue,
                        dynamicKeyValue = settings.eyeAdaptDynamicKeyValue,
                        adaptationType  = settings.eyeAdaptAdaptationFixed?EyeAdaptationModel.EyeAdaptationType.Fixed: EyeAdaptationModel.EyeAdaptationType.Progressive,
                        speedUp         = settings.eyeAdaptSpeedUp,
                        speedDown       = settings.eyeAdaptSpeedDown,
                        logMin          = settings.eyeAdaptLogMin,
                        logMax          = settings.eyeAdaptLogMax,
                    };

                    ___m_EyeAdaptation.model.settings = eSettings;
                }
                else
                {
                    ___m_EyeAdaptation.model.settings = defaultEyeAdaptSettings;
                }

                if (enabled && settings.customMotionBlur)
                {
                    MotionBlurModel.Settings mSettings = new MotionBlurModel.Settings
                    {
                        shutterAngle  = settings.motionBlurShutterAngle,
                        sampleCount   = settings.motionBlurSampleCount,
                        frameBlending = settings.motionBlurFrameBlending
                    };

                    ___m_MotionBlur.model.settings = mSettings;
                }
                else
                {
                    ___m_MotionBlur.model.settings = defaultMotionBlurSettings;
                }

                if (enabled && settings.customDepthOfField)
                {
                    DepthOfFieldModel.Settings dSettings = new DepthOfFieldModel.Settings
                    {
                        focusDistance = settings.depthOfFieldFocusDistance,
                        aperture      = settings.depthOfFieldAperture,
                        focalLength   = settings.depthOfFieldFocalLength,
                        useCameraFov  = settings.depthOfFieldUseCameraFov,
                        kernelSize    = (DepthOfFieldModel.KernelSize)settings.depthOfFieldKernelSize,
                    };

                    ___m_DepthOfField.model.settings = dSettings;
                    ___m_DepthOfField.model.enabled  = true;
                }
                else
                {
                    ___m_DepthOfField.model.settings = defaultDepthOfFieldSettings;
                    ___m_DepthOfField.model.enabled  = false;
                }

                if (enabled && settings.customColorGrading)
                {
                    ColorGradingModel.TonemappingSettings ctSettings = new ColorGradingModel.TonemappingSettings
                    {
                        tonemapper        = (ColorGradingModel.Tonemapper)settings.colorGradingTonemapper,
                        neutralBlackIn    = settings.colorGradingNeutralBlackIn,
                        neutralWhiteIn    = settings.colorGradingNeutralWhiteIn,
                        neutralBlackOut   = settings.colorGradingNeutralBlackOut,
                        neutralWhiteOut   = settings.colorGradingNeutralWhiteOut,
                        neutralWhiteLevel = settings.colorGradingNeutralWhiteLevel,
                        neutralWhiteClip  = settings.colorGradingNeutralWhiteClip
                    };

                    ColorGradingModel.BasicSettings cbSettings = new ColorGradingModel.BasicSettings
                    {
                        postExposure = settings.colorGradingPostExposure,
                        temperature  = settings.colorGradingTemperature,
                        tint         = settings.colorGradingTint,
                        hueShift     = settings.colorGradingHueShift,
                        saturation   = settings.colorGradingSaturation,
                        contrast     = settings.colorGradingContrast
                    };

                    ColorGradingModel.Settings cSettings = new ColorGradingModel.Settings
                    {
                        tonemapping  = ctSettings,
                        basic        = cbSettings,
                        channelMixer = ___m_ColorGrading.model.settings.channelMixer,
                        colorWheels  = ___m_ColorGrading.model.settings.colorWheels,
                        curves       = ___m_ColorGrading.model.settings.curves
                    };

                    ___m_ColorGrading.model.settings = cSettings;
                }
                else
                {
                    ___m_ColorGrading.model.settings = defaultColorGradingSettings;
                }

                if (enabled && settings.customAO)
                {
                    AmbientOcclusionModel.Settings aSettings = new AmbientOcclusionModel.Settings
                    {
                        intensity    = settings.AOIntensity,
                        radius       = settings.AORadius,
                        sampleCount  = (AmbientOcclusionModel.SampleCount)sampleCounts.Values.ToArray()[settings.AOSampleCount],
                        downsampling = settings.AODownsampling,
                        forceForwardCompatibility = settings.AOForceForwardCompatibility,
                        ambientOnly   = settings.AOAmbientOnly,
                        highPrecision = settings.AOHighPrecision
                    };

                    ___m_AmbientOcclusion.model.settings = aSettings;
                }
                else
                {
                    ___m_AmbientOcclusion.model.settings = defaultAOSettings;
                }

                /*
                 *
                 * if(!defaultAASet)
                 * {
                 *  defaultAATaaSettings = ___m_Taa.model.settings;
                 *  defaultAAFxaaSettings = ___m_Fxaa.model.settings;
                 *  defaultAASet = true;
                 * }
                 *
                 * if (enabled && settings.customAA)
                 * {
                 *  AntialiasingModel.FxaaSettings afSettings = new AntialiasingModel.FxaaSettings
                 *  {
                 *      preset = (AntialiasingModel.FxaaPreset) settings.AAFxaaPreset
                 *  };
                 *
                 *  AntialiasingModel.TaaSettings atSettings = new AntialiasingModel.TaaSettings
                 *  {
                 *      jitterSpread = settings.AAJitterSpread,
                 *      sharpen = settings.AASharpen,
                 *      stationaryBlending = settings.AAStationaryBlending,
                 *      motionBlending = settings.AAMotionBlending
                 *
                 *  };
                 *
                 *  AntialiasingModel.Settings aSettings = new AntialiasingModel.Settings
                 *  {
                 *      //method = settings.AAMethodTaa?AntialiasingModel.Method.Taa: AntialiasingModel.Method.Fxaa,
                 *      method = ___m_Taa.model.settings.method,
                 *      fxaaSettings = afSettings,
                 *      taaSettings = atSettings
                 *  };
                 *
                 *  AntialiasingModel.Settings aSettings2 = new AntialiasingModel.Settings
                 *  {
                 *      //method = settings.AAMethodTaa?AntialiasingModel.Method.Taa: AntialiasingModel.Method.Fxaa,
                 *      method = ___m_Fxaa.model.settings.method,
                 *      fxaaSettings = afSettings,
                 *      taaSettings = atSettings
                 *  };
                 *
                 *  ___m_Taa.model.settings = aSettings;
                 *  ___m_Fxaa.model.settings = aSettings2;
                 * }
                 * else
                 * {
                 *  ___m_Taa.model.settings = defaultAATaaSettings;
                 *  ___m_Fxaa.model.settings = defaultAAFxaaSettings;
                 * }
                 */
            }