void Start() { sunInitialIntensity = sun.intensity; PostProcessingBehaviour behaviour = Camera.main.GetComponent <PostProcessingBehaviour>(); m_profile = Instantiate(behaviour.profile); behaviour.profile = m_profile; colorGradingSettings = m_profile.colorGrading.settings; }
void Start() { profile = Camera.GetComponent <UnityEngine.PostProcessing.PostProcessingBehaviour>().profile; DOFModel = profile.depthOfField; CGModel = profile.colorGrading; DOFModel.enabled = false; CGModel.enabled = false; DOFsetting = DOFModel.settings; CGsetting = CGModel.settings; }
// Token: 0x06003AEF RID: 15087 RVA: 0x001C7EB0 File Offset: 0x001C62B0 private void GenerateLut() { ColorGradingModel.Settings settings = base.model.settings; if (!this.IsLogLutValid(base.model.bakedLut)) { GraphicsUtils.Destroy(base.model.bakedLut); base.model.bakedLut = new RenderTexture(1024, 32, 0, RenderTextureFormat.ARGBHalf) { name = "Color Grading Log LUT", hideFlags = HideFlags.DontSave, filterMode = FilterMode.Bilinear, wrapMode = TextureWrapMode.Clamp, anisoLevel = 0 }; } Material material = this.context.materialFactory.Get("Hidden/Post FX/Lut Generator"); material.SetVector(ColorGradingComponent.Uniforms._LutParams, new Vector4(32f, 0.00048828125f, 0.015625f, 1.032258f)); material.shaderKeywords = null; ColorGradingModel.TonemappingSettings tonemapping = settings.tonemapping; ColorGradingModel.Tonemapper tonemapper = tonemapping.tonemapper; if (tonemapper != ColorGradingModel.Tonemapper.Neutral) { if (tonemapper == ColorGradingModel.Tonemapper.ACES) { material.EnableKeyword("TONEMAPPING_FILMIC"); } } else { material.EnableKeyword("TONEMAPPING_NEUTRAL"); float num = tonemapping.neutralBlackIn * 20f + 1f; float num2 = tonemapping.neutralBlackOut * 10f + 1f; float num3 = tonemapping.neutralWhiteIn / 20f; float num4 = 1f - tonemapping.neutralWhiteOut / 20f; float t = num / num2; float t2 = num3 / num4; float y = Mathf.Max(0f, Mathf.LerpUnclamped(0.57f, 0.37f, t)); float z = Mathf.LerpUnclamped(0.01f, 0.24f, t2); float w = Mathf.Max(0f, Mathf.LerpUnclamped(0.02f, 0.2f, t)); material.SetVector(ColorGradingComponent.Uniforms._NeutralTonemapperParams1, new Vector4(0.2f, y, z, w)); material.SetVector(ColorGradingComponent.Uniforms._NeutralTonemapperParams2, new Vector4(0.02f, 0.3f, tonemapping.neutralWhiteLevel, tonemapping.neutralWhiteClip / 10f)); } material.SetFloat(ColorGradingComponent.Uniforms._HueShift, settings.basic.hueShift / 360f); material.SetFloat(ColorGradingComponent.Uniforms._Saturation, settings.basic.saturation); material.SetFloat(ColorGradingComponent.Uniforms._Contrast, settings.basic.contrast); material.SetVector(ColorGradingComponent.Uniforms._Balance, this.CalculateColorBalance(settings.basic.temperature, settings.basic.tint)); Vector3 v; Vector3 v2; Vector3 v3; ColorGradingComponent.CalculateLiftGammaGain(settings.colorWheels.linear.lift, settings.colorWheels.linear.gamma, settings.colorWheels.linear.gain, out v, out v2, out v3); material.SetVector(ColorGradingComponent.Uniforms._Lift, v); material.SetVector(ColorGradingComponent.Uniforms._InvGamma, v2); material.SetVector(ColorGradingComponent.Uniforms._Gain, v3); Vector3 v4; Vector3 v5; Vector3 v6; ColorGradingComponent.CalculateSlopePowerOffset(settings.colorWheels.log.slope, settings.colorWheels.log.power, settings.colorWheels.log.offset, out v4, out v5, out v6); material.SetVector(ColorGradingComponent.Uniforms._Slope, v4); material.SetVector(ColorGradingComponent.Uniforms._Power, v5); material.SetVector(ColorGradingComponent.Uniforms._Offset, v6); material.SetVector(ColorGradingComponent.Uniforms._ChannelMixerRed, settings.channelMixer.red); material.SetVector(ColorGradingComponent.Uniforms._ChannelMixerGreen, settings.channelMixer.green); material.SetVector(ColorGradingComponent.Uniforms._ChannelMixerBlue, settings.channelMixer.blue); material.SetTexture(ColorGradingComponent.Uniforms._Curves, this.GetCurveTexture()); Graphics.Blit(null, base.model.bakedLut, material, 0); }