Files
2026-06-04 11:42:34 +02:00

1198 lines
35 KiB
C#

using System;
using UnityEngine;
namespace UnityStandardAssets.CinematicEffects
{
// Token: 0x02000039 RID: 57
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Cinematic/Tonemapping and Color Grading")]
[ImageEffectAllowedInSceneView]
public class TonemappingColorGrading : MonoBehaviour
{
// Token: 0x1700003B RID: 59
// (get) Token: 0x06000092 RID: 146 RVA: 0x00005D61 File Offset: 0x00004161
// (set) Token: 0x06000093 RID: 147 RVA: 0x00005D69 File Offset: 0x00004169
public TonemappingColorGrading.EyeAdaptationSettings eyeAdaptation
{
get
{
return this.m_EyeAdaptation;
}
set
{
this.m_EyeAdaptation = value;
}
}
// Token: 0x1700003C RID: 60
// (get) Token: 0x06000094 RID: 148 RVA: 0x00005D72 File Offset: 0x00004172
// (set) Token: 0x06000095 RID: 149 RVA: 0x00005D7A File Offset: 0x0000417A
public TonemappingColorGrading.TonemappingSettings tonemapping
{
get
{
return this.m_Tonemapping;
}
set
{
this.m_Tonemapping = value;
this.SetTonemapperDirty();
}
}
// Token: 0x1700003D RID: 61
// (get) Token: 0x06000096 RID: 150 RVA: 0x00005D89 File Offset: 0x00004189
// (set) Token: 0x06000097 RID: 151 RVA: 0x00005D91 File Offset: 0x00004191
public TonemappingColorGrading.LUTSettings lut
{
get
{
return this.m_Lut;
}
set
{
this.m_Lut = value;
this.SetDirty();
}
}
// Token: 0x1700003E RID: 62
// (get) Token: 0x06000098 RID: 152 RVA: 0x00005DA0 File Offset: 0x000041A0
// (set) Token: 0x06000099 RID: 153 RVA: 0x00005DA8 File Offset: 0x000041A8
public TonemappingColorGrading.ColorGradingSettings colorGrading
{
get
{
return this.m_ColorGrading;
}
set
{
this.m_ColorGrading = value;
this.SetDirty();
}
}
// Token: 0x1700003F RID: 63
// (get) Token: 0x0600009A RID: 154 RVA: 0x00005DB8 File Offset: 0x000041B8
private Texture2D identityLut
{
get
{
if (this.m_IdentityLut == null || this.m_IdentityLut.height != this.lutSize)
{
global::UnityEngine.Object.DestroyImmediate(this.m_IdentityLut);
this.m_IdentityLut = TonemappingColorGrading.GenerateIdentityLut(this.lutSize);
}
return this.m_IdentityLut;
}
}
// Token: 0x17000040 RID: 64
// (get) Token: 0x0600009B RID: 155 RVA: 0x00005E10 File Offset: 0x00004210
private RenderTexture internalLutRt
{
get
{
if (this.m_InternalLut == null || !this.m_InternalLut.IsCreated() || this.m_InternalLut.height != this.lutSize)
{
global::UnityEngine.Object.DestroyImmediate(this.m_InternalLut);
this.m_InternalLut = new RenderTexture(this.lutSize * this.lutSize, this.lutSize, 0, RenderTextureFormat.ARGB32)
{
name = "Internal LUT",
filterMode = FilterMode.Bilinear,
anisoLevel = 0,
hideFlags = HideFlags.DontSave
};
}
return this.m_InternalLut;
}
}
// Token: 0x17000041 RID: 65
// (get) Token: 0x0600009C RID: 156 RVA: 0x00005EA8 File Offset: 0x000042A8
private Texture2D curveTexture
{
get
{
if (this.m_CurveTexture == null)
{
this.m_CurveTexture = new Texture2D(256, 1, TextureFormat.ARGB32, false, true)
{
name = "Curve texture",
wrapMode = TextureWrapMode.Clamp,
filterMode = FilterMode.Bilinear,
anisoLevel = 0,
hideFlags = HideFlags.DontSave
};
}
return this.m_CurveTexture;
}
}
// Token: 0x17000042 RID: 66
// (get) Token: 0x0600009D RID: 157 RVA: 0x00005F0C File Offset: 0x0000430C
private Texture2D tonemapperCurve
{
get
{
if (this.m_TonemapperCurve == null)
{
TextureFormat textureFormat = TextureFormat.RGB24;
if (SystemInfo.SupportsTextureFormat(TextureFormat.RFloat))
{
textureFormat = TextureFormat.RFloat;
}
else if (SystemInfo.SupportsTextureFormat(TextureFormat.RHalf))
{
textureFormat = TextureFormat.RHalf;
}
this.m_TonemapperCurve = new Texture2D(256, 1, textureFormat, false, true)
{
name = "Tonemapper curve texture",
wrapMode = TextureWrapMode.Clamp,
filterMode = FilterMode.Bilinear,
anisoLevel = 0,
hideFlags = HideFlags.DontSave
};
}
return this.m_TonemapperCurve;
}
}
// Token: 0x17000043 RID: 67
// (get) Token: 0x0600009E RID: 158 RVA: 0x00005F93 File Offset: 0x00004393
public Shader shader
{
get
{
if (this.m_Shader == null)
{
this.m_Shader = Shader.Find("Hidden/TonemappingColorGrading");
}
return this.m_Shader;
}
}
// Token: 0x17000044 RID: 68
// (get) Token: 0x0600009F RID: 159 RVA: 0x00005FBC File Offset: 0x000043BC
public Material material
{
get
{
if (this.m_Material == null)
{
this.m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(this.shader);
}
return this.m_Material;
}
}
// Token: 0x17000045 RID: 69
// (get) Token: 0x060000A0 RID: 160 RVA: 0x00005FE6 File Offset: 0x000043E6
public bool isGammaColorSpace
{
get
{
return QualitySettings.activeColorSpace == ColorSpace.Gamma;
}
}
// Token: 0x17000046 RID: 70
// (get) Token: 0x060000A1 RID: 161 RVA: 0x00005FF0 File Offset: 0x000043F0
public int lutSize
{
get
{
return (int)this.colorGrading.precision;
}
}
// Token: 0x17000047 RID: 71
// (get) Token: 0x060000A2 RID: 162 RVA: 0x0000600B File Offset: 0x0000440B
// (set) Token: 0x060000A3 RID: 163 RVA: 0x00006013 File Offset: 0x00004413
public bool validRenderTextureFormat { get; private set; }
// Token: 0x17000048 RID: 72
// (get) Token: 0x060000A4 RID: 164 RVA: 0x0000601C File Offset: 0x0000441C
// (set) Token: 0x060000A5 RID: 165 RVA: 0x00006024 File Offset: 0x00004424
public bool validUserLutSize { get; private set; }
// Token: 0x060000A6 RID: 166 RVA: 0x0000602D File Offset: 0x0000442D
public void SetDirty()
{
this.m_Dirty = true;
}
// Token: 0x060000A7 RID: 167 RVA: 0x00006036 File Offset: 0x00004436
public void SetTonemapperDirty()
{
this.m_TonemapperDirty = true;
}
// Token: 0x060000A8 RID: 168 RVA: 0x0000603F File Offset: 0x0000443F
private void OnEnable()
{
if (!ImageEffectHelper.IsSupported(this.shader, false, true, this))
{
base.enabled = false;
return;
}
this.SetDirty();
this.SetTonemapperDirty();
}
// Token: 0x060000A9 RID: 169 RVA: 0x00006068 File Offset: 0x00004468
private void OnDisable()
{
if (this.m_Material != null)
{
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
}
if (this.m_IdentityLut != null)
{
global::UnityEngine.Object.DestroyImmediate(this.m_IdentityLut);
}
if (this.m_InternalLut != null)
{
global::UnityEngine.Object.DestroyImmediate(this.internalLutRt);
}
if (this.m_SmallAdaptiveRt != null)
{
global::UnityEngine.Object.DestroyImmediate(this.m_SmallAdaptiveRt);
}
if (this.m_CurveTexture != null)
{
global::UnityEngine.Object.DestroyImmediate(this.m_CurveTexture);
}
if (this.m_TonemapperCurve != null)
{
global::UnityEngine.Object.DestroyImmediate(this.m_TonemapperCurve);
}
this.m_Material = null;
this.m_IdentityLut = null;
this.m_InternalLut = null;
this.m_SmallAdaptiveRt = null;
this.m_CurveTexture = null;
this.m_TonemapperCurve = null;
}
// Token: 0x060000AA RID: 170 RVA: 0x00006147 File Offset: 0x00004547
private void OnValidate()
{
this.SetDirty();
this.SetTonemapperDirty();
}
// Token: 0x060000AB RID: 171 RVA: 0x00006158 File Offset: 0x00004558
private static Texture2D GenerateIdentityLut(int dim)
{
Color[] array = new Color[dim * dim * dim];
float num = 1f / ((float)dim - 1f);
for (int i = 0; i < dim; i++)
{
for (int j = 0; j < dim; j++)
{
for (int k = 0; k < dim; k++)
{
array[i + j * dim + k * dim * dim] = new Color((float)i * num, Mathf.Abs((float)k * num), (float)j * num, 1f);
}
}
}
Texture2D texture2D = new Texture2D(dim * dim, dim, TextureFormat.RGB24, false, true)
{
name = "Identity LUT",
filterMode = FilterMode.Bilinear,
anisoLevel = 0,
hideFlags = HideFlags.DontSave
};
texture2D.SetPixels(array);
texture2D.Apply();
return texture2D;
}
// Token: 0x060000AC RID: 172 RVA: 0x00006234 File Offset: 0x00004634
private float StandardIlluminantY(float x)
{
return 2.87f * x - 3f * x * x - 0.27509508f;
}
// Token: 0x060000AD RID: 173 RVA: 0x00006250 File Offset: 0x00004650
private Vector3 CIExyToLMS(float x, float y)
{
float num = 1f;
float num2 = num * x / y;
float num3 = num * (1f - x - y) / y;
float num4 = 0.7328f * num2 + 0.4296f * num - 0.1624f * num3;
float num5 = -0.7036f * num2 + 1.6975f * num + 0.0061f * num3;
float num6 = 0.003f * num2 + 0.0136f * num + 0.9834f * num3;
return new Vector3(num4, num5, num6);
}
// Token: 0x060000AE RID: 174 RVA: 0x000062CC File Offset: 0x000046CC
private Vector3 GetWhiteBalance()
{
float temperatureShift = this.colorGrading.basics.temperatureShift;
float tint = this.colorGrading.basics.tint;
float num = 0.31271f - temperatureShift * ((temperatureShift >= 0f) ? 0.05f : 0.1f);
float num2 = this.StandardIlluminantY(num) + tint * 0.05f;
Vector3 vector = new Vector3(0.949237f, 1.03542f, 1.08728f);
Vector3 vector2 = this.CIExyToLMS(num, num2);
return new Vector3(vector.x / vector2.x, vector.y / vector2.y, vector.z / vector2.z);
}
// Token: 0x060000AF RID: 175 RVA: 0x0000638C File Offset: 0x0000478C
private static Color NormalizeColor(Color c)
{
float num = (c.r + c.g + c.b) / 3f;
if (Mathf.Approximately(num, 0f))
{
return new Color(1f, 1f, 1f, 1f);
}
return new Color
{
r = c.r / num,
g = c.g / num,
b = c.b / num,
a = 1f
};
}
// Token: 0x060000B0 RID: 176 RVA: 0x00006428 File Offset: 0x00004828
private void GenerateLiftGammaGain(out Color lift, out Color gamma, out Color gain)
{
Color color = TonemappingColorGrading.NormalizeColor(this.colorGrading.colorWheels.shadows);
Color color2 = TonemappingColorGrading.NormalizeColor(this.colorGrading.colorWheels.midtones);
Color color3 = TonemappingColorGrading.NormalizeColor(this.colorGrading.colorWheels.highlights);
float num = (color.r + color.g + color.b) / 3f;
float num2 = (color2.r + color2.g + color2.b) / 3f;
float num3 = (color3.r + color3.g + color3.b) / 3f;
float num4 = (color.r - num) * 0.1f;
float num5 = (color.g - num) * 0.1f;
float num6 = (color.b - num) * 0.1f;
float num7 = Mathf.Pow(2f, (color2.r - num2) * 0.5f);
float num8 = Mathf.Pow(2f, (color2.g - num2) * 0.5f);
float num9 = Mathf.Pow(2f, (color2.b - num2) * 0.5f);
float num10 = Mathf.Pow(2f, (color3.r - num3) * 0.5f);
float num11 = Mathf.Pow(2f, (color3.g - num3) * 0.5f);
float num12 = Mathf.Pow(2f, (color3.b - num3) * 0.5f);
float num13 = 1f / Mathf.Max(0.01f, num7);
float num14 = 1f / Mathf.Max(0.01f, num8);
float num15 = 1f / Mathf.Max(0.01f, num9);
lift = new Color(num4, num5, num6);
gamma = new Color(num13, num14, num15);
gain = new Color(num10, num11, num12);
}
// Token: 0x060000B1 RID: 177 RVA: 0x00006620 File Offset: 0x00004A20
private void GenCurveTexture()
{
AnimationCurve master = this.colorGrading.curves.master;
AnimationCurve red = this.colorGrading.curves.red;
AnimationCurve green = this.colorGrading.curves.green;
AnimationCurve blue = this.colorGrading.curves.blue;
Color[] array = new Color[256];
for (float num = 0f; num <= 1f; num += 0.003921569f)
{
float num2 = Mathf.Clamp(master.Evaluate(num), 0f, 1f);
float num3 = Mathf.Clamp(red.Evaluate(num), 0f, 1f);
float num4 = Mathf.Clamp(green.Evaluate(num), 0f, 1f);
float num5 = Mathf.Clamp(blue.Evaluate(num), 0f, 1f);
array[(int)Mathf.Floor(num * 255f)] = new Color(num3, num4, num5, num2);
}
this.curveTexture.SetPixels(array);
this.curveTexture.Apply();
}
// Token: 0x060000B2 RID: 178 RVA: 0x00006754 File Offset: 0x00004B54
private bool CheckUserLut()
{
this.validUserLutSize = this.IsLutSizeValid(this.lut.texture);
return this.validUserLutSize;
}
// Token: 0x060000B3 RID: 179 RVA: 0x00006781 File Offset: 0x00004B81
private bool IsLutSizeValid(Texture texture)
{
return texture.height == (int)Mathf.Sqrt((float)texture.width);
}
// Token: 0x060000B4 RID: 180 RVA: 0x00006798 File Offset: 0x00004B98
private bool CheckSmallAdaptiveRt()
{
if (this.m_SmallAdaptiveRt != null)
{
return false;
}
this.m_AdaptiveRtFormat = RenderTextureFormat.ARGBHalf;
if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf))
{
this.m_AdaptiveRtFormat = RenderTextureFormat.RGHalf;
}
this.m_SmallAdaptiveRt = new RenderTexture(1, 1, 0, this.m_AdaptiveRtFormat);
this.m_SmallAdaptiveRt.hideFlags = HideFlags.DontSave;
return true;
}
// Token: 0x060000B5 RID: 181 RVA: 0x000067F8 File Offset: 0x00004BF8
[ImageEffectTransformsToLDR]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
this.material.shaderKeywords = null;
Texture texture = null;
float num = 1f;
RenderTexture renderTexture = null;
RenderTexture[] array = null;
if (this.eyeAdaptation.enabled)
{
bool flag = this.CheckSmallAdaptiveRt();
int num2 = ((source.width >= source.height) ? source.height : source.width);
int num3 = num2;
num3 |= num3 >> 1;
num3 |= num3 >> 2;
num3 |= num3 >> 4;
num3 |= num3 >> 8;
num3 |= num3 >> 16;
num3 -= num3 >> 1;
renderTexture = RenderTexture.GetTemporary(num3, num3, 0, this.m_AdaptiveRtFormat);
Graphics.Blit(source, renderTexture);
int num4 = (int)Mathf.Log((float)renderTexture.width, 2f);
int num5 = 2;
array = new RenderTexture[num4];
for (int i = 0; i < num4; i++)
{
array[i] = RenderTexture.GetTemporary(renderTexture.width / num5, renderTexture.width / num5, 0, this.m_AdaptiveRtFormat);
num5 <<= 1;
}
RenderTexture renderTexture2 = array[num4 - 1];
Graphics.Blit(renderTexture, array[0], this.material, 1);
for (int j = 0; j < num4 - 1; j++)
{
Graphics.Blit(array[j], array[j + 1]);
renderTexture2 = array[j + 1];
}
this.m_SmallAdaptiveRt.MarkRestoreExpected();
this.material.SetFloat("_AdaptationSpeed", Mathf.Max(this.eyeAdaptation.speed, 0.001f));
Graphics.Blit(renderTexture2, this.m_SmallAdaptiveRt, this.material, (!flag) ? 2 : 3);
this.material.SetFloat("_MiddleGrey", this.eyeAdaptation.middleGrey);
this.material.SetFloat("_AdaptationMin", Mathf.Pow(2f, this.eyeAdaptation.min));
this.material.SetFloat("_AdaptationMax", Mathf.Pow(2f, this.eyeAdaptation.max));
this.material.SetTexture("_LumTex", this.m_SmallAdaptiveRt);
this.material.EnableKeyword("ENABLE_EYE_ADAPTATION");
}
int num6 = 4;
if (this.tonemapping.enabled)
{
if (this.tonemapping.tonemapper == TonemappingColorGrading.Tonemapper.Curve)
{
if (this.m_TonemapperDirty)
{
float num7 = 1f;
if (this.tonemapping.curve.length > 0)
{
num7 = this.tonemapping.curve[this.tonemapping.curve.length - 1].time;
for (float num8 = 0f; num8 <= 1f; num8 += 0.003921569f)
{
float num9 = this.tonemapping.curve.Evaluate(num8 * num7);
this.tonemapperCurve.SetPixel(Mathf.FloorToInt(num8 * 255f), 0, new Color(num9, num9, num9));
}
this.tonemapperCurve.Apply();
}
this.m_TonemapperCurveRange = 1f / num7;
this.m_TonemapperDirty = false;
}
this.material.SetFloat("_ToneCurveRange", this.m_TonemapperCurveRange);
this.material.SetTexture("_ToneCurve", this.tonemapperCurve);
}
else if (this.tonemapping.tonemapper == TonemappingColorGrading.Tonemapper.Neutral)
{
float num10 = this.tonemapping.neutralBlackIn * 20f + 1f;
float num11 = this.tonemapping.neutralBlackOut * 10f + 1f;
float num12 = this.tonemapping.neutralWhiteIn / 20f;
float num13 = 1f - this.tonemapping.neutralWhiteOut / 20f;
float num14 = num10 / num11;
float num15 = num12 / num13;
float num16 = Mathf.Max(0f, Mathf.LerpUnclamped(0.57f, 0.37f, num14));
float num17 = Mathf.LerpUnclamped(0.01f, 0.24f, num15);
float num18 = Mathf.Max(0f, Mathf.LerpUnclamped(0.02f, 0.2f, num14));
this.material.SetVector("_NeutralTonemapperParams1", new Vector4(0.2f, num16, num17, num18));
this.material.SetVector("_NeutralTonemapperParams2", new Vector4(0.02f, 0.3f, this.tonemapping.neutralWhiteLevel, this.tonemapping.neutralWhiteClip / 10f));
}
this.material.SetFloat("_Exposure", this.tonemapping.exposure);
num6 = (int)(num6 + (this.tonemapping.tonemapper + 1));
}
if (this.lut.enabled)
{
Texture texture2 = this.lut.texture;
if (this.lut.texture == null || !this.CheckUserLut())
{
texture2 = this.identityLut;
}
texture = texture2;
num = this.lut.contribution;
this.material.EnableKeyword("ENABLE_COLOR_GRADING");
}
if (this.colorGrading.enabled)
{
if (this.m_Dirty || !this.m_InternalLut.IsCreated())
{
if (texture == null)
{
this.material.SetVector("_UserLutParams", new Vector4(1f / (float)this.identityLut.width, 1f / (float)this.identityLut.height, (float)this.identityLut.height - 1f, 1f));
this.material.SetTexture("_UserLutTex", this.identityLut);
}
else
{
this.material.SetVector("_UserLutParams", new Vector4(1f / (float)texture.width, 1f / (float)texture.height, (float)texture.height - 1f, this.lut.contribution));
this.material.SetTexture("_UserLutTex", texture);
}
Color color;
Color color2;
Color color3;
this.GenerateLiftGammaGain(out color, out color2, out color3);
this.GenCurveTexture();
this.material.SetVector("_WhiteBalance", this.GetWhiteBalance());
this.material.SetVector("_Lift", color);
this.material.SetVector("_Gamma", color2);
this.material.SetVector("_Gain", color3);
this.material.SetVector("_ContrastGainGamma", new Vector3(this.colorGrading.basics.contrast, this.colorGrading.basics.gain, 1f / this.colorGrading.basics.gamma));
this.material.SetFloat("_Vibrance", this.colorGrading.basics.vibrance);
this.material.SetVector("_HSV", new Vector4(this.colorGrading.basics.hue, this.colorGrading.basics.saturation, this.colorGrading.basics.value));
this.material.SetVector("_ChannelMixerRed", this.colorGrading.channelMixer.channels[0]);
this.material.SetVector("_ChannelMixerGreen", this.colorGrading.channelMixer.channels[1]);
this.material.SetVector("_ChannelMixerBlue", this.colorGrading.channelMixer.channels[2]);
this.material.SetTexture("_CurveTex", this.curveTexture);
this.internalLutRt.MarkRestoreExpected();
Graphics.Blit(this.identityLut, this.internalLutRt, this.material, 0);
this.m_Dirty = false;
}
texture = this.internalLutRt;
num = 1f;
this.material.EnableKeyword("ENABLE_COLOR_GRADING");
if (this.colorGrading.useDithering)
{
this.material.EnableKeyword("ENABLE_DITHERING");
}
}
if (texture != null)
{
this.material.SetTexture("_LutTex", texture);
this.material.SetVector("_LutParams", new Vector4(1f / (float)texture.width, 1f / (float)texture.height, (float)texture.height - 1f, num));
}
if (this.LutOverrideTexture != null)
{
if (this.IsLutSizeValid(this.LutOverrideTexture))
{
this.material.SetTexture("_OverrideLutTex", this.LutOverrideTexture);
this.material.SetVector("_OverrideLutParams", new Vector4(1f / (float)this.LutOverrideTexture.width, 1f / (float)this.LutOverrideTexture.height, (float)this.LutOverrideTexture.height - 1f, this.LutOverrideAmount));
}
else
{
Debug.LogWarningFormat("Override texture {0} has invalid size to be used as LUT.", new object[] { this.LutOverrideTexture.name });
}
}
this.material.SetFloat("_MonochromeAmount", this.MonochromeAmount);
Graphics.Blit(source, destination, this.material, num6);
if (this.eyeAdaptation.enabled)
{
for (int k = 0; k < array.Length; k++)
{
RenderTexture.ReleaseTemporary(array[k]);
}
RenderTexture.ReleaseTemporary(renderTexture);
}
}
// Token: 0x060000B6 RID: 182 RVA: 0x00007234 File Offset: 0x00005634
public Texture2D BakeLUT()
{
Texture2D texture2D = new Texture2D(this.internalLutRt.width, this.internalLutRt.height, TextureFormat.RGB24, false, true);
RenderTexture.active = this.internalLutRt;
texture2D.ReadPixels(new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), 0, 0);
RenderTexture.active = null;
return texture2D;
}
// Token: 0x040000FE RID: 254
[SerializeField]
[TonemappingColorGrading.SettingsGroup]
private TonemappingColorGrading.EyeAdaptationSettings m_EyeAdaptation = TonemappingColorGrading.EyeAdaptationSettings.defaultSettings;
// Token: 0x040000FF RID: 255
[SerializeField]
[TonemappingColorGrading.SettingsGroup]
private TonemappingColorGrading.TonemappingSettings m_Tonemapping = TonemappingColorGrading.TonemappingSettings.defaultSettings;
// Token: 0x04000100 RID: 256
[SerializeField]
[TonemappingColorGrading.SettingsGroup]
private TonemappingColorGrading.LUTSettings m_Lut = TonemappingColorGrading.LUTSettings.defaultSettings;
// Token: 0x04000101 RID: 257
[SerializeField]
[TonemappingColorGrading.SettingsGroup]
private TonemappingColorGrading.ColorGradingSettings m_ColorGrading = TonemappingColorGrading.ColorGradingSettings.defaultSettings;
// Token: 0x04000102 RID: 258
[NonSerialized]
public float MonochromeAmount;
// Token: 0x04000103 RID: 259
[NonSerialized]
public Texture LutOverrideTexture;
// Token: 0x04000104 RID: 260
[NonSerialized]
public float LutOverrideAmount;
// Token: 0x04000105 RID: 261
private Texture2D m_IdentityLut;
// Token: 0x04000106 RID: 262
private RenderTexture m_InternalLut;
// Token: 0x04000107 RID: 263
private Texture2D m_CurveTexture;
// Token: 0x04000108 RID: 264
private Texture2D m_TonemapperCurve;
// Token: 0x04000109 RID: 265
private float m_TonemapperCurveRange;
// Token: 0x0400010A RID: 266
[SerializeField]
private Shader m_Shader;
// Token: 0x0400010B RID: 267
private Material m_Material;
// Token: 0x0400010E RID: 270
private bool m_Dirty = true;
// Token: 0x0400010F RID: 271
private bool m_TonemapperDirty = true;
// Token: 0x04000110 RID: 272
private RenderTexture m_SmallAdaptiveRt;
// Token: 0x04000111 RID: 273
private RenderTextureFormat m_AdaptiveRtFormat;
// Token: 0x0200003A RID: 58
[AttributeUsage(AttributeTargets.Field)]
public class SettingsGroup : Attribute
{
}
// Token: 0x0200003B RID: 59
public class IndentedGroup : PropertyAttribute
{
}
// Token: 0x0200003C RID: 60
public class ChannelMixer : PropertyAttribute
{
}
// Token: 0x0200003D RID: 61
public class ColorWheelGroup : PropertyAttribute
{
// Token: 0x060000BA RID: 186 RVA: 0x000072AF File Offset: 0x000056AF
public ColorWheelGroup()
{
}
// Token: 0x060000BB RID: 187 RVA: 0x000072CA File Offset: 0x000056CA
public ColorWheelGroup(int minSizePerWheel, int maxSizePerWheel)
{
this.minSizePerWheel = minSizePerWheel;
this.maxSizePerWheel = maxSizePerWheel;
}
// Token: 0x04000112 RID: 274
public int minSizePerWheel = 60;
// Token: 0x04000113 RID: 275
public int maxSizePerWheel = 150;
}
// Token: 0x0200003E RID: 62
public class Curve : PropertyAttribute
{
// Token: 0x060000BC RID: 188 RVA: 0x000072F3 File Offset: 0x000056F3
public Curve()
{
}
// Token: 0x060000BD RID: 189 RVA: 0x00007306 File Offset: 0x00005706
public Curve(float r, float g, float b, float a)
{
this.color = new Color(r, g, b, a);
}
// Token: 0x04000114 RID: 276
public Color color = Color.white;
}
// Token: 0x0200003F RID: 63
[Serializable]
public struct EyeAdaptationSettings
{
// Token: 0x17000049 RID: 73
// (get) Token: 0x060000BE RID: 190 RVA: 0x0000732C File Offset: 0x0000572C
public static TonemappingColorGrading.EyeAdaptationSettings defaultSettings
{
get
{
return new TonemappingColorGrading.EyeAdaptationSettings
{
enabled = false,
showDebug = false,
middleGrey = 0.5f,
min = -3f,
max = 3f,
speed = 1.5f
};
}
}
// Token: 0x04000115 RID: 277
public bool enabled;
// Token: 0x04000116 RID: 278
[Min(0f)]
[Tooltip("Midpoint Adjustment.")]
public float middleGrey;
// Token: 0x04000117 RID: 279
[Tooltip("The lowest possible exposure value; adjust this value to modify the brightest areas of your level.")]
public float min;
// Token: 0x04000118 RID: 280
[Tooltip("The highest possible exposure value; adjust this value to modify the darkest areas of your level.")]
public float max;
// Token: 0x04000119 RID: 281
[Min(0f)]
[Tooltip("Speed of linear adaptation. Higher is faster.")]
public float speed;
// Token: 0x0400011A RID: 282
[Tooltip("Displays a luminosity helper in the GameView.")]
public bool showDebug;
}
// Token: 0x02000040 RID: 64
public enum Tonemapper
{
// Token: 0x0400011C RID: 284
ACES,
// Token: 0x0400011D RID: 285
Curve,
// Token: 0x0400011E RID: 286
Hable,
// Token: 0x0400011F RID: 287
HejlDawson,
// Token: 0x04000120 RID: 288
Photographic,
// Token: 0x04000121 RID: 289
Reinhard,
// Token: 0x04000122 RID: 290
Neutral
}
// Token: 0x02000041 RID: 65
[Serializable]
public struct TonemappingSettings
{
// Token: 0x1700004A RID: 74
// (get) Token: 0x060000BF RID: 191 RVA: 0x00007384 File Offset: 0x00005784
public static TonemappingColorGrading.TonemappingSettings defaultSettings
{
get
{
return new TonemappingColorGrading.TonemappingSettings
{
enabled = false,
tonemapper = TonemappingColorGrading.Tonemapper.Neutral,
exposure = 1f,
curve = TonemappingColorGrading.CurvesSettings.defaultCurve,
neutralBlackIn = 0.02f,
neutralWhiteIn = 10f,
neutralBlackOut = 0f,
neutralWhiteOut = 10f,
neutralWhiteLevel = 5.3f,
neutralWhiteClip = 10f
};
}
}
// Token: 0x04000123 RID: 291
public bool enabled;
// Token: 0x04000124 RID: 292
[Tooltip("Tonemapping technique to use. ACES is the recommended one.")]
public TonemappingColorGrading.Tonemapper tonemapper;
// Token: 0x04000125 RID: 293
[Min(0f)]
[Tooltip("Adjusts the overall exposure of the scene.")]
public float exposure;
// Token: 0x04000126 RID: 294
[Tooltip("Custom tonemapping curve.")]
public AnimationCurve curve;
// Token: 0x04000127 RID: 295
[Range(-0.1f, 0.1f)]
public float neutralBlackIn;
// Token: 0x04000128 RID: 296
[Range(1f, 20f)]
public float neutralWhiteIn;
// Token: 0x04000129 RID: 297
[Range(-0.09f, 0.1f)]
public float neutralBlackOut;
// Token: 0x0400012A RID: 298
[Range(1f, 19f)]
public float neutralWhiteOut;
// Token: 0x0400012B RID: 299
[Range(0.1f, 20f)]
public float neutralWhiteLevel;
// Token: 0x0400012C RID: 300
[Range(1f, 10f)]
public float neutralWhiteClip;
}
// Token: 0x02000042 RID: 66
[Serializable]
public struct LUTSettings
{
// Token: 0x1700004B RID: 75
// (get) Token: 0x060000C0 RID: 192 RVA: 0x0000740C File Offset: 0x0000580C
public static TonemappingColorGrading.LUTSettings defaultSettings
{
get
{
return new TonemappingColorGrading.LUTSettings
{
enabled = false,
texture = null,
contribution = 1f
};
}
}
// Token: 0x0400012D RID: 301
public bool enabled;
// Token: 0x0400012E RID: 302
[Tooltip("Custom lookup texture (strip format, e.g. 256x16).")]
public Texture texture;
// Token: 0x0400012F RID: 303
[Range(0f, 1f)]
[Tooltip("Blending factor.")]
public float contribution;
}
// Token: 0x02000043 RID: 67
[Serializable]
public struct ColorWheelsSettings
{
// Token: 0x1700004C RID: 76
// (get) Token: 0x060000C1 RID: 193 RVA: 0x00007440 File Offset: 0x00005840
public static TonemappingColorGrading.ColorWheelsSettings defaultSettings
{
get
{
return new TonemappingColorGrading.ColorWheelsSettings
{
shadows = Color.white,
midtones = Color.white,
highlights = Color.white
};
}
}
// Token: 0x04000130 RID: 304
[ColorUsage(false)]
public Color shadows;
// Token: 0x04000131 RID: 305
[ColorUsage(false)]
public Color midtones;
// Token: 0x04000132 RID: 306
[ColorUsage(false)]
public Color highlights;
}
// Token: 0x02000044 RID: 68
[Serializable]
public struct BasicsSettings
{
// Token: 0x1700004D RID: 77
// (get) Token: 0x060000C2 RID: 194 RVA: 0x0000747C File Offset: 0x0000587C
public static TonemappingColorGrading.BasicsSettings defaultSettings
{
get
{
return new TonemappingColorGrading.BasicsSettings
{
temperatureShift = 0f,
tint = 0f,
contrast = 1f,
hue = 0f,
saturation = 1f,
value = 1f,
vibrance = 0f,
gain = 1f,
gamma = 1f
};
}
}
// Token: 0x04000133 RID: 307
[Range(-2f, 2f)]
[Tooltip("Sets the white balance to a custom color temperature.")]
public float temperatureShift;
// Token: 0x04000134 RID: 308
[Range(-2f, 2f)]
[Tooltip("Sets the white balance to compensate for a green or magenta tint.")]
public float tint;
// Token: 0x04000135 RID: 309
[Space]
[Range(-0.5f, 0.5f)]
[Tooltip("Shift the hue of all colors.")]
public float hue;
// Token: 0x04000136 RID: 310
[Range(0f, 2f)]
[Tooltip("Pushes the intensity of all colors.")]
public float saturation;
// Token: 0x04000137 RID: 311
[Range(-1f, 1f)]
[Tooltip("Adjusts the saturation so that clipping is minimized as colors approach full saturation.")]
public float vibrance;
// Token: 0x04000138 RID: 312
[Range(0f, 10f)]
[Tooltip("Brightens or darkens all colors.")]
public float value;
// Token: 0x04000139 RID: 313
[Space]
[Range(0f, 2f)]
[Tooltip("Expands or shrinks the overall range of tonal values.")]
public float contrast;
// Token: 0x0400013A RID: 314
[Range(0.01f, 5f)]
[Tooltip("Contrast gain curve. Controls the steepness of the curve.")]
public float gain;
// Token: 0x0400013B RID: 315
[Range(0.01f, 5f)]
[Tooltip("Applies a pow function to the source.")]
public float gamma;
}
// Token: 0x02000045 RID: 69
[Serializable]
public struct ChannelMixerSettings
{
// Token: 0x1700004E RID: 78
// (get) Token: 0x060000C3 RID: 195 RVA: 0x00007500 File Offset: 0x00005900
public static TonemappingColorGrading.ChannelMixerSettings defaultSettings
{
get
{
return new TonemappingColorGrading.ChannelMixerSettings
{
currentChannel = 0,
channels = new Vector3[]
{
new Vector3(1f, 0f, 0f),
new Vector3(0f, 1f, 0f),
new Vector3(0f, 0f, 1f)
}
};
}
}
// Token: 0x0400013C RID: 316
public int currentChannel;
// Token: 0x0400013D RID: 317
public Vector3[] channels;
}
// Token: 0x02000046 RID: 70
[Serializable]
public struct CurvesSettings
{
// Token: 0x1700004F RID: 79
// (get) Token: 0x060000C4 RID: 196 RVA: 0x0000758C File Offset: 0x0000598C
public static TonemappingColorGrading.CurvesSettings defaultSettings
{
get
{
return new TonemappingColorGrading.CurvesSettings
{
master = TonemappingColorGrading.CurvesSettings.defaultCurve,
red = TonemappingColorGrading.CurvesSettings.defaultCurve,
green = TonemappingColorGrading.CurvesSettings.defaultCurve,
blue = TonemappingColorGrading.CurvesSettings.defaultCurve
};
}
}
// Token: 0x17000050 RID: 80
// (get) Token: 0x060000C5 RID: 197 RVA: 0x000075D4 File Offset: 0x000059D4
public static AnimationCurve defaultCurve
{
get
{
return new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f, 1f, 1f),
new Keyframe(1f, 1f, 1f, 1f)
});
}
}
// Token: 0x0400013E RID: 318
[TonemappingColorGrading.Curve]
public AnimationCurve master;
// Token: 0x0400013F RID: 319
[TonemappingColorGrading.Curve(1f, 0f, 0f, 1f)]
public AnimationCurve red;
// Token: 0x04000140 RID: 320
[TonemappingColorGrading.Curve(0f, 1f, 0f, 1f)]
public AnimationCurve green;
// Token: 0x04000141 RID: 321
[TonemappingColorGrading.Curve(0f, 1f, 1f, 1f)]
public AnimationCurve blue;
}
// Token: 0x02000047 RID: 71
public enum ColorGradingPrecision
{
// Token: 0x04000143 RID: 323
Normal = 16,
// Token: 0x04000144 RID: 324
High = 32
}
// Token: 0x02000048 RID: 72
[Serializable]
public struct ColorGradingSettings
{
// Token: 0x17000051 RID: 81
// (get) Token: 0x060000C6 RID: 198 RVA: 0x00007638 File Offset: 0x00005A38
public static TonemappingColorGrading.ColorGradingSettings defaultSettings
{
get
{
return new TonemappingColorGrading.ColorGradingSettings
{
enabled = false,
useDithering = false,
showDebug = false,
precision = TonemappingColorGrading.ColorGradingPrecision.Normal,
colorWheels = TonemappingColorGrading.ColorWheelsSettings.defaultSettings,
basics = TonemappingColorGrading.BasicsSettings.defaultSettings,
channelMixer = TonemappingColorGrading.ChannelMixerSettings.defaultSettings,
curves = TonemappingColorGrading.CurvesSettings.defaultSettings
};
}
}
// Token: 0x060000C7 RID: 199 RVA: 0x0000769F File Offset: 0x00005A9F
internal void Reset()
{
this.curves = TonemappingColorGrading.CurvesSettings.defaultSettings;
}
// Token: 0x04000145 RID: 325
public bool enabled;
// Token: 0x04000146 RID: 326
[Tooltip("Internal LUT precision. \"Normal\" is 256x16, \"High\" is 1024x32. Prefer \"Normal\" on mobile devices.")]
public TonemappingColorGrading.ColorGradingPrecision precision;
// Token: 0x04000147 RID: 327
[Space]
[TonemappingColorGrading.ColorWheelGroup]
public TonemappingColorGrading.ColorWheelsSettings colorWheels;
// Token: 0x04000148 RID: 328
[Space]
[TonemappingColorGrading.IndentedGroup]
public TonemappingColorGrading.BasicsSettings basics;
// Token: 0x04000149 RID: 329
[Space]
[TonemappingColorGrading.ChannelMixer]
public TonemappingColorGrading.ChannelMixerSettings channelMixer;
// Token: 0x0400014A RID: 330
[Space]
[TonemappingColorGrading.IndentedGroup]
public TonemappingColorGrading.CurvesSettings curves;
// Token: 0x0400014B RID: 331
[Space]
[Tooltip("Use dithering to try and minimize color banding in dark areas.")]
public bool useDithering;
// Token: 0x0400014C RID: 332
[Tooltip("Displays the generated LUT in the top left corner of the GameView.")]
public bool showDebug;
}
// Token: 0x02000049 RID: 73
private enum Pass
{
// Token: 0x0400014E RID: 334
LutGen,
// Token: 0x0400014F RID: 335
AdaptationLog,
// Token: 0x04000150 RID: 336
AdaptationExpBlend,
// Token: 0x04000151 RID: 337
AdaptationExp,
// Token: 0x04000152 RID: 338
TonemappingOff,
// Token: 0x04000153 RID: 339
TonemappingACES,
// Token: 0x04000154 RID: 340
TonemappingCurve,
// Token: 0x04000155 RID: 341
TonemappingHable,
// Token: 0x04000156 RID: 342
TonemappingHejlDawson,
// Token: 0x04000157 RID: 343
TonemappingPhotographic,
// Token: 0x04000158 RID: 344
TonemappingReinhard,
// Token: 0x04000159 RID: 345
TonemappingNeutral,
// Token: 0x0400015A RID: 346
AdaptationDebug
}
}
}