scripts
This commit is contained in:
@@ -0,0 +1,514 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x02000015 RID: 21
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Image Effects/Cinematic/Ambient Occlusion")]
|
||||
[ImageEffectAllowedInSceneView]
|
||||
public class AmbientOcclusion : MonoBehaviour
|
||||
{
|
||||
// Token: 0x17000013 RID: 19
|
||||
// (get) Token: 0x06000036 RID: 54 RVA: 0x00002F05 File Offset: 0x00001305
|
||||
public bool isAmbientOnlySupported
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.targetCamera.allowHDR && this.occlusionSource == AmbientOcclusion.OcclusionSource.GBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000014 RID: 20
|
||||
// (get) Token: 0x06000037 RID: 55 RVA: 0x00002F23 File Offset: 0x00001323
|
||||
public bool isGBufferAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.targetCamera.actualRenderingPath == RenderingPath.DeferredShading;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000015 RID: 21
|
||||
// (get) Token: 0x06000038 RID: 56 RVA: 0x00002F33 File Offset: 0x00001333
|
||||
private float intensity
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.settings.intensity;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000016 RID: 22
|
||||
// (get) Token: 0x06000039 RID: 57 RVA: 0x00002F40 File Offset: 0x00001340
|
||||
private float radius
|
||||
{
|
||||
get
|
||||
{
|
||||
return Mathf.Max(this.settings.radius, 0.0001f);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000017 RID: 23
|
||||
// (get) Token: 0x0600003A RID: 58 RVA: 0x00002F57 File Offset: 0x00001357
|
||||
private AmbientOcclusion.SampleCount sampleCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.settings.sampleCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000018 RID: 24
|
||||
// (get) Token: 0x0600003B RID: 59 RVA: 0x00002F64 File Offset: 0x00001364
|
||||
private int sampleCountValue
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (this.settings.sampleCount)
|
||||
{
|
||||
case AmbientOcclusion.SampleCount.Lowest:
|
||||
return 3;
|
||||
case AmbientOcclusion.SampleCount.Low:
|
||||
return 6;
|
||||
case AmbientOcclusion.SampleCount.Medium:
|
||||
return 12;
|
||||
case AmbientOcclusion.SampleCount.High:
|
||||
return 20;
|
||||
default:
|
||||
return Mathf.Clamp(this.settings.sampleCountValue, 1, 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000019 RID: 25
|
||||
// (get) Token: 0x0600003C RID: 60 RVA: 0x00002FB8 File Offset: 0x000013B8
|
||||
private AmbientOcclusion.OcclusionSource occlusionSource
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.settings.occlusionSource == AmbientOcclusion.OcclusionSource.GBuffer && !this.isGBufferAvailable)
|
||||
{
|
||||
return AmbientOcclusion.OcclusionSource.DepthNormalsTexture;
|
||||
}
|
||||
return this.settings.occlusionSource;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001A RID: 26
|
||||
// (get) Token: 0x0600003D RID: 61 RVA: 0x00002FE3 File Offset: 0x000013E3
|
||||
private bool downsampling
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.settings.downsampling;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001B RID: 27
|
||||
// (get) Token: 0x0600003E RID: 62 RVA: 0x00002FF0 File Offset: 0x000013F0
|
||||
private bool ambientOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.settings.ambientOnly && this.isAmbientOnlySupported;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001C RID: 28
|
||||
// (get) Token: 0x0600003F RID: 63 RVA: 0x0000300B File Offset: 0x0000140B
|
||||
private Shader aoShader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._aoShader == null)
|
||||
{
|
||||
this._aoShader = Shader.Find("Hidden/Image Effects/Cinematic/AmbientOcclusion");
|
||||
}
|
||||
return this._aoShader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001D RID: 29
|
||||
// (get) Token: 0x06000040 RID: 64 RVA: 0x00003034 File Offset: 0x00001434
|
||||
private Material aoMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._aoMaterial == null)
|
||||
{
|
||||
this._aoMaterial = ImageEffectHelper.CheckShaderAndCreateMaterial(this.aoShader);
|
||||
}
|
||||
return this._aoMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001E RID: 30
|
||||
// (get) Token: 0x06000041 RID: 65 RVA: 0x0000305E File Offset: 0x0000145E
|
||||
private CommandBuffer aoCommands
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._aoCommands == null)
|
||||
{
|
||||
this._aoCommands = new CommandBuffer();
|
||||
this._aoCommands.name = "AmbientOcclusion";
|
||||
}
|
||||
return this._aoCommands;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700001F RID: 31
|
||||
// (get) Token: 0x06000042 RID: 66 RVA: 0x0000308C File Offset: 0x0000148C
|
||||
private Camera targetCamera
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.GetComponent<Camera>();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000020 RID: 32
|
||||
// (get) Token: 0x06000043 RID: 67 RVA: 0x00003094 File Offset: 0x00001494
|
||||
// (set) Token: 0x06000044 RID: 68 RVA: 0x0000309C File Offset: 0x0000149C
|
||||
private AmbientOcclusion.PropertyObserver propertyObserver { get; set; }
|
||||
|
||||
// Token: 0x17000021 RID: 33
|
||||
// (get) Token: 0x06000045 RID: 69 RVA: 0x000030A5 File Offset: 0x000014A5
|
||||
private Mesh quadMesh
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._quadMesh;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000046 RID: 70 RVA: 0x000030B0 File Offset: 0x000014B0
|
||||
private void BuildAOCommands()
|
||||
{
|
||||
CommandBuffer aoCommands = this.aoCommands;
|
||||
int pixelWidth = this.targetCamera.pixelWidth;
|
||||
int pixelHeight = this.targetCamera.pixelHeight;
|
||||
int num = ((!this.downsampling) ? 1 : 2);
|
||||
RenderTextureFormat renderTextureFormat = RenderTextureFormat.R8;
|
||||
RenderTextureReadWrite renderTextureReadWrite = RenderTextureReadWrite.Linear;
|
||||
FilterMode filterMode = FilterMode.Bilinear;
|
||||
Material aoMaterial = this.aoMaterial;
|
||||
int num2 = Shader.PropertyToID("_OcclusionTexture");
|
||||
aoCommands.GetTemporaryRT(num2, pixelWidth / num, pixelHeight / num, 0, filterMode, renderTextureFormat, renderTextureReadWrite);
|
||||
aoCommands.Blit(null, num2, aoMaterial, 0);
|
||||
int num3 = Shader.PropertyToID("_OcclusionBlurTexture");
|
||||
aoCommands.GetTemporaryRT(num3, pixelWidth, pixelHeight, 0, filterMode, renderTextureFormat, renderTextureReadWrite);
|
||||
aoCommands.SetGlobalVector("_BlurVector", Vector2.right * 2f);
|
||||
aoCommands.Blit(num2, num3, aoMaterial, 1);
|
||||
aoCommands.ReleaseTemporaryRT(num2);
|
||||
aoCommands.GetTemporaryRT(num2, pixelWidth, pixelHeight, 0, filterMode, renderTextureFormat, renderTextureReadWrite);
|
||||
aoCommands.SetGlobalVector("_BlurVector", Vector2.up * 2f * (float)num);
|
||||
aoCommands.Blit(num3, num2, aoMaterial, 1);
|
||||
aoCommands.ReleaseTemporaryRT(num3);
|
||||
aoCommands.GetTemporaryRT(num3, pixelWidth, pixelHeight, 0, filterMode, renderTextureFormat, renderTextureReadWrite);
|
||||
aoCommands.SetGlobalVector("_BlurVector", Vector2.right * (float)num);
|
||||
aoCommands.Blit(num2, num3, aoMaterial, 2);
|
||||
aoCommands.ReleaseTemporaryRT(num2);
|
||||
aoCommands.GetTemporaryRT(num2, pixelWidth, pixelHeight, 0, filterMode, renderTextureFormat, renderTextureReadWrite);
|
||||
aoCommands.SetGlobalVector("_BlurVector", Vector2.up * (float)num);
|
||||
aoCommands.Blit(num3, num2, aoMaterial, 2);
|
||||
aoCommands.ReleaseTemporaryRT(num3);
|
||||
RenderTargetIdentifier[] array = new RenderTargetIdentifier[]
|
||||
{
|
||||
BuiltinRenderTextureType.GBuffer0,
|
||||
BuiltinRenderTextureType.CameraTarget
|
||||
};
|
||||
aoCommands.SetRenderTarget(array, BuiltinRenderTextureType.CameraTarget);
|
||||
aoCommands.SetGlobalTexture("_OcclusionTexture", num2);
|
||||
aoCommands.DrawMesh(this.quadMesh, Matrix4x4.identity, aoMaterial, 0, 4);
|
||||
aoCommands.ReleaseTemporaryRT(num2);
|
||||
}
|
||||
|
||||
// Token: 0x06000047 RID: 71 RVA: 0x000032E8 File Offset: 0x000016E8
|
||||
private void ExecuteAOPass(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
int width = source.width;
|
||||
int height = source.height;
|
||||
int num = ((!this.downsampling) ? 1 : 2);
|
||||
RenderTextureFormat renderTextureFormat = RenderTextureFormat.R8;
|
||||
RenderTextureReadWrite renderTextureReadWrite = RenderTextureReadWrite.Linear;
|
||||
Material aoMaterial = this.aoMaterial;
|
||||
RenderTexture renderTexture = RenderTexture.GetTemporary(width / num, height / num, 0, renderTextureFormat, renderTextureReadWrite);
|
||||
Graphics.Blit(null, renderTexture, aoMaterial, 0);
|
||||
RenderTexture renderTexture2 = RenderTexture.GetTemporary(width, height, 0, renderTextureFormat, renderTextureReadWrite);
|
||||
aoMaterial.SetVector("_BlurVector", Vector2.right * 2f);
|
||||
Graphics.Blit(renderTexture, renderTexture2, aoMaterial, 1);
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
renderTexture = RenderTexture.GetTemporary(width, height, 0, renderTextureFormat, renderTextureReadWrite);
|
||||
aoMaterial.SetVector("_BlurVector", Vector2.up * 2f * (float)num);
|
||||
Graphics.Blit(renderTexture2, renderTexture, aoMaterial, 1);
|
||||
RenderTexture.ReleaseTemporary(renderTexture2);
|
||||
renderTexture2 = RenderTexture.GetTemporary(width, height, 0, renderTextureFormat, renderTextureReadWrite);
|
||||
aoMaterial.SetVector("_BlurVector", Vector2.right * (float)num);
|
||||
Graphics.Blit(renderTexture, renderTexture2, aoMaterial, 2);
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
renderTexture = RenderTexture.GetTemporary(width, height, 0, renderTextureFormat, renderTextureReadWrite);
|
||||
aoMaterial.SetVector("_BlurVector", Vector2.up * (float)num);
|
||||
Graphics.Blit(renderTexture2, renderTexture, aoMaterial, 2);
|
||||
RenderTexture.ReleaseTemporary(renderTexture2);
|
||||
aoMaterial.SetTexture("_OcclusionTexture", renderTexture);
|
||||
if (!this.settings.debug)
|
||||
{
|
||||
Graphics.Blit(source, destination, aoMaterial, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(source, destination, aoMaterial, 5);
|
||||
}
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
}
|
||||
|
||||
// Token: 0x06000048 RID: 72 RVA: 0x00003480 File Offset: 0x00001880
|
||||
private void UpdateMaterialProperties()
|
||||
{
|
||||
Material aoMaterial = this.aoMaterial;
|
||||
aoMaterial.shaderKeywords = null;
|
||||
aoMaterial.SetFloat("_Intensity", this.intensity);
|
||||
aoMaterial.SetFloat("_Radius", this.radius);
|
||||
aoMaterial.SetFloat("_TargetScale", (!this.downsampling) ? 1f : 0.5f);
|
||||
if (this.occlusionSource == AmbientOcclusion.OcclusionSource.GBuffer)
|
||||
{
|
||||
aoMaterial.EnableKeyword("_SOURCE_GBUFFER");
|
||||
}
|
||||
else if (this.occlusionSource == AmbientOcclusion.OcclusionSource.DepthTexture)
|
||||
{
|
||||
aoMaterial.EnableKeyword("_SOURCE_DEPTH");
|
||||
}
|
||||
else
|
||||
{
|
||||
aoMaterial.EnableKeyword("_SOURCE_DEPTHNORMALS");
|
||||
}
|
||||
if (this.sampleCount == AmbientOcclusion.SampleCount.Lowest)
|
||||
{
|
||||
aoMaterial.EnableKeyword("_SAMPLECOUNT_LOWEST");
|
||||
}
|
||||
else
|
||||
{
|
||||
aoMaterial.SetInt("_SampleCount", this.sampleCountValue);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000049 RID: 73 RVA: 0x00003550 File Offset: 0x00001950
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!ImageEffectHelper.IsSupported(this.aoShader, true, false, this))
|
||||
{
|
||||
base.enabled = false;
|
||||
return;
|
||||
}
|
||||
if (this.ambientOnly)
|
||||
{
|
||||
this.targetCamera.AddCommandBuffer(CameraEvent.BeforeReflections, this.aoCommands);
|
||||
}
|
||||
if (this.occlusionSource == AmbientOcclusion.OcclusionSource.DepthTexture)
|
||||
{
|
||||
this.targetCamera.depthTextureMode |= DepthTextureMode.Depth;
|
||||
}
|
||||
if (this.occlusionSource != AmbientOcclusion.OcclusionSource.GBuffer)
|
||||
{
|
||||
this.targetCamera.depthTextureMode |= DepthTextureMode.DepthNormals;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600004A RID: 74 RVA: 0x000035D4 File Offset: 0x000019D4
|
||||
private void OnDisable()
|
||||
{
|
||||
if (this._aoMaterial != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this._aoMaterial);
|
||||
}
|
||||
this._aoMaterial = null;
|
||||
if (this._aoCommands != null)
|
||||
{
|
||||
this.targetCamera.RemoveCommandBuffer(CameraEvent.BeforeReflections, this._aoCommands);
|
||||
}
|
||||
this._aoCommands = null;
|
||||
}
|
||||
|
||||
// Token: 0x0600004B RID: 75 RVA: 0x0000362C File Offset: 0x00001A2C
|
||||
private void Update()
|
||||
{
|
||||
if (this.propertyObserver.CheckNeedsReset(this.settings, this.targetCamera))
|
||||
{
|
||||
this.OnDisable();
|
||||
this.OnEnable();
|
||||
if (this.ambientOnly)
|
||||
{
|
||||
this.aoCommands.Clear();
|
||||
this.BuildAOCommands();
|
||||
}
|
||||
this.propertyObserver.Update(this.settings, this.targetCamera);
|
||||
}
|
||||
if (this.ambientOnly)
|
||||
{
|
||||
this.UpdateMaterialProperties();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600004C RID: 76 RVA: 0x000036AB File Offset: 0x00001AAB
|
||||
[ImageEffectOpaque]
|
||||
private void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
if (this.ambientOnly)
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.UpdateMaterialProperties();
|
||||
this.ExecuteAOPass(source, destination);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000048 RID: 72
|
||||
[SerializeField]
|
||||
public AmbientOcclusion.Settings settings = AmbientOcclusion.Settings.defaultSettings;
|
||||
|
||||
// Token: 0x04000049 RID: 73
|
||||
[SerializeField]
|
||||
private Shader _aoShader;
|
||||
|
||||
// Token: 0x0400004A RID: 74
|
||||
private Material _aoMaterial;
|
||||
|
||||
// Token: 0x0400004B RID: 75
|
||||
private CommandBuffer _aoCommands;
|
||||
|
||||
// Token: 0x0400004D RID: 77
|
||||
[SerializeField]
|
||||
private Mesh _quadMesh;
|
||||
|
||||
// Token: 0x02000016 RID: 22
|
||||
private struct PropertyObserver
|
||||
{
|
||||
// Token: 0x0600004D RID: 77 RVA: 0x000036D4 File Offset: 0x00001AD4
|
||||
public bool CheckNeedsReset(AmbientOcclusion.Settings setting, Camera camera)
|
||||
{
|
||||
return this._downsampling != setting.downsampling || this._occlusionSource != setting.occlusionSource || this._ambientOnly != setting.ambientOnly || this._pixelWidth != camera.pixelWidth || this._pixelHeight != camera.pixelHeight;
|
||||
}
|
||||
|
||||
// Token: 0x0600004E RID: 78 RVA: 0x00003739 File Offset: 0x00001B39
|
||||
public void Update(AmbientOcclusion.Settings setting, Camera camera)
|
||||
{
|
||||
this._downsampling = setting.downsampling;
|
||||
this._occlusionSource = setting.occlusionSource;
|
||||
this._ambientOnly = setting.ambientOnly;
|
||||
this._pixelWidth = camera.pixelWidth;
|
||||
this._pixelHeight = camera.pixelHeight;
|
||||
}
|
||||
|
||||
// Token: 0x0400004E RID: 78
|
||||
private bool _downsampling;
|
||||
|
||||
// Token: 0x0400004F RID: 79
|
||||
private AmbientOcclusion.OcclusionSource _occlusionSource;
|
||||
|
||||
// Token: 0x04000050 RID: 80
|
||||
private bool _ambientOnly;
|
||||
|
||||
// Token: 0x04000051 RID: 81
|
||||
private int _pixelWidth;
|
||||
|
||||
// Token: 0x04000052 RID: 82
|
||||
private int _pixelHeight;
|
||||
}
|
||||
|
||||
// Token: 0x02000017 RID: 23
|
||||
public enum SampleCount
|
||||
{
|
||||
// Token: 0x04000054 RID: 84
|
||||
Lowest,
|
||||
// Token: 0x04000055 RID: 85
|
||||
Low,
|
||||
// Token: 0x04000056 RID: 86
|
||||
Medium,
|
||||
// Token: 0x04000057 RID: 87
|
||||
High,
|
||||
// Token: 0x04000058 RID: 88
|
||||
Variable
|
||||
}
|
||||
|
||||
// Token: 0x02000018 RID: 24
|
||||
public enum OcclusionSource
|
||||
{
|
||||
// Token: 0x0400005A RID: 90
|
||||
DepthTexture,
|
||||
// Token: 0x0400005B RID: 91
|
||||
DepthNormalsTexture,
|
||||
// Token: 0x0400005C RID: 92
|
||||
GBuffer
|
||||
}
|
||||
|
||||
// Token: 0x02000019 RID: 25
|
||||
[Serializable]
|
||||
public class Settings
|
||||
{
|
||||
// Token: 0x17000022 RID: 34
|
||||
// (get) Token: 0x06000050 RID: 80 RVA: 0x00003780 File Offset: 0x00001B80
|
||||
public static AmbientOcclusion.Settings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new AmbientOcclusion.Settings
|
||||
{
|
||||
intensity = 1f,
|
||||
radius = 0.3f,
|
||||
sampleCount = AmbientOcclusion.SampleCount.Medium,
|
||||
sampleCountValue = 24,
|
||||
downsampling = false,
|
||||
ambientOnly = false,
|
||||
occlusionSource = AmbientOcclusion.OcclusionSource.DepthNormalsTexture
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400005D RID: 93
|
||||
[SerializeField]
|
||||
[Range(0f, 4f)]
|
||||
[Tooltip("Degree of darkness produced by the effect.")]
|
||||
public float intensity;
|
||||
|
||||
// Token: 0x0400005E RID: 94
|
||||
[SerializeField]
|
||||
[Tooltip("Radius of sample points, which affects extent of darkened areas.")]
|
||||
public float radius;
|
||||
|
||||
// Token: 0x0400005F RID: 95
|
||||
[SerializeField]
|
||||
[Tooltip("Number of sample points, which affects quality and performance.")]
|
||||
public AmbientOcclusion.SampleCount sampleCount;
|
||||
|
||||
// Token: 0x04000060 RID: 96
|
||||
[SerializeField]
|
||||
[Tooltip("Determines the sample count when SampleCount.Variable is used.")]
|
||||
public int sampleCountValue;
|
||||
|
||||
// Token: 0x04000061 RID: 97
|
||||
[SerializeField]
|
||||
[Tooltip("Halves the resolution of the effect to increase performance.")]
|
||||
public bool downsampling;
|
||||
|
||||
// Token: 0x04000062 RID: 98
|
||||
[SerializeField]
|
||||
[Tooltip("If checked, the effect only affects ambient lighting.")]
|
||||
public bool ambientOnly;
|
||||
|
||||
// Token: 0x04000063 RID: 99
|
||||
[SerializeField]
|
||||
[Tooltip("Source buffer on which the occlusion estimator is based.")]
|
||||
public AmbientOcclusion.OcclusionSource occlusionSource;
|
||||
|
||||
// Token: 0x04000064 RID: 100
|
||||
[SerializeField]
|
||||
public bool debug;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x02000002 RID: 2
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Image Effects/Anti-aliasing")]
|
||||
[ImageEffectAllowedInSceneView]
|
||||
public class AntiAliasing : MonoBehaviour
|
||||
{
|
||||
// Token: 0x17000001 RID: 1
|
||||
// (get) Token: 0x06000002 RID: 2 RVA: 0x0000206E File Offset: 0x0000046E
|
||||
// (set) Token: 0x06000003 RID: 3 RVA: 0x00002076 File Offset: 0x00000476
|
||||
public int method
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_Method;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.m_Method == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.m_Method = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000002 RID: 2
|
||||
// (get) Token: 0x06000004 RID: 4 RVA: 0x0000208C File Offset: 0x0000048C
|
||||
public IAntiAliasing current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.method == 0)
|
||||
{
|
||||
return this.m_SMAA;
|
||||
}
|
||||
return this.m_FXAA;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000003 RID: 3
|
||||
// (get) Token: 0x06000005 RID: 5 RVA: 0x000020A6 File Offset: 0x000004A6
|
||||
public Camera cameraComponent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Camera == null)
|
||||
{
|
||||
this.m_Camera = base.GetComponent<Camera>();
|
||||
}
|
||||
return this.m_Camera;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000006 RID: 6 RVA: 0x000020CB File Offset: 0x000004CB
|
||||
private void OnEnable()
|
||||
{
|
||||
this.m_SMAA.OnEnable(this);
|
||||
this.m_FXAA.OnEnable(this);
|
||||
}
|
||||
|
||||
// Token: 0x06000007 RID: 7 RVA: 0x000020E5 File Offset: 0x000004E5
|
||||
private void OnDisable()
|
||||
{
|
||||
this.m_SMAA.OnDisable();
|
||||
this.m_FXAA.OnDisable();
|
||||
}
|
||||
|
||||
// Token: 0x06000008 RID: 8 RVA: 0x000020FD File Offset: 0x000004FD
|
||||
private void OnPreCull()
|
||||
{
|
||||
this.current.OnPreCull(this.cameraComponent);
|
||||
}
|
||||
|
||||
// Token: 0x06000009 RID: 9 RVA: 0x00002110 File Offset: 0x00000510
|
||||
private void OnPostRender()
|
||||
{
|
||||
this.current.OnPostRender(this.cameraComponent);
|
||||
}
|
||||
|
||||
// Token: 0x0600000A RID: 10 RVA: 0x00002123 File Offset: 0x00000523
|
||||
private void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
this.current.OnRenderImage(this.cameraComponent, source, destination);
|
||||
}
|
||||
|
||||
// Token: 0x04000001 RID: 1
|
||||
[SerializeField]
|
||||
private SMAA m_SMAA = new SMAA();
|
||||
|
||||
// Token: 0x04000002 RID: 2
|
||||
[SerializeField]
|
||||
private FXAA m_FXAA = new FXAA();
|
||||
|
||||
// Token: 0x04000003 RID: 3
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private int m_Method;
|
||||
|
||||
// Token: 0x04000004 RID: 4
|
||||
private Camera m_Camera;
|
||||
|
||||
// Token: 0x02000003 RID: 3
|
||||
public enum Method
|
||||
{
|
||||
// Token: 0x04000006 RID: 6
|
||||
Smaa,
|
||||
// Token: 0x04000007 RID: 7
|
||||
Fxaa
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x0200001A RID: 26
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Image Effects/Cinematic/Bloom")]
|
||||
[ImageEffectAllowedInSceneView]
|
||||
public class Bloom : MonoBehaviour
|
||||
{
|
||||
// Token: 0x17000023 RID: 35
|
||||
// (get) Token: 0x06000052 RID: 82 RVA: 0x000037FB File Offset: 0x00001BFB
|
||||
public Shader shader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Shader == null)
|
||||
{
|
||||
this.m_Shader = Shader.Find("Hidden/Image Effects/Cinematic/Bloom");
|
||||
}
|
||||
return this.m_Shader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000024 RID: 36
|
||||
// (get) Token: 0x06000053 RID: 83 RVA: 0x00003824 File Offset: 0x00001C24
|
||||
public Material material
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Material == null)
|
||||
{
|
||||
this.m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(this.shader);
|
||||
}
|
||||
return this.m_Material;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000054 RID: 84 RVA: 0x0000384E File Offset: 0x00001C4E
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!ImageEffectHelper.IsSupported(this.shader, true, false, this))
|
||||
{
|
||||
base.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000055 RID: 85 RVA: 0x0000386A File Offset: 0x00001C6A
|
||||
private void OnDisable()
|
||||
{
|
||||
if (this.m_Material != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
|
||||
}
|
||||
this.m_Material = null;
|
||||
}
|
||||
|
||||
// Token: 0x06000056 RID: 86 RVA: 0x00003890 File Offset: 0x00001C90
|
||||
private void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
bool isMobilePlatform = Application.isMobilePlatform;
|
||||
int num = source.width;
|
||||
int num2 = source.height;
|
||||
if (!this.settings.highQuality)
|
||||
{
|
||||
num /= 2;
|
||||
num2 /= 2;
|
||||
}
|
||||
RenderTextureFormat renderTextureFormat = ((!isMobilePlatform) ? RenderTextureFormat.DefaultHDR : RenderTextureFormat.Default);
|
||||
float num3 = Mathf.Log((float)num2, 2f) + this.settings.radius - 8f;
|
||||
int num4 = (int)num3;
|
||||
int num5 = Mathf.Clamp(num4, 1, 16);
|
||||
float thresholdLinear = this.settings.thresholdLinear;
|
||||
this.material.SetFloat("_Threshold", thresholdLinear);
|
||||
float num6 = thresholdLinear * 0.5f + 1E-05f;
|
||||
Vector3 vector = new Vector3(thresholdLinear - num6, num6 * 2f, 0.25f / num6);
|
||||
this.material.SetVector("_Curve", vector);
|
||||
bool flag = !this.settings.highQuality && this.settings.antiFlicker;
|
||||
this.material.SetFloat("_PrefilterOffs", (!flag) ? 0f : (-0.5f));
|
||||
this.material.SetFloat("_SampleScale", 0.5f + num3 - (float)num4);
|
||||
this.material.SetFloat("_Intensity", Mathf.Max(0f, this.settings.intensity));
|
||||
if (this.settings.highQuality)
|
||||
{
|
||||
this.material.EnableKeyword("HIGH_QUALITY");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.material.DisableKeyword("HIGH_QUALITY");
|
||||
}
|
||||
if (this.settings.antiFlicker)
|
||||
{
|
||||
this.material.EnableKeyword("ANTI_FLICKER");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.material.DisableKeyword("ANTI_FLICKER");
|
||||
}
|
||||
RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 0, renderTextureFormat);
|
||||
Graphics.Blit(source, temporary, this.material, 0);
|
||||
RenderTexture renderTexture = temporary;
|
||||
for (int i = 0; i < num5; i++)
|
||||
{
|
||||
this.m_blurBuffer1[i] = RenderTexture.GetTemporary(renderTexture.width / 2, renderTexture.height / 2, 0, renderTextureFormat);
|
||||
Graphics.Blit(renderTexture, this.m_blurBuffer1[i], this.material, (i != 0) ? 2 : 1);
|
||||
renderTexture = this.m_blurBuffer1[i];
|
||||
}
|
||||
for (int j = num5 - 2; j >= 0; j--)
|
||||
{
|
||||
RenderTexture renderTexture2 = this.m_blurBuffer1[j];
|
||||
this.material.SetTexture("_BaseTex", renderTexture2);
|
||||
this.m_blurBuffer2[j] = RenderTexture.GetTemporary(renderTexture2.width, renderTexture2.height, 0, renderTextureFormat);
|
||||
Graphics.Blit(renderTexture, this.m_blurBuffer2[j], this.material, 3);
|
||||
renderTexture = this.m_blurBuffer2[j];
|
||||
}
|
||||
this.material.SetTexture("_BaseTex", source);
|
||||
Graphics.Blit(renderTexture, destination, this.material, 4);
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
if (this.m_blurBuffer1[k] != null)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(this.m_blurBuffer1[k]);
|
||||
}
|
||||
if (this.m_blurBuffer2[k] != null)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(this.m_blurBuffer2[k]);
|
||||
}
|
||||
this.m_blurBuffer1[k] = null;
|
||||
this.m_blurBuffer2[k] = null;
|
||||
}
|
||||
RenderTexture.ReleaseTemporary(temporary);
|
||||
}
|
||||
|
||||
// Token: 0x04000065 RID: 101
|
||||
[SerializeField]
|
||||
public Bloom.Settings settings = Bloom.Settings.defaultSettings;
|
||||
|
||||
// Token: 0x04000066 RID: 102
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
private Shader m_Shader;
|
||||
|
||||
// Token: 0x04000067 RID: 103
|
||||
private Material m_Material;
|
||||
|
||||
// Token: 0x04000068 RID: 104
|
||||
private const int kMaxIterations = 16;
|
||||
|
||||
// Token: 0x04000069 RID: 105
|
||||
private RenderTexture[] m_blurBuffer1 = new RenderTexture[16];
|
||||
|
||||
// Token: 0x0400006A RID: 106
|
||||
private RenderTexture[] m_blurBuffer2 = new RenderTexture[16];
|
||||
|
||||
// Token: 0x0200001B RID: 27
|
||||
[Serializable]
|
||||
public struct Settings
|
||||
{
|
||||
// Token: 0x17000025 RID: 37
|
||||
// (get) Token: 0x06000058 RID: 88 RVA: 0x00003BF7 File Offset: 0x00001FF7
|
||||
// (set) Token: 0x06000057 RID: 87 RVA: 0x00003BEE File Offset: 0x00001FEE
|
||||
public float thresholdGamma
|
||||
{
|
||||
get
|
||||
{
|
||||
return Mathf.Max(0f, this.threshold);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.threshold = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000026 RID: 38
|
||||
// (get) Token: 0x0600005A RID: 90 RVA: 0x00003C17 File Offset: 0x00002017
|
||||
// (set) Token: 0x06000059 RID: 89 RVA: 0x00003C09 File Offset: 0x00002009
|
||||
public float thresholdLinear
|
||||
{
|
||||
get
|
||||
{
|
||||
return Mathf.GammaToLinearSpace(this.thresholdGamma);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.threshold = Mathf.LinearToGammaSpace(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000027 RID: 39
|
||||
// (get) Token: 0x0600005B RID: 91 RVA: 0x00003C24 File Offset: 0x00002024
|
||||
public static Bloom.Settings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Bloom.Settings
|
||||
{
|
||||
threshold = 0.9f,
|
||||
radius = 2f,
|
||||
intensity = 0.7f,
|
||||
highQuality = true,
|
||||
antiFlicker = false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400006B RID: 107
|
||||
[SerializeField]
|
||||
[Tooltip("Filters out pixels under this level of brightness.")]
|
||||
public float threshold;
|
||||
|
||||
// Token: 0x0400006C RID: 108
|
||||
[SerializeField]
|
||||
[Range(1f, 7f)]
|
||||
[Tooltip("Changes extent of veiling effects in a screen resolution-independent fashion.")]
|
||||
public float radius;
|
||||
|
||||
// Token: 0x0400006D RID: 109
|
||||
[SerializeField]
|
||||
[Tooltip("Blend factor of the result image.")]
|
||||
public float intensity;
|
||||
|
||||
// Token: 0x0400006E RID: 110
|
||||
[SerializeField]
|
||||
[Tooltip("Controls filter quality and buffer resolution.")]
|
||||
public bool highQuality;
|
||||
|
||||
// Token: 0x0400006F RID: 111
|
||||
[SerializeField]
|
||||
[Tooltip("Reduces flashing noise with an additional filter.")]
|
||||
public bool antiFlicker;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1105 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x0200001F RID: 31
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("Image Effects/Cinematic/Depth Of Field")]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
public class DepthOfField : MonoBehaviour
|
||||
{
|
||||
// Token: 0x17000029 RID: 41
|
||||
// (get) Token: 0x06000065 RID: 101 RVA: 0x00003EC8 File Offset: 0x000022C8
|
||||
public Shader filmicDepthOfFieldShader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_FilmicDepthOfFieldShader == null)
|
||||
{
|
||||
this.m_FilmicDepthOfFieldShader = Shader.Find("Hidden/DepthOfField/DepthOfField");
|
||||
}
|
||||
return this.m_FilmicDepthOfFieldShader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002A RID: 42
|
||||
// (get) Token: 0x06000066 RID: 102 RVA: 0x00003EF1 File Offset: 0x000022F1
|
||||
public Shader medianFilterShader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_MedianFilterShader == null)
|
||||
{
|
||||
this.m_MedianFilterShader = Shader.Find("Hidden/DepthOfField/MedianFilter");
|
||||
}
|
||||
return this.m_MedianFilterShader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002B RID: 43
|
||||
// (get) Token: 0x06000067 RID: 103 RVA: 0x00003F1A File Offset: 0x0000231A
|
||||
public Shader textureBokehShader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_TextureBokehShader == null)
|
||||
{
|
||||
this.m_TextureBokehShader = Shader.Find("Hidden/DepthOfField/BokehSplatting");
|
||||
}
|
||||
return this.m_TextureBokehShader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002C RID: 44
|
||||
// (get) Token: 0x06000068 RID: 104 RVA: 0x00003F43 File Offset: 0x00002343
|
||||
public Material filmicDepthOfFieldMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_FilmicDepthOfFieldMaterial == null)
|
||||
{
|
||||
this.m_FilmicDepthOfFieldMaterial = ImageEffectHelper.CheckShaderAndCreateMaterial(this.filmicDepthOfFieldShader);
|
||||
}
|
||||
return this.m_FilmicDepthOfFieldMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002D RID: 45
|
||||
// (get) Token: 0x06000069 RID: 105 RVA: 0x00003F6D File Offset: 0x0000236D
|
||||
public Material medianFilterMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_MedianFilterMaterial == null)
|
||||
{
|
||||
this.m_MedianFilterMaterial = ImageEffectHelper.CheckShaderAndCreateMaterial(this.medianFilterShader);
|
||||
}
|
||||
return this.m_MedianFilterMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002E RID: 46
|
||||
// (get) Token: 0x0600006A RID: 106 RVA: 0x00003F97 File Offset: 0x00002397
|
||||
public Material textureBokehMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_TextureBokehMaterial == null)
|
||||
{
|
||||
this.m_TextureBokehMaterial = ImageEffectHelper.CheckShaderAndCreateMaterial(this.textureBokehShader);
|
||||
}
|
||||
return this.m_TextureBokehMaterial;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700002F RID: 47
|
||||
// (get) Token: 0x0600006B RID: 107 RVA: 0x00003FC4 File Offset: 0x000023C4
|
||||
public ComputeBuffer computeBufferDrawArgs
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_ComputeBufferDrawArgs == null)
|
||||
{
|
||||
this.m_ComputeBufferDrawArgs = new ComputeBuffer(1, 16, ComputeBufferType.DrawIndirect);
|
||||
this.m_ComputeBufferDrawArgs.SetData(new int[] { 0, 1, 0, 0 });
|
||||
}
|
||||
return this.m_ComputeBufferDrawArgs;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000030 RID: 48
|
||||
// (get) Token: 0x0600006C RID: 108 RVA: 0x00004011 File Offset: 0x00002411
|
||||
public ComputeBuffer computeBufferPoints
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_ComputeBufferPoints == null)
|
||||
{
|
||||
this.m_ComputeBufferPoints = new ComputeBuffer(90000, 28, ComputeBufferType.Append);
|
||||
}
|
||||
return this.m_ComputeBufferPoints;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600006D RID: 109 RVA: 0x00004038 File Offset: 0x00002438
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!ImageEffectHelper.IsSupported(this.filmicDepthOfFieldShader, true, true, this) || !ImageEffectHelper.IsSupported(this.medianFilterShader, true, true, this))
|
||||
{
|
||||
base.enabled = false;
|
||||
return;
|
||||
}
|
||||
if (ImageEffectHelper.supportsDX11 && !ImageEffectHelper.IsSupported(this.textureBokehShader, true, true, this))
|
||||
{
|
||||
base.enabled = false;
|
||||
return;
|
||||
}
|
||||
this.ComputeBlurDirections(true);
|
||||
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
|
||||
}
|
||||
|
||||
// Token: 0x0600006E RID: 110 RVA: 0x000040B4 File Offset: 0x000024B4
|
||||
private void OnDisable()
|
||||
{
|
||||
this.ReleaseComputeResources();
|
||||
if (this.m_FilmicDepthOfFieldMaterial != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_FilmicDepthOfFieldMaterial);
|
||||
}
|
||||
if (this.m_TextureBokehMaterial != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_TextureBokehMaterial);
|
||||
}
|
||||
if (this.m_MedianFilterMaterial != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_MedianFilterMaterial);
|
||||
}
|
||||
this.m_FilmicDepthOfFieldMaterial = null;
|
||||
this.m_TextureBokehMaterial = null;
|
||||
this.m_MedianFilterMaterial = null;
|
||||
this.m_RTU.ReleaseAllTemporaryRenderTextures();
|
||||
}
|
||||
|
||||
// Token: 0x0600006F RID: 111 RVA: 0x0000413C File Offset: 0x0000253C
|
||||
private void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
if (this.medianFilterMaterial == null || this.filmicDepthOfFieldMaterial == null)
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
if (this.settings.visualizeBluriness)
|
||||
{
|
||||
Vector4 vector;
|
||||
Vector4 vector2;
|
||||
this.ComputeCocParameters(out vector, out vector2);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BlurParams", vector);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector2);
|
||||
Graphics.Blit(null, destination, this.filmicDepthOfFieldMaterial, (this.settings.tweakMode != DepthOfField.TweakMode.Explicit) ? 6 : 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DoDepthOfField(source, destination);
|
||||
}
|
||||
this.m_RTU.ReleaseAllTemporaryRenderTextures();
|
||||
}
|
||||
|
||||
// Token: 0x06000070 RID: 112 RVA: 0x000041EC File Offset: 0x000025EC
|
||||
private void DoDepthOfField(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
this.m_CurrentQualitySettings = this.quality;
|
||||
if (this.settings.quality != DepthOfField.QualityPreset.Custom)
|
||||
{
|
||||
this.m_CurrentQualitySettings = DepthOfField.QualitySettings.presetQualitySettings[(int)this.settings.quality];
|
||||
}
|
||||
float num = (float)source.height / 720f;
|
||||
float num2 = num;
|
||||
float num3 = Mathf.Max(this.blur.nearRadius, this.blur.farRadius) * num2 * 0.75f;
|
||||
float num4 = this.blur.nearRadius * num;
|
||||
float num5 = this.blur.farRadius * num;
|
||||
float num6 = Mathf.Max(num4, num5);
|
||||
DepthOfField.ApertureShape apertureShape = this.settings.apertureShape;
|
||||
if (apertureShape != DepthOfField.ApertureShape.Hexagonal)
|
||||
{
|
||||
if (apertureShape == DepthOfField.ApertureShape.Octogonal)
|
||||
{
|
||||
num6 *= 1.15f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num6 *= 1.2f;
|
||||
}
|
||||
if (num6 < 0.5f)
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
int num7 = source.width / 2;
|
||||
int num8 = source.height / 2;
|
||||
Vector4 vector = new Vector4(num4 * 0.5f, num5 * 0.5f, 0f, 0f);
|
||||
RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(num7, num8, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
|
||||
RenderTexture temporaryRenderTexture2 = this.m_RTU.GetTemporaryRenderTexture(num7, num8, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
|
||||
if (this.m_CurrentQualitySettings.preventHaloing)
|
||||
{
|
||||
this.filmicDepthOfFieldMaterial.EnableKeyword("USE_SPECIAL_FETCH_FOR_COC");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.filmicDepthOfFieldMaterial.DisableKeyword("USE_SPECIAL_FETCH_FOR_COC");
|
||||
}
|
||||
Vector4 vector2;
|
||||
Vector4 vector3;
|
||||
this.ComputeCocParameters(out vector2, out vector3);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BlurParams", vector2);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector3);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BoostParams", new Vector4(num4 * this.blur.nearBoostAmount * -0.5f, num5 * this.blur.farBoostAmount * 0.5f, this.blur.boostPoint, 0f));
|
||||
Graphics.Blit(source, temporaryRenderTexture2, this.filmicDepthOfFieldMaterial, (this.settings.tweakMode != DepthOfField.TweakMode.Explicit) ? 4 : 5);
|
||||
RenderTexture renderTexture = temporaryRenderTexture2;
|
||||
RenderTexture renderTexture2 = temporaryRenderTexture;
|
||||
if (this.shouldPerformBokeh)
|
||||
{
|
||||
RenderTexture temporaryRenderTexture3 = this.m_RTU.GetTemporaryRenderTexture(num7, num8, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
|
||||
Graphics.Blit(renderTexture, temporaryRenderTexture3, this.filmicDepthOfFieldMaterial, 1);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f, 0f, 1.5f));
|
||||
Graphics.Blit(temporaryRenderTexture3, renderTexture2, this.filmicDepthOfFieldMaterial, 0);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(1.5f, 0f, 0f, 1.5f));
|
||||
Graphics.Blit(renderTexture2, temporaryRenderTexture3, this.filmicDepthOfFieldMaterial, 0);
|
||||
this.textureBokehMaterial.SetTexture("_BlurredColor", temporaryRenderTexture3);
|
||||
this.textureBokehMaterial.SetFloat("_SpawnHeuristic", this.bokehTexture.spawnHeuristic);
|
||||
this.textureBokehMaterial.SetVector("_BokehParams", new Vector4(this.bokehTexture.scale * num2, this.bokehTexture.intensity, this.bokehTexture.threshold, num3));
|
||||
Graphics.SetRandomWriteTarget(1, this.computeBufferPoints);
|
||||
Graphics.Blit(renderTexture, renderTexture2, this.textureBokehMaterial, 1);
|
||||
Graphics.ClearRandomWriteTargets();
|
||||
DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
|
||||
this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture3);
|
||||
}
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BlurParams", vector2);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BoostParams", new Vector4(num4 * this.blur.nearBoostAmount * -0.5f, num5 * this.blur.farBoostAmount * 0.5f, this.blur.boostPoint, 0f));
|
||||
RenderTexture renderTexture3 = null;
|
||||
if (this.m_CurrentQualitySettings.dilateNearBlur)
|
||||
{
|
||||
RenderTexture temporaryRenderTexture4 = this.m_RTU.GetTemporaryRenderTexture(num7, num8, 0, RenderTextureFormat.RGHalf, FilterMode.Bilinear);
|
||||
renderTexture3 = this.m_RTU.GetTemporaryRenderTexture(num7, num8, 0, RenderTextureFormat.RGHalf, FilterMode.Bilinear);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(0f, num4 * 0.75f, 0f, 0f));
|
||||
Graphics.Blit(renderTexture, temporaryRenderTexture4, this.filmicDepthOfFieldMaterial, 2);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", new Vector4(num4 * 0.75f, 0f, 0f, 0f));
|
||||
Graphics.Blit(temporaryRenderTexture4, renderTexture3, this.filmicDepthOfFieldMaterial, 3);
|
||||
this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture4);
|
||||
renderTexture3.filterMode = FilterMode.Point;
|
||||
}
|
||||
if (this.m_CurrentQualitySettings.prefilterBlur)
|
||||
{
|
||||
Graphics.Blit(renderTexture, renderTexture2, this.filmicDepthOfFieldMaterial, 8);
|
||||
DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
|
||||
}
|
||||
DepthOfField.ApertureShape apertureShape2 = this.settings.apertureShape;
|
||||
if (apertureShape2 != DepthOfField.ApertureShape.Circular)
|
||||
{
|
||||
if (apertureShape2 != DepthOfField.ApertureShape.Hexagonal)
|
||||
{
|
||||
if (apertureShape2 == DepthOfField.ApertureShape.Octogonal)
|
||||
{
|
||||
this.DoOctogonalBlur(renderTexture3, ref renderTexture, ref renderTexture2, num6);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DoHexagonalBlur(renderTexture3, ref renderTexture, ref renderTexture2, num6);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.DoCircularBlur(renderTexture3, ref renderTexture, ref renderTexture2, num6);
|
||||
}
|
||||
DepthOfField.FilterQuality medianFilter = this.m_CurrentQualitySettings.medianFilter;
|
||||
if (medianFilter != DepthOfField.FilterQuality.Normal)
|
||||
{
|
||||
if (medianFilter == DepthOfField.FilterQuality.High)
|
||||
{
|
||||
Graphics.Blit(renderTexture, renderTexture2, this.medianFilterMaterial, 1);
|
||||
DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.medianFilterMaterial.SetVector("_Offsets", new Vector4(1f, 0f, 0f, 0f));
|
||||
Graphics.Blit(renderTexture, renderTexture2, this.medianFilterMaterial, 0);
|
||||
DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
|
||||
this.medianFilterMaterial.SetVector("_Offsets", new Vector4(0f, 1f, 0f, 0f));
|
||||
Graphics.Blit(renderTexture, renderTexture2, this.medianFilterMaterial, 0);
|
||||
DepthOfField.SwapRenderTexture(ref renderTexture, ref renderTexture2);
|
||||
}
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_BlurCoe", vector);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Convolved_TexelSize", new Vector4((float)renderTexture.width, (float)renderTexture.height, 1f / (float)renderTexture.width, 1f / (float)renderTexture.height));
|
||||
this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", renderTexture);
|
||||
int num9 = ((this.settings.tweakMode != DepthOfField.TweakMode.Explicit) ? 13 : 14);
|
||||
if (this.m_CurrentQualitySettings.highQualityUpsampling)
|
||||
{
|
||||
num9 = ((this.settings.tweakMode != DepthOfField.TweakMode.Explicit) ? 15 : 16);
|
||||
}
|
||||
if (this.shouldPerformBokeh)
|
||||
{
|
||||
RenderTexture temporaryRenderTexture5 = this.m_RTU.GetTemporaryRenderTexture(source.height, source.width, 0, source.format, FilterMode.Bilinear);
|
||||
Graphics.Blit(source, temporaryRenderTexture5, this.filmicDepthOfFieldMaterial, num9);
|
||||
Graphics.SetRenderTarget(temporaryRenderTexture5);
|
||||
ComputeBuffer.CopyCount(this.computeBufferPoints, this.computeBufferDrawArgs, 0);
|
||||
this.textureBokehMaterial.SetBuffer("pointBuffer", this.computeBufferPoints);
|
||||
this.textureBokehMaterial.SetTexture("_MainTex", this.bokehTexture.texture);
|
||||
this.textureBokehMaterial.SetVector("_Screen", new Vector3(1f / (1f * (float)source.width), 1f / (1f * (float)source.height), num3));
|
||||
this.textureBokehMaterial.SetPass(0);
|
||||
Graphics.DrawProceduralIndirect(MeshTopology.Points, this.computeBufferDrawArgs, 0);
|
||||
Graphics.Blit(temporaryRenderTexture5, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(source, destination, this.filmicDepthOfFieldMaterial, num9);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000071 RID: 113 RVA: 0x00004994 File Offset: 0x00002D94
|
||||
private void DoHexagonalBlur(RenderTexture blurredFgCoc, ref RenderTexture src, ref RenderTexture dst, float maxRadius)
|
||||
{
|
||||
this.ComputeBlurDirections(false);
|
||||
int num;
|
||||
int num2;
|
||||
DepthOfField.GetDirectionalBlurPassesFromRadius(blurredFgCoc, maxRadius, out num, out num2);
|
||||
this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", blurredFgCoc);
|
||||
RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(src.width, src.height, 0, src.format, FilterMode.Bilinear);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_HexagonalBokehDirection1);
|
||||
Graphics.Blit(src, temporaryRenderTexture, this.filmicDepthOfFieldMaterial, num);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_HexagonalBokehDirection2);
|
||||
Graphics.Blit(temporaryRenderTexture, src, this.filmicDepthOfFieldMaterial, num);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_HexagonalBokehDirection3);
|
||||
this.filmicDepthOfFieldMaterial.SetTexture("_ThirdTex", src);
|
||||
Graphics.Blit(temporaryRenderTexture, dst, this.filmicDepthOfFieldMaterial, num2);
|
||||
this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture);
|
||||
DepthOfField.SwapRenderTexture(ref src, ref dst);
|
||||
}
|
||||
|
||||
// Token: 0x06000072 RID: 114 RVA: 0x00004A7C File Offset: 0x00002E7C
|
||||
private void DoOctogonalBlur(RenderTexture blurredFgCoc, ref RenderTexture src, ref RenderTexture dst, float maxRadius)
|
||||
{
|
||||
this.ComputeBlurDirections(false);
|
||||
int num;
|
||||
int num2;
|
||||
DepthOfField.GetDirectionalBlurPassesFromRadius(blurredFgCoc, maxRadius, out num, out num2);
|
||||
this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", blurredFgCoc);
|
||||
RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(src.width, src.height, 0, src.format, FilterMode.Bilinear);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection1);
|
||||
Graphics.Blit(src, temporaryRenderTexture, this.filmicDepthOfFieldMaterial, num);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection2);
|
||||
Graphics.Blit(temporaryRenderTexture, dst, this.filmicDepthOfFieldMaterial, num);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection3);
|
||||
Graphics.Blit(src, temporaryRenderTexture, this.filmicDepthOfFieldMaterial, num);
|
||||
this.filmicDepthOfFieldMaterial.SetVector("_Offsets", this.m_OctogonalBokehDirection4);
|
||||
this.filmicDepthOfFieldMaterial.SetTexture("_ThirdTex", dst);
|
||||
Graphics.Blit(temporaryRenderTexture, src, this.filmicDepthOfFieldMaterial, num2);
|
||||
this.m_RTU.ReleaseTemporaryRenderTexture(temporaryRenderTexture);
|
||||
}
|
||||
|
||||
// Token: 0x06000073 RID: 115 RVA: 0x00004B84 File Offset: 0x00002F84
|
||||
private void DoCircularBlur(RenderTexture blurredFgCoc, ref RenderTexture src, ref RenderTexture dst, float maxRadius)
|
||||
{
|
||||
int num;
|
||||
if (blurredFgCoc != null)
|
||||
{
|
||||
this.filmicDepthOfFieldMaterial.SetTexture("_SecondTex", blurredFgCoc);
|
||||
num = ((maxRadius <= 10f) ? 12 : 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
num = ((maxRadius <= 10f) ? 11 : 9);
|
||||
}
|
||||
Graphics.Blit(src, dst, this.filmicDepthOfFieldMaterial, num);
|
||||
DepthOfField.SwapRenderTexture(ref src, ref dst);
|
||||
}
|
||||
|
||||
// Token: 0x06000074 RID: 116 RVA: 0x00004BF8 File Offset: 0x00002FF8
|
||||
private void ComputeCocParameters(out Vector4 blurParams, out Vector4 blurCoe)
|
||||
{
|
||||
Camera component = base.GetComponent<Camera>();
|
||||
float num = ((!this.focus.transform) ? (this.focus.plane * this.focus.plane * this.focus.plane * this.focus.plane) : (component.WorldToViewportPoint(this.focus.transform.position).z / component.farClipPlane));
|
||||
if (this.settings.tweakMode == DepthOfField.TweakMode.Basic || this.settings.tweakMode == DepthOfField.TweakMode.Advanced)
|
||||
{
|
||||
float num2 = this.focus.rangeAdjustment * this.focus.rangeAdjustment * this.focus.rangeAdjustment * this.focus.rangeAdjustment;
|
||||
float num3 = 4f / Mathf.Tan(0.5f * component.fieldOfView * 0.017453292f);
|
||||
float num4 = num3 / this.focus.fStops;
|
||||
blurCoe = new Vector4(0f, 0f, 1f, 1f);
|
||||
blurParams = new Vector4(num4, num3, num, num2);
|
||||
}
|
||||
else
|
||||
{
|
||||
float num5 = this.focus.nearPlane * this.focus.nearPlane * this.focus.nearPlane * this.focus.nearPlane;
|
||||
float num6 = this.focus.farPlane * this.focus.farPlane * this.focus.farPlane * this.focus.farPlane;
|
||||
float num7 = this.focus.rangeAdjustment * this.focus.rangeAdjustment * this.focus.rangeAdjustment * this.focus.rangeAdjustment;
|
||||
float num8 = num7;
|
||||
if (num <= num5)
|
||||
{
|
||||
num = num5 + 1E-07f;
|
||||
}
|
||||
if (num >= num6)
|
||||
{
|
||||
num = num6 - 1E-07f;
|
||||
}
|
||||
if (num - num7 <= num5)
|
||||
{
|
||||
num7 = num - num5 - 1E-07f;
|
||||
}
|
||||
if (num + num8 >= num6)
|
||||
{
|
||||
num8 = num6 - num - 1E-07f;
|
||||
}
|
||||
float num9 = 1f / (num5 - num + num7);
|
||||
float num10 = 1f / (num6 - num - num8);
|
||||
float num11 = 1f - num9 * num5;
|
||||
float num12 = 1f - num10 * num6;
|
||||
blurParams = new Vector4(-1f * num9, -1f * num11, 1f * num10, 1f * num12);
|
||||
blurCoe = new Vector4(0f, 0f, (num12 - num11) / (num9 - num10), 0f);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000075 RID: 117 RVA: 0x00004E8B File Offset: 0x0000328B
|
||||
private void ReleaseComputeResources()
|
||||
{
|
||||
if (this.m_ComputeBufferDrawArgs != null)
|
||||
{
|
||||
this.m_ComputeBufferDrawArgs.Release();
|
||||
}
|
||||
if (this.m_ComputeBufferPoints != null)
|
||||
{
|
||||
this.m_ComputeBufferPoints.Release();
|
||||
}
|
||||
this.m_ComputeBufferDrawArgs = null;
|
||||
this.m_ComputeBufferPoints = null;
|
||||
}
|
||||
|
||||
// Token: 0x06000076 RID: 118 RVA: 0x00004EC8 File Offset: 0x000032C8
|
||||
private void ComputeBlurDirections(bool force)
|
||||
{
|
||||
if (!force && Math.Abs(this.m_LastApertureOrientation - this.settings.apertureOrientation) < 1E-45f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.m_LastApertureOrientation = this.settings.apertureOrientation;
|
||||
float num = this.settings.apertureOrientation * 0.017453292f;
|
||||
float num2 = Mathf.Cos(num);
|
||||
float num3 = Mathf.Sin(num);
|
||||
this.m_OctogonalBokehDirection1 = new Vector4(0.5f, 0f, 0f, 0f);
|
||||
this.m_OctogonalBokehDirection2 = new Vector4(0f, 0.5f, 1f, 0f);
|
||||
this.m_OctogonalBokehDirection3 = new Vector4(-0.353553f, 0.353553f, 1f, 0f);
|
||||
this.m_OctogonalBokehDirection4 = new Vector4(0.353553f, 0.353553f, 1f, 0f);
|
||||
this.m_HexagonalBokehDirection1 = new Vector4(0.5f, 0f, 0f, 0f);
|
||||
this.m_HexagonalBokehDirection2 = new Vector4(0.25f, 0.433013f, 1f, 0f);
|
||||
this.m_HexagonalBokehDirection3 = new Vector4(0.25f, -0.433013f, 1f, 0f);
|
||||
if (num > 1E-45f)
|
||||
{
|
||||
DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection1, num2, num3);
|
||||
DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection2, num2, num3);
|
||||
DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection3, num2, num3);
|
||||
DepthOfField.Rotate2D(ref this.m_OctogonalBokehDirection4, num2, num3);
|
||||
DepthOfField.Rotate2D(ref this.m_HexagonalBokehDirection1, num2, num3);
|
||||
DepthOfField.Rotate2D(ref this.m_HexagonalBokehDirection2, num2, num3);
|
||||
DepthOfField.Rotate2D(ref this.m_HexagonalBokehDirection3, num2, num3);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000031 RID: 49
|
||||
// (get) Token: 0x06000077 RID: 119 RVA: 0x00005070 File Offset: 0x00003470
|
||||
private bool shouldPerformBokeh
|
||||
{
|
||||
get
|
||||
{
|
||||
return ImageEffectHelper.supportsDX11 && this.bokehTexture.texture != null && this.textureBokehMaterial && this.settings.tweakMode != DepthOfField.TweakMode.Basic;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000078 RID: 120 RVA: 0x000050C4 File Offset: 0x000034C4
|
||||
private static void Rotate2D(ref Vector4 direction, float cosinus, float sinus)
|
||||
{
|
||||
Vector4 vector = direction;
|
||||
direction.x = vector.x * cosinus - vector.y * sinus;
|
||||
direction.y = vector.x * sinus + vector.y * cosinus;
|
||||
}
|
||||
|
||||
// Token: 0x06000079 RID: 121 RVA: 0x0000510C File Offset: 0x0000350C
|
||||
private static void SwapRenderTexture(ref RenderTexture src, ref RenderTexture dst)
|
||||
{
|
||||
RenderTexture renderTexture = dst;
|
||||
dst = src;
|
||||
src = renderTexture;
|
||||
}
|
||||
|
||||
// Token: 0x0600007A RID: 122 RVA: 0x00005124 File Offset: 0x00003524
|
||||
private static void GetDirectionalBlurPassesFromRadius(RenderTexture blurredFgCoc, float maxRadius, out int blurPass, out int blurAndMergePass)
|
||||
{
|
||||
if (blurredFgCoc == null)
|
||||
{
|
||||
if (maxRadius > 10f)
|
||||
{
|
||||
blurPass = 25;
|
||||
blurAndMergePass = 27;
|
||||
}
|
||||
else if (maxRadius > 5f)
|
||||
{
|
||||
blurPass = 21;
|
||||
blurAndMergePass = 23;
|
||||
}
|
||||
else
|
||||
{
|
||||
blurPass = 17;
|
||||
blurAndMergePass = 19;
|
||||
}
|
||||
}
|
||||
else if (maxRadius > 10f)
|
||||
{
|
||||
blurPass = 26;
|
||||
blurAndMergePass = 28;
|
||||
}
|
||||
else if (maxRadius > 5f)
|
||||
{
|
||||
blurPass = 22;
|
||||
blurAndMergePass = 24;
|
||||
}
|
||||
else
|
||||
{
|
||||
blurPass = 18;
|
||||
blurAndMergePass = 20;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000072 RID: 114
|
||||
private const float kMaxBlur = 35f;
|
||||
|
||||
// Token: 0x04000073 RID: 115
|
||||
[DepthOfField.TopLevelSettings]
|
||||
public DepthOfField.GlobalSettings settings = DepthOfField.GlobalSettings.defaultSettings;
|
||||
|
||||
// Token: 0x04000074 RID: 116
|
||||
[DepthOfField.SettingsGroup]
|
||||
[DepthOfField.AllTweakModes]
|
||||
public DepthOfField.QualitySettings quality = DepthOfField.QualitySettings.presetQualitySettings[3];
|
||||
|
||||
// Token: 0x04000075 RID: 117
|
||||
[DepthOfField.SettingsGroup]
|
||||
public DepthOfField.FocusSettings focus = DepthOfField.FocusSettings.defaultSettings;
|
||||
|
||||
// Token: 0x04000076 RID: 118
|
||||
[DepthOfField.SettingsGroup]
|
||||
public DepthOfField.BokehTextureSettings bokehTexture = DepthOfField.BokehTextureSettings.defaultSettings;
|
||||
|
||||
// Token: 0x04000077 RID: 119
|
||||
[DepthOfField.SettingsGroup]
|
||||
public DepthOfField.BlurSettings blur = DepthOfField.BlurSettings.defaultSettings;
|
||||
|
||||
// Token: 0x04000078 RID: 120
|
||||
[SerializeField]
|
||||
private Shader m_FilmicDepthOfFieldShader;
|
||||
|
||||
// Token: 0x04000079 RID: 121
|
||||
[SerializeField]
|
||||
private Shader m_MedianFilterShader;
|
||||
|
||||
// Token: 0x0400007A RID: 122
|
||||
[SerializeField]
|
||||
private Shader m_TextureBokehShader;
|
||||
|
||||
// Token: 0x0400007B RID: 123
|
||||
private RenderTextureUtility m_RTU = new RenderTextureUtility();
|
||||
|
||||
// Token: 0x0400007C RID: 124
|
||||
private Material m_FilmicDepthOfFieldMaterial;
|
||||
|
||||
// Token: 0x0400007D RID: 125
|
||||
private Material m_MedianFilterMaterial;
|
||||
|
||||
// Token: 0x0400007E RID: 126
|
||||
private Material m_TextureBokehMaterial;
|
||||
|
||||
// Token: 0x0400007F RID: 127
|
||||
private ComputeBuffer m_ComputeBufferDrawArgs;
|
||||
|
||||
// Token: 0x04000080 RID: 128
|
||||
private ComputeBuffer m_ComputeBufferPoints;
|
||||
|
||||
// Token: 0x04000081 RID: 129
|
||||
private DepthOfField.QualitySettings m_CurrentQualitySettings;
|
||||
|
||||
// Token: 0x04000082 RID: 130
|
||||
private float m_LastApertureOrientation;
|
||||
|
||||
// Token: 0x04000083 RID: 131
|
||||
private Vector4 m_OctogonalBokehDirection1;
|
||||
|
||||
// Token: 0x04000084 RID: 132
|
||||
private Vector4 m_OctogonalBokehDirection2;
|
||||
|
||||
// Token: 0x04000085 RID: 133
|
||||
private Vector4 m_OctogonalBokehDirection3;
|
||||
|
||||
// Token: 0x04000086 RID: 134
|
||||
private Vector4 m_OctogonalBokehDirection4;
|
||||
|
||||
// Token: 0x04000087 RID: 135
|
||||
private Vector4 m_HexagonalBokehDirection1;
|
||||
|
||||
// Token: 0x04000088 RID: 136
|
||||
private Vector4 m_HexagonalBokehDirection2;
|
||||
|
||||
// Token: 0x04000089 RID: 137
|
||||
private Vector4 m_HexagonalBokehDirection3;
|
||||
|
||||
// Token: 0x02000020 RID: 32
|
||||
private enum Passes
|
||||
{
|
||||
// Token: 0x0400008B RID: 139
|
||||
BlurAlphaWeighted,
|
||||
// Token: 0x0400008C RID: 140
|
||||
BoxBlur,
|
||||
// Token: 0x0400008D RID: 141
|
||||
DilateFgCocFromColor,
|
||||
// Token: 0x0400008E RID: 142
|
||||
DilateFgCoc,
|
||||
// Token: 0x0400008F RID: 143
|
||||
CaptureCoc,
|
||||
// Token: 0x04000090 RID: 144
|
||||
CaptureCocExplicit,
|
||||
// Token: 0x04000091 RID: 145
|
||||
VisualizeCoc,
|
||||
// Token: 0x04000092 RID: 146
|
||||
VisualizeCocExplicit,
|
||||
// Token: 0x04000093 RID: 147
|
||||
CocPrefilter,
|
||||
// Token: 0x04000094 RID: 148
|
||||
CircleBlur,
|
||||
// Token: 0x04000095 RID: 149
|
||||
CircleBlurWithDilatedFg,
|
||||
// Token: 0x04000096 RID: 150
|
||||
CircleBlurLowQuality,
|
||||
// Token: 0x04000097 RID: 151
|
||||
CircleBlowLowQualityWithDilatedFg,
|
||||
// Token: 0x04000098 RID: 152
|
||||
Merge,
|
||||
// Token: 0x04000099 RID: 153
|
||||
MergeExplicit,
|
||||
// Token: 0x0400009A RID: 154
|
||||
MergeBicubic,
|
||||
// Token: 0x0400009B RID: 155
|
||||
MergeExplicitBicubic,
|
||||
// Token: 0x0400009C RID: 156
|
||||
ShapeLowQuality,
|
||||
// Token: 0x0400009D RID: 157
|
||||
ShapeLowQualityDilateFg,
|
||||
// Token: 0x0400009E RID: 158
|
||||
ShapeLowQualityMerge,
|
||||
// Token: 0x0400009F RID: 159
|
||||
ShapeLowQualityMergeDilateFg,
|
||||
// Token: 0x040000A0 RID: 160
|
||||
ShapeMediumQuality,
|
||||
// Token: 0x040000A1 RID: 161
|
||||
ShapeMediumQualityDilateFg,
|
||||
// Token: 0x040000A2 RID: 162
|
||||
ShapeMediumQualityMerge,
|
||||
// Token: 0x040000A3 RID: 163
|
||||
ShapeMediumQualityMergeDilateFg,
|
||||
// Token: 0x040000A4 RID: 164
|
||||
ShapeHighQuality,
|
||||
// Token: 0x040000A5 RID: 165
|
||||
ShapeHighQualityDilateFg,
|
||||
// Token: 0x040000A6 RID: 166
|
||||
ShapeHighQualityMerge,
|
||||
// Token: 0x040000A7 RID: 167
|
||||
ShapeHighQualityMergeDilateFg
|
||||
}
|
||||
|
||||
// Token: 0x02000021 RID: 33
|
||||
private enum MedianPasses
|
||||
{
|
||||
// Token: 0x040000A9 RID: 169
|
||||
Median3,
|
||||
// Token: 0x040000AA RID: 170
|
||||
Median3X3
|
||||
}
|
||||
|
||||
// Token: 0x02000022 RID: 34
|
||||
private enum BokehTexturesPasses
|
||||
{
|
||||
// Token: 0x040000AC RID: 172
|
||||
Apply,
|
||||
// Token: 0x040000AD RID: 173
|
||||
Collect
|
||||
}
|
||||
|
||||
// Token: 0x02000023 RID: 35
|
||||
public enum TweakMode
|
||||
{
|
||||
// Token: 0x040000AF RID: 175
|
||||
Basic,
|
||||
// Token: 0x040000B0 RID: 176
|
||||
Advanced,
|
||||
// Token: 0x040000B1 RID: 177
|
||||
Explicit
|
||||
}
|
||||
|
||||
// Token: 0x02000024 RID: 36
|
||||
public enum ApertureShape
|
||||
{
|
||||
// Token: 0x040000B3 RID: 179
|
||||
Circular,
|
||||
// Token: 0x040000B4 RID: 180
|
||||
Hexagonal,
|
||||
// Token: 0x040000B5 RID: 181
|
||||
Octogonal
|
||||
}
|
||||
|
||||
// Token: 0x02000025 RID: 37
|
||||
public enum QualityPreset
|
||||
{
|
||||
// Token: 0x040000B7 RID: 183
|
||||
Simple,
|
||||
// Token: 0x040000B8 RID: 184
|
||||
Low,
|
||||
// Token: 0x040000B9 RID: 185
|
||||
Medium,
|
||||
// Token: 0x040000BA RID: 186
|
||||
High,
|
||||
// Token: 0x040000BB RID: 187
|
||||
VeryHigh,
|
||||
// Token: 0x040000BC RID: 188
|
||||
Ultra,
|
||||
// Token: 0x040000BD RID: 189
|
||||
Custom
|
||||
}
|
||||
|
||||
// Token: 0x02000026 RID: 38
|
||||
public enum FilterQuality
|
||||
{
|
||||
// Token: 0x040000BF RID: 191
|
||||
None,
|
||||
// Token: 0x040000C0 RID: 192
|
||||
Normal,
|
||||
// Token: 0x040000C1 RID: 193
|
||||
High
|
||||
}
|
||||
|
||||
// Token: 0x02000027 RID: 39
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class TopLevelSettings : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x02000028 RID: 40
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class SettingsGroup : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x02000029 RID: 41
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class AllTweakModes : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200002A RID: 42
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class Basic : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200002B RID: 43
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class Advanced : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200002C RID: 44
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class Explicit : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200002D RID: 45
|
||||
[Serializable]
|
||||
public struct GlobalSettings
|
||||
{
|
||||
// Token: 0x17000032 RID: 50
|
||||
// (get) Token: 0x06000081 RID: 129 RVA: 0x000051E4 File Offset: 0x000035E4
|
||||
public static DepthOfField.GlobalSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DepthOfField.GlobalSettings
|
||||
{
|
||||
visualizeBluriness = false,
|
||||
tweakMode = DepthOfField.TweakMode.Basic,
|
||||
quality = DepthOfField.QualityPreset.High,
|
||||
apertureShape = DepthOfField.ApertureShape.Circular,
|
||||
apertureOrientation = 0f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000C2 RID: 194
|
||||
[Tooltip("Allows to view where the blur will be applied. Yellow for near blur, blue for far blur.")]
|
||||
public bool visualizeBluriness;
|
||||
|
||||
// Token: 0x040000C3 RID: 195
|
||||
[Tooltip("Setup mode. Use \"Advanced\" if you need more control on blur settings and/or want to use a bokeh texture. \"Explicit\" is the same as \"Advanced\" but makes use of \"Near Plane\" and \"Far Plane\" values instead of \"F-Stop\".")]
|
||||
public DepthOfField.TweakMode tweakMode;
|
||||
|
||||
// Token: 0x040000C4 RID: 196
|
||||
[Tooltip("Quality presets. Use \"Custom\" for more advanced settings.")]
|
||||
public DepthOfField.QualityPreset quality;
|
||||
|
||||
// Token: 0x040000C5 RID: 197
|
||||
[Space]
|
||||
[Tooltip("\"Circular\" is the fastest, followed by \"Hexagonal\" and \"Octogonal\".")]
|
||||
public DepthOfField.ApertureShape apertureShape;
|
||||
|
||||
// Token: 0x040000C6 RID: 198
|
||||
[Range(0f, 179f)]
|
||||
[Tooltip("Rotates the aperture when working with \"Hexagonal\" and \"Ortogonal\".")]
|
||||
public float apertureOrientation;
|
||||
}
|
||||
|
||||
// Token: 0x0200002E RID: 46
|
||||
[Serializable]
|
||||
public struct QualitySettings
|
||||
{
|
||||
// Token: 0x040000C7 RID: 199
|
||||
[Tooltip("Enable this to get smooth bokeh.")]
|
||||
public bool prefilterBlur;
|
||||
|
||||
// Token: 0x040000C8 RID: 200
|
||||
[Tooltip("Applies a median filter for even smoother bokeh.")]
|
||||
public DepthOfField.FilterQuality medianFilter;
|
||||
|
||||
// Token: 0x040000C9 RID: 201
|
||||
[Tooltip("Dilates near blur over in focus area.")]
|
||||
public bool dilateNearBlur;
|
||||
|
||||
// Token: 0x040000CA RID: 202
|
||||
[Tooltip("Uses high quality upsampling.")]
|
||||
public bool highQualityUpsampling;
|
||||
|
||||
// Token: 0x040000CB RID: 203
|
||||
[Tooltip("Prevent haloing from bright in focus region over dark out of focus region.")]
|
||||
public bool preventHaloing;
|
||||
|
||||
// Token: 0x040000CC RID: 204
|
||||
public static DepthOfField.QualitySettings[] presetQualitySettings = new DepthOfField.QualitySettings[]
|
||||
{
|
||||
new DepthOfField.QualitySettings
|
||||
{
|
||||
prefilterBlur = false,
|
||||
medianFilter = DepthOfField.FilterQuality.None,
|
||||
dilateNearBlur = false,
|
||||
highQualityUpsampling = false,
|
||||
preventHaloing = false
|
||||
},
|
||||
new DepthOfField.QualitySettings
|
||||
{
|
||||
prefilterBlur = true,
|
||||
medianFilter = DepthOfField.FilterQuality.None,
|
||||
dilateNearBlur = false,
|
||||
highQualityUpsampling = false,
|
||||
preventHaloing = false
|
||||
},
|
||||
new DepthOfField.QualitySettings
|
||||
{
|
||||
prefilterBlur = true,
|
||||
medianFilter = DepthOfField.FilterQuality.Normal,
|
||||
dilateNearBlur = false,
|
||||
highQualityUpsampling = false,
|
||||
preventHaloing = false
|
||||
},
|
||||
new DepthOfField.QualitySettings
|
||||
{
|
||||
prefilterBlur = true,
|
||||
medianFilter = DepthOfField.FilterQuality.Normal,
|
||||
dilateNearBlur = true,
|
||||
highQualityUpsampling = false,
|
||||
preventHaloing = false
|
||||
},
|
||||
new DepthOfField.QualitySettings
|
||||
{
|
||||
prefilterBlur = true,
|
||||
medianFilter = DepthOfField.FilterQuality.High,
|
||||
dilateNearBlur = true,
|
||||
highQualityUpsampling = false,
|
||||
preventHaloing = true
|
||||
},
|
||||
new DepthOfField.QualitySettings
|
||||
{
|
||||
prefilterBlur = true,
|
||||
medianFilter = DepthOfField.FilterQuality.High,
|
||||
dilateNearBlur = true,
|
||||
highQualityUpsampling = true,
|
||||
preventHaloing = true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x0200002F RID: 47
|
||||
[Serializable]
|
||||
public struct FocusSettings
|
||||
{
|
||||
// Token: 0x17000033 RID: 51
|
||||
// (get) Token: 0x06000083 RID: 131 RVA: 0x000053B0 File Offset: 0x000037B0
|
||||
public static DepthOfField.FocusSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DepthOfField.FocusSettings
|
||||
{
|
||||
transform = null,
|
||||
plane = 0.225f,
|
||||
nearPlane = 0f,
|
||||
farPlane = 1f,
|
||||
fStops = 5f,
|
||||
rangeAdjustment = 0.9f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000CD RID: 205
|
||||
[DepthOfField.Basic]
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Tooltip("Auto-focus on a selected transform.")]
|
||||
public Transform transform;
|
||||
|
||||
// Token: 0x040000CE RID: 206
|
||||
[DepthOfField.Basic]
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Focus distance.")]
|
||||
public float plane;
|
||||
|
||||
// Token: 0x040000CF RID: 207
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Near focus distance.")]
|
||||
public float nearPlane;
|
||||
|
||||
// Token: 0x040000D0 RID: 208
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Far focus distance.")]
|
||||
public float farPlane;
|
||||
|
||||
// Token: 0x040000D1 RID: 209
|
||||
[DepthOfField.Basic]
|
||||
[DepthOfField.Advanced]
|
||||
[Range(0f, 32f)]
|
||||
[Tooltip("Simulates focal ratio. Lower values will result in a narrow depth of field.")]
|
||||
public float fStops;
|
||||
|
||||
// Token: 0x040000D2 RID: 210
|
||||
[DepthOfField.Basic]
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Focus range/spread. Use this to fine-tune the F-Stop range.")]
|
||||
public float rangeAdjustment;
|
||||
}
|
||||
|
||||
// Token: 0x02000030 RID: 48
|
||||
[Serializable]
|
||||
public struct BokehTextureSettings
|
||||
{
|
||||
// Token: 0x17000034 RID: 52
|
||||
// (get) Token: 0x06000084 RID: 132 RVA: 0x0000540C File Offset: 0x0000380C
|
||||
public static DepthOfField.BokehTextureSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DepthOfField.BokehTextureSettings
|
||||
{
|
||||
texture = null,
|
||||
scale = 1f,
|
||||
intensity = 50f,
|
||||
threshold = 2f,
|
||||
spawnHeuristic = 0.15f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000D3 RID: 211
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Tooltip("Adding a texture to this field will enable the use of \"Bokeh Textures\". Use with care. This feature is only available on Shader Model 5 compatible-hardware and performance scale with the amount of bokeh.")]
|
||||
public Texture2D texture;
|
||||
|
||||
// Token: 0x040000D4 RID: 212
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0.01f, 5f)]
|
||||
[Tooltip("Maximum size of bokeh textures on screen.")]
|
||||
public float scale;
|
||||
|
||||
// Token: 0x040000D5 RID: 213
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0.01f, 100f)]
|
||||
[Tooltip("Bokeh brightness.")]
|
||||
public float intensity;
|
||||
|
||||
// Token: 0x040000D6 RID: 214
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0.01f, 50f)]
|
||||
[Tooltip("Controls the amount of bokeh textures. Lower values mean more bokeh splats.")]
|
||||
public float threshold;
|
||||
|
||||
// Token: 0x040000D7 RID: 215
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0.01f, 1f)]
|
||||
[Tooltip("Controls the spawn conditions. Lower values mean more visible bokeh.")]
|
||||
public float spawnHeuristic;
|
||||
}
|
||||
|
||||
// Token: 0x02000031 RID: 49
|
||||
[Serializable]
|
||||
public struct BlurSettings
|
||||
{
|
||||
// Token: 0x17000035 RID: 53
|
||||
// (get) Token: 0x06000085 RID: 133 RVA: 0x0000545C File Offset: 0x0000385C
|
||||
public static DepthOfField.BlurSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DepthOfField.BlurSettings
|
||||
{
|
||||
nearRadius = 20f,
|
||||
farRadius = 20f,
|
||||
boostPoint = 0.75f,
|
||||
nearBoostAmount = 0f,
|
||||
farBoostAmount = 0f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000D8 RID: 216
|
||||
[DepthOfField.Basic]
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 35f)]
|
||||
[Tooltip("Maximum blur radius for the near plane.")]
|
||||
public float nearRadius;
|
||||
|
||||
// Token: 0x040000D9 RID: 217
|
||||
[DepthOfField.Basic]
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 35f)]
|
||||
[Tooltip("Maximum blur radius for the far plane.")]
|
||||
public float farRadius;
|
||||
|
||||
// Token: 0x040000DA RID: 218
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0.5f, 4f)]
|
||||
[Tooltip("Blur luminosity booster threshold for the near and far boost amounts.")]
|
||||
public float boostPoint;
|
||||
|
||||
// Token: 0x040000DB RID: 219
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Boosts luminosity in the near blur.")]
|
||||
public float nearBoostAmount;
|
||||
|
||||
// Token: 0x040000DC RID: 220
|
||||
[DepthOfField.Advanced]
|
||||
[DepthOfField.Explicit]
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Boosts luminosity in the far blur.")]
|
||||
public float farBoostAmount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x02000004 RID: 4
|
||||
[Serializable]
|
||||
public class FXAA : IAntiAliasing
|
||||
{
|
||||
// Token: 0x17000004 RID: 4
|
||||
// (get) Token: 0x0600000C RID: 12 RVA: 0x0000214B File Offset: 0x0000054B
|
||||
private Shader shader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Shader == null)
|
||||
{
|
||||
this.m_Shader = Shader.Find("Hidden/Fast Approximate Anti-aliasing");
|
||||
}
|
||||
return this.m_Shader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000005 RID: 5
|
||||
// (get) Token: 0x0600000D RID: 13 RVA: 0x00002174 File Offset: 0x00000574
|
||||
public Material material
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Material == null)
|
||||
{
|
||||
this.m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(this.shader);
|
||||
}
|
||||
return this.m_Material;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000006 RID: 6
|
||||
// (get) Token: 0x0600000E RID: 14 RVA: 0x0000219E File Offset: 0x0000059E
|
||||
// (set) Token: 0x0600000F RID: 15 RVA: 0x000021A6 File Offset: 0x000005A6
|
||||
public bool validSourceFormat { get; private set; }
|
||||
|
||||
// Token: 0x06000010 RID: 16 RVA: 0x000021AF File Offset: 0x000005AF
|
||||
public void OnEnable(AntiAliasing owner)
|
||||
{
|
||||
if (!ImageEffectHelper.IsSupported(this.shader, true, false, owner))
|
||||
{
|
||||
owner.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000011 RID: 17 RVA: 0x000021CB File Offset: 0x000005CB
|
||||
public void OnDisable()
|
||||
{
|
||||
if (this.m_Material != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000012 RID: 18 RVA: 0x000021E9 File Offset: 0x000005E9
|
||||
public void OnPreCull(Camera camera)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000013 RID: 19 RVA: 0x000021EB File Offset: 0x000005EB
|
||||
public void OnPostRender(Camera camera)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000014 RID: 20 RVA: 0x000021F0 File Offset: 0x000005F0
|
||||
public void OnRenderImage(Camera camera, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
this.material.SetVector("_QualitySettings", new Vector3(this.preset.qualitySettings.subpixelAliasingRemovalAmount, this.preset.qualitySettings.edgeDetectionThreshold, this.preset.qualitySettings.minimumRequiredLuminance));
|
||||
this.material.SetVector("_ConsoleSettings", new Vector4(this.preset.consoleSettings.subpixelSpreadAmount, this.preset.consoleSettings.edgeSharpnessAmount, this.preset.consoleSettings.edgeDetectionThreshold, this.preset.consoleSettings.minimumRequiredLuminance));
|
||||
Graphics.Blit(source, destination, this.material, 0);
|
||||
}
|
||||
|
||||
// Token: 0x04000008 RID: 8
|
||||
private Shader m_Shader;
|
||||
|
||||
// Token: 0x04000009 RID: 9
|
||||
private Material m_Material;
|
||||
|
||||
// Token: 0x0400000A RID: 10
|
||||
[SerializeField]
|
||||
[HideInInspector]
|
||||
public FXAA.Preset preset = FXAA.Preset.defaultPreset;
|
||||
|
||||
// Token: 0x0400000B RID: 11
|
||||
public static FXAA.Preset[] availablePresets = new FXAA.Preset[]
|
||||
{
|
||||
FXAA.Preset.extremePerformancePreset,
|
||||
FXAA.Preset.performancePreset,
|
||||
FXAA.Preset.defaultPreset,
|
||||
FXAA.Preset.qualityPreset,
|
||||
FXAA.Preset.extremeQualityPreset
|
||||
};
|
||||
|
||||
// Token: 0x02000005 RID: 5
|
||||
[Serializable]
|
||||
public struct QualitySettings
|
||||
{
|
||||
// Token: 0x0400000D RID: 13
|
||||
[Tooltip("The amount of desired sub-pixel aliasing removal. Effects the sharpeness of the output.")]
|
||||
[Range(0f, 1f)]
|
||||
public float subpixelAliasingRemovalAmount;
|
||||
|
||||
// Token: 0x0400000E RID: 14
|
||||
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
|
||||
[Range(0.063f, 0.333f)]
|
||||
public float edgeDetectionThreshold;
|
||||
|
||||
// Token: 0x0400000F RID: 15
|
||||
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
|
||||
[Range(0f, 0.0833f)]
|
||||
public float minimumRequiredLuminance;
|
||||
}
|
||||
|
||||
// Token: 0x02000006 RID: 6
|
||||
[Serializable]
|
||||
public struct ConsoleSettings
|
||||
{
|
||||
// Token: 0x04000010 RID: 16
|
||||
[Tooltip("The amount of spread applied to the sampling coordinates while sampling for subpixel information.")]
|
||||
[Range(0.33f, 0.5f)]
|
||||
public float subpixelSpreadAmount;
|
||||
|
||||
// Token: 0x04000011 RID: 17
|
||||
[Tooltip("This value dictates how sharp the edges in the image are kept; a higher value implies sharper edges.")]
|
||||
[Range(2f, 8f)]
|
||||
public float edgeSharpnessAmount;
|
||||
|
||||
// Token: 0x04000012 RID: 18
|
||||
[Tooltip("The minimum amount of local contrast required to qualify a region as containing an edge.")]
|
||||
[Range(0.125f, 0.25f)]
|
||||
public float edgeDetectionThreshold;
|
||||
|
||||
// Token: 0x04000013 RID: 19
|
||||
[Tooltip("Local contrast adaptation value to disallow the algorithm from executing on the darker regions.")]
|
||||
[Range(0.04f, 0.06f)]
|
||||
public float minimumRequiredLuminance;
|
||||
}
|
||||
|
||||
// Token: 0x02000007 RID: 7
|
||||
[Serializable]
|
||||
public struct Preset
|
||||
{
|
||||
// Token: 0x17000007 RID: 7
|
||||
// (get) Token: 0x06000016 RID: 22 RVA: 0x00002319 File Offset: 0x00000719
|
||||
public static FXAA.Preset extremePerformancePreset
|
||||
{
|
||||
get
|
||||
{
|
||||
return FXAA.Preset.s_ExtremePerformance;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000008 RID: 8
|
||||
// (get) Token: 0x06000017 RID: 23 RVA: 0x00002320 File Offset: 0x00000720
|
||||
public static FXAA.Preset performancePreset
|
||||
{
|
||||
get
|
||||
{
|
||||
return FXAA.Preset.s_Performance;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000009 RID: 9
|
||||
// (get) Token: 0x06000018 RID: 24 RVA: 0x00002327 File Offset: 0x00000727
|
||||
public static FXAA.Preset defaultPreset
|
||||
{
|
||||
get
|
||||
{
|
||||
return FXAA.Preset.s_Default;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000A RID: 10
|
||||
// (get) Token: 0x06000019 RID: 25 RVA: 0x0000232E File Offset: 0x0000072E
|
||||
public static FXAA.Preset qualityPreset
|
||||
{
|
||||
get
|
||||
{
|
||||
return FXAA.Preset.s_Quality;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000B RID: 11
|
||||
// (get) Token: 0x0600001A RID: 26 RVA: 0x00002335 File Offset: 0x00000735
|
||||
public static FXAA.Preset extremeQualityPreset
|
||||
{
|
||||
get
|
||||
{
|
||||
return FXAA.Preset.s_ExtremeQuality;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000014 RID: 20
|
||||
[FXAA.Preset.LayoutAttribute]
|
||||
public FXAA.QualitySettings qualitySettings;
|
||||
|
||||
// Token: 0x04000015 RID: 21
|
||||
[FXAA.Preset.LayoutAttribute]
|
||||
public FXAA.ConsoleSettings consoleSettings;
|
||||
|
||||
// Token: 0x04000016 RID: 22
|
||||
private static readonly FXAA.Preset s_ExtremePerformance = new FXAA.Preset
|
||||
{
|
||||
qualitySettings = new FXAA.QualitySettings
|
||||
{
|
||||
subpixelAliasingRemovalAmount = 0f,
|
||||
edgeDetectionThreshold = 0.333f,
|
||||
minimumRequiredLuminance = 0.0833f
|
||||
},
|
||||
consoleSettings = new FXAA.ConsoleSettings
|
||||
{
|
||||
subpixelSpreadAmount = 0.33f,
|
||||
edgeSharpnessAmount = 8f,
|
||||
edgeDetectionThreshold = 0.25f,
|
||||
minimumRequiredLuminance = 0.06f
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x04000017 RID: 23
|
||||
private static readonly FXAA.Preset s_Performance = new FXAA.Preset
|
||||
{
|
||||
qualitySettings = new FXAA.QualitySettings
|
||||
{
|
||||
subpixelAliasingRemovalAmount = 0.25f,
|
||||
edgeDetectionThreshold = 0.25f,
|
||||
minimumRequiredLuminance = 0.0833f
|
||||
},
|
||||
consoleSettings = new FXAA.ConsoleSettings
|
||||
{
|
||||
subpixelSpreadAmount = 0.33f,
|
||||
edgeSharpnessAmount = 8f,
|
||||
edgeDetectionThreshold = 0.125f,
|
||||
minimumRequiredLuminance = 0.06f
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x04000018 RID: 24
|
||||
private static readonly FXAA.Preset s_Default = new FXAA.Preset
|
||||
{
|
||||
qualitySettings = new FXAA.QualitySettings
|
||||
{
|
||||
subpixelAliasingRemovalAmount = 0.75f,
|
||||
edgeDetectionThreshold = 0.166f,
|
||||
minimumRequiredLuminance = 0.0833f
|
||||
},
|
||||
consoleSettings = new FXAA.ConsoleSettings
|
||||
{
|
||||
subpixelSpreadAmount = 0.5f,
|
||||
edgeSharpnessAmount = 8f,
|
||||
edgeDetectionThreshold = 0.125f,
|
||||
minimumRequiredLuminance = 0.05f
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x04000019 RID: 25
|
||||
private static readonly FXAA.Preset s_Quality = new FXAA.Preset
|
||||
{
|
||||
qualitySettings = new FXAA.QualitySettings
|
||||
{
|
||||
subpixelAliasingRemovalAmount = 1f,
|
||||
edgeDetectionThreshold = 0.125f,
|
||||
minimumRequiredLuminance = 0.0625f
|
||||
},
|
||||
consoleSettings = new FXAA.ConsoleSettings
|
||||
{
|
||||
subpixelSpreadAmount = 0.5f,
|
||||
edgeSharpnessAmount = 4f,
|
||||
edgeDetectionThreshold = 0.125f,
|
||||
minimumRequiredLuminance = 0.04f
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x0400001A RID: 26
|
||||
private static readonly FXAA.Preset s_ExtremeQuality = new FXAA.Preset
|
||||
{
|
||||
qualitySettings = new FXAA.QualitySettings
|
||||
{
|
||||
subpixelAliasingRemovalAmount = 1f,
|
||||
edgeDetectionThreshold = 0.063f,
|
||||
minimumRequiredLuminance = 0.0312f
|
||||
},
|
||||
consoleSettings = new FXAA.ConsoleSettings
|
||||
{
|
||||
subpixelSpreadAmount = 0.5f,
|
||||
edgeSharpnessAmount = 2f,
|
||||
edgeDetectionThreshold = 0.125f,
|
||||
minimumRequiredLuminance = 0.04f
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x02000008 RID: 8
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class LayoutAttribute : PropertyAttribute
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x02000009 RID: 9
|
||||
public interface IAntiAliasing
|
||||
{
|
||||
// Token: 0x0600001D RID: 29
|
||||
void OnEnable(AntiAliasing owner);
|
||||
|
||||
// Token: 0x0600001E RID: 30
|
||||
void OnDisable();
|
||||
|
||||
// Token: 0x0600001F RID: 31
|
||||
void OnPreCull(Camera camera);
|
||||
|
||||
// Token: 0x06000020 RID: 32
|
||||
void OnPostRender(Camera camera);
|
||||
|
||||
// Token: 0x06000021 RID: 33
|
||||
void OnRenderImage(Camera camera, RenderTexture source, RenderTexture destination);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x0200001C RID: 28
|
||||
public static class ImageEffectHelper
|
||||
{
|
||||
// Token: 0x0600005C RID: 92 RVA: 0x00003C70 File Offset: 0x00002070
|
||||
public static bool IsSupported(Shader s, bool needDepth, bool needHdr, MonoBehaviour effect)
|
||||
{
|
||||
if (s == null || !s.isSupported)
|
||||
{
|
||||
Debug.LogWarningFormat("Missing shader for image effect {0}", new object[] { effect });
|
||||
return false;
|
||||
}
|
||||
if (!SystemInfo.supportsImageEffects)
|
||||
{
|
||||
Debug.LogWarningFormat("Image effects aren't supported on this device ({0})", new object[] { effect });
|
||||
return false;
|
||||
}
|
||||
if (needDepth && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
|
||||
{
|
||||
Debug.LogWarningFormat("Depth textures aren't supported on this device ({0})", new object[] { effect });
|
||||
return false;
|
||||
}
|
||||
if (needHdr && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf))
|
||||
{
|
||||
Debug.LogWarningFormat("Floating point textures aren't supported on this device ({0})", new object[] { effect });
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x0600005D RID: 93 RVA: 0x00003D1C File Offset: 0x0000211C
|
||||
public static Material CheckShaderAndCreateMaterial(Shader s)
|
||||
{
|
||||
if (s == null || !s.isSupported)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new Material(s)
|
||||
{
|
||||
hideFlags = HideFlags.DontSave
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x17000028 RID: 40
|
||||
// (get) Token: 0x0600005E RID: 94 RVA: 0x00003D52 File Offset: 0x00002152
|
||||
public static bool supportsDX11
|
||||
{
|
||||
get
|
||||
{
|
||||
return SystemInfo.graphicsShaderLevel >= 50 && SystemInfo.supportsComputeShaders;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x02000032 RID: 50
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Image Effects/Cinematic/Lens Aberrations")]
|
||||
public class LensAberrations : MonoBehaviour
|
||||
{
|
||||
// Token: 0x17000036 RID: 54
|
||||
// (get) Token: 0x06000087 RID: 135 RVA: 0x000054D7 File Offset: 0x000038D7
|
||||
public Shader shader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Shader == null)
|
||||
{
|
||||
this.m_Shader = Shader.Find("Hidden/LensAberrations");
|
||||
}
|
||||
return this.m_Shader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000037 RID: 55
|
||||
// (get) Token: 0x06000088 RID: 136 RVA: 0x00005500 File Offset: 0x00003900
|
||||
public Material material
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Material == null)
|
||||
{
|
||||
this.m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(this.shader);
|
||||
}
|
||||
return this.m_Material;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000089 RID: 137 RVA: 0x0000552A File Offset: 0x0000392A
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!ImageEffectHelper.IsSupported(this.shader, false, false, this))
|
||||
{
|
||||
base.enabled = false;
|
||||
}
|
||||
this.m_RTU = new RenderTextureUtility();
|
||||
}
|
||||
|
||||
// Token: 0x0600008A RID: 138 RVA: 0x00005551 File Offset: 0x00003951
|
||||
private void OnDisable()
|
||||
{
|
||||
if (this.m_Material != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
|
||||
}
|
||||
this.m_Material = null;
|
||||
this.m_RTU.ReleaseAllTemporaryRenderTextures();
|
||||
}
|
||||
|
||||
// Token: 0x0600008B RID: 139 RVA: 0x00005584 File Offset: 0x00003984
|
||||
private void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
if (!this.vignette.enabled && !this.chromaticAberration.enabled && !this.distortion.enabled)
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
this.material.shaderKeywords = null;
|
||||
if (this.distortion.enabled)
|
||||
{
|
||||
float num = 1.6f * Math.Max(Mathf.Abs(this.distortion.amount), 1f);
|
||||
float num2 = 0.017453292f * Math.Min(160f, num);
|
||||
float num3 = 2f * Mathf.Tan(num2 * 0.5f);
|
||||
Vector4 vector = new Vector4(this.distortion.centerX, this.distortion.centerY, Mathf.Max(this.distortion.amountX, 0.0001f), Mathf.Max(this.distortion.amountY, 0.0001f));
|
||||
Vector3 vector2 = new Vector3((this.distortion.amount < 0f) ? (1f / num2) : num2, num3, 1f / this.distortion.scale);
|
||||
this.material.EnableKeyword((this.distortion.amount < 0f) ? "UNDISTORT" : "DISTORT");
|
||||
this.material.SetVector("_DistCenterScale", vector);
|
||||
this.material.SetVector("_DistAmount", vector2);
|
||||
}
|
||||
if (this.chromaticAberration.enabled)
|
||||
{
|
||||
this.material.EnableKeyword("CHROMATIC_ABERRATION");
|
||||
Vector4 vector3 = new Vector4(this.chromaticAberration.color.r, this.chromaticAberration.color.g, this.chromaticAberration.color.b, this.chromaticAberration.amount * 0.001f);
|
||||
this.material.SetVector("_ChromaticAberration", vector3);
|
||||
}
|
||||
if (this.vignette.enabled)
|
||||
{
|
||||
this.material.SetColor("_VignetteColor", this.vignette.color);
|
||||
if (this.vignette.blur > 0f)
|
||||
{
|
||||
int num4 = source.width / 2;
|
||||
int num5 = source.height / 2;
|
||||
RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(num4, num5, 0, source.format, FilterMode.Bilinear);
|
||||
RenderTexture temporaryRenderTexture2 = this.m_RTU.GetTemporaryRenderTexture(num4, num5, 0, source.format, FilterMode.Bilinear);
|
||||
this.material.SetVector("_BlurPass", new Vector2(1f / (float)num4, 0f));
|
||||
Graphics.Blit(source, temporaryRenderTexture, this.material, 0);
|
||||
if (this.distortion.enabled)
|
||||
{
|
||||
this.material.DisableKeyword("DISTORT");
|
||||
this.material.DisableKeyword("UNDISTORT");
|
||||
}
|
||||
this.material.SetVector("_BlurPass", new Vector2(0f, 1f / (float)num5));
|
||||
Graphics.Blit(temporaryRenderTexture, temporaryRenderTexture2, this.material, 0);
|
||||
this.material.SetVector("_BlurPass", new Vector2(1f / (float)num4, 0f));
|
||||
Graphics.Blit(temporaryRenderTexture2, temporaryRenderTexture, this.material, 0);
|
||||
this.material.SetVector("_BlurPass", new Vector2(0f, 1f / (float)num5));
|
||||
Graphics.Blit(temporaryRenderTexture, temporaryRenderTexture2, this.material, 0);
|
||||
this.material.SetTexture("_BlurTex", temporaryRenderTexture2);
|
||||
this.material.SetFloat("_VignetteBlur", this.vignette.blur * 3f);
|
||||
this.material.EnableKeyword("VIGNETTE_BLUR");
|
||||
if (this.distortion.enabled)
|
||||
{
|
||||
this.material.EnableKeyword((this.distortion.amount < 0f) ? "UNDISTORT" : "DISTORT");
|
||||
}
|
||||
}
|
||||
if (this.vignette.desaturate > 0f)
|
||||
{
|
||||
this.material.EnableKeyword("VIGNETTE_DESAT");
|
||||
this.material.SetFloat("_VignetteDesat", 1f - this.vignette.desaturate);
|
||||
}
|
||||
this.material.SetVector("_VignetteCenter", this.vignette.center);
|
||||
if (Mathf.Approximately(this.vignette.roundness, 1f))
|
||||
{
|
||||
this.material.EnableKeyword("VIGNETTE_CLASSIC");
|
||||
this.material.SetVector("_VignetteSettings", new Vector2(this.vignette.intensity, this.vignette.smoothness));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.material.EnableKeyword("VIGNETTE_FILMIC");
|
||||
float num6 = (1f - this.vignette.roundness) * 6f + this.vignette.roundness;
|
||||
this.material.SetVector("_VignetteSettings", new Vector3(this.vignette.intensity, this.vignette.smoothness, num6));
|
||||
}
|
||||
}
|
||||
int num7 = 0;
|
||||
if (this.vignette.enabled && this.chromaticAberration.enabled && this.distortion.enabled)
|
||||
{
|
||||
num7 = 7;
|
||||
}
|
||||
else if (this.vignette.enabled && this.chromaticAberration.enabled)
|
||||
{
|
||||
num7 = 5;
|
||||
}
|
||||
else if (this.vignette.enabled && this.distortion.enabled)
|
||||
{
|
||||
num7 = 6;
|
||||
}
|
||||
else if (this.chromaticAberration.enabled && this.distortion.enabled)
|
||||
{
|
||||
num7 = 4;
|
||||
}
|
||||
else if (this.vignette.enabled)
|
||||
{
|
||||
num7 = 3;
|
||||
}
|
||||
else if (this.chromaticAberration.enabled)
|
||||
{
|
||||
num7 = 1;
|
||||
}
|
||||
else if (this.distortion.enabled)
|
||||
{
|
||||
num7 = 2;
|
||||
}
|
||||
Graphics.Blit(source, destination, this.material, num7);
|
||||
this.m_RTU.ReleaseAllTemporaryRenderTextures();
|
||||
}
|
||||
|
||||
// Token: 0x040000DD RID: 221
|
||||
[LensAberrations.SettingsGroup]
|
||||
public LensAberrations.DistortionSettings distortion = LensAberrations.DistortionSettings.defaultSettings;
|
||||
|
||||
// Token: 0x040000DE RID: 222
|
||||
[LensAberrations.SettingsGroup]
|
||||
public LensAberrations.VignetteSettings vignette = LensAberrations.VignetteSettings.defaultSettings;
|
||||
|
||||
// Token: 0x040000DF RID: 223
|
||||
[LensAberrations.SettingsGroup]
|
||||
public LensAberrations.ChromaticAberrationSettings chromaticAberration = LensAberrations.ChromaticAberrationSettings.defaultSettings;
|
||||
|
||||
// Token: 0x040000E0 RID: 224
|
||||
[SerializeField]
|
||||
private Shader m_Shader;
|
||||
|
||||
// Token: 0x040000E1 RID: 225
|
||||
private Material m_Material;
|
||||
|
||||
// Token: 0x040000E2 RID: 226
|
||||
private RenderTextureUtility m_RTU;
|
||||
|
||||
// Token: 0x02000033 RID: 51
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class SettingsGroup : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x02000034 RID: 52
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class AdvancedSetting : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x02000035 RID: 53
|
||||
[Serializable]
|
||||
public struct DistortionSettings
|
||||
{
|
||||
// Token: 0x17000038 RID: 56
|
||||
// (get) Token: 0x0600008E RID: 142 RVA: 0x00005BE4 File Offset: 0x00003FE4
|
||||
public static LensAberrations.DistortionSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new LensAberrations.DistortionSettings
|
||||
{
|
||||
enabled = false,
|
||||
amount = 0f,
|
||||
centerX = 0f,
|
||||
centerY = 0f,
|
||||
amountX = 1f,
|
||||
amountY = 1f,
|
||||
scale = 1f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000E3 RID: 227
|
||||
public bool enabled;
|
||||
|
||||
// Token: 0x040000E4 RID: 228
|
||||
[Range(-100f, 100f)]
|
||||
[Tooltip("Distortion amount.")]
|
||||
public float amount;
|
||||
|
||||
// Token: 0x040000E5 RID: 229
|
||||
[Range(-1f, 1f)]
|
||||
[Tooltip("Distortion center point (X axis).")]
|
||||
public float centerX;
|
||||
|
||||
// Token: 0x040000E6 RID: 230
|
||||
[Range(-1f, 1f)]
|
||||
[Tooltip("Distortion center point (Y axis).")]
|
||||
public float centerY;
|
||||
|
||||
// Token: 0x040000E7 RID: 231
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Amount multiplier on X axis. Set it to 0 to disable distortion on this axis.")]
|
||||
public float amountX;
|
||||
|
||||
// Token: 0x040000E8 RID: 232
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Amount multiplier on Y axis. Set it to 0 to disable distortion on this axis.")]
|
||||
public float amountY;
|
||||
|
||||
// Token: 0x040000E9 RID: 233
|
||||
[Range(0.01f, 5f)]
|
||||
[Tooltip("Global screen scaling.")]
|
||||
public float scale;
|
||||
}
|
||||
|
||||
// Token: 0x02000036 RID: 54
|
||||
[Serializable]
|
||||
public struct VignetteSettings
|
||||
{
|
||||
// Token: 0x17000039 RID: 57
|
||||
// (get) Token: 0x0600008F RID: 143 RVA: 0x00005C4C File Offset: 0x0000404C
|
||||
public static LensAberrations.VignetteSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new LensAberrations.VignetteSettings
|
||||
{
|
||||
enabled = false,
|
||||
color = new Color(0f, 0f, 0f, 1f),
|
||||
center = new Vector2(0.5f, 0.5f),
|
||||
intensity = 1.4f,
|
||||
smoothness = 0.8f,
|
||||
roundness = 1f,
|
||||
blur = 0f,
|
||||
desaturate = 0f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000EA RID: 234
|
||||
public bool enabled;
|
||||
|
||||
// Token: 0x040000EB RID: 235
|
||||
[ColorUsage(false)]
|
||||
[Tooltip("Vignette color. Use the alpha channel for transparency.")]
|
||||
public Color color;
|
||||
|
||||
// Token: 0x040000EC RID: 236
|
||||
[Tooltip("Sets the vignette center point (screen center is [0.5,0.5]).")]
|
||||
public Vector2 center;
|
||||
|
||||
// Token: 0x040000ED RID: 237
|
||||
[Range(0f, 3f)]
|
||||
[Tooltip("Amount of vignetting on screen.")]
|
||||
public float intensity;
|
||||
|
||||
// Token: 0x040000EE RID: 238
|
||||
[Range(0.01f, 3f)]
|
||||
[Tooltip("Smoothness of the vignette borders.")]
|
||||
public float smoothness;
|
||||
|
||||
// Token: 0x040000EF RID: 239
|
||||
[LensAberrations.AdvancedSetting]
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Lower values will make a square-ish vignette.")]
|
||||
public float roundness;
|
||||
|
||||
// Token: 0x040000F0 RID: 240
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Blurs the corners of the screen. Leave this at 0 to disable it.")]
|
||||
public float blur;
|
||||
|
||||
// Token: 0x040000F1 RID: 241
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("Desaturate the corners of the screen. Leave this to 0 to disable it.")]
|
||||
public float desaturate;
|
||||
}
|
||||
|
||||
// Token: 0x02000037 RID: 55
|
||||
[Serializable]
|
||||
public struct ChromaticAberrationSettings
|
||||
{
|
||||
// Token: 0x1700003A RID: 58
|
||||
// (get) Token: 0x06000090 RID: 144 RVA: 0x00005CDC File Offset: 0x000040DC
|
||||
public static LensAberrations.ChromaticAberrationSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new LensAberrations.ChromaticAberrationSettings
|
||||
{
|
||||
enabled = false,
|
||||
color = Color.green,
|
||||
amount = 0f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040000F2 RID: 242
|
||||
public bool enabled;
|
||||
|
||||
// Token: 0x040000F3 RID: 243
|
||||
[ColorUsage(false)]
|
||||
[Tooltip("Channels to apply chromatic aberration to.")]
|
||||
public Color color;
|
||||
|
||||
// Token: 0x040000F4 RID: 244
|
||||
[Range(-50f, 50f)]
|
||||
[Tooltip("Amount of tangential distortion.")]
|
||||
public float amount;
|
||||
}
|
||||
|
||||
// Token: 0x02000038 RID: 56
|
||||
private enum Pass
|
||||
{
|
||||
// Token: 0x040000F6 RID: 246
|
||||
BlurPrePass,
|
||||
// Token: 0x040000F7 RID: 247
|
||||
Chroma,
|
||||
// Token: 0x040000F8 RID: 248
|
||||
Distort,
|
||||
// Token: 0x040000F9 RID: 249
|
||||
Vignette,
|
||||
// Token: 0x040000FA RID: 250
|
||||
ChromaDistort,
|
||||
// Token: 0x040000FB RID: 251
|
||||
ChromaVignette,
|
||||
// Token: 0x040000FC RID: 252
|
||||
DistortVignette,
|
||||
// Token: 0x040000FD RID: 253
|
||||
ChromaDistortVignette
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x0200001D RID: 29
|
||||
public sealed class MinAttribute : PropertyAttribute
|
||||
{
|
||||
// Token: 0x0600005F RID: 95 RVA: 0x00003D68 File Offset: 0x00002168
|
||||
public MinAttribute(float min)
|
||||
{
|
||||
this.min = min;
|
||||
}
|
||||
|
||||
// Token: 0x04000070 RID: 112
|
||||
public readonly float min;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x0200001E RID: 30
|
||||
public class RenderTextureUtility
|
||||
{
|
||||
// Token: 0x06000061 RID: 97 RVA: 0x00003D8C File Offset: 0x0000218C
|
||||
public RenderTexture GetTemporaryRenderTexture(int width, int height, int depthBuffer = 0, RenderTextureFormat format = RenderTextureFormat.ARGBHalf, FilterMode filterMode = FilterMode.Bilinear)
|
||||
{
|
||||
RenderTexture temporary = RenderTexture.GetTemporary(width, height, depthBuffer, format);
|
||||
temporary.filterMode = filterMode;
|
||||
temporary.wrapMode = TextureWrapMode.Clamp;
|
||||
temporary.name = "RenderTextureUtilityTempTexture";
|
||||
this.m_TemporaryRTs.Add(temporary);
|
||||
return temporary;
|
||||
}
|
||||
|
||||
// Token: 0x06000062 RID: 98 RVA: 0x00003DCC File Offset: 0x000021CC
|
||||
public void ReleaseTemporaryRenderTexture(RenderTexture rt)
|
||||
{
|
||||
if (rt == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!this.m_TemporaryRTs.Contains(rt))
|
||||
{
|
||||
Debug.LogErrorFormat("Attempting to remove texture that was not allocated: {0}", new object[] { rt });
|
||||
return;
|
||||
}
|
||||
this.m_TemporaryRTs.Remove(rt);
|
||||
RenderTexture.ReleaseTemporary(rt);
|
||||
}
|
||||
|
||||
// Token: 0x06000063 RID: 99 RVA: 0x00003E20 File Offset: 0x00002220
|
||||
public void ReleaseAllTemporaryRenderTextures()
|
||||
{
|
||||
for (int i = 0; i < this.m_TemporaryRTs.Count; i++)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(this.m_TemporaryRTs[i]);
|
||||
}
|
||||
this.m_TemporaryRTs.Clear();
|
||||
}
|
||||
|
||||
// Token: 0x04000071 RID: 113
|
||||
private List<RenderTexture> m_TemporaryRTs = new List<RenderTexture>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,525 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x0200000A RID: 10
|
||||
[Serializable]
|
||||
public class SMAA : IAntiAliasing
|
||||
{
|
||||
// Token: 0x1700000C RID: 12
|
||||
// (get) Token: 0x06000023 RID: 35 RVA: 0x0000263D File Offset: 0x00000A3D
|
||||
public Shader shader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Shader == null)
|
||||
{
|
||||
this.m_Shader = Shader.Find("Hidden/Subpixel Morphological Anti-aliasing");
|
||||
}
|
||||
return this.m_Shader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000D RID: 13
|
||||
// (get) Token: 0x06000024 RID: 36 RVA: 0x00002666 File Offset: 0x00000A66
|
||||
private Texture2D areaTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_AreaTexture == null)
|
||||
{
|
||||
this.m_AreaTexture = Resources.Load<Texture2D>("AreaTex");
|
||||
}
|
||||
return this.m_AreaTexture;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000E RID: 14
|
||||
// (get) Token: 0x06000025 RID: 37 RVA: 0x0000268F File Offset: 0x00000A8F
|
||||
private Texture2D searchTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_SearchTexture == null)
|
||||
{
|
||||
this.m_SearchTexture = Resources.Load<Texture2D>("SearchTex");
|
||||
}
|
||||
return this.m_SearchTexture;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700000F RID: 15
|
||||
// (get) Token: 0x06000026 RID: 38 RVA: 0x000026B8 File Offset: 0x00000AB8
|
||||
private Material material
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Material == null)
|
||||
{
|
||||
this.m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(this.shader);
|
||||
}
|
||||
return this.m_Material;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000027 RID: 39 RVA: 0x000026E2 File Offset: 0x00000AE2
|
||||
public void OnEnable(AntiAliasing owner)
|
||||
{
|
||||
if (!ImageEffectHelper.IsSupported(this.shader, true, false, owner))
|
||||
{
|
||||
owner.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000028 RID: 40 RVA: 0x00002700 File Offset: 0x00000B00
|
||||
public void OnDisable()
|
||||
{
|
||||
if (this.m_Material != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
|
||||
}
|
||||
if (this.m_Accumulation != null)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_Accumulation);
|
||||
}
|
||||
this.m_Material = null;
|
||||
this.m_Accumulation = null;
|
||||
}
|
||||
|
||||
// Token: 0x06000029 RID: 41 RVA: 0x00002754 File Offset: 0x00000B54
|
||||
public void OnPreCull(Camera camera)
|
||||
{
|
||||
if (this.temporal.UseTemporal())
|
||||
{
|
||||
this.m_ProjectionMatrix = camera.projectionMatrix;
|
||||
this.m_FlipFlop -= 2f * this.m_FlipFlop;
|
||||
Matrix4x4 identity = Matrix4x4.identity;
|
||||
identity.m03 = 0.25f * this.m_FlipFlop * this.temporal.fuzzSize / (float)camera.pixelWidth;
|
||||
identity.m13 = -0.25f * this.m_FlipFlop * this.temporal.fuzzSize / (float)camera.pixelHeight;
|
||||
camera.projectionMatrix = identity * camera.projectionMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600002A RID: 42 RVA: 0x000027FC File Offset: 0x00000BFC
|
||||
public void OnPostRender(Camera camera)
|
||||
{
|
||||
if (this.temporal.UseTemporal())
|
||||
{
|
||||
camera.ResetProjectionMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600002B RID: 43 RVA: 0x00002814 File Offset: 0x00000C14
|
||||
public void OnRenderImage(Camera camera, RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
int pixelWidth = camera.pixelWidth;
|
||||
int pixelHeight = camera.pixelHeight;
|
||||
bool flag = false;
|
||||
SMAA.QualitySettings qualitySettings = this.quality;
|
||||
if (this.settings.quality != SMAA.QualityPreset.Custom)
|
||||
{
|
||||
qualitySettings = SMAA.QualitySettings.presetQualitySettings[(int)this.settings.quality];
|
||||
}
|
||||
int edgeDetectionMethod = (int)this.settings.edgeDetectionMethod;
|
||||
int num = 4;
|
||||
int num2 = 5;
|
||||
int num3 = 6;
|
||||
Matrix4x4 matrix4x = GL.GetGPUProjectionMatrix(this.m_ProjectionMatrix, true) * camera.worldToCameraMatrix;
|
||||
this.material.SetTexture("_AreaTex", this.areaTexture);
|
||||
this.material.SetTexture("_SearchTex", this.searchTexture);
|
||||
this.material.SetVector("_Metrics", new Vector4(1f / (float)pixelWidth, 1f / (float)pixelHeight, (float)pixelWidth, (float)pixelHeight));
|
||||
this.material.SetVector("_Params1", new Vector4(qualitySettings.threshold, qualitySettings.depthThreshold, (float)qualitySettings.maxSearchSteps, (float)qualitySettings.maxDiagonalSearchSteps));
|
||||
this.material.SetVector("_Params2", new Vector2((float)qualitySettings.cornerRounding, qualitySettings.localContrastAdaptationFactor));
|
||||
this.material.SetMatrix("_ReprojectionMatrix", this.m_PreviousViewProjectionMatrix * Matrix4x4.Inverse(matrix4x));
|
||||
float num4 = ((this.m_FlipFlop >= 0f) ? 1f : 2f);
|
||||
this.material.SetVector("_SubsampleIndices", new Vector4(num4, num4, num4, 0f));
|
||||
Shader.DisableKeyword("USE_PREDICATION");
|
||||
if (this.settings.edgeDetectionMethod == SMAA.EdgeDetectionMethod.Depth)
|
||||
{
|
||||
camera.depthTextureMode |= DepthTextureMode.Depth;
|
||||
}
|
||||
else if (this.predication.enabled)
|
||||
{
|
||||
camera.depthTextureMode |= DepthTextureMode.Depth;
|
||||
Shader.EnableKeyword("USE_PREDICATION");
|
||||
this.material.SetVector("_Params3", new Vector3(this.predication.threshold, this.predication.scale, this.predication.strength));
|
||||
}
|
||||
Shader.DisableKeyword("USE_DIAG_SEARCH");
|
||||
Shader.DisableKeyword("USE_CORNER_DETECTION");
|
||||
if (qualitySettings.diagonalDetection)
|
||||
{
|
||||
Shader.EnableKeyword("USE_DIAG_SEARCH");
|
||||
}
|
||||
if (qualitySettings.cornerDetection)
|
||||
{
|
||||
Shader.EnableKeyword("USE_CORNER_DETECTION");
|
||||
}
|
||||
Shader.DisableKeyword("USE_UV_BASED_REPROJECTION");
|
||||
if (this.temporal.UseTemporal())
|
||||
{
|
||||
Shader.EnableKeyword("USE_UV_BASED_REPROJECTION");
|
||||
}
|
||||
if (this.m_Accumulation == null || this.m_Accumulation.width != pixelWidth || this.m_Accumulation.height != pixelHeight)
|
||||
{
|
||||
if (this.m_Accumulation)
|
||||
{
|
||||
RenderTexture.ReleaseTemporary(this.m_Accumulation);
|
||||
}
|
||||
this.m_Accumulation = RenderTexture.GetTemporary(pixelWidth, pixelHeight, 0, source.format, RenderTextureReadWrite.Linear);
|
||||
this.m_Accumulation.hideFlags = HideFlags.HideAndDontSave;
|
||||
flag = true;
|
||||
}
|
||||
RenderTexture renderTexture = this.TempRT(pixelWidth, pixelHeight, source.format);
|
||||
Graphics.Blit(null, renderTexture, this.material, 0);
|
||||
Graphics.Blit(source, renderTexture, this.material, edgeDetectionMethod);
|
||||
if (this.settings.debugPass == SMAA.DebugPass.Edges)
|
||||
{
|
||||
Graphics.Blit(renderTexture, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderTexture renderTexture2 = this.TempRT(pixelWidth, pixelHeight, source.format);
|
||||
Graphics.Blit(null, renderTexture2, this.material, 0);
|
||||
Graphics.Blit(renderTexture, renderTexture2, this.material, num);
|
||||
if (this.settings.debugPass == SMAA.DebugPass.Weights)
|
||||
{
|
||||
Graphics.Blit(renderTexture2, destination);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.material.SetTexture("_BlendTex", renderTexture2);
|
||||
if (this.temporal.UseTemporal())
|
||||
{
|
||||
Graphics.Blit(source, renderTexture, this.material, num2);
|
||||
if (this.settings.debugPass == SMAA.DebugPass.Accumulation)
|
||||
{
|
||||
Graphics.Blit(this.m_Accumulation, destination);
|
||||
}
|
||||
else if (!flag)
|
||||
{
|
||||
this.material.SetTexture("_AccumulationTex", this.m_Accumulation);
|
||||
Graphics.Blit(renderTexture, destination, this.material, num3);
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(renderTexture, destination);
|
||||
}
|
||||
Graphics.Blit(destination, this.m_Accumulation);
|
||||
RenderTexture.active = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Graphics.Blit(source, destination, this.material, num2);
|
||||
}
|
||||
}
|
||||
RenderTexture.ReleaseTemporary(renderTexture2);
|
||||
}
|
||||
RenderTexture.ReleaseTemporary(renderTexture);
|
||||
this.m_PreviousViewProjectionMatrix = matrix4x;
|
||||
}
|
||||
|
||||
// Token: 0x0600002C RID: 44 RVA: 0x00002C74 File Offset: 0x00001074
|
||||
private RenderTexture TempRT(int width, int height, RenderTextureFormat format)
|
||||
{
|
||||
int num = 0;
|
||||
return RenderTexture.GetTemporary(width, height, num, format, RenderTextureReadWrite.Linear);
|
||||
}
|
||||
|
||||
// Token: 0x0400001B RID: 27
|
||||
[SMAA.TopLevelSettings]
|
||||
public SMAA.GlobalSettings settings = SMAA.GlobalSettings.defaultSettings;
|
||||
|
||||
// Token: 0x0400001C RID: 28
|
||||
[SMAA.SettingsGroup]
|
||||
public SMAA.QualitySettings quality = SMAA.QualitySettings.presetQualitySettings[2];
|
||||
|
||||
// Token: 0x0400001D RID: 29
|
||||
[SMAA.SettingsGroup]
|
||||
public SMAA.PredicationSettings predication = SMAA.PredicationSettings.defaultSettings;
|
||||
|
||||
// Token: 0x0400001E RID: 30
|
||||
[SMAA.SettingsGroup]
|
||||
[SMAA.ExperimentalGroup]
|
||||
public SMAA.TemporalSettings temporal = SMAA.TemporalSettings.defaultSettings;
|
||||
|
||||
// Token: 0x0400001F RID: 31
|
||||
private Matrix4x4 m_ProjectionMatrix;
|
||||
|
||||
// Token: 0x04000020 RID: 32
|
||||
private Matrix4x4 m_PreviousViewProjectionMatrix;
|
||||
|
||||
// Token: 0x04000021 RID: 33
|
||||
private float m_FlipFlop = 1f;
|
||||
|
||||
// Token: 0x04000022 RID: 34
|
||||
private RenderTexture m_Accumulation;
|
||||
|
||||
// Token: 0x04000023 RID: 35
|
||||
private Shader m_Shader;
|
||||
|
||||
// Token: 0x04000024 RID: 36
|
||||
private Texture2D m_AreaTexture;
|
||||
|
||||
// Token: 0x04000025 RID: 37
|
||||
private Texture2D m_SearchTexture;
|
||||
|
||||
// Token: 0x04000026 RID: 38
|
||||
private Material m_Material;
|
||||
|
||||
// Token: 0x0200000B RID: 11
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class SettingsGroup : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200000C RID: 12
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class TopLevelSettings : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200000D RID: 13
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class ExperimentalGroup : Attribute
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200000E RID: 14
|
||||
public enum DebugPass
|
||||
{
|
||||
// Token: 0x04000028 RID: 40
|
||||
Off,
|
||||
// Token: 0x04000029 RID: 41
|
||||
Edges,
|
||||
// Token: 0x0400002A RID: 42
|
||||
Weights,
|
||||
// Token: 0x0400002B RID: 43
|
||||
Accumulation
|
||||
}
|
||||
|
||||
// Token: 0x0200000F RID: 15
|
||||
public enum QualityPreset
|
||||
{
|
||||
// Token: 0x0400002D RID: 45
|
||||
Low,
|
||||
// Token: 0x0400002E RID: 46
|
||||
Medium,
|
||||
// Token: 0x0400002F RID: 47
|
||||
High,
|
||||
// Token: 0x04000030 RID: 48
|
||||
Ultra,
|
||||
// Token: 0x04000031 RID: 49
|
||||
Custom
|
||||
}
|
||||
|
||||
// Token: 0x02000010 RID: 16
|
||||
public enum EdgeDetectionMethod
|
||||
{
|
||||
// Token: 0x04000033 RID: 51
|
||||
Luma = 1,
|
||||
// Token: 0x04000034 RID: 52
|
||||
Color,
|
||||
// Token: 0x04000035 RID: 53
|
||||
Depth
|
||||
}
|
||||
|
||||
// Token: 0x02000011 RID: 17
|
||||
[Serializable]
|
||||
public struct GlobalSettings
|
||||
{
|
||||
// Token: 0x17000010 RID: 16
|
||||
// (get) Token: 0x06000030 RID: 48 RVA: 0x00002CA8 File Offset: 0x000010A8
|
||||
public static SMAA.GlobalSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SMAA.GlobalSettings
|
||||
{
|
||||
debugPass = SMAA.DebugPass.Off,
|
||||
quality = SMAA.QualityPreset.High,
|
||||
edgeDetectionMethod = SMAA.EdgeDetectionMethod.Color
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000036 RID: 54
|
||||
[Tooltip("Use this to fine tune your settings when working in Custom quality mode. \"Accumulation\" only works when \"Temporal Filtering\" is enabled.")]
|
||||
public SMAA.DebugPass debugPass;
|
||||
|
||||
// Token: 0x04000037 RID: 55
|
||||
[Tooltip("Low: 60% of the quality.\nMedium: 80% of the quality.\nHigh: 95% of the quality.\nUltra: 99% of the quality (overkill).")]
|
||||
public SMAA.QualityPreset quality;
|
||||
|
||||
// Token: 0x04000038 RID: 56
|
||||
[Tooltip("You've three edge detection methods to choose from: luma, color or depth.\nThey represent different quality/performance and anti-aliasing/sharpness tradeoffs, so our recommendation is for you to choose the one that best suits your particular scenario:\n\n- Depth edge detection is usually the fastest but it may miss some edges.\n- Luma edge detection is usually more expensive than depth edge detection, but catches visible edges that depth edge detection can miss.\n- Color edge detection is usually the most expensive one but catches chroma-only edges.")]
|
||||
public SMAA.EdgeDetectionMethod edgeDetectionMethod;
|
||||
}
|
||||
|
||||
// Token: 0x02000012 RID: 18
|
||||
[Serializable]
|
||||
public struct QualitySettings
|
||||
{
|
||||
// Token: 0x04000039 RID: 57
|
||||
[Tooltip("Enables/Disables diagonal processing.")]
|
||||
public bool diagonalDetection;
|
||||
|
||||
// Token: 0x0400003A RID: 58
|
||||
[Tooltip("Enables/Disables corner detection. Leave this on to avoid blurry corners.")]
|
||||
public bool cornerDetection;
|
||||
|
||||
// Token: 0x0400003B RID: 59
|
||||
[Range(0f, 0.5f)]
|
||||
[Tooltip("Specifies the threshold or sensitivity to edges. Lowering this value you will be able to detect more edges at the expense of performance.\n0.1 is a reasonable value, and allows to catch most visible edges. 0.05 is a rather overkill value, that allows to catch 'em all.")]
|
||||
public float threshold;
|
||||
|
||||
// Token: 0x0400003C RID: 60
|
||||
[Min(0.0001f)]
|
||||
[Tooltip("Specifies the threshold for depth edge detection. Lowering this value you will be able to detect more edges at the expense of performance.")]
|
||||
public float depthThreshold;
|
||||
|
||||
// Token: 0x0400003D RID: 61
|
||||
[Range(0f, 112f)]
|
||||
[Tooltip("Specifies the maximum steps performed in the horizontal/vertical pattern searches, at each side of the pixel.\nIn number of pixels, it's actually the double. So the maximum line length perfectly handled by, for example 16, is 64 (by perfectly, we meant that longer lines won't look as good, but still antialiased).")]
|
||||
public int maxSearchSteps;
|
||||
|
||||
// Token: 0x0400003E RID: 62
|
||||
[Range(0f, 20f)]
|
||||
[Tooltip("Specifies the maximum steps performed in the diagonal pattern searches, at each side of the pixel. In this case we jump one pixel at time, instead of two.\nOn high-end machines it is cheap (between a 0.8x and 0.9x slower for 16 steps), but it can have a significant impact on older machines.")]
|
||||
public int maxDiagonalSearchSteps;
|
||||
|
||||
// Token: 0x0400003F RID: 63
|
||||
[Range(0f, 100f)]
|
||||
[Tooltip("Specifies how much sharp corners will be rounded.")]
|
||||
public int cornerRounding;
|
||||
|
||||
// Token: 0x04000040 RID: 64
|
||||
[Min(0f)]
|
||||
[Tooltip("If there is an neighbor edge that has a local contrast factor times bigger contrast than current edge, current edge will be discarded.\nThis allows to eliminate spurious crossing edges, and is based on the fact that, if there is too much contrast in a direction, that will hide perceptually contrast in the other neighbors.")]
|
||||
public float localContrastAdaptationFactor;
|
||||
|
||||
// Token: 0x04000041 RID: 65
|
||||
public static SMAA.QualitySettings[] presetQualitySettings = new SMAA.QualitySettings[]
|
||||
{
|
||||
new SMAA.QualitySettings
|
||||
{
|
||||
diagonalDetection = false,
|
||||
cornerDetection = false,
|
||||
threshold = 0.15f,
|
||||
depthThreshold = 0.01f,
|
||||
maxSearchSteps = 4,
|
||||
maxDiagonalSearchSteps = 8,
|
||||
cornerRounding = 25,
|
||||
localContrastAdaptationFactor = 2f
|
||||
},
|
||||
new SMAA.QualitySettings
|
||||
{
|
||||
diagonalDetection = false,
|
||||
cornerDetection = false,
|
||||
threshold = 0.1f,
|
||||
depthThreshold = 0.01f,
|
||||
maxSearchSteps = 8,
|
||||
maxDiagonalSearchSteps = 8,
|
||||
cornerRounding = 25,
|
||||
localContrastAdaptationFactor = 2f
|
||||
},
|
||||
new SMAA.QualitySettings
|
||||
{
|
||||
diagonalDetection = true,
|
||||
cornerDetection = true,
|
||||
threshold = 0.1f,
|
||||
depthThreshold = 0.01f,
|
||||
maxSearchSteps = 16,
|
||||
maxDiagonalSearchSteps = 8,
|
||||
cornerRounding = 25,
|
||||
localContrastAdaptationFactor = 2f
|
||||
},
|
||||
new SMAA.QualitySettings
|
||||
{
|
||||
diagonalDetection = true,
|
||||
cornerDetection = true,
|
||||
threshold = 0.05f,
|
||||
depthThreshold = 0.01f,
|
||||
maxSearchSteps = 32,
|
||||
maxDiagonalSearchSteps = 16,
|
||||
cornerRounding = 25,
|
||||
localContrastAdaptationFactor = 2f
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x02000013 RID: 19
|
||||
[Serializable]
|
||||
public struct TemporalSettings
|
||||
{
|
||||
// Token: 0x06000032 RID: 50 RVA: 0x00002E7B File Offset: 0x0000127B
|
||||
public bool UseTemporal()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
// Token: 0x17000011 RID: 17
|
||||
// (get) Token: 0x06000033 RID: 51 RVA: 0x00002E84 File Offset: 0x00001284
|
||||
public static SMAA.TemporalSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SMAA.TemporalSettings
|
||||
{
|
||||
enabled = false,
|
||||
fuzzSize = 2f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000042 RID: 66
|
||||
[Tooltip("Temporal filtering makes it possible for the SMAA algorithm to benefit from minute subpixel information available that has been accumulated over many frames.")]
|
||||
public bool enabled;
|
||||
|
||||
// Token: 0x04000043 RID: 67
|
||||
[Range(0.5f, 10f)]
|
||||
[Tooltip("The size of the fuzz-displacement (jitter) in pixels applied to the camera's perspective projection matrix.\nUsed for 2x temporal anti-aliasing.")]
|
||||
public float fuzzSize;
|
||||
}
|
||||
|
||||
// Token: 0x02000014 RID: 20
|
||||
[Serializable]
|
||||
public struct PredicationSettings
|
||||
{
|
||||
// Token: 0x17000012 RID: 18
|
||||
// (get) Token: 0x06000034 RID: 52 RVA: 0x00002EB0 File Offset: 0x000012B0
|
||||
public static SMAA.PredicationSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new SMAA.PredicationSettings
|
||||
{
|
||||
enabled = false,
|
||||
threshold = 0.01f,
|
||||
scale = 2f,
|
||||
strength = 0.4f
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000044 RID: 68
|
||||
[Tooltip("Predicated thresholding allows to better preserve texture details and to improve performance, by decreasing the number of detected edges using an additional buffer (the detph buffer).\nIt locally decreases the luma or color threshold if an edge is found in an additional buffer (so the global threshold can be higher).")]
|
||||
public bool enabled;
|
||||
|
||||
// Token: 0x04000045 RID: 69
|
||||
[Min(0.0001f)]
|
||||
[Tooltip("Threshold to be used in the additional predication buffer.")]
|
||||
public float threshold;
|
||||
|
||||
// Token: 0x04000046 RID: 70
|
||||
[Range(1f, 5f)]
|
||||
[Tooltip("How much to scale the global threshold used for luma or color edge detection when using predication.")]
|
||||
public float scale;
|
||||
|
||||
// Token: 0x04000047 RID: 71
|
||||
[Range(0f, 1f)]
|
||||
[Tooltip("How much to locally decrease the threshold.")]
|
||||
public float strength;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,758 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityStandardAssets.CinematicEffects
|
||||
{
|
||||
// Token: 0x02000080 RID: 128
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(Camera))]
|
||||
[AddComponentMenu("Image Effects/Rendering/Screen Space Reflection")]
|
||||
[ImageEffectAllowedInSceneView]
|
||||
public class ScreenSpaceReflection : MonoBehaviour
|
||||
{
|
||||
// Token: 0x17000059 RID: 89
|
||||
// (get) Token: 0x06000185 RID: 389 RVA: 0x000108B7 File Offset: 0x0000ECB7
|
||||
public Shader shader
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Shader == null)
|
||||
{
|
||||
this.m_Shader = Shader.Find("Hidden/ScreenSpaceReflection");
|
||||
}
|
||||
return this.m_Shader;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005A RID: 90
|
||||
// (get) Token: 0x06000186 RID: 390 RVA: 0x000108E0 File Offset: 0x0000ECE0
|
||||
public Material material
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.m_Material == null)
|
||||
{
|
||||
this.m_Material = ImageEffectHelper.CheckShaderAndCreateMaterial(this.shader);
|
||||
}
|
||||
return this.m_Material;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000187 RID: 391 RVA: 0x0001090A File Offset: 0x0000ED0A
|
||||
private void OnEnable()
|
||||
{
|
||||
if (!ImageEffectHelper.IsSupported(this.shader, false, true, this))
|
||||
{
|
||||
base.enabled = false;
|
||||
return;
|
||||
}
|
||||
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
|
||||
}
|
||||
|
||||
// Token: 0x06000188 RID: 392 RVA: 0x0001093C File Offset: 0x0000ED3C
|
||||
private void OnDisable()
|
||||
{
|
||||
if (this.m_Material)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
|
||||
}
|
||||
if (this.m_PreviousDepthBuffer)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_PreviousDepthBuffer);
|
||||
}
|
||||
if (this.m_PreviousHitBuffer)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_PreviousHitBuffer);
|
||||
}
|
||||
if (this.m_PreviousReflectionBuffer)
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_PreviousReflectionBuffer);
|
||||
}
|
||||
this.m_Material = null;
|
||||
this.m_PreviousDepthBuffer = null;
|
||||
this.m_PreviousHitBuffer = null;
|
||||
this.m_PreviousReflectionBuffer = null;
|
||||
}
|
||||
|
||||
// Token: 0x06000189 RID: 393 RVA: 0x000109D4 File Offset: 0x0000EDD4
|
||||
private void PreparePreviousBuffers(int w, int h)
|
||||
{
|
||||
if (this.m_PreviousDepthBuffer != null && (this.m_PreviousDepthBuffer.width != w || this.m_PreviousDepthBuffer.height != h))
|
||||
{
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_PreviousDepthBuffer);
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_PreviousHitBuffer);
|
||||
global::UnityEngine.Object.DestroyImmediate(this.m_PreviousReflectionBuffer);
|
||||
this.m_PreviousDepthBuffer = null;
|
||||
this.m_PreviousHitBuffer = null;
|
||||
this.m_PreviousReflectionBuffer = null;
|
||||
}
|
||||
if (this.m_PreviousDepthBuffer == null)
|
||||
{
|
||||
this.m_PreviousDepthBuffer = new RenderTexture(w, h, 0, RenderTextureFormat.RFloat);
|
||||
this.m_PreviousHitBuffer = new RenderTexture(w, h, 0, RenderTextureFormat.ARGBHalf);
|
||||
this.m_PreviousReflectionBuffer = new RenderTexture(w, h, 0, RenderTextureFormat.ARGBHalf);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600018A RID: 394 RVA: 0x00010A8C File Offset: 0x0000EE8C
|
||||
[ImageEffectOpaque]
|
||||
public void OnRenderImage(RenderTexture source, RenderTexture destination)
|
||||
{
|
||||
if (this.material == null)
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
if (this.m_HasInformationFromPreviousFrame)
|
||||
{
|
||||
this.m_HasInformationFromPreviousFrame = this.m_PreviousDepthBuffer != null && source.width == this.m_PreviousDepthBuffer.width && source.height == this.m_PreviousDepthBuffer.height;
|
||||
}
|
||||
bool flag = this.m_HasInformationFromPreviousFrame && (double)this.settings.advancedSettings.temporalFilterStrength > 0.0;
|
||||
this.m_HasInformationFromPreviousFrame = false;
|
||||
if (Camera.current.actualRenderingPath != RenderingPath.DeferredShading)
|
||||
{
|
||||
Graphics.Blit(source, destination);
|
||||
return;
|
||||
}
|
||||
int num = source.width;
|
||||
int num2 = source.height;
|
||||
RenderTexture temporaryRenderTexture = this.m_RTU.GetTemporaryRenderTexture(num, num2, 0, RenderTextureFormat.ARGB32, FilterMode.Bilinear);
|
||||
temporaryRenderTexture.filterMode = FilterMode.Point;
|
||||
Graphics.Blit(source, temporaryRenderTexture, this.material, 12);
|
||||
this.material.SetTexture("_NormalAndRoughnessTexture", temporaryRenderTexture);
|
||||
float num3 = (float)source.width;
|
||||
float num4 = (float)source.height;
|
||||
Vector2 vector = new Vector2(num3 / (float)num, num4 / (float)num2);
|
||||
int num5 = ((this.settings.advancedSettings.resolution != ScreenSpaceReflection.SSRResolution.FullResolution) ? 2 : 1);
|
||||
num /= num5;
|
||||
num2 /= num5;
|
||||
this.material.SetVector("_SourceToTempUV", new Vector4(vector.x, vector.y, 1f / vector.x, 1f / vector.y));
|
||||
Matrix4x4 projectionMatrix = base.GetComponent<Camera>().projectionMatrix;
|
||||
Vector4 vector2 = new Vector4(-2f / (num3 * projectionMatrix[0]), -2f / (num4 * projectionMatrix[5]), (1f - projectionMatrix[2]) / projectionMatrix[0], (1f + projectionMatrix[6]) / projectionMatrix[5]);
|
||||
float num6 = num3 / (-2f * (float)Math.Tan((double)base.GetComponent<Camera>().fieldOfView / 180.0 * 3.141592653589793 * 0.5));
|
||||
this.material.SetFloat("_PixelsPerMeterAtOneMeter", num6);
|
||||
float num7 = num3 / 2f;
|
||||
float num8 = num4 / 2f;
|
||||
Matrix4x4 matrix4x = default(Matrix4x4);
|
||||
matrix4x.SetRow(0, new Vector4(num7, 0f, 0f, num7));
|
||||
matrix4x.SetRow(1, new Vector4(0f, num8, 0f, num8));
|
||||
matrix4x.SetRow(2, new Vector4(0f, 0f, 1f, 0f));
|
||||
matrix4x.SetRow(3, new Vector4(0f, 0f, 0f, 1f));
|
||||
Matrix4x4 matrix4x2 = matrix4x * projectionMatrix;
|
||||
this.material.SetVector("_ScreenSize", new Vector2(num3, num4));
|
||||
this.material.SetVector("_ReflectionBufferSize", new Vector2((float)num, (float)num2));
|
||||
Vector2 vector3 = new Vector2((float)(1.0 / (double)num3), (float)(1.0 / (double)num4));
|
||||
Matrix4x4 worldToCameraMatrix = base.GetComponent<Camera>().worldToCameraMatrix;
|
||||
Matrix4x4 inverse = base.GetComponent<Camera>().worldToCameraMatrix.inverse;
|
||||
this.material.SetVector("_InvScreenSize", vector3);
|
||||
this.material.SetVector("_ProjInfo", vector2);
|
||||
this.material.SetMatrix("_ProjectToPixelMatrix", matrix4x2);
|
||||
this.material.SetMatrix("_WorldToCameraMatrix", worldToCameraMatrix);
|
||||
this.material.SetMatrix("_CameraToWorldMatrix", inverse);
|
||||
this.material.SetInt("_EnableRefine", (!this.settings.advancedSettings.reduceBanding) ? 0 : 1);
|
||||
this.material.SetInt("_AdditiveReflection", (!this.settings.basicSettings.additiveReflection) ? 0 : 1);
|
||||
this.material.SetInt("_ImproveCorners", (!this.settings.advancedSettings.improveCorners) ? 0 : 1);
|
||||
this.material.SetFloat("_ScreenEdgeFading", this.settings.basicSettings.screenEdgeFading);
|
||||
this.material.SetFloat("_MipBias", this.mipBias);
|
||||
this.material.SetInt("_UseOcclusion", (!this.useOcclusion) ? 0 : 1);
|
||||
this.material.SetInt("_BilateralUpsampling", (!this.settings.advancedSettings.bilateralUpsample) ? 0 : 1);
|
||||
this.material.SetInt("_FallbackToSky", (!this.fallbackToSky) ? 0 : 1);
|
||||
this.material.SetInt("_TreatBackfaceHitAsMiss", (!this.settings.advancedSettings.treatBackfaceHitAsMiss) ? 0 : 1);
|
||||
this.material.SetInt("_AllowBackwardsRays", (!this.settings.advancedSettings.allowBackwardsRays) ? 0 : 1);
|
||||
this.material.SetInt("_TraceEverywhere", (!this.settings.advancedSettings.traceEverywhere) ? 0 : 1);
|
||||
float farClipPlane = base.GetComponent<Camera>().farClipPlane;
|
||||
float nearClipPlane = base.GetComponent<Camera>().nearClipPlane;
|
||||
Vector3 vector4 = ((!float.IsPositiveInfinity(farClipPlane)) ? new Vector3(nearClipPlane * farClipPlane, nearClipPlane - farClipPlane, farClipPlane) : new Vector3(nearClipPlane, -1f, 1f));
|
||||
this.material.SetVector("_CameraClipInfo", vector4);
|
||||
this.material.SetFloat("_MaxRayTraceDistance", this.settings.basicSettings.maxDistance);
|
||||
this.material.SetFloat("_FadeDistance", this.settings.basicSettings.fadeDistance);
|
||||
this.material.SetFloat("_LayerThickness", this.settings.reflectionSettings.widthModifier);
|
||||
RenderTextureFormat renderTextureFormat = ((!this.settings.basicSettings.enableHDR) ? RenderTextureFormat.ARGB32 : RenderTextureFormat.ARGBHalf);
|
||||
RenderTexture[] array = new RenderTexture[5];
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
if (this.fullResolutionFiltering)
|
||||
{
|
||||
array[i] = this.m_RTU.GetTemporaryRenderTexture(num, num2, 0, renderTextureFormat, FilterMode.Bilinear);
|
||||
}
|
||||
else
|
||||
{
|
||||
array[i] = this.m_RTU.GetTemporaryRenderTexture(num >> i, num2 >> i, 0, renderTextureFormat, FilterMode.Bilinear);
|
||||
}
|
||||
array[i].filterMode = ((!this.settings.advancedSettings.bilateralUpsample) ? FilterMode.Bilinear : FilterMode.Point);
|
||||
}
|
||||
this.material.SetInt("_EnableSSR", 1);
|
||||
this.material.SetInt("_DebugMode", (int)this.settings.debugSettings.debugMode);
|
||||
this.material.SetInt("_TraceBehindObjects", (!this.settings.advancedSettings.traceBehindObjects) ? 0 : 1);
|
||||
this.material.SetInt("_MaxSteps", this.settings.reflectionSettings.maxSteps);
|
||||
RenderTexture temporaryRenderTexture2 = this.m_RTU.GetTemporaryRenderTexture(num, num2, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
|
||||
int num9 = Mathf.Clamp(this.settings.reflectionSettings.rayStepSize, 0, 4);
|
||||
Graphics.Blit(source, temporaryRenderTexture2, this.material, num9);
|
||||
this.material.SetTexture("_HitPointTexture", temporaryRenderTexture2);
|
||||
Graphics.Blit(source, array[0], this.material, 11);
|
||||
this.material.SetTexture("_ReflectionTexture0", array[0]);
|
||||
this.material.SetInt("_FullResolutionFiltering", (!this.fullResolutionFiltering) ? 0 : 1);
|
||||
this.material.SetFloat("_MaxRoughness", 1f - this.settings.reflectionSettings.smoothFallbackThreshold);
|
||||
this.material.SetFloat("_RoughnessFalloffRange", this.settings.reflectionSettings.smoothFallbackDistance);
|
||||
this.material.SetFloat("_SSRMultiplier", this.settings.basicSettings.reflectionMultiplier);
|
||||
RenderTexture[] array2 = new RenderTexture[5];
|
||||
if (this.settings.advancedSettings.bilateralUpsample && this.useEdgeDetector)
|
||||
{
|
||||
array2[0] = this.m_RTU.GetTemporaryRenderTexture(num, num2, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
|
||||
Graphics.Blit(source, array2[0], this.material, 9);
|
||||
for (int j = 1; j < 5; j++)
|
||||
{
|
||||
array2[j] = this.m_RTU.GetTemporaryRenderTexture(num >> j, num2 >> j, 0, RenderTextureFormat.ARGBHalf, FilterMode.Bilinear);
|
||||
this.material.SetInt("_LastMip", j - 1);
|
||||
Graphics.Blit(array2[j - 1], array2[j], this.material, 10);
|
||||
}
|
||||
}
|
||||
if (this.settings.advancedSettings.highQualitySharpReflections)
|
||||
{
|
||||
RenderTexture temporaryRenderTexture3 = this.m_RTU.GetTemporaryRenderTexture(array[0].width, array[0].height, 0, array[0].format, FilterMode.Bilinear);
|
||||
temporaryRenderTexture3.filterMode = array[0].filterMode;
|
||||
array[0].filterMode = FilterMode.Bilinear;
|
||||
Graphics.Blit(array[0], temporaryRenderTexture3, this.material, 16);
|
||||
this.m_RTU.ReleaseTemporaryRenderTexture(array[0]);
|
||||
array[0] = temporaryRenderTexture3;
|
||||
this.material.SetTexture("_ReflectionTexture0", array[0]);
|
||||
}
|
||||
for (int k = 1; k < 5; k++)
|
||||
{
|
||||
RenderTexture renderTexture = array[k - 1];
|
||||
RenderTexture renderTexture2;
|
||||
if (this.fullResolutionFiltering)
|
||||
{
|
||||
renderTexture2 = this.m_RTU.GetTemporaryRenderTexture(num, num2, 0, renderTextureFormat, FilterMode.Bilinear);
|
||||
}
|
||||
else
|
||||
{
|
||||
int num10 = k;
|
||||
renderTexture2 = this.m_RTU.GetTemporaryRenderTexture(num >> num10, num2 >> k - 1, 0, renderTextureFormat, FilterMode.Bilinear);
|
||||
}
|
||||
for (int l = 0; l < ((!this.fullResolutionFiltering) ? 1 : (k * k)); l++)
|
||||
{
|
||||
this.material.SetVector("_Axis", new Vector4(1f, 0f, 0f, 0f));
|
||||
this.material.SetFloat("_CurrentMipLevel", (float)k - 1f);
|
||||
Graphics.Blit(renderTexture, renderTexture2, this.material, 6);
|
||||
this.material.SetVector("_Axis", new Vector4(0f, 1f, 0f, 0f));
|
||||
renderTexture = array[k];
|
||||
Graphics.Blit(renderTexture2, renderTexture, this.material, 6);
|
||||
}
|
||||
this.material.SetTexture("_ReflectionTexture" + k, array[k]);
|
||||
this.m_RTU.ReleaseTemporaryRenderTexture(renderTexture2);
|
||||
}
|
||||
if (this.settings.advancedSettings.bilateralUpsample && this.useEdgeDetector)
|
||||
{
|
||||
for (int m = 0; m < 5; m++)
|
||||
{
|
||||
this.material.SetTexture("_EdgeTexture" + m, array2[m]);
|
||||
}
|
||||
}
|
||||
this.material.SetInt("_UseEdgeDetector", (!this.useEdgeDetector) ? 0 : 1);
|
||||
RenderTexture temporaryRenderTexture4 = this.m_RTU.GetTemporaryRenderTexture(source.width, source.height, 0, RenderTextureFormat.RHalf, FilterMode.Bilinear);
|
||||
if (this.computeAverageRayDistance)
|
||||
{
|
||||
Graphics.Blit(source, temporaryRenderTexture4, this.material, 15);
|
||||
}
|
||||
this.material.SetInt("_UseAverageRayDistance", (!this.computeAverageRayDistance) ? 0 : 1);
|
||||
this.material.SetTexture("_AverageRayDistanceBuffer", temporaryRenderTexture4);
|
||||
bool flag2 = this.settings.advancedSettings.resolution == ScreenSpaceReflection.SSRResolution.HalfTraceFullResolve;
|
||||
RenderTexture temporaryRenderTexture5 = this.m_RTU.GetTemporaryRenderTexture((!flag2) ? num : source.width, (!flag2) ? num2 : source.height, 0, renderTextureFormat, FilterMode.Bilinear);
|
||||
this.material.SetFloat("_FresnelFade", this.settings.reflectionSettings.fresnelFade);
|
||||
this.material.SetFloat("_FresnelFadePower", this.settings.reflectionSettings.fresnelFadePower);
|
||||
this.material.SetFloat("_DistanceBlur", this.settings.reflectionSettings.distanceBlur);
|
||||
this.material.SetInt("_HalfResolution", (this.settings.advancedSettings.resolution == ScreenSpaceReflection.SSRResolution.FullResolution) ? 0 : 1);
|
||||
this.material.SetInt("_HighlightSuppression", (!this.settings.advancedSettings.highlightSuppression) ? 0 : 1);
|
||||
Graphics.Blit(array[0], temporaryRenderTexture5, this.material, 7);
|
||||
this.material.SetTexture("_FinalReflectionTexture", temporaryRenderTexture5);
|
||||
RenderTexture temporaryRenderTexture6 = this.m_RTU.GetTemporaryRenderTexture((!flag2) ? num : source.width, (!flag2) ? num2 : source.height, 0, renderTextureFormat, FilterMode.Bilinear);
|
||||
if (flag)
|
||||
{
|
||||
this.material.SetInt("_UseTemporalConfidence", (!this.settings.advancedSettings.useTemporalConfidence) ? 0 : 1);
|
||||
this.material.SetFloat("_TemporalAlpha", this.settings.advancedSettings.temporalFilterStrength);
|
||||
this.material.SetMatrix("_CurrentCameraToPreviousCamera", this.m_PreviousWorldToCameraMatrix * inverse);
|
||||
this.material.SetTexture("_PreviousReflectionTexture", this.m_PreviousReflectionBuffer);
|
||||
this.material.SetTexture("_PreviousCSZBuffer", this.m_PreviousDepthBuffer);
|
||||
Graphics.Blit(source, temporaryRenderTexture6, this.material, 14);
|
||||
this.material.SetTexture("_FinalReflectionTexture", temporaryRenderTexture6);
|
||||
}
|
||||
if ((double)this.settings.advancedSettings.temporalFilterStrength > 0.0)
|
||||
{
|
||||
this.m_PreviousWorldToCameraMatrix = worldToCameraMatrix;
|
||||
this.PreparePreviousBuffers(source.width, source.height);
|
||||
Graphics.Blit(source, this.m_PreviousDepthBuffer, this.material, 13);
|
||||
Graphics.Blit(temporaryRenderTexture2, this.m_PreviousHitBuffer);
|
||||
Graphics.Blit((!flag) ? temporaryRenderTexture5 : temporaryRenderTexture6, this.m_PreviousReflectionBuffer);
|
||||
this.m_HasInformationFromPreviousFrame = true;
|
||||
}
|
||||
Graphics.Blit(source, destination, this.material, 5);
|
||||
this.m_RTU.ReleaseAllTemporaryRenderTextures();
|
||||
}
|
||||
|
||||
// Token: 0x04000322 RID: 802
|
||||
[SerializeField]
|
||||
public ScreenSpaceReflection.SSRSettings settings = ScreenSpaceReflection.SSRSettings.defaultSettings;
|
||||
|
||||
// Token: 0x04000323 RID: 803
|
||||
[Tooltip("Enable to try and bypass expensive bilateral upsampling away from edges. There is a slight performance hit for generating the edge buffers, but a potentially high performance savings from bypassing bilateral upsampling where it is unneeded. Test on your target platforms to see if performance improves.")]
|
||||
private bool useEdgeDetector;
|
||||
|
||||
// Token: 0x04000324 RID: 804
|
||||
[Range(-4f, 4f)]
|
||||
private float mipBias;
|
||||
|
||||
// Token: 0x04000325 RID: 805
|
||||
private bool useOcclusion = true;
|
||||
|
||||
// Token: 0x04000326 RID: 806
|
||||
private bool fullResolutionFiltering;
|
||||
|
||||
// Token: 0x04000327 RID: 807
|
||||
private bool fallbackToSky;
|
||||
|
||||
// Token: 0x04000328 RID: 808
|
||||
private bool computeAverageRayDistance;
|
||||
|
||||
// Token: 0x04000329 RID: 809
|
||||
private bool m_HasInformationFromPreviousFrame;
|
||||
|
||||
// Token: 0x0400032A RID: 810
|
||||
private Matrix4x4 m_PreviousWorldToCameraMatrix;
|
||||
|
||||
// Token: 0x0400032B RID: 811
|
||||
private RenderTexture m_PreviousDepthBuffer;
|
||||
|
||||
// Token: 0x0400032C RID: 812
|
||||
private RenderTexture m_PreviousHitBuffer;
|
||||
|
||||
// Token: 0x0400032D RID: 813
|
||||
private RenderTexture m_PreviousReflectionBuffer;
|
||||
|
||||
// Token: 0x0400032E RID: 814
|
||||
[NonSerialized]
|
||||
private RenderTextureUtility m_RTU = new RenderTextureUtility();
|
||||
|
||||
// Token: 0x0400032F RID: 815
|
||||
[SerializeField]
|
||||
private Shader m_Shader;
|
||||
|
||||
// Token: 0x04000330 RID: 816
|
||||
private Material m_Material;
|
||||
|
||||
// Token: 0x02000081 RID: 129
|
||||
public enum SSRDebugMode
|
||||
{
|
||||
// Token: 0x04000332 RID: 818
|
||||
None,
|
||||
// Token: 0x04000333 RID: 819
|
||||
IncomingRadiance,
|
||||
// Token: 0x04000334 RID: 820
|
||||
SSRResult,
|
||||
// Token: 0x04000335 RID: 821
|
||||
FinalGlossyTerm,
|
||||
// Token: 0x04000336 RID: 822
|
||||
SSRMask,
|
||||
// Token: 0x04000337 RID: 823
|
||||
Roughness,
|
||||
// Token: 0x04000338 RID: 824
|
||||
BaseColor,
|
||||
// Token: 0x04000339 RID: 825
|
||||
SpecColor,
|
||||
// Token: 0x0400033A RID: 826
|
||||
Reflectivity,
|
||||
// Token: 0x0400033B RID: 827
|
||||
ReflectionProbeOnly,
|
||||
// Token: 0x0400033C RID: 828
|
||||
ReflectionProbeMinusSSR,
|
||||
// Token: 0x0400033D RID: 829
|
||||
SSRMinusReflectionProbe,
|
||||
// Token: 0x0400033E RID: 830
|
||||
NoGlossy,
|
||||
// Token: 0x0400033F RID: 831
|
||||
NegativeNoGlossy,
|
||||
// Token: 0x04000340 RID: 832
|
||||
MipLevel
|
||||
}
|
||||
|
||||
// Token: 0x02000082 RID: 130
|
||||
public enum SSRResolution
|
||||
{
|
||||
// Token: 0x04000342 RID: 834
|
||||
FullResolution,
|
||||
// Token: 0x04000343 RID: 835
|
||||
HalfTraceFullResolve,
|
||||
// Token: 0x04000344 RID: 836
|
||||
HalfResolution
|
||||
}
|
||||
|
||||
// Token: 0x02000083 RID: 131
|
||||
[Serializable]
|
||||
public struct SSRSettings
|
||||
{
|
||||
// Token: 0x1700005B RID: 91
|
||||
// (get) Token: 0x0600018B RID: 395 RVA: 0x0001190D File Offset: 0x0000FD0D
|
||||
public static ScreenSpaceReflection.SSRSettings performanceSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return ScreenSpaceReflection.SSRSettings.s_Performance;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005C RID: 92
|
||||
// (get) Token: 0x0600018C RID: 396 RVA: 0x00011914 File Offset: 0x0000FD14
|
||||
public static ScreenSpaceReflection.SSRSettings defaultSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return ScreenSpaceReflection.SSRSettings.s_Default;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700005D RID: 93
|
||||
// (get) Token: 0x0600018D RID: 397 RVA: 0x0001191B File Offset: 0x0000FD1B
|
||||
public static ScreenSpaceReflection.SSRSettings highQualitySettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return ScreenSpaceReflection.SSRSettings.s_HighQuality;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000345 RID: 837
|
||||
[ScreenSpaceReflection.SSRSettings.LayoutAttribute]
|
||||
public ScreenSpaceReflection.BasicSettings basicSettings;
|
||||
|
||||
// Token: 0x04000346 RID: 838
|
||||
[ScreenSpaceReflection.SSRSettings.LayoutAttribute]
|
||||
public ScreenSpaceReflection.ReflectionSettings reflectionSettings;
|
||||
|
||||
// Token: 0x04000347 RID: 839
|
||||
[ScreenSpaceReflection.SSRSettings.LayoutAttribute]
|
||||
public ScreenSpaceReflection.AdvancedSettings advancedSettings;
|
||||
|
||||
// Token: 0x04000348 RID: 840
|
||||
[ScreenSpaceReflection.SSRSettings.LayoutAttribute]
|
||||
public ScreenSpaceReflection.DebugSettings debugSettings;
|
||||
|
||||
// Token: 0x04000349 RID: 841
|
||||
private static readonly ScreenSpaceReflection.SSRSettings s_Performance = new ScreenSpaceReflection.SSRSettings
|
||||
{
|
||||
basicSettings = new ScreenSpaceReflection.BasicSettings
|
||||
{
|
||||
screenEdgeFading = 0f,
|
||||
maxDistance = 10f,
|
||||
fadeDistance = 10f,
|
||||
reflectionMultiplier = 1f,
|
||||
enableHDR = false,
|
||||
additiveReflection = false
|
||||
},
|
||||
reflectionSettings = new ScreenSpaceReflection.ReflectionSettings
|
||||
{
|
||||
maxSteps = 64,
|
||||
rayStepSize = 4,
|
||||
widthModifier = 0.5f,
|
||||
smoothFallbackThreshold = 0.4f,
|
||||
distanceBlur = 1f,
|
||||
fresnelFade = 0.2f,
|
||||
fresnelFadePower = 2f,
|
||||
smoothFallbackDistance = 0.05f
|
||||
},
|
||||
advancedSettings = new ScreenSpaceReflection.AdvancedSettings
|
||||
{
|
||||
useTemporalConfidence = false,
|
||||
temporalFilterStrength = 0f,
|
||||
treatBackfaceHitAsMiss = false,
|
||||
allowBackwardsRays = false,
|
||||
traceBehindObjects = true,
|
||||
highQualitySharpReflections = false,
|
||||
traceEverywhere = false,
|
||||
resolution = ScreenSpaceReflection.SSRResolution.HalfResolution,
|
||||
bilateralUpsample = false,
|
||||
improveCorners = false,
|
||||
reduceBanding = false,
|
||||
highlightSuppression = false
|
||||
},
|
||||
debugSettings = new ScreenSpaceReflection.DebugSettings
|
||||
{
|
||||
debugMode = ScreenSpaceReflection.SSRDebugMode.None
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x0400034A RID: 842
|
||||
private static readonly ScreenSpaceReflection.SSRSettings s_Default = new ScreenSpaceReflection.SSRSettings
|
||||
{
|
||||
basicSettings = new ScreenSpaceReflection.BasicSettings
|
||||
{
|
||||
screenEdgeFading = 0.03f,
|
||||
maxDistance = 100f,
|
||||
fadeDistance = 100f,
|
||||
reflectionMultiplier = 1f,
|
||||
enableHDR = true,
|
||||
additiveReflection = false
|
||||
},
|
||||
reflectionSettings = new ScreenSpaceReflection.ReflectionSettings
|
||||
{
|
||||
maxSteps = 128,
|
||||
rayStepSize = 3,
|
||||
widthModifier = 0.5f,
|
||||
smoothFallbackThreshold = 0.2f,
|
||||
distanceBlur = 1f,
|
||||
fresnelFade = 0.2f,
|
||||
fresnelFadePower = 2f,
|
||||
smoothFallbackDistance = 0.05f
|
||||
},
|
||||
advancedSettings = new ScreenSpaceReflection.AdvancedSettings
|
||||
{
|
||||
useTemporalConfidence = true,
|
||||
temporalFilterStrength = 0.7f,
|
||||
treatBackfaceHitAsMiss = false,
|
||||
allowBackwardsRays = false,
|
||||
traceBehindObjects = true,
|
||||
highQualitySharpReflections = true,
|
||||
traceEverywhere = true,
|
||||
resolution = ScreenSpaceReflection.SSRResolution.HalfTraceFullResolve,
|
||||
bilateralUpsample = true,
|
||||
improveCorners = true,
|
||||
reduceBanding = true,
|
||||
highlightSuppression = false
|
||||
},
|
||||
debugSettings = new ScreenSpaceReflection.DebugSettings
|
||||
{
|
||||
debugMode = ScreenSpaceReflection.SSRDebugMode.None
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x0400034B RID: 843
|
||||
private static readonly ScreenSpaceReflection.SSRSettings s_HighQuality = new ScreenSpaceReflection.SSRSettings
|
||||
{
|
||||
basicSettings = new ScreenSpaceReflection.BasicSettings
|
||||
{
|
||||
screenEdgeFading = 0.03f,
|
||||
maxDistance = 100f,
|
||||
fadeDistance = 100f,
|
||||
reflectionMultiplier = 1f,
|
||||
enableHDR = true,
|
||||
additiveReflection = false
|
||||
},
|
||||
reflectionSettings = new ScreenSpaceReflection.ReflectionSettings
|
||||
{
|
||||
maxSteps = 512,
|
||||
rayStepSize = 1,
|
||||
widthModifier = 0.5f,
|
||||
smoothFallbackThreshold = 0.2f,
|
||||
distanceBlur = 1f,
|
||||
fresnelFade = 0.2f,
|
||||
fresnelFadePower = 2f,
|
||||
smoothFallbackDistance = 0.05f
|
||||
},
|
||||
advancedSettings = new ScreenSpaceReflection.AdvancedSettings
|
||||
{
|
||||
useTemporalConfidence = true,
|
||||
temporalFilterStrength = 0.7f,
|
||||
treatBackfaceHitAsMiss = false,
|
||||
allowBackwardsRays = false,
|
||||
traceBehindObjects = true,
|
||||
highQualitySharpReflections = true,
|
||||
traceEverywhere = true,
|
||||
resolution = ScreenSpaceReflection.SSRResolution.HalfTraceFullResolve,
|
||||
bilateralUpsample = true,
|
||||
improveCorners = true,
|
||||
reduceBanding = true,
|
||||
highlightSuppression = false
|
||||
},
|
||||
debugSettings = new ScreenSpaceReflection.DebugSettings
|
||||
{
|
||||
debugMode = ScreenSpaceReflection.SSRDebugMode.None
|
||||
}
|
||||
};
|
||||
|
||||
// Token: 0x02000084 RID: 132
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class LayoutAttribute : PropertyAttribute
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x02000085 RID: 133
|
||||
[Serializable]
|
||||
public struct BasicSettings
|
||||
{
|
||||
// Token: 0x0400034C RID: 844
|
||||
[Tooltip("Nonphysical multiplier for the SSR reflections. 1.0 is physically based.")]
|
||||
[Range(0f, 2f)]
|
||||
public float reflectionMultiplier;
|
||||
|
||||
// Token: 0x0400034D RID: 845
|
||||
[Tooltip("Maximum reflection distance in world units.")]
|
||||
[Range(0.5f, 1000f)]
|
||||
public float maxDistance;
|
||||
|
||||
// Token: 0x0400034E RID: 846
|
||||
[Tooltip("How far away from the maxDistance to begin fading SSR.")]
|
||||
[Range(0f, 1000f)]
|
||||
public float fadeDistance;
|
||||
|
||||
// Token: 0x0400034F RID: 847
|
||||
[Tooltip("Higher = fade out SSRR near the edge of the screen so that reflections don't pop under camera motion.")]
|
||||
[Range(0f, 1f)]
|
||||
public float screenEdgeFading;
|
||||
|
||||
// Token: 0x04000350 RID: 848
|
||||
[Tooltip("Enable for better reflections of very bright objects at a performance cost")]
|
||||
public bool enableHDR;
|
||||
|
||||
// Token: 0x04000351 RID: 849
|
||||
[Tooltip("Add reflections on top of existing ones. Not physically correct.")]
|
||||
public bool additiveReflection;
|
||||
}
|
||||
|
||||
// Token: 0x02000086 RID: 134
|
||||
[Serializable]
|
||||
public struct ReflectionSettings
|
||||
{
|
||||
// Token: 0x04000352 RID: 850
|
||||
[Tooltip("Max raytracing length.")]
|
||||
[Range(16f, 2048f)]
|
||||
public int maxSteps;
|
||||
|
||||
// Token: 0x04000353 RID: 851
|
||||
[Tooltip("Log base 2 of ray tracing coarse step size. Higher traces farther, lower gives better quality silhouettes.")]
|
||||
[Range(0f, 4f)]
|
||||
public int rayStepSize;
|
||||
|
||||
// Token: 0x04000354 RID: 852
|
||||
[Tooltip("Typical thickness of columns, walls, furniture, and other objects that reflection rays might pass behind.")]
|
||||
[Range(0.01f, 10f)]
|
||||
public float widthModifier;
|
||||
|
||||
// Token: 0x04000355 RID: 853
|
||||
[Tooltip("Increase if reflections flicker on very rough surfaces.")]
|
||||
[Range(0f, 1f)]
|
||||
public float smoothFallbackThreshold;
|
||||
|
||||
// Token: 0x04000356 RID: 854
|
||||
[Tooltip("Start falling back to non-SSR value solution at smoothFallbackThreshold - smoothFallbackDistance, with full fallback occuring at smoothFallbackThreshold.")]
|
||||
[Range(0f, 0.2f)]
|
||||
public float smoothFallbackDistance;
|
||||
|
||||
// Token: 0x04000357 RID: 855
|
||||
[Tooltip("Amplify Fresnel fade out. Increase if floor reflections look good close to the surface and bad farther 'under' the floor.")]
|
||||
[Range(0f, 1f)]
|
||||
public float fresnelFade;
|
||||
|
||||
// Token: 0x04000358 RID: 856
|
||||
[Tooltip("Higher values correspond to a faster Fresnel fade as the reflection changes from the grazing angle.")]
|
||||
[Range(0.1f, 10f)]
|
||||
public float fresnelFadePower;
|
||||
|
||||
// Token: 0x04000359 RID: 857
|
||||
[Tooltip("Controls how blurry reflections get as objects are further from the camera. 0 is constant blur no matter trace distance or distance from camera. 1 fully takes into account both factors.")]
|
||||
[Range(0f, 1f)]
|
||||
public float distanceBlur;
|
||||
}
|
||||
|
||||
// Token: 0x02000087 RID: 135
|
||||
[Serializable]
|
||||
public struct AdvancedSettings
|
||||
{
|
||||
// Token: 0x0400035A RID: 858
|
||||
[Range(0f, 0.99f)]
|
||||
[Tooltip("Increase to decrease flicker in scenes; decrease to prevent ghosting (especially in dynamic scenes). 0 gives maximum performance.")]
|
||||
public float temporalFilterStrength;
|
||||
|
||||
// Token: 0x0400035B RID: 859
|
||||
[Tooltip("Enable to limit ghosting from applying the temporal filter.")]
|
||||
public bool useTemporalConfidence;
|
||||
|
||||
// Token: 0x0400035C RID: 860
|
||||
[Tooltip("Enable to allow rays to pass behind objects. This can lead to more screen-space reflections, but the reflections are more likely to be wrong.")]
|
||||
public bool traceBehindObjects;
|
||||
|
||||
// Token: 0x0400035D RID: 861
|
||||
[Tooltip("Enable to increase quality of the sharpest reflections (through filtering), at a performance cost.")]
|
||||
public bool highQualitySharpReflections;
|
||||
|
||||
// Token: 0x0400035E RID: 862
|
||||
[Tooltip("Improves quality in scenes with varying smoothness, at a potential performance cost.")]
|
||||
public bool traceEverywhere;
|
||||
|
||||
// Token: 0x0400035F RID: 863
|
||||
[Tooltip("Enable to force more surfaces to use reflection probes if you see streaks on the sides of objects or bad reflections of their backs.")]
|
||||
public bool treatBackfaceHitAsMiss;
|
||||
|
||||
// Token: 0x04000360 RID: 864
|
||||
[Tooltip("Enable for a performance gain in scenes where most glossy objects are horizontal, like floors, water, and tables. Leave on for scenes with glossy vertical objects.")]
|
||||
public bool allowBackwardsRays;
|
||||
|
||||
// Token: 0x04000361 RID: 865
|
||||
[Tooltip("Improve visual fidelity of reflections on rough surfaces near corners in the scene, at the cost of a small amount of performance.")]
|
||||
public bool improveCorners;
|
||||
|
||||
// Token: 0x04000362 RID: 866
|
||||
[Tooltip("Half resolution SSRR is much faster, but less accurate. Quality can be reclaimed for some performance by doing the resolve at full resolution.")]
|
||||
public ScreenSpaceReflection.SSRResolution resolution;
|
||||
|
||||
// Token: 0x04000363 RID: 867
|
||||
[Tooltip("Drastically improves reflection reconstruction quality at the expense of some performance.")]
|
||||
public bool bilateralUpsample;
|
||||
|
||||
// Token: 0x04000364 RID: 868
|
||||
[Tooltip("Improve visual fidelity of mirror reflections at the cost of a small amount of performance.")]
|
||||
public bool reduceBanding;
|
||||
|
||||
// Token: 0x04000365 RID: 869
|
||||
[Tooltip("Enable to limit the effect a few bright pixels can have on rougher surfaces")]
|
||||
public bool highlightSuppression;
|
||||
}
|
||||
|
||||
// Token: 0x02000088 RID: 136
|
||||
[Serializable]
|
||||
public struct DebugSettings
|
||||
{
|
||||
// Token: 0x04000366 RID: 870
|
||||
[Tooltip("Various Debug Visualizations")]
|
||||
public ScreenSpaceReflection.SSRDebugMode debugMode;
|
||||
}
|
||||
|
||||
// Token: 0x02000089 RID: 137
|
||||
private enum PassIndex
|
||||
{
|
||||
// Token: 0x04000368 RID: 872
|
||||
RayTraceStep1,
|
||||
// Token: 0x04000369 RID: 873
|
||||
RayTraceStep2,
|
||||
// Token: 0x0400036A RID: 874
|
||||
RayTraceStep4,
|
||||
// Token: 0x0400036B RID: 875
|
||||
RayTraceStep8,
|
||||
// Token: 0x0400036C RID: 876
|
||||
RayTraceStep16,
|
||||
// Token: 0x0400036D RID: 877
|
||||
CompositeFinal,
|
||||
// Token: 0x0400036E RID: 878
|
||||
Blur,
|
||||
// Token: 0x0400036F RID: 879
|
||||
CompositeSSR,
|
||||
// Token: 0x04000370 RID: 880
|
||||
Blit,
|
||||
// Token: 0x04000371 RID: 881
|
||||
EdgeGeneration,
|
||||
// Token: 0x04000372 RID: 882
|
||||
MinMipGeneration,
|
||||
// Token: 0x04000373 RID: 883
|
||||
HitPointToReflections,
|
||||
// Token: 0x04000374 RID: 884
|
||||
BilateralKeyPack,
|
||||
// Token: 0x04000375 RID: 885
|
||||
BlitDepthAsCSZ,
|
||||
// Token: 0x04000376 RID: 886
|
||||
TemporalFilter,
|
||||
// Token: 0x04000377 RID: 887
|
||||
AverageRayDistanceGeneration,
|
||||
// Token: 0x04000378 RID: 888
|
||||
PoissonBlur
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1197 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user