This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{99604A24-13D0-4C83-A3AA-9A315339FA42}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>UnityStandardAssets</RootNamespace>
<AssemblyName>Assembly-CSharp-firstpass</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup />
<ItemGroup>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Compile Include="CinematicEffects\AmbientOcclusion.cs" />
<Compile Include="CinematicEffects\AntiAliasing.cs" />
<Compile Include="CinematicEffects\Bloom.cs" />
<Compile Include="CinematicEffects\DepthOfField.cs" />
<Compile Include="CinematicEffects\FXAA.cs" />
<Compile Include="CinematicEffects\IAntiAliasing.cs" />
<Compile Include="CinematicEffects\ImageEffectHelper.cs" />
<Compile Include="CinematicEffects\LensAberrations.cs" />
<Compile Include="CinematicEffects\MinAttribute.cs" />
<Compile Include="CinematicEffects\RenderTextureUtility.cs" />
<Compile Include="CinematicEffects\ScreenSpaceReflection.cs" />
<Compile Include="CinematicEffects\SMAA.cs" />
<Compile Include="CinematicEffects\TonemappingColorGrading.cs" />
<Compile Include="ImageEffects\AAMode.cs" />
<Compile Include="ImageEffects\Antialiasing.cs" />
<Compile Include="ImageEffects\Bloom.cs" />
<Compile Include="ImageEffects\BloomAndFlares.cs" />
<Compile Include="ImageEffects\BloomOptimized.cs" />
<Compile Include="ImageEffects\BloomScreenBlendMode.cs" />
<Compile Include="ImageEffects\Blur.cs" />
<Compile Include="ImageEffects\BlurOptimized.cs" />
<Compile Include="ImageEffects\CameraMotionBlur.cs" />
<Compile Include="ImageEffects\ColorCorrectionCurves.cs" />
<Compile Include="ImageEffects\ColorCorrectionLookup.cs" />
<Compile Include="ImageEffects\ColorCorrectionRamp.cs" />
<Compile Include="ImageEffects\ContrastEnhance.cs" />
<Compile Include="ImageEffects\ContrastStretch.cs" />
<Compile Include="ImageEffects\CreaseShading.cs" />
<Compile Include="ImageEffects\DepthOfField.cs" />
<Compile Include="ImageEffects\DepthOfFieldDeprecated.cs" />
<Compile Include="ImageEffects\EdgeDetection.cs" />
<Compile Include="ImageEffects\Fisheye.cs" />
<Compile Include="ImageEffects\GlobalFog.cs" />
<Compile Include="ImageEffects\Grayscale.cs" />
<Compile Include="ImageEffects\HDRBloomMode.cs" />
<Compile Include="ImageEffects\ImageEffectBase.cs" />
<Compile Include="ImageEffects\ImageEffects.cs" />
<Compile Include="ImageEffects\LensflareStyle34.cs" />
<Compile Include="ImageEffects\MotionBlur.cs" />
<Compile Include="ImageEffects\NoiseAndGrain.cs" />
<Compile Include="ImageEffects\NoiseAndScratches.cs" />
<Compile Include="ImageEffects\PostEffectsBase.cs" />
<Compile Include="ImageEffects\PostEffectsHelper.cs" />
<Compile Include="ImageEffects\Quads.cs" />
<Compile Include="ImageEffects\ScreenOverlay.cs" />
<Compile Include="ImageEffects\ScreenSpaceAmbientObscurance.cs" />
<Compile Include="ImageEffects\ScreenSpaceAmbientOcclusion.cs" />
<Compile Include="ImageEffects\SepiaTone.cs" />
<Compile Include="ImageEffects\SunShafts.cs" />
<Compile Include="ImageEffects\TiltShift.cs" />
<Compile Include="ImageEffects\Tonemapping.cs" />
<Compile Include="ImageEffects\Triangles.cs" />
<Compile Include="ImageEffects\TweakMode34.cs" />
<Compile Include="ImageEffects\Twirl.cs" />
<Compile Include="ImageEffects\VignetteAndChromaticAberration.cs" />
<Compile Include="ImageEffects\Vortex.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\mscorlib\mscorlib.csproj">
<Project>{99604a24-13d0-4c83-a3aa-9a315339fa4c}</Project>
<Name>mscorlib</Name>
</ProjectReference>
<ProjectReference Include="..\UnityEngine\UnityEngine.csproj">
<Project>{99604a24-13d0-4c83-a3aa-9a315339fa58}</Project>
<Name>UnityEngine</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -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
}
}
}
@@ -0,0 +1,23 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200004A RID: 74
public enum AAMode
{
// Token: 0x0400015C RID: 348
FXAA2,
// Token: 0x0400015D RID: 349
FXAA3Console,
// Token: 0x0400015E RID: 350
FXAA1PresetA,
// Token: 0x0400015F RID: 351
FXAA1PresetB,
// Token: 0x04000160 RID: 352
NFAA,
// Token: 0x04000161 RID: 353
SSAA,
// Token: 0x04000162 RID: 354
DLAA
}
}
@@ -0,0 +1,185 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200004B RID: 75
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Other/Antialiasing")]
public class Antialiasing : PostEffectsBase
{
// Token: 0x060000C9 RID: 201 RVA: 0x00007CD8 File Offset: 0x000060D8
public Material CurrentAAMaterial()
{
Material material;
switch (this.mode)
{
case AAMode.FXAA2:
material = this.materialFXAAII;
break;
case AAMode.FXAA3Console:
material = this.materialFXAAIII;
break;
case AAMode.FXAA1PresetA:
material = this.materialFXAAPreset2;
break;
case AAMode.FXAA1PresetB:
material = this.materialFXAAPreset3;
break;
case AAMode.NFAA:
material = this.nfaa;
break;
case AAMode.SSAA:
material = this.ssaa;
break;
case AAMode.DLAA:
material = this.dlaa;
break;
default:
material = null;
break;
}
return material;
}
// Token: 0x060000CA RID: 202 RVA: 0x00007D74 File Offset: 0x00006174
public override bool CheckResources()
{
base.CheckSupport(false);
this.materialFXAAPreset2 = base.CreateMaterial(this.shaderFXAAPreset2, this.materialFXAAPreset2);
this.materialFXAAPreset3 = base.CreateMaterial(this.shaderFXAAPreset3, this.materialFXAAPreset3);
this.materialFXAAII = base.CreateMaterial(this.shaderFXAAII, this.materialFXAAII);
this.materialFXAAIII = base.CreateMaterial(this.shaderFXAAIII, this.materialFXAAIII);
this.nfaa = base.CreateMaterial(this.nfaaShader, this.nfaa);
this.ssaa = base.CreateMaterial(this.ssaaShader, this.ssaa);
this.dlaa = base.CreateMaterial(this.dlaaShader, this.dlaa);
if (!this.ssaaShader.isSupported)
{
base.NotSupported();
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000CB RID: 203 RVA: 0x00007E54 File Offset: 0x00006254
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.mode == AAMode.FXAA3Console && this.materialFXAAIII != null)
{
this.materialFXAAIII.SetFloat("_EdgeThresholdMin", this.edgeThresholdMin);
this.materialFXAAIII.SetFloat("_EdgeThreshold", this.edgeThreshold);
this.materialFXAAIII.SetFloat("_EdgeSharpness", this.edgeSharpness);
Graphics.Blit(source, destination, this.materialFXAAIII);
}
else if (this.mode == AAMode.FXAA1PresetB && this.materialFXAAPreset3 != null)
{
Graphics.Blit(source, destination, this.materialFXAAPreset3);
}
else if (this.mode == AAMode.FXAA1PresetA && this.materialFXAAPreset2 != null)
{
source.anisoLevel = 4;
Graphics.Blit(source, destination, this.materialFXAAPreset2);
source.anisoLevel = 0;
}
else if (this.mode == AAMode.FXAA2 && this.materialFXAAII != null)
{
Graphics.Blit(source, destination, this.materialFXAAII);
}
else if (this.mode == AAMode.SSAA && this.ssaa != null)
{
Graphics.Blit(source, destination, this.ssaa);
}
else if (this.mode == AAMode.DLAA && this.dlaa != null)
{
source.anisoLevel = 0;
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height);
Graphics.Blit(source, temporary, this.dlaa, 0);
Graphics.Blit(temporary, destination, this.dlaa, (!this.dlaaSharp) ? 1 : 2);
RenderTexture.ReleaseTemporary(temporary);
}
else if (this.mode == AAMode.NFAA && this.nfaa != null)
{
source.anisoLevel = 0;
this.nfaa.SetFloat("_OffsetScale", this.offsetScale);
this.nfaa.SetFloat("_BlurRadius", this.blurRadius);
Graphics.Blit(source, destination, this.nfaa, (!this.showGeneratedNormals) ? 0 : 1);
}
else
{
Graphics.Blit(source, destination);
}
}
// Token: 0x04000163 RID: 355
public AAMode mode = AAMode.FXAA3Console;
// Token: 0x04000164 RID: 356
public bool showGeneratedNormals;
// Token: 0x04000165 RID: 357
public float offsetScale = 0.2f;
// Token: 0x04000166 RID: 358
public float blurRadius = 18f;
// Token: 0x04000167 RID: 359
public float edgeThresholdMin = 0.05f;
// Token: 0x04000168 RID: 360
public float edgeThreshold = 0.2f;
// Token: 0x04000169 RID: 361
public float edgeSharpness = 4f;
// Token: 0x0400016A RID: 362
public bool dlaaSharp;
// Token: 0x0400016B RID: 363
public Shader ssaaShader;
// Token: 0x0400016C RID: 364
private Material ssaa;
// Token: 0x0400016D RID: 365
public Shader dlaaShader;
// Token: 0x0400016E RID: 366
private Material dlaa;
// Token: 0x0400016F RID: 367
public Shader nfaaShader;
// Token: 0x04000170 RID: 368
private Material nfaa;
// Token: 0x04000171 RID: 369
public Shader shaderFXAAPreset2;
// Token: 0x04000172 RID: 370
private Material materialFXAAPreset2;
// Token: 0x04000173 RID: 371
public Shader shaderFXAAPreset3;
// Token: 0x04000174 RID: 372
private Material materialFXAAPreset3;
// Token: 0x04000175 RID: 373
public Shader shaderFXAAII;
// Token: 0x04000176 RID: 374
private Material materialFXAAII;
// Token: 0x04000177 RID: 375
public Shader shaderFXAAIII;
// Token: 0x04000178 RID: 376
private Material materialFXAAIII;
}
}
@@ -0,0 +1,390 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200004C RID: 76
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Bloom and Glow/Bloom")]
public class Bloom : PostEffectsBase
{
// Token: 0x060000CD RID: 205 RVA: 0x00008198 File Offset: 0x00006598
public override bool CheckResources()
{
base.CheckSupport(false);
this.screenBlend = base.CheckShaderAndCreateMaterial(this.screenBlendShader, this.screenBlend);
this.lensFlareMaterial = base.CheckShaderAndCreateMaterial(this.lensFlareShader, this.lensFlareMaterial);
this.blurAndFlaresMaterial = base.CheckShaderAndCreateMaterial(this.blurAndFlaresShader, this.blurAndFlaresMaterial);
this.brightPassFilterMaterial = base.CheckShaderAndCreateMaterial(this.brightPassFilterShader, this.brightPassFilterMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000CE RID: 206 RVA: 0x00008224 File Offset: 0x00006624
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.doHdr = false;
if (this.hdr == Bloom.HDRBloomMode.Auto)
{
this.doHdr = source.format == RenderTextureFormat.ARGBHalf && base.GetComponent<Camera>().allowHDR;
}
else
{
this.doHdr = this.hdr == Bloom.HDRBloomMode.On;
}
this.doHdr = this.doHdr && this.supportHDRTextures;
Bloom.BloomScreenBlendMode bloomScreenBlendMode = this.screenBlendMode;
if (this.doHdr)
{
bloomScreenBlendMode = Bloom.BloomScreenBlendMode.Add;
}
RenderTextureFormat renderTextureFormat = ((!this.doHdr) ? RenderTextureFormat.Default : RenderTextureFormat.ARGBHalf);
int num = source.width / 2;
int num2 = source.height / 2;
int num3 = source.width / 4;
int num4 = source.height / 4;
float num5 = 1f * (float)source.width / (1f * (float)source.height);
float num6 = 0.001953125f;
RenderTexture temporary = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
RenderTexture temporary2 = RenderTexture.GetTemporary(num, num2, 0, renderTextureFormat);
if (this.quality > Bloom.BloomQuality.Cheap)
{
Graphics.Blit(source, temporary2, this.screenBlend, 2);
RenderTexture temporary3 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
Graphics.Blit(temporary2, temporary3, this.screenBlend, 2);
Graphics.Blit(temporary3, temporary, this.screenBlend, 6);
RenderTexture.ReleaseTemporary(temporary3);
}
else
{
Graphics.Blit(source, temporary2);
Graphics.Blit(temporary2, temporary, this.screenBlend, 6);
}
RenderTexture.ReleaseTemporary(temporary2);
RenderTexture renderTexture = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
this.BrightFilter(this.bloomThreshold * this.bloomThresholdColor, temporary, renderTexture);
if (this.bloomBlurIterations < 1)
{
this.bloomBlurIterations = 1;
}
else if (this.bloomBlurIterations > 10)
{
this.bloomBlurIterations = 10;
}
for (int i = 0; i < this.bloomBlurIterations; i++)
{
float num7 = (1f + (float)i * 0.25f) * this.sepBlurSpread;
RenderTexture renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(0f, num7 * num6, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurAndFlaresMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num7 / num5 * num6, 0f, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurAndFlaresMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
if (this.quality > Bloom.BloomQuality.Cheap)
{
if (i == 0)
{
Graphics.SetRenderTarget(temporary);
GL.Clear(false, true, Color.black);
Graphics.Blit(renderTexture, temporary);
}
else
{
temporary.MarkRestoreExpected();
Graphics.Blit(renderTexture, temporary, this.screenBlend, 10);
}
}
}
if (this.quality > Bloom.BloomQuality.Cheap)
{
Graphics.SetRenderTarget(renderTexture);
GL.Clear(false, true, Color.black);
Graphics.Blit(temporary, renderTexture, this.screenBlend, 6);
}
if (this.lensflareIntensity > Mathf.Epsilon)
{
RenderTexture temporary4 = RenderTexture.GetTemporary(num3, num4, 0, renderTextureFormat);
if (this.lensflareMode == Bloom.LensFlareStyle.Ghosting)
{
this.BrightFilter(this.lensflareThreshold, renderTexture, temporary4);
if (this.quality > Bloom.BloomQuality.Cheap)
{
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f / (1f * (float)temporary.height), 0f, 0f));
Graphics.SetRenderTarget(temporary);
GL.Clear(false, true, Color.black);
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 4);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(1.5f / (1f * (float)temporary.width), 0f, 0f, 0f));
Graphics.SetRenderTarget(temporary4);
GL.Clear(false, true, Color.black);
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 4);
}
this.Vignette(0.975f, temporary4, temporary4);
this.BlendFlares(temporary4, renderTexture);
}
else
{
float num8 = 1f * Mathf.Cos(this.flareRotation);
float num9 = 1f * Mathf.Sin(this.flareRotation);
float num10 = this.hollyStretchWidth * 1f / num5 * num6;
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num8, num9, 0f, 0f));
this.blurAndFlaresMaterial.SetVector("_Threshhold", new Vector4(this.lensflareThreshold, 1f, 0f, 0f));
this.blurAndFlaresMaterial.SetVector("_TintColor", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.flareColorA.a * this.lensflareIntensity);
this.blurAndFlaresMaterial.SetFloat("_Saturation", this.lensFlareSaturation);
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 2);
temporary4.DiscardContents();
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 3);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num8 * num10, num9 * num10, 0f, 0f));
this.blurAndFlaresMaterial.SetFloat("_StretchWidth", this.hollyStretchWidth);
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 1);
this.blurAndFlaresMaterial.SetFloat("_StretchWidth", this.hollyStretchWidth * 2f);
temporary4.DiscardContents();
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 1);
this.blurAndFlaresMaterial.SetFloat("_StretchWidth", this.hollyStretchWidth * 4f);
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 1);
for (int j = 0; j < this.hollywoodFlareBlurIterations; j++)
{
num10 = this.hollyStretchWidth * 2f / num5 * num6;
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num10 * num8, num10 * num9, 0f, 0f));
temporary4.DiscardContents();
Graphics.Blit(temporary, temporary4, this.blurAndFlaresMaterial, 4);
this.blurAndFlaresMaterial.SetVector("_Offsets", new Vector4(num10 * num8, num10 * num9, 0f, 0f));
temporary.DiscardContents();
Graphics.Blit(temporary4, temporary, this.blurAndFlaresMaterial, 4);
}
if (this.lensflareMode == Bloom.LensFlareStyle.Anamorphic)
{
this.AddTo(1f, temporary, renderTexture);
}
else
{
this.Vignette(1f, temporary, temporary4);
this.BlendFlares(temporary4, temporary);
this.AddTo(1f, temporary, renderTexture);
}
}
RenderTexture.ReleaseTemporary(temporary4);
}
int num11 = (int)bloomScreenBlendMode;
this.screenBlend.SetFloat("_Intensity", this.bloomIntensity);
this.screenBlend.SetTexture("_ColorBuffer", source);
if (this.quality > Bloom.BloomQuality.Cheap)
{
RenderTexture temporary5 = RenderTexture.GetTemporary(num, num2, 0, renderTextureFormat);
Graphics.Blit(renderTexture, temporary5);
Graphics.Blit(temporary5, destination, this.screenBlend, num11);
RenderTexture.ReleaseTemporary(temporary5);
}
else
{
Graphics.Blit(renderTexture, destination, this.screenBlend, num11);
}
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x060000CF RID: 207 RVA: 0x000089C5 File Offset: 0x00006DC5
private void AddTo(float intensity_, RenderTexture from, RenderTexture to)
{
this.screenBlend.SetFloat("_Intensity", intensity_);
to.MarkRestoreExpected();
Graphics.Blit(from, to, this.screenBlend, 9);
}
// Token: 0x060000D0 RID: 208 RVA: 0x000089F0 File Offset: 0x00006DF0
private void BlendFlares(RenderTexture from, RenderTexture to)
{
this.lensFlareMaterial.SetVector("colorA", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorB", new Vector4(this.flareColorB.r, this.flareColorB.g, this.flareColorB.b, this.flareColorB.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorC", new Vector4(this.flareColorC.r, this.flareColorC.g, this.flareColorC.b, this.flareColorC.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorD", new Vector4(this.flareColorD.r, this.flareColorD.g, this.flareColorD.b, this.flareColorD.a) * this.lensflareIntensity);
to.MarkRestoreExpected();
Graphics.Blit(from, to, this.lensFlareMaterial);
}
// Token: 0x060000D1 RID: 209 RVA: 0x00008B40 File Offset: 0x00006F40
private void BrightFilter(float thresh, RenderTexture from, RenderTexture to)
{
this.brightPassFilterMaterial.SetVector("_Threshhold", new Vector4(thresh, thresh, thresh, thresh));
Graphics.Blit(from, to, this.brightPassFilterMaterial, 0);
}
// Token: 0x060000D2 RID: 210 RVA: 0x00008B69 File Offset: 0x00006F69
private void BrightFilter(Color threshColor, RenderTexture from, RenderTexture to)
{
this.brightPassFilterMaterial.SetVector("_Threshhold", threshColor);
Graphics.Blit(from, to, this.brightPassFilterMaterial, 1);
}
// Token: 0x060000D3 RID: 211 RVA: 0x00008B90 File Offset: 0x00006F90
private void Vignette(float amount, RenderTexture from, RenderTexture to)
{
if (this.lensFlareVignetteMask)
{
this.screenBlend.SetTexture("_ColorBuffer", this.lensFlareVignetteMask);
to.MarkRestoreExpected();
Graphics.Blit((!(from == to)) ? from : null, to, this.screenBlend, (!(from == to)) ? 3 : 7);
}
else if (from != to)
{
Graphics.SetRenderTarget(to);
GL.Clear(false, true, Color.black);
Graphics.Blit(from, to);
}
}
// Token: 0x04000179 RID: 377
public Bloom.TweakMode tweakMode;
// Token: 0x0400017A RID: 378
public Bloom.BloomScreenBlendMode screenBlendMode = Bloom.BloomScreenBlendMode.Add;
// Token: 0x0400017B RID: 379
public Bloom.HDRBloomMode hdr;
// Token: 0x0400017C RID: 380
private bool doHdr;
// Token: 0x0400017D RID: 381
public float sepBlurSpread = 2.5f;
// Token: 0x0400017E RID: 382
public Bloom.BloomQuality quality = Bloom.BloomQuality.High;
// Token: 0x0400017F RID: 383
public float bloomIntensity = 0.5f;
// Token: 0x04000180 RID: 384
public float bloomThreshold = 0.5f;
// Token: 0x04000181 RID: 385
public Color bloomThresholdColor = Color.white;
// Token: 0x04000182 RID: 386
public int bloomBlurIterations = 2;
// Token: 0x04000183 RID: 387
public int hollywoodFlareBlurIterations = 2;
// Token: 0x04000184 RID: 388
public float flareRotation;
// Token: 0x04000185 RID: 389
public Bloom.LensFlareStyle lensflareMode = Bloom.LensFlareStyle.Anamorphic;
// Token: 0x04000186 RID: 390
public float hollyStretchWidth = 2.5f;
// Token: 0x04000187 RID: 391
public float lensflareIntensity;
// Token: 0x04000188 RID: 392
public float lensflareThreshold = 0.3f;
// Token: 0x04000189 RID: 393
public float lensFlareSaturation = 0.75f;
// Token: 0x0400018A RID: 394
public Color flareColorA = new Color(0.4f, 0.4f, 0.8f, 0.75f);
// Token: 0x0400018B RID: 395
public Color flareColorB = new Color(0.4f, 0.8f, 0.8f, 0.75f);
// Token: 0x0400018C RID: 396
public Color flareColorC = new Color(0.8f, 0.4f, 0.8f, 0.75f);
// Token: 0x0400018D RID: 397
public Color flareColorD = new Color(0.8f, 0.4f, 0f, 0.75f);
// Token: 0x0400018E RID: 398
public Texture2D lensFlareVignetteMask;
// Token: 0x0400018F RID: 399
public Shader lensFlareShader;
// Token: 0x04000190 RID: 400
private Material lensFlareMaterial;
// Token: 0x04000191 RID: 401
public Shader screenBlendShader;
// Token: 0x04000192 RID: 402
private Material screenBlend;
// Token: 0x04000193 RID: 403
public Shader blurAndFlaresShader;
// Token: 0x04000194 RID: 404
private Material blurAndFlaresMaterial;
// Token: 0x04000195 RID: 405
public Shader brightPassFilterShader;
// Token: 0x04000196 RID: 406
private Material brightPassFilterMaterial;
// Token: 0x0200004D RID: 77
public enum LensFlareStyle
{
// Token: 0x04000198 RID: 408
Ghosting,
// Token: 0x04000199 RID: 409
Anamorphic,
// Token: 0x0400019A RID: 410
Combined
}
// Token: 0x0200004E RID: 78
public enum TweakMode
{
// Token: 0x0400019C RID: 412
Basic,
// Token: 0x0400019D RID: 413
Complex
}
// Token: 0x0200004F RID: 79
public enum HDRBloomMode
{
// Token: 0x0400019F RID: 415
Auto,
// Token: 0x040001A0 RID: 416
On,
// Token: 0x040001A1 RID: 417
Off
}
// Token: 0x02000050 RID: 80
public enum BloomScreenBlendMode
{
// Token: 0x040001A3 RID: 419
Screen,
// Token: 0x040001A4 RID: 420
Add
}
// Token: 0x02000051 RID: 81
public enum BloomQuality
{
// Token: 0x040001A6 RID: 422
Cheap,
// Token: 0x040001A7 RID: 423
High
}
}
}
@@ -0,0 +1,300 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000056 RID: 86
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Bloom and Glow/BloomAndFlares (3.5, Deprecated)")]
public class BloomAndFlares : PostEffectsBase
{
// Token: 0x060000D5 RID: 213 RVA: 0x00008D20 File Offset: 0x00007120
public override bool CheckResources()
{
base.CheckSupport(false);
this.screenBlend = base.CheckShaderAndCreateMaterial(this.screenBlendShader, this.screenBlend);
this.lensFlareMaterial = base.CheckShaderAndCreateMaterial(this.lensFlareShader, this.lensFlareMaterial);
this.vignetteMaterial = base.CheckShaderAndCreateMaterial(this.vignetteShader, this.vignetteMaterial);
this.separableBlurMaterial = base.CheckShaderAndCreateMaterial(this.separableBlurShader, this.separableBlurMaterial);
this.addBrightStuffBlendOneOneMaterial = base.CheckShaderAndCreateMaterial(this.addBrightStuffOneOneShader, this.addBrightStuffBlendOneOneMaterial);
this.hollywoodFlaresMaterial = base.CheckShaderAndCreateMaterial(this.hollywoodFlaresShader, this.hollywoodFlaresMaterial);
this.brightPassFilterMaterial = base.CheckShaderAndCreateMaterial(this.brightPassFilterShader, this.brightPassFilterMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000D6 RID: 214 RVA: 0x00008DF4 File Offset: 0x000071F4
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.doHdr = false;
if (this.hdr == HDRBloomMode.Auto)
{
this.doHdr = source.format == RenderTextureFormat.ARGBHalf && base.GetComponent<Camera>().allowHDR;
}
else
{
this.doHdr = this.hdr == HDRBloomMode.On;
}
this.doHdr = this.doHdr && this.supportHDRTextures;
BloomScreenBlendMode bloomScreenBlendMode = this.screenBlendMode;
if (this.doHdr)
{
bloomScreenBlendMode = BloomScreenBlendMode.Add;
}
RenderTextureFormat renderTextureFormat = ((!this.doHdr) ? RenderTextureFormat.Default : RenderTextureFormat.ARGBHalf);
RenderTexture temporary = RenderTexture.GetTemporary(source.width / 2, source.height / 2, 0, renderTextureFormat);
RenderTexture temporary2 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, renderTextureFormat);
RenderTexture temporary3 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, renderTextureFormat);
RenderTexture temporary4 = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0, renderTextureFormat);
float num = 1f * (float)source.width / (1f * (float)source.height);
float num2 = 0.001953125f;
Graphics.Blit(source, temporary, this.screenBlend, 2);
Graphics.Blit(temporary, temporary2, this.screenBlend, 2);
RenderTexture.ReleaseTemporary(temporary);
this.BrightFilter(this.bloomThreshold, this.useSrcAlphaAsMask, temporary2, temporary3);
temporary2.DiscardContents();
if (this.bloomBlurIterations < 1)
{
this.bloomBlurIterations = 1;
}
for (int i = 0; i < this.bloomBlurIterations; i++)
{
float num3 = (1f + (float)i * 0.5f) * this.sepBlurSpread;
this.separableBlurMaterial.SetVector("offsets", new Vector4(0f, num3 * num2, 0f, 0f));
RenderTexture renderTexture = ((i != 0) ? temporary2 : temporary3);
Graphics.Blit(renderTexture, temporary4, this.separableBlurMaterial);
renderTexture.DiscardContents();
this.separableBlurMaterial.SetVector("offsets", new Vector4(num3 / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary4, temporary2, this.separableBlurMaterial);
temporary4.DiscardContents();
}
if (this.lensflares)
{
if (this.lensflareMode == LensflareStyle34.Ghosting)
{
this.BrightFilter(this.lensflareThreshold, 0f, temporary2, temporary4);
temporary2.DiscardContents();
this.Vignette(0.975f, temporary4, temporary3);
temporary4.DiscardContents();
this.BlendFlares(temporary3, temporary2);
temporary3.DiscardContents();
}
else
{
this.hollywoodFlaresMaterial.SetVector("_threshold", new Vector4(this.lensflareThreshold, 1f / (1f - this.lensflareThreshold), 0f, 0f));
this.hollywoodFlaresMaterial.SetVector("tintColor", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.flareColorA.a * this.lensflareIntensity);
Graphics.Blit(temporary4, temporary3, this.hollywoodFlaresMaterial, 2);
temporary4.DiscardContents();
Graphics.Blit(temporary3, temporary4, this.hollywoodFlaresMaterial, 3);
temporary3.DiscardContents();
this.hollywoodFlaresMaterial.SetVector("offsets", new Vector4(this.sepBlurSpread * 1f / num * num2, 0f, 0f, 0f));
this.hollywoodFlaresMaterial.SetFloat("stretchWidth", this.hollyStretchWidth);
Graphics.Blit(temporary4, temporary3, this.hollywoodFlaresMaterial, 1);
temporary4.DiscardContents();
this.hollywoodFlaresMaterial.SetFloat("stretchWidth", this.hollyStretchWidth * 2f);
Graphics.Blit(temporary3, temporary4, this.hollywoodFlaresMaterial, 1);
temporary3.DiscardContents();
this.hollywoodFlaresMaterial.SetFloat("stretchWidth", this.hollyStretchWidth * 4f);
Graphics.Blit(temporary4, temporary3, this.hollywoodFlaresMaterial, 1);
temporary4.DiscardContents();
if (this.lensflareMode == LensflareStyle34.Anamorphic)
{
for (int j = 0; j < this.hollywoodFlareBlurIterations; j++)
{
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary3, temporary4, this.separableBlurMaterial);
temporary3.DiscardContents();
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary4, temporary3, this.separableBlurMaterial);
temporary4.DiscardContents();
}
this.AddTo(1f, temporary3, temporary2);
temporary3.DiscardContents();
}
else
{
for (int k = 0; k < this.hollywoodFlareBlurIterations; k++)
{
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary3, temporary4, this.separableBlurMaterial);
temporary3.DiscardContents();
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.hollyStretchWidth * 2f / num * num2, 0f, 0f, 0f));
Graphics.Blit(temporary4, temporary3, this.separableBlurMaterial);
temporary4.DiscardContents();
}
this.Vignette(1f, temporary3, temporary4);
temporary3.DiscardContents();
this.BlendFlares(temporary4, temporary3);
temporary4.DiscardContents();
this.AddTo(1f, temporary3, temporary2);
temporary3.DiscardContents();
}
}
}
this.screenBlend.SetFloat("_Intensity", this.bloomIntensity);
this.screenBlend.SetTexture("_ColorBuffer", source);
Graphics.Blit(temporary2, destination, this.screenBlend, (int)bloomScreenBlendMode);
RenderTexture.ReleaseTemporary(temporary2);
RenderTexture.ReleaseTemporary(temporary3);
RenderTexture.ReleaseTemporary(temporary4);
}
// Token: 0x060000D7 RID: 215 RVA: 0x0000942B File Offset: 0x0000782B
private void AddTo(float intensity_, RenderTexture from, RenderTexture to)
{
this.addBrightStuffBlendOneOneMaterial.SetFloat("_Intensity", intensity_);
Graphics.Blit(from, to, this.addBrightStuffBlendOneOneMaterial);
}
// Token: 0x060000D8 RID: 216 RVA: 0x0000944C File Offset: 0x0000784C
private void BlendFlares(RenderTexture from, RenderTexture to)
{
this.lensFlareMaterial.SetVector("colorA", new Vector4(this.flareColorA.r, this.flareColorA.g, this.flareColorA.b, this.flareColorA.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorB", new Vector4(this.flareColorB.r, this.flareColorB.g, this.flareColorB.b, this.flareColorB.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorC", new Vector4(this.flareColorC.r, this.flareColorC.g, this.flareColorC.b, this.flareColorC.a) * this.lensflareIntensity);
this.lensFlareMaterial.SetVector("colorD", new Vector4(this.flareColorD.r, this.flareColorD.g, this.flareColorD.b, this.flareColorD.a) * this.lensflareIntensity);
Graphics.Blit(from, to, this.lensFlareMaterial);
}
// Token: 0x060000D9 RID: 217 RVA: 0x00009598 File Offset: 0x00007998
private void BrightFilter(float thresh, float useAlphaAsMask, RenderTexture from, RenderTexture to)
{
if (this.doHdr)
{
this.brightPassFilterMaterial.SetVector("threshold", new Vector4(thresh, 1f, 0f, 0f));
}
else
{
this.brightPassFilterMaterial.SetVector("threshold", new Vector4(thresh, 1f / (1f - thresh), 0f, 0f));
}
this.brightPassFilterMaterial.SetFloat("useSrcAlphaAsMask", useAlphaAsMask);
Graphics.Blit(from, to, this.brightPassFilterMaterial);
}
// Token: 0x060000DA RID: 218 RVA: 0x00009628 File Offset: 0x00007A28
private void Vignette(float amount, RenderTexture from, RenderTexture to)
{
if (this.lensFlareVignetteMask)
{
this.screenBlend.SetTexture("_ColorBuffer", this.lensFlareVignetteMask);
Graphics.Blit(from, to, this.screenBlend, 3);
}
else
{
this.vignetteMaterial.SetFloat("vignetteIntensity", amount);
Graphics.Blit(from, to, this.vignetteMaterial);
}
}
// Token: 0x040001B6 RID: 438
public TweakMode34 tweakMode;
// Token: 0x040001B7 RID: 439
public BloomScreenBlendMode screenBlendMode = BloomScreenBlendMode.Add;
// Token: 0x040001B8 RID: 440
public HDRBloomMode hdr;
// Token: 0x040001B9 RID: 441
private bool doHdr;
// Token: 0x040001BA RID: 442
public float sepBlurSpread = 1.5f;
// Token: 0x040001BB RID: 443
public float useSrcAlphaAsMask = 0.5f;
// Token: 0x040001BC RID: 444
public float bloomIntensity = 1f;
// Token: 0x040001BD RID: 445
public float bloomThreshold = 0.5f;
// Token: 0x040001BE RID: 446
public int bloomBlurIterations = 2;
// Token: 0x040001BF RID: 447
public bool lensflares;
// Token: 0x040001C0 RID: 448
public int hollywoodFlareBlurIterations = 2;
// Token: 0x040001C1 RID: 449
public LensflareStyle34 lensflareMode = LensflareStyle34.Anamorphic;
// Token: 0x040001C2 RID: 450
public float hollyStretchWidth = 3.5f;
// Token: 0x040001C3 RID: 451
public float lensflareIntensity = 1f;
// Token: 0x040001C4 RID: 452
public float lensflareThreshold = 0.3f;
// Token: 0x040001C5 RID: 453
public Color flareColorA = new Color(0.4f, 0.4f, 0.8f, 0.75f);
// Token: 0x040001C6 RID: 454
public Color flareColorB = new Color(0.4f, 0.8f, 0.8f, 0.75f);
// Token: 0x040001C7 RID: 455
public Color flareColorC = new Color(0.8f, 0.4f, 0.8f, 0.75f);
// Token: 0x040001C8 RID: 456
public Color flareColorD = new Color(0.8f, 0.4f, 0f, 0.75f);
// Token: 0x040001C9 RID: 457
public Texture2D lensFlareVignetteMask;
// Token: 0x040001CA RID: 458
public Shader lensFlareShader;
// Token: 0x040001CB RID: 459
private Material lensFlareMaterial;
// Token: 0x040001CC RID: 460
public Shader vignetteShader;
// Token: 0x040001CD RID: 461
private Material vignetteMaterial;
// Token: 0x040001CE RID: 462
public Shader separableBlurShader;
// Token: 0x040001CF RID: 463
private Material separableBlurMaterial;
// Token: 0x040001D0 RID: 464
public Shader addBrightStuffOneOneShader;
// Token: 0x040001D1 RID: 465
private Material addBrightStuffBlendOneOneMaterial;
// Token: 0x040001D2 RID: 466
public Shader screenBlendShader;
// Token: 0x040001D3 RID: 467
private Material screenBlend;
// Token: 0x040001D4 RID: 468
public Shader hollywoodFlaresShader;
// Token: 0x040001D5 RID: 469
private Material hollywoodFlaresMaterial;
// Token: 0x040001D6 RID: 470
public Shader brightPassFilterShader;
// Token: 0x040001D7 RID: 471
private Material brightPassFilterMaterial;
}
}
@@ -0,0 +1,116 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000057 RID: 87
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Bloom and Glow/Bloom (Optimized)")]
public class BloomOptimized : PostEffectsBase
{
// Token: 0x060000DC RID: 220 RVA: 0x000096BC File Offset: 0x00007ABC
public override bool CheckResources()
{
base.CheckSupport(false);
this.fastBloomMaterial = base.CheckShaderAndCreateMaterial(this.fastBloomShader, this.fastBloomMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000DD RID: 221 RVA: 0x000096F5 File Offset: 0x00007AF5
private void OnDisable()
{
if (this.fastBloomMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.fastBloomMaterial);
}
}
// Token: 0x060000DE RID: 222 RVA: 0x00009714 File Offset: 0x00007B14
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int num = ((this.resolution != BloomOptimized.Resolution.Low) ? 2 : 4);
float num2 = ((this.resolution != BloomOptimized.Resolution.Low) ? 1f : 0.5f);
this.fastBloomMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num2, 0f, this.threshold, this.intensity));
source.filterMode = FilterMode.Bilinear;
int num3 = source.width / num;
int num4 = source.height / num;
RenderTexture renderTexture = RenderTexture.GetTemporary(num3, num4, 0, source.format);
renderTexture.filterMode = FilterMode.Bilinear;
Graphics.Blit(source, renderTexture, this.fastBloomMaterial, 1);
int num5 = ((this.blurType != BloomOptimized.BlurType.Standard) ? 2 : 0);
for (int i = 0; i < this.blurIterations; i++)
{
this.fastBloomMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num2 + (float)i * 1f, 0f, this.threshold, this.intensity));
RenderTexture renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.fastBloomMaterial, 2 + num5);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(num3, num4, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.fastBloomMaterial, 3 + num5);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
this.fastBloomMaterial.SetTexture("_Bloom", renderTexture);
Graphics.Blit(source, destination, this.fastBloomMaterial, 0);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x040001D8 RID: 472
[Range(0f, 1.5f)]
public float threshold = 0.25f;
// Token: 0x040001D9 RID: 473
[Range(0f, 2.5f)]
public float intensity = 0.75f;
// Token: 0x040001DA RID: 474
[Range(0.25f, 5.5f)]
public float blurSize = 1f;
// Token: 0x040001DB RID: 475
private BloomOptimized.Resolution resolution;
// Token: 0x040001DC RID: 476
[Range(1f, 4f)]
public int blurIterations = 1;
// Token: 0x040001DD RID: 477
public BloomOptimized.BlurType blurType;
// Token: 0x040001DE RID: 478
public Shader fastBloomShader;
// Token: 0x040001DF RID: 479
private Material fastBloomMaterial;
// Token: 0x02000058 RID: 88
public enum Resolution
{
// Token: 0x040001E1 RID: 481
Low,
// Token: 0x040001E2 RID: 482
High
}
// Token: 0x02000059 RID: 89
public enum BlurType
{
// Token: 0x040001E4 RID: 484
Standard,
// Token: 0x040001E5 RID: 485
Sgx
}
}
}
@@ -0,0 +1,13 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000055 RID: 85
public enum BloomScreenBlendMode
{
// Token: 0x040001B4 RID: 436
Screen,
// Token: 0x040001B5 RID: 437
Add
}
}
@@ -0,0 +1,108 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005A RID: 90
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Blur/Blur")]
public class Blur : MonoBehaviour
{
// Token: 0x17000052 RID: 82
// (get) Token: 0x060000E0 RID: 224 RVA: 0x000098E4 File Offset: 0x00007CE4
protected Material material
{
get
{
if (Blur.m_Material == null)
{
Blur.m_Material = new Material(this.blurShader);
Blur.m_Material.hideFlags = HideFlags.DontSave;
}
return Blur.m_Material;
}
}
// Token: 0x060000E1 RID: 225 RVA: 0x00009917 File Offset: 0x00007D17
protected void OnDisable()
{
if (Blur.m_Material)
{
global::UnityEngine.Object.DestroyImmediate(Blur.m_Material);
}
}
// Token: 0x060000E2 RID: 226 RVA: 0x00009934 File Offset: 0x00007D34
protected void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (!this.blurShader || !this.material.shader.isSupported)
{
base.enabled = false;
return;
}
}
// Token: 0x060000E3 RID: 227 RVA: 0x00009980 File Offset: 0x00007D80
public void FourTapCone(RenderTexture source, RenderTexture dest, int iteration)
{
float num = 0.5f + (float)iteration * this.blurSpread;
Graphics.BlitMultiTap(source, dest, this.material, new Vector2[]
{
new Vector2(-num, -num),
new Vector2(-num, num),
new Vector2(num, num),
new Vector2(num, -num)
});
}
// Token: 0x060000E4 RID: 228 RVA: 0x00009A00 File Offset: 0x00007E00
private void DownSample4x(RenderTexture source, RenderTexture dest)
{
float num = 1f;
Graphics.BlitMultiTap(source, dest, this.material, new Vector2[]
{
new Vector2(-num, -num),
new Vector2(-num, num),
new Vector2(num, num),
new Vector2(num, -num)
});
}
// Token: 0x060000E5 RID: 229 RVA: 0x00009A78 File Offset: 0x00007E78
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
int num = source.width / 4;
int num2 = source.height / 4;
RenderTexture renderTexture = RenderTexture.GetTemporary(num, num2, 0);
this.DownSample4x(source, renderTexture);
for (int i = 0; i < this.iterations; i++)
{
RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 0);
this.FourTapCone(renderTexture, temporary, i);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = temporary;
}
Graphics.Blit(renderTexture, destination);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x040001E6 RID: 486
[Range(0f, 10f)]
public int iterations = 3;
// Token: 0x040001E7 RID: 487
[Range(0f, 1f)]
public float blurSpread = 0.6f;
// Token: 0x040001E8 RID: 488
public Shader blurShader;
// Token: 0x040001E9 RID: 489
private static Material m_Material;
}
}
@@ -0,0 +1,99 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005B RID: 91
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Blur/Blur (Optimized)")]
public class BlurOptimized : PostEffectsBase
{
// Token: 0x060000E8 RID: 232 RVA: 0x00009B0C File Offset: 0x00007F0C
public override bool CheckResources()
{
base.CheckSupport(false);
this.blurMaterial = base.CheckShaderAndCreateMaterial(this.blurShader, this.blurMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000E9 RID: 233 RVA: 0x00009B45 File Offset: 0x00007F45
public void OnDisable()
{
if (this.blurMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.blurMaterial);
}
}
// Token: 0x060000EA RID: 234 RVA: 0x00009B64 File Offset: 0x00007F64
public void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
float num = 1f / (1f * (float)(1 << this.downsample));
this.blurMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num, -this.blurSize * num, 0f, 0f));
source.filterMode = FilterMode.Bilinear;
int num2 = source.width >> this.downsample;
int num3 = source.height >> this.downsample;
RenderTexture renderTexture = RenderTexture.GetTemporary(num2, num3, 0, source.format);
renderTexture.filterMode = FilterMode.Bilinear;
Graphics.Blit(source, renderTexture, this.blurMaterial, 0);
int num4 = ((this.blurType != BlurOptimized.BlurType.StandardGauss) ? 2 : 0);
for (int i = 0; i < this.blurIterations; i++)
{
float num5 = (float)i * 1f;
this.blurMaterial.SetVector("_Parameter", new Vector4(this.blurSize * num + num5, -this.blurSize * num - num5, 0f, 0f));
RenderTexture renderTexture2 = RenderTexture.GetTemporary(num2, num3, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial, 1 + num4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(num2, num3, 0, source.format);
renderTexture2.filterMode = FilterMode.Bilinear;
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial, 2 + num4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
Graphics.Blit(renderTexture, destination);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x040001EA RID: 490
[Range(0f, 2f)]
public int downsample = 1;
// Token: 0x040001EB RID: 491
[Range(0f, 10f)]
public float blurSize = 3f;
// Token: 0x040001EC RID: 492
[Range(1f, 4f)]
public int blurIterations = 2;
// Token: 0x040001ED RID: 493
public BlurOptimized.BlurType blurType;
// Token: 0x040001EE RID: 494
public Shader blurShader;
// Token: 0x040001EF RID: 495
private Material blurMaterial;
// Token: 0x0200005C RID: 92
public enum BlurType
{
// Token: 0x040001F1 RID: 497
StandardGauss,
// Token: 0x040001F2 RID: 498
SgxGauss
}
}
}
@@ -0,0 +1,432 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005D RID: 93
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Camera Motion Blur")]
public class CameraMotionBlur : PostEffectsBase
{
// Token: 0x060000EC RID: 236 RVA: 0x00009DA8 File Offset: 0x000081A8
private void CalculateViewProjection()
{
Matrix4x4 worldToCameraMatrix = this._camera.worldToCameraMatrix;
Matrix4x4 gpuprojectionMatrix = GL.GetGPUProjectionMatrix(this._camera.projectionMatrix, true);
this.currentViewProjMat = gpuprojectionMatrix * worldToCameraMatrix;
if (this._camera.stereoEnabled)
{
for (int i = 0; i < 2; i++)
{
Matrix4x4 stereoViewMatrix = this._camera.GetStereoViewMatrix((i != 0) ? Camera.StereoscopicEye.Right : Camera.StereoscopicEye.Left);
Matrix4x4 matrix4x = this._camera.GetStereoProjectionMatrix((i != 0) ? Camera.StereoscopicEye.Right : Camera.StereoscopicEye.Left);
matrix4x = GL.GetGPUProjectionMatrix(matrix4x, true);
this.currentStereoViewProjMat[i] = matrix4x * stereoViewMatrix;
}
}
}
// Token: 0x060000ED RID: 237 RVA: 0x00009E58 File Offset: 0x00008258
private new void Start()
{
this.CheckResources();
if (this._camera == null)
{
this._camera = base.GetComponent<Camera>();
}
this.wasActive = base.gameObject.activeInHierarchy;
this.currentStereoViewProjMat = new Matrix4x4[2];
this.prevStereoViewProjMat = new Matrix4x4[2];
this.CalculateViewProjection();
this.Remember();
this.wasActive = false;
}
// Token: 0x060000EE RID: 238 RVA: 0x00009EC5 File Offset: 0x000082C5
private void OnEnable()
{
if (this._camera == null)
{
this._camera = base.GetComponent<Camera>();
}
this._camera.depthTextureMode |= DepthTextureMode.Depth;
}
// Token: 0x060000EF RID: 239 RVA: 0x00009EF8 File Offset: 0x000082F8
private void OnDisable()
{
if (null != this.motionBlurMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.motionBlurMaterial);
this.motionBlurMaterial = null;
}
if (null != this.dx11MotionBlurMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.dx11MotionBlurMaterial);
this.dx11MotionBlurMaterial = null;
}
if (null != this.tmpCam)
{
global::UnityEngine.Object.DestroyImmediate(this.tmpCam);
this.tmpCam = null;
}
}
// Token: 0x060000F0 RID: 240 RVA: 0x00009F70 File Offset: 0x00008370
public override bool CheckResources()
{
base.CheckSupport(true, true);
this.motionBlurMaterial = base.CheckShaderAndCreateMaterial(this.shader, this.motionBlurMaterial);
if (this.supportDX11 && this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDX11)
{
this.dx11MotionBlurMaterial = base.CheckShaderAndCreateMaterial(this.dx11MotionBlurShader, this.dx11MotionBlurMaterial);
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000F1 RID: 241 RVA: 0x00009FE4 File Offset: 0x000083E4
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.filterType == CameraMotionBlur.MotionBlurFilter.CameraMotion)
{
this.StartFrame();
}
RenderTextureFormat renderTextureFormat = ((!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf)) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.RGHalf);
RenderTexture temporary = RenderTexture.GetTemporary(CameraMotionBlur.divRoundUp(source.width, this.velocityDownsample), CameraMotionBlur.divRoundUp(source.height, this.velocityDownsample), 0, renderTextureFormat);
this.maxVelocity = Mathf.Max(2f, this.maxVelocity);
float num = this.maxVelocity;
bool flag = this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDX11 && this.dx11MotionBlurMaterial == null;
int num2;
int num3;
if (this.filterType == CameraMotionBlur.MotionBlurFilter.Reconstruction || flag || this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDisc)
{
this.maxVelocity = Mathf.Min(this.maxVelocity, CameraMotionBlur.MAX_RADIUS);
num2 = CameraMotionBlur.divRoundUp(temporary.width, (int)this.maxVelocity);
num3 = CameraMotionBlur.divRoundUp(temporary.height, (int)this.maxVelocity);
num = (float)(temporary.width / num2);
}
else
{
num2 = CameraMotionBlur.divRoundUp(temporary.width, (int)this.maxVelocity);
num3 = CameraMotionBlur.divRoundUp(temporary.height, (int)this.maxVelocity);
num = (float)(temporary.width / num2);
}
RenderTexture temporary2 = RenderTexture.GetTemporary(num2, num3, 0, renderTextureFormat);
RenderTexture temporary3 = RenderTexture.GetTemporary(num2, num3, 0, renderTextureFormat);
temporary.filterMode = FilterMode.Point;
temporary2.filterMode = FilterMode.Point;
temporary3.filterMode = FilterMode.Point;
if (this.noiseTexture)
{
this.noiseTexture.filterMode = FilterMode.Point;
}
source.wrapMode = TextureWrapMode.Clamp;
temporary.wrapMode = TextureWrapMode.Clamp;
temporary3.wrapMode = TextureWrapMode.Clamp;
temporary2.wrapMode = TextureWrapMode.Clamp;
this.CalculateViewProjection();
if (base.gameObject.activeInHierarchy && !this.wasActive)
{
this.Remember();
}
this.wasActive = base.gameObject.activeInHierarchy;
Matrix4x4 matrix4x = Matrix4x4.Inverse(this.currentViewProjMat);
this.motionBlurMaterial.SetMatrix("_InvViewProj", matrix4x);
this.motionBlurMaterial.SetMatrix("_PrevViewProj", this.prevViewProjMat);
this.motionBlurMaterial.SetMatrix("_ToPrevViewProjCombined", this.prevViewProjMat * matrix4x);
if (this._camera.stereoEnabled)
{
Matrix4x4[] array = new Matrix4x4[]
{
Matrix4x4.Inverse(this.currentStereoViewProjMat[0]),
Matrix4x4.Inverse(this.currentStereoViewProjMat[1])
};
Matrix4x4 matrix4x2 = this.prevStereoViewProjMat[0] * array[0];
this.motionBlurMaterial.SetMatrix("_StereoToPrevViewProjCombined0", matrix4x2);
this.motionBlurMaterial.SetMatrix("_StereoToPrevViewProjCombined1", this.prevStereoViewProjMat[1] * array[1]);
}
this.motionBlurMaterial.SetFloat("_MaxVelocity", num);
this.motionBlurMaterial.SetFloat("_MaxRadiusOrKInPaper", num);
this.motionBlurMaterial.SetFloat("_MinVelocity", this.minVelocity);
this.motionBlurMaterial.SetFloat("_VelocityScale", this.velocityScale);
this.motionBlurMaterial.SetFloat("_Jitter", this.jitter);
this.motionBlurMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.motionBlurMaterial.SetTexture("_VelTex", temporary);
this.motionBlurMaterial.SetTexture("_NeighbourMaxTex", temporary3);
this.motionBlurMaterial.SetTexture("_TileTexDebug", temporary2);
if (this.preview)
{
Matrix4x4 worldToCameraMatrix = this._camera.worldToCameraMatrix;
Matrix4x4 identity = Matrix4x4.identity;
identity.SetTRS(this.previewScale * 0.3333f, Quaternion.identity, Vector3.one);
Matrix4x4 gpuprojectionMatrix = GL.GetGPUProjectionMatrix(this._camera.projectionMatrix, true);
this.prevViewProjMat = gpuprojectionMatrix * identity * worldToCameraMatrix;
this.motionBlurMaterial.SetMatrix("_PrevViewProj", this.prevViewProjMat);
this.motionBlurMaterial.SetMatrix("_ToPrevViewProjCombined", this.prevViewProjMat * matrix4x);
}
if (this.filterType == CameraMotionBlur.MotionBlurFilter.CameraMotion)
{
Vector4 zero = Vector4.zero;
float num4 = Vector3.Dot(base.transform.up, Vector3.up);
Vector3 vector = this.prevFramePos - base.transform.position;
float magnitude = vector.magnitude;
float num5 = Vector3.Angle(base.transform.up, this.prevFrameUp) / this._camera.fieldOfView * ((float)source.width * 0.75f);
zero.x = this.rotationScale * num5;
num5 = Vector3.Angle(base.transform.forward, this.prevFrameForward) / this._camera.fieldOfView * ((float)source.width * 0.75f);
zero.y = this.rotationScale * num4 * num5;
num5 = Vector3.Angle(base.transform.forward, this.prevFrameForward) / this._camera.fieldOfView * ((float)source.width * 0.75f);
zero.z = this.rotationScale * (1f - num4) * num5;
if (magnitude > Mathf.Epsilon && this.movementScale > Mathf.Epsilon)
{
zero.w = this.movementScale * Vector3.Dot(base.transform.forward, vector) * ((float)source.width * 0.5f);
zero.x += this.movementScale * Vector3.Dot(base.transform.up, vector) * ((float)source.width * 0.5f);
zero.y += this.movementScale * Vector3.Dot(base.transform.right, vector) * ((float)source.width * 0.5f);
}
if (this.preview)
{
this.motionBlurMaterial.SetVector("_BlurDirectionPacked", new Vector4(this.previewScale.y, this.previewScale.x, 0f, this.previewScale.z) * 0.5f * this._camera.fieldOfView);
}
else
{
this.motionBlurMaterial.SetVector("_BlurDirectionPacked", zero);
}
}
else
{
Graphics.Blit(source, temporary, this.motionBlurMaterial, 0);
Camera camera = null;
if (this.excludeLayers.value != 0)
{
camera = this.GetTmpCam();
}
if (camera && this.excludeLayers.value != 0 && this.replacementClear && this.replacementClear.isSupported)
{
camera.targetTexture = temporary;
camera.cullingMask = this.excludeLayers;
camera.RenderWithShader(this.replacementClear, string.Empty);
}
}
if (!this.preview && Time.frameCount != this.prevFrameCount)
{
this.prevFrameCount = Time.frameCount;
this.Remember();
}
source.filterMode = FilterMode.Bilinear;
if (this.showVelocity)
{
this.motionBlurMaterial.SetFloat("_DisplayVelocityScale", this.showVelocityScale);
Graphics.Blit(temporary, destination, this.motionBlurMaterial, 1);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDX11 && !flag)
{
this.dx11MotionBlurMaterial.SetFloat("_MinVelocity", this.minVelocity);
this.dx11MotionBlurMaterial.SetFloat("_VelocityScale", this.velocityScale);
this.dx11MotionBlurMaterial.SetFloat("_Jitter", this.jitter);
this.dx11MotionBlurMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.dx11MotionBlurMaterial.SetTexture("_VelTex", temporary);
this.dx11MotionBlurMaterial.SetTexture("_NeighbourMaxTex", temporary3);
this.dx11MotionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance));
this.dx11MotionBlurMaterial.SetFloat("_MaxRadiusOrKInPaper", num);
Graphics.Blit(temporary, temporary2, this.dx11MotionBlurMaterial, 0);
Graphics.Blit(temporary2, temporary3, this.dx11MotionBlurMaterial, 1);
Graphics.Blit(source, destination, this.dx11MotionBlurMaterial, 2);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.Reconstruction || flag)
{
this.motionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance));
Graphics.Blit(temporary, temporary2, this.motionBlurMaterial, 2);
Graphics.Blit(temporary2, temporary3, this.motionBlurMaterial, 3);
Graphics.Blit(source, destination, this.motionBlurMaterial, 4);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.CameraMotion)
{
Graphics.Blit(source, destination, this.motionBlurMaterial, 6);
}
else if (this.filterType == CameraMotionBlur.MotionBlurFilter.ReconstructionDisc)
{
this.motionBlurMaterial.SetFloat("_SoftZDistance", Mathf.Max(0.00025f, this.softZDistance));
Graphics.Blit(temporary, temporary2, this.motionBlurMaterial, 2);
Graphics.Blit(temporary2, temporary3, this.motionBlurMaterial, 3);
Graphics.Blit(source, destination, this.motionBlurMaterial, 7);
}
else
{
Graphics.Blit(source, destination, this.motionBlurMaterial, 5);
}
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(temporary2);
RenderTexture.ReleaseTemporary(temporary3);
}
// Token: 0x060000F2 RID: 242 RVA: 0x0000A978 File Offset: 0x00008D78
private void Remember()
{
this.prevViewProjMat = this.currentViewProjMat;
this.prevFrameForward = base.transform.forward;
this.prevFrameUp = base.transform.up;
this.prevFramePos = base.transform.position;
this.prevStereoViewProjMat[0] = this.currentStereoViewProjMat[0];
this.prevStereoViewProjMat[1] = this.currentStereoViewProjMat[1];
}
// Token: 0x060000F3 RID: 243 RVA: 0x0000AA08 File Offset: 0x00008E08
private Camera GetTmpCam()
{
if (this.tmpCam == null)
{
string text = "_" + this._camera.name + "_MotionBlurTmpCam";
GameObject gameObject = GameObject.Find(text);
if (null == gameObject)
{
this.tmpCam = new GameObject(text, new Type[] { typeof(Camera) });
}
else
{
this.tmpCam = gameObject;
}
}
this.tmpCam.hideFlags = HideFlags.DontSave;
this.tmpCam.transform.position = this._camera.transform.position;
this.tmpCam.transform.rotation = this._camera.transform.rotation;
this.tmpCam.transform.localScale = this._camera.transform.localScale;
this.tmpCam.GetComponent<Camera>().CopyFrom(this._camera);
this.tmpCam.GetComponent<Camera>().enabled = false;
this.tmpCam.GetComponent<Camera>().depthTextureMode = DepthTextureMode.None;
this.tmpCam.GetComponent<Camera>().clearFlags = CameraClearFlags.Nothing;
return this.tmpCam.GetComponent<Camera>();
}
// Token: 0x060000F4 RID: 244 RVA: 0x0000AB40 File Offset: 0x00008F40
private void StartFrame()
{
this.prevFramePos = Vector3.Slerp(this.prevFramePos, base.transform.position, 0.75f);
}
// Token: 0x060000F5 RID: 245 RVA: 0x0000AB63 File Offset: 0x00008F63
private static int divRoundUp(int x, int d)
{
return (x + d - 1) / d;
}
// Token: 0x040001F3 RID: 499
private static float MAX_RADIUS = 10f;
// Token: 0x040001F4 RID: 500
public CameraMotionBlur.MotionBlurFilter filterType = CameraMotionBlur.MotionBlurFilter.Reconstruction;
// Token: 0x040001F5 RID: 501
public bool preview;
// Token: 0x040001F6 RID: 502
public Vector3 previewScale = Vector3.one;
// Token: 0x040001F7 RID: 503
public float movementScale;
// Token: 0x040001F8 RID: 504
public float rotationScale = 1f;
// Token: 0x040001F9 RID: 505
public float maxVelocity = 8f;
// Token: 0x040001FA RID: 506
public float minVelocity = 0.1f;
// Token: 0x040001FB RID: 507
public float velocityScale = 0.375f;
// Token: 0x040001FC RID: 508
public float softZDistance = 0.005f;
// Token: 0x040001FD RID: 509
public int velocityDownsample = 1;
// Token: 0x040001FE RID: 510
public LayerMask excludeLayers = 0;
// Token: 0x040001FF RID: 511
private GameObject tmpCam;
// Token: 0x04000200 RID: 512
public Shader shader;
// Token: 0x04000201 RID: 513
public Shader dx11MotionBlurShader;
// Token: 0x04000202 RID: 514
public Shader replacementClear;
// Token: 0x04000203 RID: 515
private Material motionBlurMaterial;
// Token: 0x04000204 RID: 516
private Material dx11MotionBlurMaterial;
// Token: 0x04000205 RID: 517
public Texture2D noiseTexture;
// Token: 0x04000206 RID: 518
public float jitter = 0.05f;
// Token: 0x04000207 RID: 519
public bool showVelocity;
// Token: 0x04000208 RID: 520
public float showVelocityScale = 1f;
// Token: 0x04000209 RID: 521
private Matrix4x4 currentViewProjMat;
// Token: 0x0400020A RID: 522
private Matrix4x4[] currentStereoViewProjMat;
// Token: 0x0400020B RID: 523
private Matrix4x4 prevViewProjMat;
// Token: 0x0400020C RID: 524
private Matrix4x4[] prevStereoViewProjMat;
// Token: 0x0400020D RID: 525
private int prevFrameCount;
// Token: 0x0400020E RID: 526
private bool wasActive;
// Token: 0x0400020F RID: 527
private Vector3 prevFrameForward = Vector3.forward;
// Token: 0x04000210 RID: 528
private Vector3 prevFrameUp = Vector3.up;
// Token: 0x04000211 RID: 529
private Vector3 prevFramePos = Vector3.zero;
// Token: 0x04000212 RID: 530
private Camera _camera;
// Token: 0x0200005E RID: 94
public enum MotionBlurFilter
{
// Token: 0x04000214 RID: 532
CameraMotion,
// Token: 0x04000215 RID: 533
LocalBlur,
// Token: 0x04000216 RID: 534
Reconstruction,
// Token: 0x04000217 RID: 535
ReconstructionDX11,
// Token: 0x04000218 RID: 536
ReconstructionDisc
}
}
}
@@ -0,0 +1,244 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200005F RID: 95
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Color Correction (Curves, Saturation)")]
public class ColorCorrectionCurves : PostEffectsBase
{
// Token: 0x060000F8 RID: 248 RVA: 0x0000ADAB File Offset: 0x000091AB
private new void Start()
{
base.Start();
this.updateTexturesOnStartup = true;
}
// Token: 0x060000F9 RID: 249 RVA: 0x0000ADBA File Offset: 0x000091BA
private void Awake()
{
}
// Token: 0x060000FA RID: 250 RVA: 0x0000ADBC File Offset: 0x000091BC
public override bool CheckResources()
{
base.CheckSupport(this.mode == ColorCorrectionCurves.ColorCorrectionMode.Advanced);
this.ccMaterial = base.CheckShaderAndCreateMaterial(this.simpleColorCorrectionCurvesShader, this.ccMaterial);
this.ccDepthMaterial = base.CheckShaderAndCreateMaterial(this.colorCorrectionCurvesShader, this.ccDepthMaterial);
this.selectiveCcMaterial = base.CheckShaderAndCreateMaterial(this.colorCorrectionSelectiveShader, this.selectiveCcMaterial);
if (!this.rgbChannelTex)
{
this.rgbChannelTex = new Texture2D(256, 4, TextureFormat.ARGB32, false, true);
}
if (!this.rgbDepthChannelTex)
{
this.rgbDepthChannelTex = new Texture2D(256, 4, TextureFormat.ARGB32, false, true);
}
if (!this.zCurveTex)
{
this.zCurveTex = new Texture2D(256, 1, TextureFormat.ARGB32, false, true);
}
this.rgbChannelTex.hideFlags = HideFlags.DontSave;
this.rgbDepthChannelTex.hideFlags = HideFlags.DontSave;
this.zCurveTex.hideFlags = HideFlags.DontSave;
this.rgbChannelTex.wrapMode = TextureWrapMode.Clamp;
this.rgbDepthChannelTex.wrapMode = TextureWrapMode.Clamp;
this.zCurveTex.wrapMode = TextureWrapMode.Clamp;
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060000FB RID: 251 RVA: 0x0000AEF0 File Offset: 0x000092F0
public void UpdateParameters()
{
this.CheckResources();
if (this.redChannel != null && this.greenChannel != null && this.blueChannel != null)
{
for (float num = 0f; num <= 1f; num += 0.003921569f)
{
float num2 = Mathf.Clamp(this.redChannel.Evaluate(num), 0f, 1f);
float num3 = Mathf.Clamp(this.greenChannel.Evaluate(num), 0f, 1f);
float num4 = Mathf.Clamp(this.blueChannel.Evaluate(num), 0f, 1f);
this.rgbChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 0, new Color(num2, num2, num2));
this.rgbChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 1, new Color(num3, num3, num3));
this.rgbChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 2, new Color(num4, num4, num4));
float num5 = Mathf.Clamp(this.zCurve.Evaluate(num), 0f, 1f);
this.zCurveTex.SetPixel((int)Mathf.Floor(num * 255f), 0, new Color(num5, num5, num5));
num2 = Mathf.Clamp(this.depthRedChannel.Evaluate(num), 0f, 1f);
num3 = Mathf.Clamp(this.depthGreenChannel.Evaluate(num), 0f, 1f);
num4 = Mathf.Clamp(this.depthBlueChannel.Evaluate(num), 0f, 1f);
this.rgbDepthChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 0, new Color(num2, num2, num2));
this.rgbDepthChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 1, new Color(num3, num3, num3));
this.rgbDepthChannelTex.SetPixel((int)Mathf.Floor(num * 255f), 2, new Color(num4, num4, num4));
}
this.rgbChannelTex.Apply();
this.rgbDepthChannelTex.Apply();
this.zCurveTex.Apply();
}
}
// Token: 0x060000FC RID: 252 RVA: 0x0000B113 File Offset: 0x00009513
private void UpdateTextures()
{
this.UpdateParameters();
}
// Token: 0x060000FD RID: 253 RVA: 0x0000B11C File Offset: 0x0000951C
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.updateTexturesOnStartup)
{
this.UpdateParameters();
this.updateTexturesOnStartup = false;
}
if (this.useDepthCorrection)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
RenderTexture renderTexture = destination;
if (this.selectiveCc)
{
renderTexture = RenderTexture.GetTemporary(source.width, source.height);
}
if (this.useDepthCorrection)
{
this.ccDepthMaterial.SetTexture("_RgbTex", this.rgbChannelTex);
this.ccDepthMaterial.SetTexture("_ZCurve", this.zCurveTex);
this.ccDepthMaterial.SetTexture("_RgbDepthTex", this.rgbDepthChannelTex);
this.ccDepthMaterial.SetFloat("_Saturation", this.saturation);
Graphics.Blit(source, renderTexture, this.ccDepthMaterial);
}
else
{
this.ccMaterial.SetTexture("_RgbTex", this.rgbChannelTex);
this.ccMaterial.SetFloat("_Saturation", this.saturation);
Graphics.Blit(source, renderTexture, this.ccMaterial);
}
if (this.selectiveCc)
{
this.selectiveCcMaterial.SetColor("selColor", this.selectiveFromColor);
this.selectiveCcMaterial.SetColor("targetColor", this.selectiveToColor);
Graphics.Blit(renderTexture, destination, this.selectiveCcMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
}
}
// Token: 0x04000219 RID: 537
public AnimationCurve redChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021A RID: 538
public AnimationCurve greenChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021B RID: 539
public AnimationCurve blueChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021C RID: 540
public bool useDepthCorrection;
// Token: 0x0400021D RID: 541
public AnimationCurve zCurve = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021E RID: 542
public AnimationCurve depthRedChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x0400021F RID: 543
public AnimationCurve depthGreenChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x04000220 RID: 544
public AnimationCurve depthBlueChannel = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(1f, 1f)
});
// Token: 0x04000221 RID: 545
private Material ccMaterial;
// Token: 0x04000222 RID: 546
private Material ccDepthMaterial;
// Token: 0x04000223 RID: 547
private Material selectiveCcMaterial;
// Token: 0x04000224 RID: 548
private Texture2D rgbChannelTex;
// Token: 0x04000225 RID: 549
private Texture2D rgbDepthChannelTex;
// Token: 0x04000226 RID: 550
private Texture2D zCurveTex;
// Token: 0x04000227 RID: 551
public float saturation = 1f;
// Token: 0x04000228 RID: 552
public bool selectiveCc;
// Token: 0x04000229 RID: 553
public Color selectiveFromColor = Color.white;
// Token: 0x0400022A RID: 554
public Color selectiveToColor = Color.white;
// Token: 0x0400022B RID: 555
public ColorCorrectionCurves.ColorCorrectionMode mode;
// Token: 0x0400022C RID: 556
public bool updateTextures = true;
// Token: 0x0400022D RID: 557
public Shader colorCorrectionCurvesShader;
// Token: 0x0400022E RID: 558
public Shader simpleColorCorrectionCurvesShader;
// Token: 0x0400022F RID: 559
public Shader colorCorrectionSelectiveShader;
// Token: 0x04000230 RID: 560
private bool updateTexturesOnStartup = true;
// Token: 0x02000060 RID: 96
public enum ColorCorrectionMode
{
// Token: 0x04000232 RID: 562
Simple,
// Token: 0x04000233 RID: 563
Advanced
}
}
}
@@ -0,0 +1,153 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000061 RID: 97
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Color Correction (3D Lookup Texture)")]
public class ColorCorrectionLookup : PostEffectsBase
{
// Token: 0x060000FF RID: 255 RVA: 0x0000B29C File Offset: 0x0000969C
public override bool CheckResources()
{
base.CheckSupport(false);
this.material = base.CheckShaderAndCreateMaterial(this.shader, this.material);
if (!this.isSupported || !SystemInfo.supports3DTextures)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000100 RID: 256 RVA: 0x0000B2EA File Offset: 0x000096EA
private void OnDisable()
{
if (this.material)
{
global::UnityEngine.Object.DestroyImmediate(this.material);
this.material = null;
}
}
// Token: 0x06000101 RID: 257 RVA: 0x0000B30E File Offset: 0x0000970E
private void OnDestroy()
{
if (this.converted3DLut)
{
global::UnityEngine.Object.DestroyImmediate(this.converted3DLut);
}
this.converted3DLut = null;
}
// Token: 0x06000102 RID: 258 RVA: 0x0000B334 File Offset: 0x00009734
public void SetIdentityLut()
{
int num = 16;
Color[] array = new Color[num * num * num];
float num2 = 1f / (1f * (float)num - 1f);
for (int i = 0; i < num; i++)
{
for (int j = 0; j < num; j++)
{
for (int k = 0; k < num; k++)
{
array[i + j * num + k * num * num] = new Color((float)i * 1f * num2, (float)j * 1f * num2, (float)k * 1f * num2, 1f);
}
}
}
if (this.converted3DLut)
{
global::UnityEngine.Object.DestroyImmediate(this.converted3DLut);
}
this.converted3DLut = new Texture3D(num, num, num, TextureFormat.ARGB32, false);
this.converted3DLut.SetPixels(array);
this.converted3DLut.Apply();
this.basedOnTempTex = string.Empty;
}
// Token: 0x06000103 RID: 259 RVA: 0x0000B434 File Offset: 0x00009834
public bool ValidDimensions(Texture2D tex2d)
{
if (!tex2d)
{
return false;
}
int height = tex2d.height;
return height == Mathf.FloorToInt(Mathf.Sqrt((float)tex2d.width));
}
// Token: 0x06000104 RID: 260 RVA: 0x0000B470 File Offset: 0x00009870
public void Convert(Texture2D temp2DTex, string path)
{
if (temp2DTex)
{
int num = temp2DTex.width * temp2DTex.height;
num = temp2DTex.height;
if (!this.ValidDimensions(temp2DTex))
{
Debug.LogWarning("The given 2D texture " + temp2DTex.name + " cannot be used as a 3D LUT.");
this.basedOnTempTex = string.Empty;
return;
}
Color[] pixels = temp2DTex.GetPixels();
Color[] array = new Color[pixels.Length];
for (int i = 0; i < num; i++)
{
for (int j = 0; j < num; j++)
{
for (int k = 0; k < num; k++)
{
int num2 = num - j - 1;
array[i + j * num + k * num * num] = pixels[k * num + i + num2 * num * num];
}
}
}
if (this.converted3DLut)
{
global::UnityEngine.Object.DestroyImmediate(this.converted3DLut);
}
this.converted3DLut = new Texture3D(num, num, num, TextureFormat.ARGB32, false);
this.converted3DLut.SetPixels(array);
this.converted3DLut.Apply();
this.basedOnTempTex = path;
}
else
{
Debug.LogError("Couldn't color correct with 3D LUT texture. Image Effect will be disabled.");
}
}
// Token: 0x06000105 RID: 261 RVA: 0x0000B5B0 File Offset: 0x000099B0
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources() || !SystemInfo.supports3DTextures)
{
Graphics.Blit(source, destination);
return;
}
if (this.converted3DLut == null)
{
this.SetIdentityLut();
}
int width = this.converted3DLut.width;
this.converted3DLut.wrapMode = TextureWrapMode.Clamp;
this.material.SetFloat("_Scale", (float)(width - 1) / (1f * (float)width));
this.material.SetFloat("_Offset", 1f / (2f * (float)width));
this.material.SetTexture("_ClutTex", this.converted3DLut);
Graphics.Blit(source, destination, this.material, (QualitySettings.activeColorSpace != ColorSpace.Linear) ? 0 : 1);
}
// Token: 0x04000234 RID: 564
public Shader shader;
// Token: 0x04000235 RID: 565
private Material material;
// Token: 0x04000236 RID: 566
public Texture3D converted3DLut;
// Token: 0x04000237 RID: 567
public string basedOnTempTex = string.Empty;
}
}
@@ -0,0 +1,21 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000062 RID: 98
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Color Correction (Ramp)")]
public class ColorCorrectionRamp : ImageEffectBase
{
// Token: 0x06000107 RID: 263 RVA: 0x0000B718 File Offset: 0x00009B18
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
base.material.SetTexture("_RampTex", this.textureRamp);
Graphics.Blit(source, destination, base.material);
}
// Token: 0x04000238 RID: 568
public Texture textureRamp;
}
}
@@ -0,0 +1,79 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000063 RID: 99
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Color Adjustments/Contrast Enhance (Unsharp Mask)")]
public class ContrastEnhance : PostEffectsBase
{
// Token: 0x06000109 RID: 265 RVA: 0x0000B75C File Offset: 0x00009B5C
public override bool CheckResources()
{
base.CheckSupport(false);
this.contrastCompositeMaterial = base.CheckShaderAndCreateMaterial(this.contrastCompositeShader, this.contrastCompositeMaterial);
this.separableBlurMaterial = base.CheckShaderAndCreateMaterial(this.separableBlurShader, this.separableBlurMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600010A RID: 266 RVA: 0x0000B7B8 File Offset: 0x00009BB8
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int width = source.width;
int height = source.height;
RenderTexture temporary = RenderTexture.GetTemporary(width / 2, height / 2, 0);
Graphics.Blit(source, temporary);
RenderTexture renderTexture = RenderTexture.GetTemporary(width / 4, height / 4, 0);
Graphics.Blit(temporary, renderTexture);
RenderTexture.ReleaseTemporary(temporary);
this.separableBlurMaterial.SetVector("offsets", new Vector4(0f, this.blurSpread * 1f / (float)renderTexture.height, 0f, 0f));
RenderTexture temporary2 = RenderTexture.GetTemporary(width / 4, height / 4, 0);
Graphics.Blit(renderTexture, temporary2, this.separableBlurMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
this.separableBlurMaterial.SetVector("offsets", new Vector4(this.blurSpread * 1f / (float)renderTexture.width, 0f, 0f, 0f));
renderTexture = RenderTexture.GetTemporary(width / 4, height / 4, 0);
Graphics.Blit(temporary2, renderTexture, this.separableBlurMaterial);
RenderTexture.ReleaseTemporary(temporary2);
this.contrastCompositeMaterial.SetTexture("_MainTexBlurred", renderTexture);
this.contrastCompositeMaterial.SetFloat("intensity", this.intensity);
this.contrastCompositeMaterial.SetFloat("threshold", this.threshold);
Graphics.Blit(source, destination, this.contrastCompositeMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x04000239 RID: 569
[Range(0f, 1f)]
public float intensity = 0.5f;
// Token: 0x0400023A RID: 570
[Range(0f, 0.999f)]
public float threshold;
// Token: 0x0400023B RID: 571
private Material separableBlurMaterial;
// Token: 0x0400023C RID: 572
private Material contrastCompositeMaterial;
// Token: 0x0400023D RID: 573
[Range(0f, 1f)]
public float blurSpread = 1f;
// Token: 0x0400023E RID: 574
public Shader separableBlurShader;
// Token: 0x0400023F RID: 575
public Shader contrastCompositeShader;
}
}
@@ -0,0 +1,209 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000064 RID: 100
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Contrast Stretch")]
public class ContrastStretch : MonoBehaviour
{
// Token: 0x17000053 RID: 83
// (get) Token: 0x0600010C RID: 268 RVA: 0x0000B94D File Offset: 0x00009D4D
protected Material materialLum
{
get
{
if (this.m_materialLum == null)
{
this.m_materialLum = new Material(this.shaderLum);
this.m_materialLum.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialLum;
}
}
// Token: 0x17000054 RID: 84
// (get) Token: 0x0600010D RID: 269 RVA: 0x0000B984 File Offset: 0x00009D84
protected Material materialReduce
{
get
{
if (this.m_materialReduce == null)
{
this.m_materialReduce = new Material(this.shaderReduce);
this.m_materialReduce.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialReduce;
}
}
// Token: 0x17000055 RID: 85
// (get) Token: 0x0600010E RID: 270 RVA: 0x0000B9BB File Offset: 0x00009DBB
protected Material materialAdapt
{
get
{
if (this.m_materialAdapt == null)
{
this.m_materialAdapt = new Material(this.shaderAdapt);
this.m_materialAdapt.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialAdapt;
}
}
// Token: 0x17000056 RID: 86
// (get) Token: 0x0600010F RID: 271 RVA: 0x0000B9F2 File Offset: 0x00009DF2
protected Material materialApply
{
get
{
if (this.m_materialApply == null)
{
this.m_materialApply = new Material(this.shaderApply);
this.m_materialApply.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_materialApply;
}
}
// Token: 0x06000110 RID: 272 RVA: 0x0000BA2C File Offset: 0x00009E2C
private void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (!this.shaderAdapt.isSupported || !this.shaderApply.isSupported || !this.shaderLum.isSupported || !this.shaderReduce.isSupported)
{
base.enabled = false;
return;
}
}
// Token: 0x06000111 RID: 273 RVA: 0x0000BA94 File Offset: 0x00009E94
private void OnEnable()
{
for (int i = 0; i < 2; i++)
{
if (!this.adaptRenderTex[i])
{
this.adaptRenderTex[i] = new RenderTexture(1, 1, 0);
this.adaptRenderTex[i].hideFlags = HideFlags.HideAndDontSave;
}
}
}
// Token: 0x06000112 RID: 274 RVA: 0x0000BAE4 File Offset: 0x00009EE4
private void OnDisable()
{
for (int i = 0; i < 2; i++)
{
global::UnityEngine.Object.DestroyImmediate(this.adaptRenderTex[i]);
this.adaptRenderTex[i] = null;
}
if (this.m_materialLum)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialLum);
}
if (this.m_materialReduce)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialReduce);
}
if (this.m_materialAdapt)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialAdapt);
}
if (this.m_materialApply)
{
global::UnityEngine.Object.DestroyImmediate(this.m_materialApply);
}
}
// Token: 0x06000113 RID: 275 RVA: 0x0000BB88 File Offset: 0x00009F88
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
RenderTexture renderTexture = RenderTexture.GetTemporary(source.width, source.height);
Graphics.Blit(source, renderTexture, this.materialLum);
while (renderTexture.width > 1 || renderTexture.height > 1)
{
int num = renderTexture.width / 2;
if (num < 1)
{
num = 1;
}
int num2 = renderTexture.height / 2;
if (num2 < 1)
{
num2 = 1;
}
RenderTexture temporary = RenderTexture.GetTemporary(num, num2);
Graphics.Blit(renderTexture, temporary, this.materialReduce);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = temporary;
}
this.CalculateAdaptation(renderTexture);
this.materialApply.SetTexture("_AdaptTex", this.adaptRenderTex[this.curAdaptIndex]);
Graphics.Blit(source, destination, this.materialApply);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x06000114 RID: 276 RVA: 0x0000BC4C File Offset: 0x0000A04C
private void CalculateAdaptation(Texture curTexture)
{
int num = this.curAdaptIndex;
this.curAdaptIndex = (this.curAdaptIndex + 1) % 2;
float num2 = 1f - Mathf.Pow(1f - this.adaptationSpeed, 30f * Time.deltaTime);
num2 = Mathf.Clamp(num2, 0.01f, 1f);
this.materialAdapt.SetTexture("_CurTex", curTexture);
this.materialAdapt.SetVector("_AdaptParams", new Vector4(num2, this.limitMinimum, this.limitMaximum, 0f));
Graphics.SetRenderTarget(this.adaptRenderTex[this.curAdaptIndex]);
GL.Clear(false, true, Color.black);
Graphics.Blit(this.adaptRenderTex[num], this.adaptRenderTex[this.curAdaptIndex], this.materialAdapt);
}
// Token: 0x04000240 RID: 576
[Range(0.0001f, 1f)]
public float adaptationSpeed = 0.02f;
// Token: 0x04000241 RID: 577
[Range(0f, 1f)]
public float limitMinimum = 0.2f;
// Token: 0x04000242 RID: 578
[Range(0f, 1f)]
public float limitMaximum = 0.6f;
// Token: 0x04000243 RID: 579
private RenderTexture[] adaptRenderTex = new RenderTexture[2];
// Token: 0x04000244 RID: 580
private int curAdaptIndex;
// Token: 0x04000245 RID: 581
public Shader shaderLum;
// Token: 0x04000246 RID: 582
private Material m_materialLum;
// Token: 0x04000247 RID: 583
public Shader shaderReduce;
// Token: 0x04000248 RID: 584
private Material m_materialReduce;
// Token: 0x04000249 RID: 585
public Shader shaderAdapt;
// Token: 0x0400024A RID: 586
private Material m_materialAdapt;
// Token: 0x0400024B RID: 587
public Shader shaderApply;
// Token: 0x0400024C RID: 588
private Material m_materialApply;
}
}
@@ -0,0 +1,90 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000065 RID: 101
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Edge Detection/Crease Shading")]
public class CreaseShading : PostEffectsBase
{
// Token: 0x06000116 RID: 278 RVA: 0x0000BD40 File Offset: 0x0000A140
public override bool CheckResources()
{
base.CheckSupport(true);
this.blurMaterial = base.CheckShaderAndCreateMaterial(this.blurShader, this.blurMaterial);
this.depthFetchMaterial = base.CheckShaderAndCreateMaterial(this.depthFetchShader, this.depthFetchMaterial);
this.creaseApplyMaterial = base.CheckShaderAndCreateMaterial(this.creaseApplyShader, this.creaseApplyMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000117 RID: 279 RVA: 0x0000BDB4 File Offset: 0x0000A1B4
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int width = source.width;
int height = source.height;
float num = 1f * (float)width / (1f * (float)height);
float num2 = 0.001953125f;
RenderTexture temporary = RenderTexture.GetTemporary(width, height, 0);
RenderTexture renderTexture = RenderTexture.GetTemporary(width / 2, height / 2, 0);
Graphics.Blit(source, temporary, this.depthFetchMaterial);
Graphics.Blit(temporary, renderTexture);
for (int i = 0; i < this.softness; i++)
{
RenderTexture renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0);
this.blurMaterial.SetVector("offsets", new Vector4(0f, this.spread * num2, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0);
this.blurMaterial.SetVector("offsets", new Vector4(this.spread * num2 / num, 0f, 0f, 0f));
Graphics.Blit(renderTexture, renderTexture2, this.blurMaterial);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
this.creaseApplyMaterial.SetTexture("_HrDepthTex", temporary);
this.creaseApplyMaterial.SetTexture("_LrDepthTex", renderTexture);
this.creaseApplyMaterial.SetFloat("intensity", this.intensity);
Graphics.Blit(source, destination, this.creaseApplyMaterial);
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x0400024D RID: 589
public float intensity = 0.5f;
// Token: 0x0400024E RID: 590
public int softness = 1;
// Token: 0x0400024F RID: 591
public float spread = 1f;
// Token: 0x04000250 RID: 592
public Shader blurShader;
// Token: 0x04000251 RID: 593
private Material blurMaterial;
// Token: 0x04000252 RID: 594
public Shader depthFetchShader;
// Token: 0x04000253 RID: 595
private Material depthFetchMaterial;
// Token: 0x04000254 RID: 596
public Shader creaseApplyShader;
// Token: 0x04000255 RID: 597
private Material creaseApplyMaterial;
}
}
@@ -0,0 +1,390 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000066 RID: 102
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Depth of Field (Lens Blur, Scatter, DX11)")]
public class DepthOfField : PostEffectsBase
{
// Token: 0x06000119 RID: 281 RVA: 0x0000BFD8 File Offset: 0x0000A3D8
public override bool CheckResources()
{
base.CheckSupport(true);
this.dofHdrMaterial = base.CheckShaderAndCreateMaterial(this.dofHdrShader, this.dofHdrMaterial);
if (this.supportDX11 && this.blurType == DepthOfField.BlurType.DX11)
{
this.dx11bokehMaterial = base.CheckShaderAndCreateMaterial(this.dx11BokehShader, this.dx11bokehMaterial);
this.CreateComputeResources();
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600011A RID: 282 RVA: 0x0000C051 File Offset: 0x0000A451
private void OnEnable()
{
this.cachedCamera = base.GetComponent<Camera>();
this.cachedCamera.depthTextureMode |= DepthTextureMode.Depth;
}
// Token: 0x0600011B RID: 283 RVA: 0x0000C074 File Offset: 0x0000A474
private void OnDisable()
{
this.ReleaseComputeResources();
if (this.dofHdrMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.dofHdrMaterial);
}
this.dofHdrMaterial = null;
if (this.dx11bokehMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.dx11bokehMaterial);
}
this.dx11bokehMaterial = null;
}
// Token: 0x0600011C RID: 284 RVA: 0x0000C0CB File Offset: 0x0000A4CB
private void ReleaseComputeResources()
{
if (this.cbDrawArgs != null)
{
this.cbDrawArgs.Release();
}
this.cbDrawArgs = null;
if (this.cbPoints != null)
{
this.cbPoints.Release();
}
this.cbPoints = null;
}
// Token: 0x0600011D RID: 285 RVA: 0x0000C108 File Offset: 0x0000A508
private void CreateComputeResources()
{
if (this.cbDrawArgs == null)
{
this.cbDrawArgs = new ComputeBuffer(1, 16, ComputeBufferType.DrawIndirect);
int[] array = new int[] { 0, 1, 0, 0 };
this.cbDrawArgs.SetData(array);
}
if (this.cbPoints == null)
{
this.cbPoints = new ComputeBuffer(90000, 28, ComputeBufferType.Append);
}
}
// Token: 0x0600011E RID: 286 RVA: 0x0000C174 File Offset: 0x0000A574
private float FocalDistance01(float worldDist)
{
return this.cachedCamera.WorldToViewportPoint((worldDist - this.cachedCamera.nearClipPlane) * this.cachedCamera.transform.forward + this.cachedCamera.transform.position).z / (this.cachedCamera.farClipPlane - this.cachedCamera.nearClipPlane);
}
// Token: 0x0600011F RID: 287 RVA: 0x0000C1E4 File Offset: 0x0000A5E4
private void WriteCoc(RenderTexture fromTo, bool fgDilate)
{
this.dofHdrMaterial.SetTexture("_FgOverlap", null);
if (this.nearBlur && fgDilate)
{
int num = fromTo.width / 2;
int num2 = fromTo.height / 2;
RenderTexture renderTexture = RenderTexture.GetTemporary(num, num2, 0, fromTo.format);
Graphics.Blit(fromTo, renderTexture, this.dofHdrMaterial, 4);
float num3 = this.internalBlurWidth * this.foregroundOverlap;
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, num3, 0f, num3));
RenderTexture temporary = RenderTexture.GetTemporary(num, num2, 0, fromTo.format);
Graphics.Blit(renderTexture, temporary, this.dofHdrMaterial, 2);
RenderTexture.ReleaseTemporary(renderTexture);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(num3, 0f, 0f, num3));
renderTexture = RenderTexture.GetTemporary(num, num2, 0, fromTo.format);
Graphics.Blit(temporary, renderTexture, this.dofHdrMaterial, 2);
RenderTexture.ReleaseTemporary(temporary);
this.dofHdrMaterial.SetTexture("_FgOverlap", renderTexture);
fromTo.MarkRestoreExpected();
Graphics.Blit(fromTo, fromTo, this.dofHdrMaterial, 13);
RenderTexture.ReleaseTemporary(renderTexture);
}
else
{
fromTo.MarkRestoreExpected();
Graphics.Blit(fromTo, fromTo, this.dofHdrMaterial, 0);
}
}
// Token: 0x06000120 RID: 288 RVA: 0x0000C324 File Offset: 0x0000A724
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.aperture < 0f)
{
this.aperture = 0f;
}
if (this.maxBlurSize < 0.1f)
{
this.maxBlurSize = 0.1f;
}
this.focalSize = Mathf.Clamp(this.focalSize, 0f, 2f);
this.internalBlurWidth = Mathf.Max(this.maxBlurSize, 0f);
this.focalDistance01 = ((!this.focalTransform) ? this.FocalDistance01(this.focalLength) : (this.cachedCamera.WorldToViewportPoint(this.focalTransform.position).z / this.cachedCamera.farClipPlane));
this.dofHdrMaterial.SetVector("_CurveParams", new Vector4(1f, this.focalSize, 1f / (1f - this.aperture) - 1f, this.focalDistance01));
RenderTexture renderTexture = null;
RenderTexture renderTexture2 = null;
float num = this.internalBlurWidth * this.foregroundOverlap;
if (this.visualizeFocus)
{
this.WriteCoc(source, true);
Graphics.Blit(source, destination, this.dofHdrMaterial, 16);
}
else if (this.blurType == DepthOfField.BlurType.DX11 && this.dx11bokehMaterial)
{
if (this.highResolution)
{
this.internalBlurWidth = ((this.internalBlurWidth >= 0.1f) ? this.internalBlurWidth : 0.1f);
num = this.internalBlurWidth * this.foregroundOverlap;
renderTexture = RenderTexture.GetTemporary(source.width, source.height, 0, source.format);
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, source.format);
this.WriteCoc(source, false);
RenderTexture renderTexture3 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
RenderTexture renderTexture4 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
Graphics.Blit(source, renderTexture3, this.dofHdrMaterial, 15);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f, 0f, 1.5f));
Graphics.Blit(renderTexture3, renderTexture4, this.dofHdrMaterial, 19);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(1.5f, 0f, 0f, 1.5f));
Graphics.Blit(renderTexture4, renderTexture3, this.dofHdrMaterial, 19);
if (this.nearBlur)
{
Graphics.Blit(source, renderTexture4, this.dofHdrMaterial, 4);
}
this.dx11bokehMaterial.SetTexture("_BlurredColor", renderTexture3);
this.dx11bokehMaterial.SetFloat("_SpawnHeuristic", this.dx11SpawnHeuristic);
this.dx11bokehMaterial.SetVector("_BokehParams", new Vector4(this.dx11BokehScale, this.dx11BokehIntensity, Mathf.Clamp(this.dx11BokehThreshold, 0.005f, 4f), this.internalBlurWidth));
this.dx11bokehMaterial.SetTexture("_FgCocMask", (!this.nearBlur) ? null : renderTexture4);
Graphics.SetRandomWriteTarget(1, this.cbPoints);
Graphics.Blit(source, renderTexture, this.dx11bokehMaterial, 0);
Graphics.ClearRandomWriteTargets();
if (this.nearBlur)
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, num, 0f, num));
Graphics.Blit(renderTexture4, renderTexture3, this.dofHdrMaterial, 2);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(num, 0f, 0f, num));
Graphics.Blit(renderTexture3, renderTexture4, this.dofHdrMaterial, 2);
Graphics.Blit(renderTexture4, renderTexture, this.dofHdrMaterial, 3);
}
Graphics.Blit(renderTexture, temporary, this.dofHdrMaterial, 20);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(this.internalBlurWidth, 0f, 0f, this.internalBlurWidth));
Graphics.Blit(renderTexture, source, this.dofHdrMaterial, 5);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0f, this.internalBlurWidth));
Graphics.Blit(source, temporary, this.dofHdrMaterial, 21);
Graphics.SetRenderTarget(temporary);
ComputeBuffer.CopyCount(this.cbPoints, this.cbDrawArgs, 0);
this.dx11bokehMaterial.SetBuffer("pointBuffer", this.cbPoints);
this.dx11bokehMaterial.SetTexture("_MainTex", this.dx11BokehTexture);
this.dx11bokehMaterial.SetVector("_Screen", new Vector3(1f / (1f * (float)source.width), 1f / (1f * (float)source.height), this.internalBlurWidth));
this.dx11bokehMaterial.SetPass(2);
Graphics.DrawProceduralIndirect(MeshTopology.Points, this.cbDrawArgs, 0);
Graphics.Blit(temporary, destination);
RenderTexture.ReleaseTemporary(temporary);
RenderTexture.ReleaseTemporary(renderTexture3);
RenderTexture.ReleaseTemporary(renderTexture4);
}
else
{
renderTexture = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
renderTexture2 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
num = this.internalBlurWidth * this.foregroundOverlap;
this.WriteCoc(source, false);
source.filterMode = FilterMode.Bilinear;
Graphics.Blit(source, renderTexture, this.dofHdrMaterial, 6);
RenderTexture renderTexture3 = RenderTexture.GetTemporary(renderTexture.width >> 1, renderTexture.height >> 1, 0, renderTexture.format);
RenderTexture renderTexture4 = RenderTexture.GetTemporary(renderTexture.width >> 1, renderTexture.height >> 1, 0, renderTexture.format);
Graphics.Blit(renderTexture, renderTexture3, this.dofHdrMaterial, 15);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, 1.5f, 0f, 1.5f));
Graphics.Blit(renderTexture3, renderTexture4, this.dofHdrMaterial, 19);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(1.5f, 0f, 0f, 1.5f));
Graphics.Blit(renderTexture4, renderTexture3, this.dofHdrMaterial, 19);
RenderTexture renderTexture5 = null;
if (this.nearBlur)
{
renderTexture5 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
Graphics.Blit(source, renderTexture5, this.dofHdrMaterial, 4);
}
this.dx11bokehMaterial.SetTexture("_BlurredColor", renderTexture3);
this.dx11bokehMaterial.SetFloat("_SpawnHeuristic", this.dx11SpawnHeuristic);
this.dx11bokehMaterial.SetVector("_BokehParams", new Vector4(this.dx11BokehScale, this.dx11BokehIntensity, Mathf.Clamp(this.dx11BokehThreshold, 0.005f, 4f), this.internalBlurWidth));
this.dx11bokehMaterial.SetTexture("_FgCocMask", renderTexture5);
Graphics.SetRandomWriteTarget(1, this.cbPoints);
Graphics.Blit(renderTexture, renderTexture2, this.dx11bokehMaterial, 0);
Graphics.ClearRandomWriteTargets();
RenderTexture.ReleaseTemporary(renderTexture3);
RenderTexture.ReleaseTemporary(renderTexture4);
if (this.nearBlur)
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, num, 0f, num));
Graphics.Blit(renderTexture5, renderTexture, this.dofHdrMaterial, 2);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(num, 0f, 0f, num));
Graphics.Blit(renderTexture, renderTexture5, this.dofHdrMaterial, 2);
Graphics.Blit(renderTexture5, renderTexture2, this.dofHdrMaterial, 3);
}
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(this.internalBlurWidth, 0f, 0f, this.internalBlurWidth));
Graphics.Blit(renderTexture2, renderTexture, this.dofHdrMaterial, 5);
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0f, this.internalBlurWidth));
Graphics.Blit(renderTexture, renderTexture2, this.dofHdrMaterial, 5);
Graphics.SetRenderTarget(renderTexture2);
ComputeBuffer.CopyCount(this.cbPoints, this.cbDrawArgs, 0);
this.dx11bokehMaterial.SetBuffer("pointBuffer", this.cbPoints);
this.dx11bokehMaterial.SetTexture("_MainTex", this.dx11BokehTexture);
this.dx11bokehMaterial.SetVector("_Screen", new Vector3(1f / (1f * (float)renderTexture2.width), 1f / (1f * (float)renderTexture2.height), this.internalBlurWidth));
this.dx11bokehMaterial.SetPass(1);
Graphics.DrawProceduralIndirect(MeshTopology.Points, this.cbDrawArgs, 0);
this.dofHdrMaterial.SetTexture("_LowRez", renderTexture2);
this.dofHdrMaterial.SetTexture("_FgOverlap", renderTexture5);
this.dofHdrMaterial.SetVector("_Offsets", 1f * (float)source.width / (1f * (float)renderTexture2.width) * this.internalBlurWidth * Vector4.one);
Graphics.Blit(source, destination, this.dofHdrMaterial, 9);
if (renderTexture5)
{
RenderTexture.ReleaseTemporary(renderTexture5);
}
}
}
else
{
source.filterMode = FilterMode.Bilinear;
if (this.highResolution)
{
this.internalBlurWidth *= 2f;
}
this.WriteCoc(source, true);
renderTexture = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
renderTexture2 = RenderTexture.GetTemporary(source.width >> 1, source.height >> 1, 0, source.format);
int num2 = ((this.blurSampleCount != DepthOfField.BlurSampleCount.High && this.blurSampleCount != DepthOfField.BlurSampleCount.Medium) ? 11 : 17);
if (this.highResolution)
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0.025f, this.internalBlurWidth));
Graphics.Blit(source, destination, this.dofHdrMaterial, num2);
}
else
{
this.dofHdrMaterial.SetVector("_Offsets", new Vector4(0f, this.internalBlurWidth, 0.1f, this.internalBlurWidth));
Graphics.Blit(source, renderTexture, this.dofHdrMaterial, 6);
Graphics.Blit(renderTexture, renderTexture2, this.dofHdrMaterial, num2);
this.dofHdrMaterial.SetTexture("_LowRez", renderTexture2);
this.dofHdrMaterial.SetTexture("_FgOverlap", null);
this.dofHdrMaterial.SetVector("_Offsets", Vector4.one * (1f * (float)source.width / (1f * (float)renderTexture2.width)) * this.internalBlurWidth);
Graphics.Blit(source, destination, this.dofHdrMaterial, (this.blurSampleCount != DepthOfField.BlurSampleCount.High) ? 12 : 18);
}
}
if (renderTexture)
{
RenderTexture.ReleaseTemporary(renderTexture);
}
if (renderTexture2)
{
RenderTexture.ReleaseTemporary(renderTexture2);
}
}
// Token: 0x04000256 RID: 598
public bool visualizeFocus;
// Token: 0x04000257 RID: 599
public float focalLength = 10f;
// Token: 0x04000258 RID: 600
public float focalSize = 0.05f;
// Token: 0x04000259 RID: 601
public float aperture = 0.5f;
// Token: 0x0400025A RID: 602
public Transform focalTransform;
// Token: 0x0400025B RID: 603
public float maxBlurSize = 2f;
// Token: 0x0400025C RID: 604
public bool highResolution;
// Token: 0x0400025D RID: 605
public DepthOfField.BlurType blurType;
// Token: 0x0400025E RID: 606
public DepthOfField.BlurSampleCount blurSampleCount = DepthOfField.BlurSampleCount.High;
// Token: 0x0400025F RID: 607
public bool nearBlur;
// Token: 0x04000260 RID: 608
public float foregroundOverlap = 1f;
// Token: 0x04000261 RID: 609
public Shader dofHdrShader;
// Token: 0x04000262 RID: 610
private Material dofHdrMaterial;
// Token: 0x04000263 RID: 611
public Shader dx11BokehShader;
// Token: 0x04000264 RID: 612
private Material dx11bokehMaterial;
// Token: 0x04000265 RID: 613
public float dx11BokehThreshold = 0.5f;
// Token: 0x04000266 RID: 614
public float dx11SpawnHeuristic = 0.0875f;
// Token: 0x04000267 RID: 615
public Texture2D dx11BokehTexture;
// Token: 0x04000268 RID: 616
public float dx11BokehScale = 1.2f;
// Token: 0x04000269 RID: 617
public float dx11BokehIntensity = 2.5f;
// Token: 0x0400026A RID: 618
private float focalDistance01 = 10f;
// Token: 0x0400026B RID: 619
private ComputeBuffer cbDrawArgs;
// Token: 0x0400026C RID: 620
private ComputeBuffer cbPoints;
// Token: 0x0400026D RID: 621
private float internalBlurWidth = 1f;
// Token: 0x0400026E RID: 622
private Camera cachedCamera;
// Token: 0x02000067 RID: 103
public enum BlurType
{
// Token: 0x04000270 RID: 624
DiscBlur,
// Token: 0x04000271 RID: 625
DX11
}
// Token: 0x02000068 RID: 104
public enum BlurSampleCount
{
// Token: 0x04000273 RID: 627
Low,
// Token: 0x04000274 RID: 628
Medium,
// Token: 0x04000275 RID: 629
High
}
}
}
@@ -0,0 +1,525 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000069 RID: 105
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Depth of Field (deprecated)")]
public class DepthOfFieldDeprecated : PostEffectsBase
{
// Token: 0x06000122 RID: 290 RVA: 0x0000CF18 File Offset: 0x0000B318
private void CreateMaterials()
{
this.dofBlurMaterial = base.CheckShaderAndCreateMaterial(this.dofBlurShader, this.dofBlurMaterial);
this.dofMaterial = base.CheckShaderAndCreateMaterial(this.dofShader, this.dofMaterial);
this.bokehSupport = this.bokehShader.isSupported;
if (this.bokeh && this.bokehSupport && this.bokehShader)
{
this.bokehMaterial = base.CheckShaderAndCreateMaterial(this.bokehShader, this.bokehMaterial);
}
}
// Token: 0x06000123 RID: 291 RVA: 0x0000CFA4 File Offset: 0x0000B3A4
public override bool CheckResources()
{
base.CheckSupport(true);
this.dofBlurMaterial = base.CheckShaderAndCreateMaterial(this.dofBlurShader, this.dofBlurMaterial);
this.dofMaterial = base.CheckShaderAndCreateMaterial(this.dofShader, this.dofMaterial);
this.bokehSupport = this.bokehShader.isSupported;
if (this.bokeh && this.bokehSupport && this.bokehShader)
{
this.bokehMaterial = base.CheckShaderAndCreateMaterial(this.bokehShader, this.bokehMaterial);
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000124 RID: 292 RVA: 0x0000D04F File Offset: 0x0000B44F
private void OnDisable()
{
Quads.Cleanup();
}
// Token: 0x06000125 RID: 293 RVA: 0x0000D056 File Offset: 0x0000B456
private void OnEnable()
{
this._camera = base.GetComponent<Camera>();
this._camera.depthTextureMode |= DepthTextureMode.Depth;
}
// Token: 0x06000126 RID: 294 RVA: 0x0000D078 File Offset: 0x0000B478
private float FocalDistance01(float worldDist)
{
return this._camera.WorldToViewportPoint((worldDist - this._camera.nearClipPlane) * this._camera.transform.forward + this._camera.transform.position).z / (this._camera.farClipPlane - this._camera.nearClipPlane);
}
// Token: 0x06000127 RID: 295 RVA: 0x0000D0E8 File Offset: 0x0000B4E8
private int GetDividerBasedOnQuality()
{
int num = 1;
if (this.resolution == DepthOfFieldDeprecated.DofResolution.Medium)
{
num = 2;
}
else if (this.resolution == DepthOfFieldDeprecated.DofResolution.Low)
{
num = 2;
}
return num;
}
// Token: 0x06000128 RID: 296 RVA: 0x0000D11C File Offset: 0x0000B51C
private int GetLowResolutionDividerBasedOnQuality(int baseDivider)
{
int num = baseDivider;
if (this.resolution == DepthOfFieldDeprecated.DofResolution.High)
{
num *= 2;
}
if (this.resolution == DepthOfFieldDeprecated.DofResolution.Low)
{
num *= 2;
}
return num;
}
// Token: 0x06000129 RID: 297 RVA: 0x0000D14C File Offset: 0x0000B54C
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.smoothness < 0.1f)
{
this.smoothness = 0.1f;
}
this.bokeh = this.bokeh && this.bokehSupport;
float num = ((!this.bokeh) ? 1f : DepthOfFieldDeprecated.BOKEH_EXTRA_BLUR);
bool flag = this.quality > DepthOfFieldDeprecated.Dof34QualitySetting.OnlyBackground;
float num2 = this.focalSize / (this._camera.farClipPlane - this._camera.nearClipPlane);
if (this.simpleTweakMode)
{
this.focalDistance01 = ((!this.objectFocus) ? this.FocalDistance01(this.focalPoint) : (this._camera.WorldToViewportPoint(this.objectFocus.position).z / this._camera.farClipPlane));
this.focalStartCurve = this.focalDistance01 * this.smoothness;
this.focalEndCurve = this.focalStartCurve;
flag = flag && this.focalPoint > this._camera.nearClipPlane + Mathf.Epsilon;
}
else
{
if (this.objectFocus)
{
Vector3 vector = this._camera.WorldToViewportPoint(this.objectFocus.position);
vector.z /= this._camera.farClipPlane;
this.focalDistance01 = vector.z;
}
else
{
this.focalDistance01 = this.FocalDistance01(this.focalZDistance);
}
this.focalStartCurve = this.focalZStartCurve;
this.focalEndCurve = this.focalZEndCurve;
flag = flag && this.focalPoint > this._camera.nearClipPlane + Mathf.Epsilon;
}
this.widthOverHeight = 1f * (float)source.width / (1f * (float)source.height);
this.oneOverBaseSize = 0.001953125f;
this.dofMaterial.SetFloat("_ForegroundBlurExtrude", this.foregroundBlurExtrude);
this.dofMaterial.SetVector("_CurveParams", new Vector4((!this.simpleTweakMode) ? this.focalStartCurve : (1f / this.focalStartCurve), (!this.simpleTweakMode) ? this.focalEndCurve : (1f / this.focalEndCurve), num2 * 0.5f, this.focalDistance01));
this.dofMaterial.SetVector("_InvRenderTargetSize", new Vector4(1f / (1f * (float)source.width), 1f / (1f * (float)source.height), 0f, 0f));
int dividerBasedOnQuality = this.GetDividerBasedOnQuality();
int lowResolutionDividerBasedOnQuality = this.GetLowResolutionDividerBasedOnQuality(dividerBasedOnQuality);
this.AllocateTextures(flag, source, dividerBasedOnQuality, lowResolutionDividerBasedOnQuality);
Graphics.Blit(source, source, this.dofMaterial, 3);
this.Downsample(source, this.mediumRezWorkTexture);
this.Blur(this.mediumRezWorkTexture, this.mediumRezWorkTexture, DepthOfFieldDeprecated.DofBlurriness.Low, 4, this.maxBlurSpread);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.dofMaterial.SetVector("_Threshhold", new Vector4(this.bokehThresholdContrast, this.bokehThresholdLuminance, 0.95f, 0f));
Graphics.Blit(this.mediumRezWorkTexture, this.bokehSource2, this.dofMaterial, 11);
Graphics.Blit(this.mediumRezWorkTexture, this.lowRezWorkTexture);
this.Blur(this.lowRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 0, this.maxBlurSpread * num);
}
else
{
this.Downsample(this.mediumRezWorkTexture, this.lowRezWorkTexture);
this.Blur(this.lowRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 0, this.maxBlurSpread);
}
this.dofBlurMaterial.SetTexture("_TapLow", this.lowRezWorkTexture);
this.dofBlurMaterial.SetTexture("_TapMedium", this.mediumRezWorkTexture);
Graphics.Blit(null, this.finalDefocus, this.dofBlurMaterial, 3);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.AddBokeh(this.bokehSource2, this.bokehSource, this.finalDefocus);
}
this.dofMaterial.SetTexture("_TapLowBackground", this.finalDefocus);
this.dofMaterial.SetTexture("_TapMedium", this.mediumRezWorkTexture);
Graphics.Blit(source, (!flag) ? destination : this.foregroundTexture, this.dofMaterial, (!this.visualize) ? 0 : 2);
if (flag)
{
Graphics.Blit(this.foregroundTexture, source, this.dofMaterial, 5);
this.Downsample(source, this.mediumRezWorkTexture);
this.BlurFg(this.mediumRezWorkTexture, this.mediumRezWorkTexture, DepthOfFieldDeprecated.DofBlurriness.Low, 2, this.maxBlurSpread);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.dofMaterial.SetVector("_Threshhold", new Vector4(this.bokehThresholdContrast * 0.5f, this.bokehThresholdLuminance, 0f, 0f));
Graphics.Blit(this.mediumRezWorkTexture, this.bokehSource2, this.dofMaterial, 11);
Graphics.Blit(this.mediumRezWorkTexture, this.lowRezWorkTexture);
this.BlurFg(this.lowRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 1, this.maxBlurSpread * num);
}
else
{
this.BlurFg(this.mediumRezWorkTexture, this.lowRezWorkTexture, this.bluriness, 1, this.maxBlurSpread);
}
Graphics.Blit(this.lowRezWorkTexture, this.finalDefocus);
this.dofMaterial.SetTexture("_TapLowForeground", this.finalDefocus);
Graphics.Blit(source, destination, this.dofMaterial, (!this.visualize) ? 4 : 1);
if (this.bokeh && (DepthOfFieldDeprecated.BokehDestination.Foreground & this.bokehDestination) != (DepthOfFieldDeprecated.BokehDestination)0)
{
this.AddBokeh(this.bokehSource2, this.bokehSource, destination);
}
}
this.ReleaseTextures();
}
// Token: 0x0600012A RID: 298 RVA: 0x0000D768 File Offset: 0x0000BB68
private void Blur(RenderTexture from, RenderTexture to, DepthOfFieldDeprecated.DofBlurriness iterations, int blurPass, float spread)
{
RenderTexture temporary = RenderTexture.GetTemporary(to.width, to.height);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.Low)
{
this.BlurHex(from, to, blurPass, spread, temporary);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.High)
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(to, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
}
else
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(from, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
RenderTexture.ReleaseTemporary(temporary);
}
// Token: 0x0600012B RID: 299 RVA: 0x0000D8AC File Offset: 0x0000BCAC
private void BlurFg(RenderTexture from, RenderTexture to, DepthOfFieldDeprecated.DofBlurriness iterations, int blurPass, float spread)
{
this.dofBlurMaterial.SetTexture("_TapHigh", from);
RenderTexture temporary = RenderTexture.GetTemporary(to.width, to.height);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.Low)
{
this.BlurHex(from, to, blurPass, spread, temporary);
if (iterations > DepthOfFieldDeprecated.DofBlurriness.High)
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(to, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
}
else
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(from, temporary, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(temporary, to, this.dofBlurMaterial, blurPass);
}
RenderTexture.ReleaseTemporary(temporary);
}
// Token: 0x0600012C RID: 300 RVA: 0x0000DA00 File Offset: 0x0000BE00
private void BlurHex(RenderTexture from, RenderTexture to, int blurPass, float spread, RenderTexture tmp)
{
this.dofBlurMaterial.SetVector("offsets", new Vector4(0f, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(from, tmp, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, 0f, 0f, 0f));
Graphics.Blit(tmp, to, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(to, tmp, this.dofBlurMaterial, blurPass);
this.dofBlurMaterial.SetVector("offsets", new Vector4(spread / this.widthOverHeight * this.oneOverBaseSize, -spread * this.oneOverBaseSize, 0f, 0f));
Graphics.Blit(tmp, to, this.dofBlurMaterial, blurPass);
}
// Token: 0x0600012D RID: 301 RVA: 0x0000DB1C File Offset: 0x0000BF1C
private void Downsample(RenderTexture from, RenderTexture to)
{
this.dofMaterial.SetVector("_InvRenderTargetSize", new Vector4(1f / (1f * (float)to.width), 1f / (1f * (float)to.height), 0f, 0f));
Graphics.Blit(from, to, this.dofMaterial, DepthOfFieldDeprecated.SMOOTH_DOWNSAMPLE_PASS);
}
// Token: 0x0600012E RID: 302 RVA: 0x0000DB80 File Offset: 0x0000BF80
private void AddBokeh(RenderTexture bokehInfo, RenderTexture tempTex, RenderTexture finalTarget)
{
if (this.bokehMaterial)
{
Mesh[] meshes = Quads.GetMeshes(tempTex.width, tempTex.height);
RenderTexture.active = tempTex;
GL.Clear(false, true, new Color(0f, 0f, 0f, 0f));
GL.PushMatrix();
GL.LoadIdentity();
bokehInfo.filterMode = FilterMode.Point;
float num = (float)bokehInfo.width * 1f / ((float)bokehInfo.height * 1f);
float num2 = 2f / (1f * (float)bokehInfo.width);
num2 += this.bokehScale * this.maxBlurSpread * DepthOfFieldDeprecated.BOKEH_EXTRA_BLUR * this.oneOverBaseSize;
this.bokehMaterial.SetTexture("_Source", bokehInfo);
this.bokehMaterial.SetTexture("_MainTex", this.bokehTexture);
this.bokehMaterial.SetVector("_ArScale", new Vector4(num2, num2 * num, 0.5f, 0.5f * num));
this.bokehMaterial.SetFloat("_Intensity", this.bokehIntensity);
this.bokehMaterial.SetPass(0);
foreach (Mesh mesh in meshes)
{
if (mesh)
{
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
}
}
GL.PopMatrix();
Graphics.Blit(tempTex, finalTarget, this.dofMaterial, 8);
bokehInfo.filterMode = FilterMode.Bilinear;
}
}
// Token: 0x0600012F RID: 303 RVA: 0x0000DCF4 File Offset: 0x0000C0F4
private void ReleaseTextures()
{
if (this.foregroundTexture)
{
RenderTexture.ReleaseTemporary(this.foregroundTexture);
}
if (this.finalDefocus)
{
RenderTexture.ReleaseTemporary(this.finalDefocus);
}
if (this.mediumRezWorkTexture)
{
RenderTexture.ReleaseTemporary(this.mediumRezWorkTexture);
}
if (this.lowRezWorkTexture)
{
RenderTexture.ReleaseTemporary(this.lowRezWorkTexture);
}
if (this.bokehSource)
{
RenderTexture.ReleaseTemporary(this.bokehSource);
}
if (this.bokehSource2)
{
RenderTexture.ReleaseTemporary(this.bokehSource2);
}
}
// Token: 0x06000130 RID: 304 RVA: 0x0000DDA4 File Offset: 0x0000C1A4
private void AllocateTextures(bool blurForeground, RenderTexture source, int divider, int lowTexDivider)
{
this.foregroundTexture = null;
if (blurForeground)
{
this.foregroundTexture = RenderTexture.GetTemporary(source.width, source.height, 0);
}
this.mediumRezWorkTexture = RenderTexture.GetTemporary(source.width / divider, source.height / divider, 0);
this.finalDefocus = RenderTexture.GetTemporary(source.width / divider, source.height / divider, 0);
this.lowRezWorkTexture = RenderTexture.GetTemporary(source.width / lowTexDivider, source.height / lowTexDivider, 0);
this.bokehSource = null;
this.bokehSource2 = null;
if (this.bokeh)
{
this.bokehSource = RenderTexture.GetTemporary(source.width / (lowTexDivider * this.bokehDownsample), source.height / (lowTexDivider * this.bokehDownsample), 0, RenderTextureFormat.ARGBHalf);
this.bokehSource2 = RenderTexture.GetTemporary(source.width / (lowTexDivider * this.bokehDownsample), source.height / (lowTexDivider * this.bokehDownsample), 0, RenderTextureFormat.ARGBHalf);
this.bokehSource.filterMode = FilterMode.Bilinear;
this.bokehSource2.filterMode = FilterMode.Bilinear;
RenderTexture.active = this.bokehSource2;
GL.Clear(false, true, new Color(0f, 0f, 0f, 0f));
}
source.filterMode = FilterMode.Bilinear;
this.finalDefocus.filterMode = FilterMode.Bilinear;
this.mediumRezWorkTexture.filterMode = FilterMode.Bilinear;
this.lowRezWorkTexture.filterMode = FilterMode.Bilinear;
if (this.foregroundTexture)
{
this.foregroundTexture.filterMode = FilterMode.Bilinear;
}
}
// Token: 0x04000276 RID: 630
private static int SMOOTH_DOWNSAMPLE_PASS = 6;
// Token: 0x04000277 RID: 631
private static float BOKEH_EXTRA_BLUR = 2f;
// Token: 0x04000278 RID: 632
public DepthOfFieldDeprecated.Dof34QualitySetting quality = DepthOfFieldDeprecated.Dof34QualitySetting.OnlyBackground;
// Token: 0x04000279 RID: 633
public DepthOfFieldDeprecated.DofResolution resolution = DepthOfFieldDeprecated.DofResolution.Low;
// Token: 0x0400027A RID: 634
public bool simpleTweakMode = true;
// Token: 0x0400027B RID: 635
public float focalPoint = 1f;
// Token: 0x0400027C RID: 636
public float smoothness = 0.5f;
// Token: 0x0400027D RID: 637
public float focalZDistance;
// Token: 0x0400027E RID: 638
public float focalZStartCurve = 1f;
// Token: 0x0400027F RID: 639
public float focalZEndCurve = 1f;
// Token: 0x04000280 RID: 640
private float focalStartCurve = 2f;
// Token: 0x04000281 RID: 641
private float focalEndCurve = 2f;
// Token: 0x04000282 RID: 642
private float focalDistance01 = 0.1f;
// Token: 0x04000283 RID: 643
public Transform objectFocus;
// Token: 0x04000284 RID: 644
public float focalSize;
// Token: 0x04000285 RID: 645
public DepthOfFieldDeprecated.DofBlurriness bluriness = DepthOfFieldDeprecated.DofBlurriness.High;
// Token: 0x04000286 RID: 646
public float maxBlurSpread = 1.75f;
// Token: 0x04000287 RID: 647
public float foregroundBlurExtrude = 1.15f;
// Token: 0x04000288 RID: 648
public Shader dofBlurShader;
// Token: 0x04000289 RID: 649
private Material dofBlurMaterial;
// Token: 0x0400028A RID: 650
public Shader dofShader;
// Token: 0x0400028B RID: 651
private Material dofMaterial;
// Token: 0x0400028C RID: 652
public bool visualize;
// Token: 0x0400028D RID: 653
public DepthOfFieldDeprecated.BokehDestination bokehDestination = DepthOfFieldDeprecated.BokehDestination.Background;
// Token: 0x0400028E RID: 654
private float widthOverHeight = 1.25f;
// Token: 0x0400028F RID: 655
private float oneOverBaseSize = 0.001953125f;
// Token: 0x04000290 RID: 656
public bool bokeh;
// Token: 0x04000291 RID: 657
public bool bokehSupport = true;
// Token: 0x04000292 RID: 658
public Shader bokehShader;
// Token: 0x04000293 RID: 659
public Texture2D bokehTexture;
// Token: 0x04000294 RID: 660
public float bokehScale = 2.4f;
// Token: 0x04000295 RID: 661
public float bokehIntensity = 0.15f;
// Token: 0x04000296 RID: 662
public float bokehThresholdContrast = 0.1f;
// Token: 0x04000297 RID: 663
public float bokehThresholdLuminance = 0.55f;
// Token: 0x04000298 RID: 664
public int bokehDownsample = 1;
// Token: 0x04000299 RID: 665
private Material bokehMaterial;
// Token: 0x0400029A RID: 666
private Camera _camera;
// Token: 0x0400029B RID: 667
private RenderTexture foregroundTexture;
// Token: 0x0400029C RID: 668
private RenderTexture mediumRezWorkTexture;
// Token: 0x0400029D RID: 669
private RenderTexture finalDefocus;
// Token: 0x0400029E RID: 670
private RenderTexture lowRezWorkTexture;
// Token: 0x0400029F RID: 671
private RenderTexture bokehSource;
// Token: 0x040002A0 RID: 672
private RenderTexture bokehSource2;
// Token: 0x0200006A RID: 106
public enum Dof34QualitySetting
{
// Token: 0x040002A2 RID: 674
OnlyBackground = 1,
// Token: 0x040002A3 RID: 675
BackgroundAndForeground
}
// Token: 0x0200006B RID: 107
public enum DofResolution
{
// Token: 0x040002A5 RID: 677
High = 2,
// Token: 0x040002A6 RID: 678
Medium,
// Token: 0x040002A7 RID: 679
Low
}
// Token: 0x0200006C RID: 108
public enum DofBlurriness
{
// Token: 0x040002A9 RID: 681
Low = 1,
// Token: 0x040002AA RID: 682
High,
// Token: 0x040002AB RID: 683
VeryHigh = 4
}
// Token: 0x0200006D RID: 109
public enum BokehDestination
{
// Token: 0x040002AD RID: 685
Background = 1,
// Token: 0x040002AE RID: 686
Foreground,
// Token: 0x040002AF RID: 687
BackgroundAndForeground
}
}
}
@@ -0,0 +1,121 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200006E RID: 110
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Edge Detection/Edge Detection")]
public class EdgeDetection : PostEffectsBase
{
// Token: 0x06000133 RID: 307 RVA: 0x0000DFA0 File Offset: 0x0000C3A0
public override bool CheckResources()
{
base.CheckSupport(true);
this.edgeDetectMaterial = base.CheckShaderAndCreateMaterial(this.edgeDetectShader, this.edgeDetectMaterial);
if (this.mode != this.oldMode)
{
this.SetCameraFlag();
}
this.oldMode = this.mode;
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000134 RID: 308 RVA: 0x0000E007 File Offset: 0x0000C407
private new void Start()
{
this.oldMode = this.mode;
}
// Token: 0x06000135 RID: 309 RVA: 0x0000E018 File Offset: 0x0000C418
private void SetCameraFlag()
{
if (this.mode == EdgeDetection.EdgeDetectMode.SobelDepth || this.mode == EdgeDetection.EdgeDetectMode.SobelDepthThin)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
else if (this.mode == EdgeDetection.EdgeDetectMode.TriangleDepthNormals || this.mode == EdgeDetection.EdgeDetectMode.RobertsCrossDepthNormals)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.DepthNormals;
}
}
// Token: 0x06000136 RID: 310 RVA: 0x0000E07F File Offset: 0x0000C47F
private void OnEnable()
{
this.SetCameraFlag();
}
// Token: 0x06000137 RID: 311 RVA: 0x0000E088 File Offset: 0x0000C488
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
Vector2 vector = new Vector2(this.sensitivityDepth, this.sensitivityNormals);
this.edgeDetectMaterial.SetVector("_Sensitivity", new Vector4(vector.x, vector.y, 1f, vector.y));
this.edgeDetectMaterial.SetFloat("_BgFade", this.edgesOnly);
this.edgeDetectMaterial.SetFloat("_SampleDistance", this.sampleDist);
this.edgeDetectMaterial.SetVector("_BgColor", this.edgesOnlyBgColor);
this.edgeDetectMaterial.SetFloat("_Exponent", this.edgeExp);
this.edgeDetectMaterial.SetFloat("_Threshold", this.lumThreshold);
Graphics.Blit(source, destination, this.edgeDetectMaterial, (int)this.mode);
}
// Token: 0x040002B0 RID: 688
public EdgeDetection.EdgeDetectMode mode = EdgeDetection.EdgeDetectMode.SobelDepthThin;
// Token: 0x040002B1 RID: 689
public float sensitivityDepth = 1f;
// Token: 0x040002B2 RID: 690
public float sensitivityNormals = 1f;
// Token: 0x040002B3 RID: 691
public float lumThreshold = 0.2f;
// Token: 0x040002B4 RID: 692
public float edgeExp = 1f;
// Token: 0x040002B5 RID: 693
public float sampleDist = 1f;
// Token: 0x040002B6 RID: 694
public float edgesOnly;
// Token: 0x040002B7 RID: 695
public Color edgesOnlyBgColor = Color.white;
// Token: 0x040002B8 RID: 696
public Shader edgeDetectShader;
// Token: 0x040002B9 RID: 697
private Material edgeDetectMaterial;
// Token: 0x040002BA RID: 698
private EdgeDetection.EdgeDetectMode oldMode = EdgeDetection.EdgeDetectMode.SobelDepthThin;
// Token: 0x0200006F RID: 111
public enum EdgeDetectMode
{
// Token: 0x040002BC RID: 700
TriangleDepthNormals,
// Token: 0x040002BD RID: 701
RobertsCrossDepthNormals,
// Token: 0x040002BE RID: 702
SobelDepth,
// Token: 0x040002BF RID: 703
SobelDepthThin,
// Token: 0x040002C0 RID: 704
TriangleLuminance
}
}
}
@@ -0,0 +1,52 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000070 RID: 112
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Displacement/Fisheye")]
public class Fisheye : PostEffectsBase
{
// Token: 0x06000139 RID: 313 RVA: 0x0000E18E File Offset: 0x0000C58E
public override bool CheckResources()
{
base.CheckSupport(false);
this.fisheyeMaterial = base.CheckShaderAndCreateMaterial(this.fishEyeShader, this.fisheyeMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600013A RID: 314 RVA: 0x0000E1C8 File Offset: 0x0000C5C8
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
float num = 0.15625f;
float num2 = (float)source.width * 1f / ((float)source.height * 1f);
this.fisheyeMaterial.SetVector("intensity", new Vector4(this.strengthX * num2 * num, this.strengthY * num, this.strengthX * num2 * num, this.strengthY * num));
Graphics.Blit(source, destination, this.fisheyeMaterial);
}
// Token: 0x040002C1 RID: 705
[Range(0f, 1.5f)]
public float strengthX = 0.05f;
// Token: 0x040002C2 RID: 706
[Range(0f, 1.5f)]
public float strengthY = 0.05f;
// Token: 0x040002C3 RID: 707
public Shader fishEyeShader;
// Token: 0x040002C4 RID: 708
private Material fisheyeMaterial;
}
}
@@ -0,0 +1,153 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000071 RID: 113
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Global Fog")]
internal class GlobalFog : PostEffectsBase
{
// Token: 0x0600013C RID: 316 RVA: 0x0000E283 File Offset: 0x0000C683
public override bool CheckResources()
{
base.CheckSupport(true);
this.fogMaterial = base.CheckShaderAndCreateMaterial(this.fogShader, this.fogMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600013D RID: 317 RVA: 0x0000E2BC File Offset: 0x0000C6BC
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources() || (!this.distanceFog && !this.heightFog))
{
Graphics.Blit(source, destination);
return;
}
Camera component = base.GetComponent<Camera>();
Transform transform = component.transform;
float nearClipPlane = component.nearClipPlane;
float farClipPlane = component.farClipPlane;
float fieldOfView = component.fieldOfView;
float aspect = component.aspect;
Matrix4x4 identity = Matrix4x4.identity;
float num = fieldOfView * 0.5f;
Vector3 vector = transform.right * nearClipPlane * Mathf.Tan(num * 0.017453292f) * aspect;
Vector3 vector2 = transform.up * nearClipPlane * Mathf.Tan(num * 0.017453292f);
Vector3 vector3 = transform.forward * nearClipPlane - vector + vector2;
float num2 = vector3.magnitude * farClipPlane / nearClipPlane;
vector3.Normalize();
vector3 *= num2;
Vector3 vector4 = transform.forward * nearClipPlane + vector + vector2;
vector4.Normalize();
vector4 *= num2;
Vector3 vector5 = transform.forward * nearClipPlane + vector - vector2;
vector5.Normalize();
vector5 *= num2;
Vector3 vector6 = transform.forward * nearClipPlane - vector - vector2;
vector6.Normalize();
vector6 *= num2;
identity.SetRow(0, vector3);
identity.SetRow(1, vector4);
identity.SetRow(2, vector5);
identity.SetRow(3, vector6);
Vector3 position = transform.position;
float num3 = position.y - this.height;
float num4 = ((num3 > 0f) ? 0f : 1f);
float num5 = ((!this.excludeFarPixels) ? 2f : 1f);
this.fogMaterial.SetMatrix("_FrustumCornersWS", identity);
this.fogMaterial.SetVector("_CameraWS", position);
this.fogMaterial.SetVector("_HeightParams", new Vector4(this.height, num3, num4, this.heightDensity * 0.5f));
this.fogMaterial.SetVector("_DistanceParams", new Vector4(-Mathf.Max(this.startDistance, 0f), num5, 0f, 0f));
FogMode fogMode = RenderSettings.fogMode;
float fogDensity = RenderSettings.fogDensity;
float fogStartDistance = RenderSettings.fogStartDistance;
float fogEndDistance = RenderSettings.fogEndDistance;
bool flag = fogMode == FogMode.Linear;
float num6 = ((!flag) ? 0f : (fogEndDistance - fogStartDistance));
float num7 = ((Mathf.Abs(num6) <= 0.0001f) ? 0f : (1f / num6));
Vector4 vector7;
vector7.x = fogDensity * 1.2011224f;
vector7.y = fogDensity * 1.442695f;
vector7.z = ((!flag) ? 0f : (-num7));
vector7.w = ((!flag) ? 0f : (fogEndDistance * num7));
this.fogMaterial.SetVector("_SceneFogParams", vector7);
this.fogMaterial.SetVector("_SceneFogMode", new Vector4((float)fogMode, (float)((!this.useRadialDistance) ? 0 : 1), 0f, 0f));
int num8;
if (this.distanceFog && this.heightFog)
{
num8 = 0;
}
else if (this.distanceFog)
{
num8 = 1;
}
else
{
num8 = 2;
}
GlobalFog.CustomGraphicsBlit(source, destination, this.fogMaterial, num8);
}
// Token: 0x0600013E RID: 318 RVA: 0x0000E694 File Offset: 0x0000CA94
private static void CustomGraphicsBlit(RenderTexture source, RenderTexture dest, Material fxMaterial, int passNr)
{
RenderTexture.active = dest;
fxMaterial.SetTexture("_MainTex", source);
GL.PushMatrix();
GL.LoadOrtho();
fxMaterial.SetPass(passNr);
GL.Begin(7);
GL.MultiTexCoord2(0, 0f, 0f);
GL.Vertex3(0f, 0f, 3f);
GL.MultiTexCoord2(0, 1f, 0f);
GL.Vertex3(1f, 0f, 2f);
GL.MultiTexCoord2(0, 1f, 1f);
GL.Vertex3(1f, 1f, 1f);
GL.MultiTexCoord2(0, 0f, 1f);
GL.Vertex3(0f, 1f, 0f);
GL.End();
GL.PopMatrix();
}
// Token: 0x040002C5 RID: 709
[Tooltip("Apply distance-based fog?")]
public bool distanceFog = true;
// Token: 0x040002C6 RID: 710
[Tooltip("Exclude far plane pixels from distance-based fog? (Skybox or clear color)")]
public bool excludeFarPixels = true;
// Token: 0x040002C7 RID: 711
[Tooltip("Distance fog is based on radial distance from camera when checked")]
public bool useRadialDistance;
// Token: 0x040002C8 RID: 712
[Tooltip("Apply height-based fog?")]
public bool heightFog = true;
// Token: 0x040002C9 RID: 713
[Tooltip("Fog top Y coordinate")]
public float height = 1f;
// Token: 0x040002CA RID: 714
[Range(0.001f, 10f)]
public float heightDensity = 2f;
// Token: 0x040002CB RID: 715
[Tooltip("Push fog away from the camera by this amount")]
public float startDistance;
// Token: 0x040002CC RID: 716
public Shader fogShader;
// Token: 0x040002CD RID: 717
private Material fogMaterial;
}
}
@@ -0,0 +1,26 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000072 RID: 114
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Grayscale")]
public class Grayscale : ImageEffectBase
{
// Token: 0x06000140 RID: 320 RVA: 0x0000E76D File Offset: 0x0000CB6D
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
base.material.SetTexture("_RampTex", this.textureRamp);
base.material.SetFloat("_RampOffset", this.rampOffset);
Graphics.Blit(source, destination, base.material);
}
// Token: 0x040002CE RID: 718
public Texture textureRamp;
// Token: 0x040002CF RID: 719
[Range(-1f, 1f)]
public float rampOffset;
}
}
@@ -0,0 +1,15 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000054 RID: 84
public enum HDRBloomMode
{
// Token: 0x040001B0 RID: 432
Auto,
// Token: 0x040001B1 RID: 433
On,
// Token: 0x040001B2 RID: 434
Off
}
}
@@ -0,0 +1,55 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000073 RID: 115
[RequireComponent(typeof(Camera))]
[AddComponentMenu("")]
public class ImageEffectBase : MonoBehaviour
{
// Token: 0x06000142 RID: 322 RVA: 0x0000B681 File Offset: 0x00009A81
protected virtual void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (!this.shader || !this.shader.isSupported)
{
base.enabled = false;
}
}
// Token: 0x17000057 RID: 87
// (get) Token: 0x06000143 RID: 323 RVA: 0x0000B6BC File Offset: 0x00009ABC
protected Material material
{
get
{
if (this.m_Material == null)
{
this.m_Material = new Material(this.shader);
this.m_Material.hideFlags = HideFlags.HideAndDontSave;
}
return this.m_Material;
}
}
// Token: 0x06000144 RID: 324 RVA: 0x0000B6F3 File Offset: 0x00009AF3
protected virtual void OnDisable()
{
if (this.m_Material)
{
global::UnityEngine.Object.DestroyImmediate(this.m_Material);
}
}
// Token: 0x040002D0 RID: 720
public Shader shader;
// Token: 0x040002D1 RID: 721
private Material m_Material;
}
}
@@ -0,0 +1,40 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000074 RID: 116
[AddComponentMenu("")]
public class ImageEffects
{
// Token: 0x06000146 RID: 326 RVA: 0x0000E7B0 File Offset: 0x0000CBB0
public static void RenderDistortion(Material material, RenderTexture source, RenderTexture destination, float angle, Vector2 center, Vector2 radius)
{
bool flag = source.texelSize.y < 0f;
if (flag)
{
center.y = 1f - center.y;
angle = -angle;
}
Matrix4x4 matrix4x = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0f, 0f, angle), Vector3.one);
material.SetMatrix("_RotationMatrix", matrix4x);
material.SetVector("_CenterRadius", new Vector4(center.x, center.y, radius.x, radius.y));
material.SetFloat("_Angle", angle * 0.017453292f);
Graphics.Blit(source, destination, material);
}
// Token: 0x06000147 RID: 327 RVA: 0x0000E863 File Offset: 0x0000CC63
[Obsolete("Use Graphics.Blit(source,dest) instead")]
public static void Blit(RenderTexture source, RenderTexture dest)
{
Graphics.Blit(source, dest);
}
// Token: 0x06000148 RID: 328 RVA: 0x0000E86C File Offset: 0x0000CC6C
[Obsolete("Use Graphics.Blit(source, destination, material) instead")]
public static void BlitWithMaterial(Material material, RenderTexture source, RenderTexture dest)
{
Graphics.Blit(source, dest, material);
}
}
}
@@ -0,0 +1,15 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000052 RID: 82
public enum LensflareStyle34
{
// Token: 0x040001A9 RID: 425
Ghosting,
// Token: 0x040001AA RID: 426
Anamorphic,
// Token: 0x040001AB RID: 427
Combined
}
}
@@ -0,0 +1,55 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000075 RID: 117
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Blur/Motion Blur (Color Accumulation)")]
[RequireComponent(typeof(Camera))]
public class MotionBlur : ImageEffectBase
{
// Token: 0x0600014A RID: 330 RVA: 0x0000E889 File Offset: 0x0000CC89
protected override void OnDisable()
{
base.OnDisable();
global::UnityEngine.Object.DestroyImmediate(this.accumTexture);
}
// Token: 0x0600014B RID: 331 RVA: 0x0000E89C File Offset: 0x0000CC9C
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (this.accumTexture == null || this.accumTexture.width != source.width || this.accumTexture.height != source.height)
{
global::UnityEngine.Object.DestroyImmediate(this.accumTexture);
this.accumTexture = new RenderTexture(source.width, source.height, 0);
this.accumTexture.hideFlags = HideFlags.HideAndDontSave;
Graphics.Blit(source, this.accumTexture);
}
if (this.extraBlur)
{
RenderTexture temporary = RenderTexture.GetTemporary(source.width / 4, source.height / 4, 0);
this.accumTexture.MarkRestoreExpected();
Graphics.Blit(this.accumTexture, temporary);
Graphics.Blit(temporary, this.accumTexture);
RenderTexture.ReleaseTemporary(temporary);
}
this.blurAmount = Mathf.Clamp(this.blurAmount, 0f, 0.92f);
base.material.SetTexture("_MainTex", this.accumTexture);
base.material.SetFloat("_AccumOrig", 1f - this.blurAmount);
this.accumTexture.MarkRestoreExpected();
Graphics.Blit(source, this.accumTexture, base.material);
Graphics.Blit(this.accumTexture, destination);
}
// Token: 0x040002D2 RID: 722
[Range(0f, 0.92f)]
public float blurAmount = 0.8f;
// Token: 0x040002D3 RID: 723
public bool extraBlur;
// Token: 0x040002D4 RID: 724
private RenderTexture accumTexture;
}
}
@@ -0,0 +1,239 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000076 RID: 118
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Noise/Noise And Grain (Filmic)")]
public class NoiseAndGrain : PostEffectsBase
{
// Token: 0x0600014D RID: 333 RVA: 0x0000EA74 File Offset: 0x0000CE74
private void Awake()
{
this.mesh = new Mesh();
}
// Token: 0x0600014E RID: 334 RVA: 0x0000EA84 File Offset: 0x0000CE84
public override bool CheckResources()
{
base.CheckSupport(false);
this.noiseMaterial = base.CheckShaderAndCreateMaterial(this.noiseShader, this.noiseMaterial);
if (this.dx11Grain && this.supportDX11)
{
this.dx11NoiseMaterial = base.CheckShaderAndCreateMaterial(this.dx11NoiseShader, this.dx11NoiseMaterial);
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600014F RID: 335 RVA: 0x0000EAF8 File Offset: 0x0000CEF8
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources() || null == this.noiseTexture)
{
Graphics.Blit(source, destination);
if (null == this.noiseTexture)
{
Debug.LogWarning("Noise & Grain effect failing as noise texture is not assigned. please assign.", base.transform);
}
return;
}
this.softness = Mathf.Clamp(this.softness, 0f, 0.99f);
if (this.dx11Grain && this.supportDX11)
{
this.dx11NoiseMaterial.SetFloat("_DX11NoiseTime", (float)Time.frameCount);
this.dx11NoiseMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.dx11NoiseMaterial.SetVector("_NoisePerChannel", (!this.monochrome) ? this.intensities : Vector3.one);
this.dx11NoiseMaterial.SetVector("_MidGrey", new Vector3(this.midGrey, 1f / (1f - this.midGrey), -1f / this.midGrey));
this.dx11NoiseMaterial.SetVector("_NoiseAmount", new Vector3(this.generalIntensity, this.blackIntensity, this.whiteIntensity) * this.intensityMultiplier);
if (this.softness > Mathf.Epsilon)
{
RenderTexture temporary = RenderTexture.GetTemporary((int)((float)source.width * (1f - this.softness)), (int)((float)source.height * (1f - this.softness)));
NoiseAndGrain.DrawNoiseQuadGrid(source, temporary, this.dx11NoiseMaterial, this.noiseTexture, this.mesh, (!this.monochrome) ? 2 : 3);
this.dx11NoiseMaterial.SetTexture("_NoiseTex", temporary);
Graphics.Blit(source, destination, this.dx11NoiseMaterial, 4);
RenderTexture.ReleaseTemporary(temporary);
}
else
{
NoiseAndGrain.DrawNoiseQuadGrid(source, destination, this.dx11NoiseMaterial, this.noiseTexture, this.mesh, (!this.monochrome) ? 0 : 1);
}
}
else
{
if (this.noiseTexture)
{
this.noiseTexture.wrapMode = TextureWrapMode.Repeat;
this.noiseTexture.filterMode = this.filterMode;
}
this.noiseMaterial.SetTexture("_NoiseTex", this.noiseTexture);
this.noiseMaterial.SetVector("_NoisePerChannel", (!this.monochrome) ? this.intensities : Vector3.one);
this.noiseMaterial.SetVector("_NoiseTilingPerChannel", (!this.monochrome) ? this.tiling : (Vector3.one * this.monochromeTiling));
this.noiseMaterial.SetVector("_MidGrey", new Vector3(this.midGrey, 1f / (1f - this.midGrey), -1f / this.midGrey));
this.noiseMaterial.SetVector("_NoiseAmount", new Vector3(this.generalIntensity, this.blackIntensity, this.whiteIntensity) * this.intensityMultiplier);
if (this.softness > Mathf.Epsilon)
{
RenderTexture temporary2 = RenderTexture.GetTemporary((int)((float)source.width * (1f - this.softness)), (int)((float)source.height * (1f - this.softness)));
NoiseAndGrain.DrawNoiseQuadGrid(source, temporary2, this.noiseMaterial, this.noiseTexture, this.mesh, 2);
this.noiseMaterial.SetTexture("_NoiseTex", temporary2);
Graphics.Blit(source, destination, this.noiseMaterial, 1);
RenderTexture.ReleaseTemporary(temporary2);
}
else
{
NoiseAndGrain.DrawNoiseQuadGrid(source, destination, this.noiseMaterial, this.noiseTexture, this.mesh, 0);
}
}
}
// Token: 0x06000150 RID: 336 RVA: 0x0000EED4 File Offset: 0x0000D2D4
private static void DrawNoiseQuadGrid(RenderTexture source, RenderTexture dest, Material fxMaterial, Texture2D noise, Mesh mesh, int passNr)
{
RenderTexture.active = dest;
fxMaterial.SetTexture("_MainTex", source);
GL.PushMatrix();
GL.LoadOrtho();
fxMaterial.SetPass(passNr);
NoiseAndGrain.BuildMesh(mesh, source, noise);
Transform transform = Camera.main.transform;
Vector3 position = transform.position;
Quaternion rotation = transform.rotation;
transform.position = Vector3.zero;
transform.rotation = Quaternion.identity;
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
transform.position = position;
transform.rotation = rotation;
GL.PopMatrix();
}
// Token: 0x06000151 RID: 337 RVA: 0x0000EF60 File Offset: 0x0000D360
private static void BuildMesh(Mesh mesh, RenderTexture source, Texture2D noise)
{
float num = (float)noise.width * 1f;
float num2 = 1f * (float)source.width / NoiseAndGrain.TILE_AMOUNT;
float num3 = 1f * (float)source.width / (1f * (float)source.height);
float num4 = 1f / num2;
float num5 = num4 * num3;
int num6 = (int)Mathf.Ceil(num2);
int num7 = (int)Mathf.Ceil(1f / num5);
if (mesh.vertices.Length != num6 * num7 * 4)
{
Vector3[] array = new Vector3[num6 * num7 * 4];
Vector2[] array2 = new Vector2[num6 * num7 * 4];
int[] array3 = new int[num6 * num7 * 6];
int num8 = 0;
int num9 = 0;
for (float num10 = 0f; num10 < 1f; num10 += num4)
{
for (float num11 = 0f; num11 < 1f; num11 += num5)
{
array[num8] = new Vector3(num10, num11, 0.1f);
array[num8 + 1] = new Vector3(num10 + num4, num11, 0.1f);
array[num8 + 2] = new Vector3(num10 + num4, num11 + num5, 0.1f);
array[num8 + 3] = new Vector3(num10, num11 + num5, 0.1f);
array2[num8] = new Vector2(0f, 0f);
array2[num8 + 1] = new Vector2(1f, 0f);
array2[num8 + 2] = new Vector2(1f, 1f);
array2[num8 + 3] = new Vector2(0f, 1f);
array3[num9] = num8;
array3[num9 + 1] = num8 + 1;
array3[num9 + 2] = num8 + 2;
array3[num9 + 3] = num8;
array3[num9 + 4] = num8 + 2;
array3[num9 + 5] = num8 + 3;
num8 += 4;
num9 += 6;
}
}
mesh.vertices = array;
mesh.uv2 = array2;
mesh.triangles = array3;
}
NoiseAndGrain.BuildMeshUV0(mesh, num6, num7, num, noise.width);
}
// Token: 0x06000152 RID: 338 RVA: 0x0000F1C0 File Offset: 0x0000D5C0
private static void BuildMeshUV0(Mesh mesh, int width, int height, float noiseSize, int noiseWidth)
{
float num = noiseSize / ((float)noiseWidth * 1f);
float num2 = 1f / noiseSize;
Vector2[] array = new Vector2[width * height * 4];
int num3 = 0;
for (int i = 0; i < width * height; i++)
{
float num4 = global::UnityEngine.Random.Range(0f, noiseSize);
float num5 = global::UnityEngine.Random.Range(0f, noiseSize);
num4 = Mathf.Floor(num4) * num2;
num5 = Mathf.Floor(num5) * num2;
array[num3] = new Vector2(num4, num5);
array[num3 + 1] = new Vector2(num4 + num * num2, num5);
array[num3 + 2] = new Vector2(num4 + num * num2, num5 + num * num2);
array[num3 + 3] = new Vector2(num4, num5 + num * num2);
num3 += 4;
}
mesh.uv = array;
}
// Token: 0x040002D5 RID: 725
public float intensityMultiplier = 0.25f;
// Token: 0x040002D6 RID: 726
public float generalIntensity = 0.5f;
// Token: 0x040002D7 RID: 727
public float blackIntensity = 1f;
// Token: 0x040002D8 RID: 728
public float whiteIntensity = 1f;
// Token: 0x040002D9 RID: 729
public float midGrey = 0.2f;
// Token: 0x040002DA RID: 730
public bool dx11Grain;
// Token: 0x040002DB RID: 731
public float softness;
// Token: 0x040002DC RID: 732
public bool monochrome;
// Token: 0x040002DD RID: 733
public Vector3 intensities = new Vector3(1f, 1f, 1f);
// Token: 0x040002DE RID: 734
public Vector3 tiling = new Vector3(64f, 64f, 64f);
// Token: 0x040002DF RID: 735
public float monochromeTiling = 64f;
// Token: 0x040002E0 RID: 736
public FilterMode filterMode = FilterMode.Bilinear;
// Token: 0x040002E1 RID: 737
public Texture2D noiseTexture;
// Token: 0x040002E2 RID: 738
public Shader noiseShader;
// Token: 0x040002E3 RID: 739
private Material noiseMaterial;
// Token: 0x040002E4 RID: 740
public Shader dx11NoiseShader;
// Token: 0x040002E5 RID: 741
private Material dx11NoiseMaterial;
// Token: 0x040002E6 RID: 742
private static float TILE_AMOUNT = 64f;
// Token: 0x040002E7 RID: 743
private Mesh mesh;
}
}
@@ -0,0 +1,162 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000077 RID: 119
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Noise/Noise and Scratches")]
public class NoiseAndScratches : MonoBehaviour
{
// Token: 0x06000155 RID: 341 RVA: 0x0000F320 File Offset: 0x0000D720
protected void Start()
{
if (!SystemInfo.supportsImageEffects)
{
base.enabled = false;
return;
}
if (this.shaderRGB == null || this.shaderYUV == null)
{
Debug.Log("Noise shaders are not set up! Disabling noise effect.");
base.enabled = false;
}
else if (!this.shaderRGB.isSupported)
{
base.enabled = false;
}
else if (!this.shaderYUV.isSupported)
{
this.rgbFallback = true;
}
}
// Token: 0x17000058 RID: 88
// (get) Token: 0x06000156 RID: 342 RVA: 0x0000F3AC File Offset: 0x0000D7AC
protected Material material
{
get
{
if (this.m_MaterialRGB == null)
{
this.m_MaterialRGB = new Material(this.shaderRGB);
this.m_MaterialRGB.hideFlags = HideFlags.HideAndDontSave;
}
if (this.m_MaterialYUV == null && !this.rgbFallback)
{
this.m_MaterialYUV = new Material(this.shaderYUV);
this.m_MaterialYUV.hideFlags = HideFlags.HideAndDontSave;
}
return (this.rgbFallback || this.monochrome) ? this.m_MaterialRGB : this.m_MaterialYUV;
}
}
// Token: 0x06000157 RID: 343 RVA: 0x0000F449 File Offset: 0x0000D849
protected void OnDisable()
{
if (this.m_MaterialRGB)
{
global::UnityEngine.Object.DestroyImmediate(this.m_MaterialRGB);
}
if (this.m_MaterialYUV)
{
global::UnityEngine.Object.DestroyImmediate(this.m_MaterialYUV);
}
}
// Token: 0x06000158 RID: 344 RVA: 0x0000F484 File Offset: 0x0000D884
private void SanitizeParameters()
{
this.grainIntensityMin = Mathf.Clamp(this.grainIntensityMin, 0f, 5f);
this.grainIntensityMax = Mathf.Clamp(this.grainIntensityMax, 0f, 5f);
this.scratchIntensityMin = Mathf.Clamp(this.scratchIntensityMin, 0f, 5f);
this.scratchIntensityMax = Mathf.Clamp(this.scratchIntensityMax, 0f, 5f);
this.scratchFPS = Mathf.Clamp(this.scratchFPS, 1f, 30f);
this.scratchJitter = Mathf.Clamp(this.scratchJitter, 0f, 1f);
this.grainSize = Mathf.Clamp(this.grainSize, 0.1f, 50f);
}
// Token: 0x06000159 RID: 345 RVA: 0x0000F550 File Offset: 0x0000D950
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
this.SanitizeParameters();
if (this.scratchTimeLeft <= 0f)
{
this.scratchTimeLeft = global::UnityEngine.Random.value * 2f / this.scratchFPS;
this.scratchX = global::UnityEngine.Random.value;
this.scratchY = global::UnityEngine.Random.value;
}
this.scratchTimeLeft -= Time.deltaTime;
Material material = this.material;
material.SetTexture("_GrainTex", this.grainTexture);
material.SetTexture("_ScratchTex", this.scratchTexture);
float num = 1f / this.grainSize;
material.SetVector("_GrainOffsetScale", new Vector4(global::UnityEngine.Random.value, global::UnityEngine.Random.value, (float)Screen.width / (float)this.grainTexture.width * num, (float)Screen.height / (float)this.grainTexture.height * num));
material.SetVector("_ScratchOffsetScale", new Vector4(this.scratchX + global::UnityEngine.Random.value * this.scratchJitter, this.scratchY + global::UnityEngine.Random.value * this.scratchJitter, (float)Screen.width / (float)this.scratchTexture.width, (float)Screen.height / (float)this.scratchTexture.height));
material.SetVector("_Intensity", new Vector4(global::UnityEngine.Random.Range(this.grainIntensityMin, this.grainIntensityMax), global::UnityEngine.Random.Range(this.scratchIntensityMin, this.scratchIntensityMax), 0f, 0f));
Graphics.Blit(source, destination, material);
}
// Token: 0x040002E8 RID: 744
public bool monochrome = true;
// Token: 0x040002E9 RID: 745
private bool rgbFallback;
// Token: 0x040002EA RID: 746
[Range(0f, 5f)]
public float grainIntensityMin = 0.1f;
// Token: 0x040002EB RID: 747
[Range(0f, 5f)]
public float grainIntensityMax = 0.2f;
// Token: 0x040002EC RID: 748
[Range(0.1f, 50f)]
public float grainSize = 2f;
// Token: 0x040002ED RID: 749
[Range(0f, 5f)]
public float scratchIntensityMin = 0.05f;
// Token: 0x040002EE RID: 750
[Range(0f, 5f)]
public float scratchIntensityMax = 0.25f;
// Token: 0x040002EF RID: 751
[Range(1f, 30f)]
public float scratchFPS = 10f;
// Token: 0x040002F0 RID: 752
[Range(0f, 1f)]
public float scratchJitter = 0.01f;
// Token: 0x040002F1 RID: 753
public Texture grainTexture;
// Token: 0x040002F2 RID: 754
public Texture scratchTexture;
// Token: 0x040002F3 RID: 755
public Shader shaderRGB;
// Token: 0x040002F4 RID: 756
public Shader shaderYUV;
// Token: 0x040002F5 RID: 757
private Material m_MaterialRGB;
// Token: 0x040002F6 RID: 758
private Material m_MaterialYUV;
// Token: 0x040002F7 RID: 759
private float scratchTimeLeft;
// Token: 0x040002F8 RID: 760
private float scratchX;
// Token: 0x040002F9 RID: 761
private float scratchY;
}
}
@@ -0,0 +1,272 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000078 RID: 120
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class PostEffectsBase : MonoBehaviour
{
// Token: 0x0600015B RID: 347 RVA: 0x000076D0 File Offset: 0x00005AD0
protected Material CheckShaderAndCreateMaterial(Shader s, Material m2Create)
{
if (!s)
{
Debug.Log("Missing shader in " + this.ToString());
base.enabled = false;
return null;
}
if (s.isSupported && m2Create && m2Create.shader == s)
{
return m2Create;
}
if (!s.isSupported)
{
this.NotSupported();
Debug.Log(string.Concat(new string[]
{
"The shader ",
s.ToString(),
" on effect ",
this.ToString(),
" is not supported on this platform!"
}));
return null;
}
m2Create = new Material(s);
this.createdMaterials.Add(m2Create);
m2Create.hideFlags = HideFlags.DontSave;
return m2Create;
}
// Token: 0x0600015C RID: 348 RVA: 0x0000779C File Offset: 0x00005B9C
protected Material CreateMaterial(Shader s, Material m2Create)
{
if (!s)
{
Debug.Log("Missing shader in " + this.ToString());
return null;
}
if (m2Create && m2Create.shader == s && s.isSupported)
{
return m2Create;
}
if (!s.isSupported)
{
return null;
}
m2Create = new Material(s);
this.createdMaterials.Add(m2Create);
m2Create.hideFlags = HideFlags.DontSave;
return m2Create;
}
// Token: 0x0600015D RID: 349 RVA: 0x0000781E File Offset: 0x00005C1E
private void OnEnable()
{
this.isSupported = true;
}
// Token: 0x0600015E RID: 350 RVA: 0x00007827 File Offset: 0x00005C27
private void OnDestroy()
{
this.RemoveCreatedMaterials();
}
// Token: 0x0600015F RID: 351 RVA: 0x00007830 File Offset: 0x00005C30
private void RemoveCreatedMaterials()
{
while (this.createdMaterials.Count > 0)
{
Material material = this.createdMaterials[0];
this.createdMaterials.RemoveAt(0);
global::UnityEngine.Object.Destroy(material);
}
}
// Token: 0x06000160 RID: 352 RVA: 0x00007872 File Offset: 0x00005C72
protected bool CheckSupport()
{
return this.CheckSupport(false);
}
// Token: 0x06000161 RID: 353 RVA: 0x0000787B File Offset: 0x00005C7B
public virtual bool CheckResources()
{
Debug.LogWarning("CheckResources () for " + this.ToString() + " should be overwritten.");
return this.isSupported;
}
// Token: 0x06000162 RID: 354 RVA: 0x0000789D File Offset: 0x00005C9D
protected void Start()
{
this.CheckResources();
}
// Token: 0x06000163 RID: 355 RVA: 0x000078A8 File Offset: 0x00005CA8
protected bool CheckSupport(bool needDepth)
{
this.isSupported = true;
this.supportHDRTextures = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf);
this.supportDX11 = SystemInfo.graphicsShaderLevel >= 50 && SystemInfo.supportsComputeShaders;
if (!SystemInfo.supportsImageEffects)
{
this.NotSupported();
return false;
}
if (needDepth && !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
{
this.NotSupported();
return false;
}
if (needDepth)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
return true;
}
// Token: 0x06000164 RID: 356 RVA: 0x00007927 File Offset: 0x00005D27
protected bool CheckSupport(bool needDepth, bool needHdr)
{
if (!this.CheckSupport(needDepth))
{
return false;
}
if (needHdr && !this.supportHDRTextures)
{
this.NotSupported();
return false;
}
return true;
}
// Token: 0x06000165 RID: 357 RVA: 0x00007951 File Offset: 0x00005D51
public bool Dx11Support()
{
return this.supportDX11;
}
// Token: 0x06000166 RID: 358 RVA: 0x00007959 File Offset: 0x00005D59
protected void ReportAutoDisable()
{
Debug.LogWarning("The image effect " + this.ToString() + " has been disabled as it's not supported on the current platform.");
}
// Token: 0x06000167 RID: 359 RVA: 0x00007978 File Offset: 0x00005D78
private bool CheckShader(Shader s)
{
Debug.Log(string.Concat(new string[]
{
"The shader ",
s.ToString(),
" on effect ",
this.ToString(),
" is not part of the Unity 3.2+ effects suite anymore. For best performance and quality, please ensure you are using the latest Standard Assets Image Effects (Pro only) package."
}));
if (!s.isSupported)
{
this.NotSupported();
return false;
}
return false;
}
// Token: 0x06000168 RID: 360 RVA: 0x000079D3 File Offset: 0x00005DD3
protected void NotSupported()
{
base.enabled = false;
this.isSupported = false;
}
// Token: 0x06000169 RID: 361 RVA: 0x000079E4 File Offset: 0x00005DE4
protected void DrawBorder(RenderTexture dest, Material material)
{
RenderTexture.active = dest;
bool flag = true;
GL.PushMatrix();
GL.LoadOrtho();
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
float num;
float num2;
if (flag)
{
num = 1f;
num2 = 0f;
}
else
{
num = 0f;
num2 = 1f;
}
float num3 = 0f;
float num4 = 1f / ((float)dest.width * 1f);
float num5 = 0f;
float num6 = 1f;
GL.Begin(7);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 1f - 1f / ((float)dest.width * 1f);
num4 = 1f;
num5 = 0f;
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 0f;
num6 = 1f / ((float)dest.height * 1f);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 1f - 1f / ((float)dest.height * 1f);
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
GL.End();
}
GL.PopMatrix();
}
// Token: 0x040002FA RID: 762
protected bool supportHDRTextures = true;
// Token: 0x040002FB RID: 763
protected bool supportDX11;
// Token: 0x040002FC RID: 764
protected bool isSupported = true;
// Token: 0x040002FD RID: 765
private List<Material> createdMaterials = new List<Material>();
}
}
@@ -0,0 +1,181 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000079 RID: 121
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
internal class PostEffectsHelper : MonoBehaviour
{
// Token: 0x0600016B RID: 363 RVA: 0x0000F6D5 File Offset: 0x0000DAD5
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Debug.Log("OnRenderImage in Helper called ...");
}
// Token: 0x0600016C RID: 364 RVA: 0x0000F6E4 File Offset: 0x0000DAE4
private static void DrawLowLevelPlaneAlignedWithCamera(float dist, RenderTexture source, RenderTexture dest, Material material, Camera cameraForProjectionMatrix)
{
RenderTexture.active = dest;
material.SetTexture("_MainTex", source);
bool flag = true;
GL.PushMatrix();
GL.LoadIdentity();
GL.LoadProjectionMatrix(cameraForProjectionMatrix.projectionMatrix);
float num = cameraForProjectionMatrix.fieldOfView * 0.5f * 0.017453292f;
float num2 = Mathf.Cos(num) / Mathf.Sin(num);
float aspect = cameraForProjectionMatrix.aspect;
float num3 = aspect / -num2;
float num4 = aspect / num2;
float num5 = 1f / -num2;
float num6 = 1f / num2;
float num7 = 1f;
num3 *= dist * num7;
num4 *= dist * num7;
num5 *= dist * num7;
num6 *= dist * num7;
float num8 = -dist;
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
GL.Begin(7);
float num9;
float num10;
if (flag)
{
num9 = 1f;
num10 = 0f;
}
else
{
num9 = 0f;
num10 = 1f;
}
GL.TexCoord2(0f, num9);
GL.Vertex3(num3, num5, num8);
GL.TexCoord2(1f, num9);
GL.Vertex3(num4, num5, num8);
GL.TexCoord2(1f, num10);
GL.Vertex3(num4, num6, num8);
GL.TexCoord2(0f, num10);
GL.Vertex3(num3, num6, num8);
GL.End();
}
GL.PopMatrix();
}
// Token: 0x0600016D RID: 365 RVA: 0x0000F84C File Offset: 0x0000DC4C
private static void DrawBorder(RenderTexture dest, Material material)
{
RenderTexture.active = dest;
bool flag = true;
GL.PushMatrix();
GL.LoadOrtho();
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
float num;
float num2;
if (flag)
{
num = 1f;
num2 = 0f;
}
else
{
num = 0f;
num2 = 1f;
}
float num3 = 0f;
float num4 = 1f / ((float)dest.width * 1f);
float num5 = 0f;
float num6 = 1f;
GL.Begin(7);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 1f - 1f / ((float)dest.width * 1f);
num4 = 1f;
num5 = 0f;
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 0f;
num6 = 1f / ((float)dest.height * 1f);
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
num3 = 0f;
num4 = 1f;
num5 = 1f - 1f / ((float)dest.height * 1f);
num6 = 1f;
GL.TexCoord2(0f, num);
GL.Vertex3(num3, num5, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(num4, num5, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(num4, num6, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(num3, num6, 0.1f);
GL.End();
}
GL.PopMatrix();
}
// Token: 0x0600016E RID: 366 RVA: 0x0000FAEC File Offset: 0x0000DEEC
private static void DrawLowLevelQuad(float x1, float x2, float y1, float y2, RenderTexture source, RenderTexture dest, Material material)
{
RenderTexture.active = dest;
material.SetTexture("_MainTex", source);
bool flag = true;
GL.PushMatrix();
GL.LoadOrtho();
for (int i = 0; i < material.passCount; i++)
{
material.SetPass(i);
GL.Begin(7);
float num;
float num2;
if (flag)
{
num = 1f;
num2 = 0f;
}
else
{
num = 0f;
num2 = 1f;
}
GL.TexCoord2(0f, num);
GL.Vertex3(x1, y1, 0.1f);
GL.TexCoord2(1f, num);
GL.Vertex3(x2, y1, 0.1f);
GL.TexCoord2(1f, num2);
GL.Vertex3(x2, y2, 0.1f);
GL.TexCoord2(0f, num2);
GL.Vertex3(x1, y2, 0.1f);
GL.End();
}
GL.PopMatrix();
}
}
}
@@ -0,0 +1,115 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007A RID: 122
internal class Quads
{
// Token: 0x06000170 RID: 368 RVA: 0x0000FBD4 File Offset: 0x0000DFD4
private static bool HasMeshes()
{
if (Quads.meshes == null)
{
return false;
}
foreach (Mesh mesh in Quads.meshes)
{
if (null == mesh)
{
return false;
}
}
return true;
}
// Token: 0x06000171 RID: 369 RVA: 0x0000FC1C File Offset: 0x0000E01C
public static void Cleanup()
{
if (Quads.meshes == null)
{
return;
}
for (int i = 0; i < Quads.meshes.Length; i++)
{
if (null != Quads.meshes[i])
{
global::UnityEngine.Object.DestroyImmediate(Quads.meshes[i]);
Quads.meshes[i] = null;
}
}
Quads.meshes = null;
}
// Token: 0x06000172 RID: 370 RVA: 0x0000FC78 File Offset: 0x0000E078
public static Mesh[] GetMeshes(int totalWidth, int totalHeight)
{
if (Quads.HasMeshes() && Quads.currentQuads == totalWidth * totalHeight)
{
return Quads.meshes;
}
int num = 10833;
int num2 = totalWidth * totalHeight;
Quads.currentQuads = num2;
int num3 = Mathf.CeilToInt(1f * (float)num2 / (1f * (float)num));
Quads.meshes = new Mesh[num3];
int num4 = 0;
for (int i = 0; i < num2; i += num)
{
int num5 = Mathf.FloorToInt((float)Mathf.Clamp(num2 - i, 0, num));
Quads.meshes[num4] = Quads.GetMesh(num5, i, totalWidth, totalHeight);
num4++;
}
return Quads.meshes;
}
// Token: 0x06000173 RID: 371 RVA: 0x0000FD1C File Offset: 0x0000E11C
private static Mesh GetMesh(int triCount, int triOffset, int totalWidth, int totalHeight)
{
Mesh mesh = new Mesh();
mesh.hideFlags = HideFlags.DontSave;
Vector3[] array = new Vector3[triCount * 4];
Vector2[] array2 = new Vector2[triCount * 4];
Vector2[] array3 = new Vector2[triCount * 4];
int[] array4 = new int[triCount * 6];
for (int i = 0; i < triCount; i++)
{
int num = i * 4;
int num2 = i * 6;
int num3 = triOffset + i;
float num4 = Mathf.Floor((float)(num3 % totalWidth)) / (float)totalWidth;
float num5 = Mathf.Floor((float)(num3 / totalWidth)) / (float)totalHeight;
Vector3 vector = new Vector3(num4 * 2f - 1f, num5 * 2f - 1f, 1f);
array[num] = vector;
array[num + 1] = vector;
array[num + 2] = vector;
array[num + 3] = vector;
array2[num] = new Vector2(0f, 0f);
array2[num + 1] = new Vector2(1f, 0f);
array2[num + 2] = new Vector2(0f, 1f);
array2[num + 3] = new Vector2(1f, 1f);
array3[num] = new Vector2(num4, num5);
array3[num + 1] = new Vector2(num4, num5);
array3[num + 2] = new Vector2(num4, num5);
array3[num + 3] = new Vector2(num4, num5);
array4[num2] = num;
array4[num2 + 1] = num + 1;
array4[num2 + 2] = num + 2;
array4[num2 + 3] = num + 1;
array4[num2 + 4] = num + 2;
array4[num2 + 5] = num + 3;
}
mesh.vertices = array;
mesh.triangles = array4;
mesh.uv = array2;
mesh.uv2 = array3;
return mesh;
}
// Token: 0x040002FE RID: 766
private static Mesh[] meshes;
// Token: 0x040002FF RID: 767
private static int currentQuads;
}
}
@@ -0,0 +1,69 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007B RID: 123
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Other/Screen Overlay")]
public class ScreenOverlay : PostEffectsBase
{
// Token: 0x06000176 RID: 374 RVA: 0x0000FF58 File Offset: 0x0000E358
public override bool CheckResources()
{
base.CheckSupport(false);
this.overlayMaterial = base.CheckShaderAndCreateMaterial(this.overlayShader, this.overlayMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000177 RID: 375 RVA: 0x0000FF94 File Offset: 0x0000E394
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
Vector4 vector = new Vector4(1f, 0f, 0f, 1f);
this.overlayMaterial.SetVector("_UV_Transform", vector);
this.overlayMaterial.SetFloat("_Intensity", this.intensity);
this.overlayMaterial.SetTexture("_Overlay", this.texture);
Graphics.Blit(source, destination, this.overlayMaterial, (int)this.blendMode);
}
// Token: 0x04000300 RID: 768
public ScreenOverlay.OverlayBlendMode blendMode = ScreenOverlay.OverlayBlendMode.Overlay;
// Token: 0x04000301 RID: 769
public float intensity = 1f;
// Token: 0x04000302 RID: 770
public Texture2D texture;
// Token: 0x04000303 RID: 771
public Shader overlayShader;
// Token: 0x04000304 RID: 772
private Material overlayMaterial;
// Token: 0x0200007C RID: 124
public enum OverlayBlendMode
{
// Token: 0x04000306 RID: 774
Additive,
// Token: 0x04000307 RID: 775
ScreenBlend,
// Token: 0x04000308 RID: 776
Multiply,
// Token: 0x04000309 RID: 777
Overlay,
// Token: 0x0400030A RID: 778
AlphaBlend
}
}
}
@@ -0,0 +1,119 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007D RID: 125
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Screen Space Ambient Obscurance")]
internal class ScreenSpaceAmbientObscurance : PostEffectsBase
{
// Token: 0x06000179 RID: 377 RVA: 0x0001004F File Offset: 0x0000E44F
public override bool CheckResources()
{
base.CheckSupport(true);
this.aoMaterial = base.CheckShaderAndCreateMaterial(this.aoShader, this.aoMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600017A RID: 378 RVA: 0x00010088 File Offset: 0x0000E488
private void OnDisable()
{
if (this.aoMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.aoMaterial);
}
this.aoMaterial = null;
}
// Token: 0x0600017B RID: 379 RVA: 0x000100AC File Offset: 0x0000E4AC
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
Camera component = base.GetComponent<Camera>();
Matrix4x4 projectionMatrix = component.projectionMatrix;
Matrix4x4 inverse = projectionMatrix.inverse;
Vector4 vector = new Vector4(-2f / projectionMatrix[0, 0], -2f / projectionMatrix[1, 1], (1f - projectionMatrix[0, 2]) / projectionMatrix[0, 0], (1f + projectionMatrix[1, 2]) / projectionMatrix[1, 1]);
if (component.stereoEnabled)
{
Matrix4x4 stereoProjectionMatrix = component.GetStereoProjectionMatrix(Camera.StereoscopicEye.Left);
Matrix4x4 stereoProjectionMatrix2 = component.GetStereoProjectionMatrix(Camera.StereoscopicEye.Right);
Vector4 vector2 = new Vector4(-2f / stereoProjectionMatrix[0, 0], -2f / stereoProjectionMatrix[1, 1], (1f - stereoProjectionMatrix[0, 2]) / stereoProjectionMatrix[0, 0], (1f + stereoProjectionMatrix[1, 2]) / stereoProjectionMatrix[1, 1]);
Vector4 vector3 = new Vector4(-2f / stereoProjectionMatrix2[0, 0], -2f / stereoProjectionMatrix2[1, 1], (1f - stereoProjectionMatrix2[0, 2]) / stereoProjectionMatrix2[0, 0], (1f + stereoProjectionMatrix2[1, 2]) / stereoProjectionMatrix2[1, 1]);
this.aoMaterial.SetVector("_ProjInfoLeft", vector2);
this.aoMaterial.SetVector("_ProjInfoRight", vector3);
}
this.aoMaterial.SetVector("_ProjInfo", vector);
this.aoMaterial.SetMatrix("_ProjectionInv", inverse);
this.aoMaterial.SetTexture("_Rand", this.rand);
this.aoMaterial.SetFloat("_Radius", this.radius);
this.aoMaterial.SetFloat("_Radius2", this.radius * this.radius);
this.aoMaterial.SetFloat("_Intensity", this.intensity);
this.aoMaterial.SetFloat("_BlurFilterDistance", this.blurFilterDistance);
int width = source.width;
int height = source.height;
RenderTexture renderTexture = RenderTexture.GetTemporary(width >> this.downsample, height >> this.downsample);
Graphics.Blit(source, renderTexture, this.aoMaterial, 0);
if (this.downsample > 0)
{
RenderTexture renderTexture2 = RenderTexture.GetTemporary(width, height);
Graphics.Blit(renderTexture, renderTexture2, this.aoMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
renderTexture = renderTexture2;
}
for (int i = 0; i < this.blurIterations; i++)
{
this.aoMaterial.SetVector("_Axis", new Vector2(1f, 0f));
RenderTexture renderTexture2 = RenderTexture.GetTemporary(width, height);
Graphics.Blit(renderTexture, renderTexture2, this.aoMaterial, 1);
RenderTexture.ReleaseTemporary(renderTexture);
this.aoMaterial.SetVector("_Axis", new Vector2(0f, 1f));
renderTexture = RenderTexture.GetTemporary(width, height);
Graphics.Blit(renderTexture2, renderTexture, this.aoMaterial, 1);
RenderTexture.ReleaseTemporary(renderTexture2);
}
this.aoMaterial.SetTexture("_AOTex", renderTexture);
Graphics.Blit(source, destination, this.aoMaterial, 2);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x0400030B RID: 779
[Range(0f, 3f)]
public float intensity = 0.5f;
// Token: 0x0400030C RID: 780
[Range(0.1f, 3f)]
public float radius = 0.2f;
// Token: 0x0400030D RID: 781
[Range(0f, 3f)]
public int blurIterations = 1;
// Token: 0x0400030E RID: 782
[Range(0f, 5f)]
public float blurFilterDistance = 1.25f;
// Token: 0x0400030F RID: 783
[Range(0f, 1f)]
public int downsample;
// Token: 0x04000310 RID: 784
public Texture2D rand;
// Token: 0x04000311 RID: 785
public Shader aoShader;
// Token: 0x04000312 RID: 786
private Material aoMaterial;
}
}
@@ -0,0 +1,183 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200007E RID: 126
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Screen Space Ambient Occlusion")]
public class ScreenSpaceAmbientOcclusion : MonoBehaviour
{
// Token: 0x0600017D RID: 381 RVA: 0x00010454 File Offset: 0x0000E854
private static Material CreateMaterial(Shader shader)
{
if (!shader)
{
return null;
}
return new Material(shader)
{
hideFlags = HideFlags.HideAndDontSave
};
}
// Token: 0x0600017E RID: 382 RVA: 0x0001047E File Offset: 0x0000E87E
private static void DestroyMaterial(Material mat)
{
if (mat)
{
global::UnityEngine.Object.DestroyImmediate(mat);
mat = null;
}
}
// Token: 0x0600017F RID: 383 RVA: 0x00010494 File Offset: 0x0000E894
private void OnDisable()
{
ScreenSpaceAmbientOcclusion.DestroyMaterial(this.m_SSAOMaterial);
}
// Token: 0x06000180 RID: 384 RVA: 0x000104A4 File Offset: 0x0000E8A4
private void Start()
{
if (!SystemInfo.supportsImageEffects || !SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.Depth))
{
this.m_Supported = false;
base.enabled = false;
return;
}
this.CreateMaterials();
if (!this.m_SSAOMaterial || this.m_SSAOMaterial.passCount != 5)
{
this.m_Supported = false;
base.enabled = false;
return;
}
this.m_Supported = true;
}
// Token: 0x06000181 RID: 385 RVA: 0x00010512 File Offset: 0x0000E912
private void OnEnable()
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.DepthNormals;
}
// Token: 0x06000182 RID: 386 RVA: 0x00010528 File Offset: 0x0000E928
private void CreateMaterials()
{
if (!this.m_SSAOMaterial && this.m_SSAOShader.isSupported)
{
this.m_SSAOMaterial = ScreenSpaceAmbientOcclusion.CreateMaterial(this.m_SSAOShader);
this.m_SSAOMaterial.SetTexture("_RandomTexture", this.m_RandomTexture);
}
}
// Token: 0x06000183 RID: 387 RVA: 0x0001057C File Offset: 0x0000E97C
[ImageEffectOpaque]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.m_Supported || !this.m_SSAOShader.isSupported)
{
base.enabled = false;
return;
}
this.CreateMaterials();
this.m_Downsampling = Mathf.Clamp(this.m_Downsampling, 1, 6);
this.m_Radius = Mathf.Clamp(this.m_Radius, 0.05f, 1f);
this.m_MinZ = Mathf.Clamp(this.m_MinZ, 1E-05f, 0.5f);
this.m_OcclusionIntensity = Mathf.Clamp(this.m_OcclusionIntensity, 0.5f, 4f);
this.m_OcclusionAttenuation = Mathf.Clamp(this.m_OcclusionAttenuation, 0.2f, 2f);
this.m_Blur = Mathf.Clamp(this.m_Blur, 0, 4);
RenderTexture renderTexture = RenderTexture.GetTemporary(source.width / this.m_Downsampling, source.height / this.m_Downsampling, 0);
float fieldOfView = base.GetComponent<Camera>().fieldOfView;
float farClipPlane = base.GetComponent<Camera>().farClipPlane;
float num = Mathf.Tan(fieldOfView * 0.017453292f * 0.5f) * farClipPlane;
float num2 = num * base.GetComponent<Camera>().aspect;
this.m_SSAOMaterial.SetVector("_FarCorner", new Vector3(num2, num, farClipPlane));
int num3;
int num4;
if (this.m_RandomTexture)
{
num3 = this.m_RandomTexture.width;
num4 = this.m_RandomTexture.height;
}
else
{
num3 = 1;
num4 = 1;
}
this.m_SSAOMaterial.SetVector("_NoiseScale", new Vector3((float)renderTexture.width / (float)num3, (float)renderTexture.height / (float)num4, 0f));
this.m_SSAOMaterial.SetVector("_Params", new Vector4(this.m_Radius, this.m_MinZ, 1f / this.m_OcclusionAttenuation, this.m_OcclusionIntensity));
bool flag = this.m_Blur > 0;
Graphics.Blit((!flag) ? source : null, renderTexture, this.m_SSAOMaterial, (int)this.m_SampleCount);
if (flag)
{
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0);
this.m_SSAOMaterial.SetVector("_TexelOffsetScale", new Vector4((float)this.m_Blur / (float)source.width, 0f, 0f, 0f));
this.m_SSAOMaterial.SetTexture("_SSAO", renderTexture);
Graphics.Blit(null, temporary, this.m_SSAOMaterial, 3);
RenderTexture.ReleaseTemporary(renderTexture);
RenderTexture temporary2 = RenderTexture.GetTemporary(source.width, source.height, 0);
this.m_SSAOMaterial.SetVector("_TexelOffsetScale", new Vector4(0f, (float)this.m_Blur / (float)source.height, 0f, 0f));
this.m_SSAOMaterial.SetTexture("_SSAO", temporary);
Graphics.Blit(source, temporary2, this.m_SSAOMaterial, 3);
RenderTexture.ReleaseTemporary(temporary);
renderTexture = temporary2;
}
this.m_SSAOMaterial.SetTexture("_SSAO", renderTexture);
Graphics.Blit(source, destination, this.m_SSAOMaterial, 4);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x04000313 RID: 787
[Range(0.05f, 1f)]
public float m_Radius = 0.4f;
// Token: 0x04000314 RID: 788
public ScreenSpaceAmbientOcclusion.SSAOSamples m_SampleCount = ScreenSpaceAmbientOcclusion.SSAOSamples.Medium;
// Token: 0x04000315 RID: 789
[Range(0.5f, 4f)]
public float m_OcclusionIntensity = 1.5f;
// Token: 0x04000316 RID: 790
[Range(0f, 4f)]
public int m_Blur = 2;
// Token: 0x04000317 RID: 791
[Range(1f, 6f)]
public int m_Downsampling = 2;
// Token: 0x04000318 RID: 792
[Range(0.2f, 2f)]
public float m_OcclusionAttenuation = 1f;
// Token: 0x04000319 RID: 793
[Range(1E-05f, 0.5f)]
public float m_MinZ = 0.01f;
// Token: 0x0400031A RID: 794
public Shader m_SSAOShader;
// Token: 0x0400031B RID: 795
private Material m_SSAOMaterial;
// Token: 0x0400031C RID: 796
public Texture2D m_RandomTexture;
// Token: 0x0400031D RID: 797
private bool m_Supported;
// Token: 0x0200007F RID: 127
public enum SSAOSamples
{
// Token: 0x0400031F RID: 799
Low,
// Token: 0x04000320 RID: 800
Medium,
// Token: 0x04000321 RID: 801
High
}
}
}
@@ -0,0 +1,17 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200008A RID: 138
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Color Adjustments/Sepia Tone")]
public class SepiaTone : ImageEffectBase
{
// Token: 0x06000191 RID: 401 RVA: 0x00011D4B File Offset: 0x0001014B
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
Graphics.Blit(source, destination, base.material);
}
}
}
@@ -0,0 +1,168 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200008B RID: 139
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Rendering/Sun Shafts")]
public class SunShafts : PostEffectsBase
{
// Token: 0x06000193 RID: 403 RVA: 0x00011DCC File Offset: 0x000101CC
public override bool CheckResources()
{
base.CheckSupport(this.useDepthTexture);
this.sunShaftsMaterial = base.CheckShaderAndCreateMaterial(this.sunShaftsShader, this.sunShaftsMaterial);
this.simpleClearMaterial = base.CheckShaderAndCreateMaterial(this.simpleClearShader, this.simpleClearMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000194 RID: 404 RVA: 0x00011E30 File Offset: 0x00010230
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
if (this.useDepthTexture)
{
base.GetComponent<Camera>().depthTextureMode |= DepthTextureMode.Depth;
}
int num = 4;
if (this.resolution == SunShafts.SunShaftsResolution.Normal)
{
num = 2;
}
else if (this.resolution == SunShafts.SunShaftsResolution.High)
{
num = 1;
}
Vector3 vector = Vector3.one * 0.5f;
if (this.sunTransform)
{
vector = base.GetComponent<Camera>().WorldToViewportPoint(this.sunTransform.position);
}
else
{
vector = new Vector3(0.5f, 0.5f, 0f);
}
int num2 = source.width / num;
int num3 = source.height / num;
RenderTexture renderTexture = RenderTexture.GetTemporary(num2, num3, 0);
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(1f, 1f, 0f, 0f) * this.sunShaftBlurRadius);
this.sunShaftsMaterial.SetVector("_SunPosition", new Vector4(vector.x, vector.y, vector.z, this.maxRadius));
this.sunShaftsMaterial.SetVector("_SunThreshold", this.sunThreshold);
if (!this.useDepthTexture)
{
RenderTextureFormat renderTextureFormat = ((!base.GetComponent<Camera>().allowHDR) ? RenderTextureFormat.Default : RenderTextureFormat.DefaultHDR);
RenderTexture temporary = RenderTexture.GetTemporary(source.width, source.height, 0, renderTextureFormat);
RenderTexture.active = temporary;
GL.ClearWithSkybox(false, base.GetComponent<Camera>());
this.sunShaftsMaterial.SetTexture("_Skybox", temporary);
Graphics.Blit(source, renderTexture, this.sunShaftsMaterial, 3);
RenderTexture.ReleaseTemporary(temporary);
}
else
{
Graphics.Blit(source, renderTexture, this.sunShaftsMaterial, 2);
}
base.DrawBorder(renderTexture, this.simpleClearMaterial);
this.radialBlurIterations = Mathf.Clamp(this.radialBlurIterations, 1, 4);
float num4 = this.sunShaftBlurRadius * 0.0013020834f;
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f));
this.sunShaftsMaterial.SetVector("_SunPosition", new Vector4(vector.x, vector.y, vector.z, this.maxRadius));
for (int i = 0; i < this.radialBlurIterations; i++)
{
RenderTexture temporary2 = RenderTexture.GetTemporary(num2, num3, 0);
Graphics.Blit(renderTexture, temporary2, this.sunShaftsMaterial, 1);
RenderTexture.ReleaseTemporary(renderTexture);
num4 = this.sunShaftBlurRadius * (((float)i * 2f + 1f) * 6f) / 768f;
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f));
renderTexture = RenderTexture.GetTemporary(num2, num3, 0);
Graphics.Blit(temporary2, renderTexture, this.sunShaftsMaterial, 1);
RenderTexture.ReleaseTemporary(temporary2);
num4 = this.sunShaftBlurRadius * (((float)i * 2f + 2f) * 6f) / 768f;
this.sunShaftsMaterial.SetVector("_BlurRadius4", new Vector4(num4, num4, 0f, 0f));
}
if (vector.z >= 0f)
{
this.sunShaftsMaterial.SetVector("_SunColor", new Vector4(this.sunColor.r, this.sunColor.g, this.sunColor.b, this.sunColor.a) * this.sunShaftIntensity);
}
else
{
this.sunShaftsMaterial.SetVector("_SunColor", Vector4.zero);
}
this.sunShaftsMaterial.SetTexture("_ColorBuffer", renderTexture);
Graphics.Blit(source, destination, this.sunShaftsMaterial, (this.screenBlendMode != SunShafts.ShaftsScreenBlendMode.Screen) ? 4 : 0);
RenderTexture.ReleaseTemporary(renderTexture);
}
// Token: 0x04000379 RID: 889
public SunShafts.SunShaftsResolution resolution = SunShafts.SunShaftsResolution.Normal;
// Token: 0x0400037A RID: 890
public SunShafts.ShaftsScreenBlendMode screenBlendMode;
// Token: 0x0400037B RID: 891
public Transform sunTransform;
// Token: 0x0400037C RID: 892
public int radialBlurIterations = 2;
// Token: 0x0400037D RID: 893
public Color sunColor = Color.white;
// Token: 0x0400037E RID: 894
public Color sunThreshold = new Color(0.87f, 0.74f, 0.65f);
// Token: 0x0400037F RID: 895
public float sunShaftBlurRadius = 2.5f;
// Token: 0x04000380 RID: 896
public float sunShaftIntensity = 1.15f;
// Token: 0x04000381 RID: 897
public float maxRadius = 0.75f;
// Token: 0x04000382 RID: 898
public bool useDepthTexture = true;
// Token: 0x04000383 RID: 899
public Shader sunShaftsShader;
// Token: 0x04000384 RID: 900
private Material sunShaftsMaterial;
// Token: 0x04000385 RID: 901
public Shader simpleClearShader;
// Token: 0x04000386 RID: 902
private Material simpleClearMaterial;
// Token: 0x0200008C RID: 140
public enum SunShaftsResolution
{
// Token: 0x04000388 RID: 904
Low,
// Token: 0x04000389 RID: 905
Normal,
// Token: 0x0400038A RID: 906
High
}
// Token: 0x0200008D RID: 141
public enum ShaftsScreenBlendMode
{
// Token: 0x0400038C RID: 908
Screen,
// Token: 0x0400038D RID: 909
Add
}
}
}
@@ -0,0 +1,98 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x0200008E RID: 142
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Tilt Shift (Lens Blur)")]
internal class TiltShift : PostEffectsBase
{
// Token: 0x06000196 RID: 406 RVA: 0x00012249 File Offset: 0x00010649
public override bool CheckResources()
{
base.CheckSupport(true);
this.tiltShiftMaterial = base.CheckShaderAndCreateMaterial(this.tiltShiftShader, this.tiltShiftMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x06000197 RID: 407 RVA: 0x00012284 File Offset: 0x00010684
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.tiltShiftMaterial.SetFloat("_BlurSize", (this.maxBlurSize >= 0f) ? this.maxBlurSize : 0f);
this.tiltShiftMaterial.SetFloat("_BlurArea", this.blurArea);
source.filterMode = FilterMode.Bilinear;
RenderTexture renderTexture = destination;
if ((float)this.downsample > 0f)
{
renderTexture = RenderTexture.GetTemporary(source.width >> this.downsample, source.height >> this.downsample, 0, source.format);
renderTexture.filterMode = FilterMode.Bilinear;
}
int num = (int)this.quality;
num *= 2;
Graphics.Blit(source, renderTexture, this.tiltShiftMaterial, (this.mode != TiltShift.TiltShiftMode.TiltShiftMode) ? (num + 1) : num);
if (this.downsample > 0)
{
this.tiltShiftMaterial.SetTexture("_Blurred", renderTexture);
Graphics.Blit(source, destination, this.tiltShiftMaterial, 6);
}
if (renderTexture != destination)
{
RenderTexture.ReleaseTemporary(renderTexture);
}
}
// Token: 0x0400038E RID: 910
public TiltShift.TiltShiftMode mode;
// Token: 0x0400038F RID: 911
public TiltShift.TiltShiftQuality quality = TiltShift.TiltShiftQuality.Normal;
// Token: 0x04000390 RID: 912
[Range(0f, 15f)]
public float blurArea = 1f;
// Token: 0x04000391 RID: 913
[Range(0f, 25f)]
public float maxBlurSize = 5f;
// Token: 0x04000392 RID: 914
[Range(0f, 1f)]
public int downsample;
// Token: 0x04000393 RID: 915
public Shader tiltShiftShader;
// Token: 0x04000394 RID: 916
private Material tiltShiftMaterial;
// Token: 0x0200008F RID: 143
public enum TiltShiftMode
{
// Token: 0x04000396 RID: 918
TiltShiftMode,
// Token: 0x04000397 RID: 919
IrisMode
}
// Token: 0x02000090 RID: 144
public enum TiltShiftQuality
{
// Token: 0x04000399 RID: 921
Preview,
// Token: 0x0400039A RID: 922
Normal,
// Token: 0x0400039B RID: 923
High
}
}
}
@@ -0,0 +1,268 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000091 RID: 145
[ImageEffectAllowedInSceneView]
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Color Adjustments/Tonemapping")]
public class Tonemapping : PostEffectsBase
{
// Token: 0x06000199 RID: 409 RVA: 0x00012404 File Offset: 0x00010804
public override bool CheckResources()
{
base.CheckSupport(false, true);
this.tonemapMaterial = base.CheckShaderAndCreateMaterial(this.tonemapper, this.tonemapMaterial);
if (!this.curveTex && this.type == Tonemapping.TonemapperType.UserCurve)
{
this.curveTex = new Texture2D(256, 1, TextureFormat.ARGB32, false, true);
this.curveTex.filterMode = FilterMode.Bilinear;
this.curveTex.wrapMode = TextureWrapMode.Clamp;
this.curveTex.hideFlags = HideFlags.DontSave;
}
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x0600019A RID: 410 RVA: 0x000124A0 File Offset: 0x000108A0
public float UpdateCurve()
{
float num = 1f;
if (this.remapCurve.keys.Length < 1)
{
this.remapCurve = new AnimationCurve(new Keyframe[]
{
new Keyframe(0f, 0f),
new Keyframe(2f, 1f)
});
}
if (this.remapCurve != null)
{
if (this.remapCurve.length > 0)
{
num = this.remapCurve[this.remapCurve.length - 1].time;
}
for (float num2 = 0f; num2 <= 1f; num2 += 0.003921569f)
{
float num3 = this.remapCurve.Evaluate(num2 * 1f * num);
this.curveTex.SetPixel((int)Mathf.Floor(num2 * 255f), 0, new Color(num3, num3, num3));
}
this.curveTex.Apply();
}
return 1f / num;
}
// Token: 0x0600019B RID: 411 RVA: 0x000125B0 File Offset: 0x000109B0
private void OnDisable()
{
if (this.rt)
{
global::UnityEngine.Object.DestroyImmediate(this.rt);
this.rt = null;
}
if (this.tonemapMaterial)
{
global::UnityEngine.Object.DestroyImmediate(this.tonemapMaterial);
this.tonemapMaterial = null;
}
if (this.curveTex)
{
global::UnityEngine.Object.DestroyImmediate(this.curveTex);
this.curveTex = null;
}
}
// Token: 0x0600019C RID: 412 RVA: 0x00012624 File Offset: 0x00010A24
private bool CreateInternalRenderTexture()
{
if (this.rt)
{
return false;
}
this.rtFormat = ((!SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf)) ? RenderTextureFormat.ARGBHalf : RenderTextureFormat.RGHalf);
this.rt = new RenderTexture(1, 1, 0, this.rtFormat);
this.rt.hideFlags = HideFlags.DontSave;
return true;
}
// Token: 0x0600019D RID: 413 RVA: 0x00012680 File Offset: 0x00010A80
[ImageEffectTransformsToLDR]
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
this.exposureAdjustment = ((this.exposureAdjustment >= 0.001f) ? this.exposureAdjustment : 0.001f);
if (this.type == Tonemapping.TonemapperType.UserCurve)
{
float num = this.UpdateCurve();
this.tonemapMaterial.SetFloat("_RangeScale", num);
this.tonemapMaterial.SetTexture("_Curve", this.curveTex);
Graphics.Blit(source, destination, this.tonemapMaterial, 4);
return;
}
if (this.type == Tonemapping.TonemapperType.SimpleReinhard)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 6);
return;
}
if (this.type == Tonemapping.TonemapperType.Hable)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 5);
return;
}
if (this.type == Tonemapping.TonemapperType.Photographic)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 8);
return;
}
if (this.type == Tonemapping.TonemapperType.OptimizedHejiDawson)
{
this.tonemapMaterial.SetFloat("_ExposureAdjustment", 0.5f * this.exposureAdjustment);
Graphics.Blit(source, destination, this.tonemapMaterial, 7);
return;
}
bool flag = this.CreateInternalRenderTexture();
RenderTexture temporary = RenderTexture.GetTemporary((int)this.adaptiveTextureSize, (int)this.adaptiveTextureSize, 0, this.rtFormat);
Graphics.Blit(source, temporary);
int num2 = (int)Mathf.Log((float)temporary.width * 1f, 2f);
int num3 = 2;
RenderTexture[] array = new RenderTexture[num2];
for (int i = 0; i < num2; i++)
{
array[i] = RenderTexture.GetTemporary(temporary.width / num3, temporary.width / num3, 0, this.rtFormat);
num3 *= 2;
}
RenderTexture renderTexture = array[num2 - 1];
Graphics.Blit(temporary, array[0], this.tonemapMaterial, 1);
if (this.type == Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite)
{
for (int j = 0; j < num2 - 1; j++)
{
Graphics.Blit(array[j], array[j + 1], this.tonemapMaterial, 9);
renderTexture = array[j + 1];
}
}
else if (this.type == Tonemapping.TonemapperType.AdaptiveReinhard)
{
for (int k = 0; k < num2 - 1; k++)
{
Graphics.Blit(array[k], array[k + 1]);
renderTexture = array[k + 1];
}
}
this.adaptionSpeed = ((this.adaptionSpeed >= 0.001f) ? this.adaptionSpeed : 0.001f);
this.tonemapMaterial.SetFloat("_AdaptionSpeed", this.adaptionSpeed);
this.rt.MarkRestoreExpected();
Graphics.Blit(renderTexture, this.rt, this.tonemapMaterial, (!flag) ? 2 : 3);
this.middleGrey = ((this.middleGrey >= 0.001f) ? this.middleGrey : 0.001f);
this.tonemapMaterial.SetVector("_HdrParams", new Vector4(this.middleGrey, this.middleGrey, this.middleGrey, this.white * this.white));
this.tonemapMaterial.SetTexture("_SmallTex", this.rt);
if (this.type == Tonemapping.TonemapperType.AdaptiveReinhard)
{
Graphics.Blit(source, destination, this.tonemapMaterial, 0);
}
else if (this.type == Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite)
{
Graphics.Blit(source, destination, this.tonemapMaterial, 10);
}
else
{
Debug.LogError("No valid adaptive tonemapper type found!");
Graphics.Blit(source, destination);
}
for (int l = 0; l < num2; l++)
{
RenderTexture.ReleaseTemporary(array[l]);
}
RenderTexture.ReleaseTemporary(temporary);
}
// Token: 0x0400039C RID: 924
public Tonemapping.TonemapperType type = Tonemapping.TonemapperType.Photographic;
// Token: 0x0400039D RID: 925
public Tonemapping.AdaptiveTexSize adaptiveTextureSize = Tonemapping.AdaptiveTexSize.Square256;
// Token: 0x0400039E RID: 926
public AnimationCurve remapCurve;
// Token: 0x0400039F RID: 927
private Texture2D curveTex;
// Token: 0x040003A0 RID: 928
public float exposureAdjustment = 1.5f;
// Token: 0x040003A1 RID: 929
public float middleGrey = 0.4f;
// Token: 0x040003A2 RID: 930
public float white = 2f;
// Token: 0x040003A3 RID: 931
public float adaptionSpeed = 1.5f;
// Token: 0x040003A4 RID: 932
public Shader tonemapper;
// Token: 0x040003A5 RID: 933
public bool validRenderTextureFormat = true;
// Token: 0x040003A6 RID: 934
private Material tonemapMaterial;
// Token: 0x040003A7 RID: 935
private RenderTexture rt;
// Token: 0x040003A8 RID: 936
private RenderTextureFormat rtFormat = RenderTextureFormat.ARGBHalf;
// Token: 0x02000092 RID: 146
public enum TonemapperType
{
// Token: 0x040003AA RID: 938
SimpleReinhard,
// Token: 0x040003AB RID: 939
UserCurve,
// Token: 0x040003AC RID: 940
Hable,
// Token: 0x040003AD RID: 941
Photographic,
// Token: 0x040003AE RID: 942
OptimizedHejiDawson,
// Token: 0x040003AF RID: 943
AdaptiveReinhard,
// Token: 0x040003B0 RID: 944
AdaptiveReinhardAutoWhite
}
// Token: 0x02000093 RID: 147
public enum AdaptiveTexSize
{
// Token: 0x040003B2 RID: 946
Square16 = 16,
// Token: 0x040003B3 RID: 947
Square32 = 32,
// Token: 0x040003B4 RID: 948
Square64 = 64,
// Token: 0x040003B5 RID: 949
Square128 = 128,
// Token: 0x040003B6 RID: 950
Square256 = 256,
// Token: 0x040003B7 RID: 951
Square512 = 512,
// Token: 0x040003B8 RID: 952
Square1024 = 1024
}
}
}
@@ -0,0 +1,108 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000094 RID: 148
internal class Triangles
{
// Token: 0x0600019F RID: 415 RVA: 0x00012A5C File Offset: 0x00010E5C
private static bool HasMeshes()
{
if (Triangles.meshes == null)
{
return false;
}
for (int i = 0; i < Triangles.meshes.Length; i++)
{
if (null == Triangles.meshes[i])
{
return false;
}
}
return true;
}
// Token: 0x060001A0 RID: 416 RVA: 0x00012AA4 File Offset: 0x00010EA4
private static void Cleanup()
{
if (Triangles.meshes == null)
{
return;
}
for (int i = 0; i < Triangles.meshes.Length; i++)
{
if (null != Triangles.meshes[i])
{
global::UnityEngine.Object.DestroyImmediate(Triangles.meshes[i]);
Triangles.meshes[i] = null;
}
}
Triangles.meshes = null;
}
// Token: 0x060001A1 RID: 417 RVA: 0x00012B00 File Offset: 0x00010F00
private static Mesh[] GetMeshes(int totalWidth, int totalHeight)
{
if (Triangles.HasMeshes() && Triangles.currentTris == totalWidth * totalHeight)
{
return Triangles.meshes;
}
int num = 21666;
int num2 = totalWidth * totalHeight;
Triangles.currentTris = num2;
int num3 = Mathf.CeilToInt(1f * (float)num2 / (1f * (float)num));
Triangles.meshes = new Mesh[num3];
int num4 = 0;
for (int i = 0; i < num2; i += num)
{
int num5 = Mathf.FloorToInt((float)Mathf.Clamp(num2 - i, 0, num));
Triangles.meshes[num4] = Triangles.GetMesh(num5, i, totalWidth, totalHeight);
num4++;
}
return Triangles.meshes;
}
// Token: 0x060001A2 RID: 418 RVA: 0x00012BA4 File Offset: 0x00010FA4
private static Mesh GetMesh(int triCount, int triOffset, int totalWidth, int totalHeight)
{
Mesh mesh = new Mesh();
mesh.hideFlags = HideFlags.DontSave;
Vector3[] array = new Vector3[triCount * 3];
Vector2[] array2 = new Vector2[triCount * 3];
Vector2[] array3 = new Vector2[triCount * 3];
int[] array4 = new int[triCount * 3];
for (int i = 0; i < triCount; i++)
{
int num = i * 3;
int num2 = triOffset + i;
float num3 = Mathf.Floor((float)(num2 % totalWidth)) / (float)totalWidth;
float num4 = Mathf.Floor((float)(num2 / totalWidth)) / (float)totalHeight;
Vector3 vector = new Vector3(num3 * 2f - 1f, num4 * 2f - 1f, 1f);
array[num] = vector;
array[num + 1] = vector;
array[num + 2] = vector;
array2[num] = new Vector2(0f, 0f);
array2[num + 1] = new Vector2(1f, 0f);
array2[num + 2] = new Vector2(0f, 1f);
array3[num] = new Vector2(num3, num4);
array3[num + 1] = new Vector2(num3, num4);
array3[num + 2] = new Vector2(num3, num4);
array4[num] = num;
array4[num + 1] = num + 1;
array4[num + 2] = num + 2;
}
mesh.vertices = array;
mesh.triangles = array4;
mesh.uv = array2;
mesh.uv2 = array3;
return mesh;
}
// Token: 0x040003B9 RID: 953
private static Mesh[] meshes;
// Token: 0x040003BA RID: 954
private static int currentTris;
}
}
@@ -0,0 +1,13 @@
using System;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000053 RID: 83
public enum TweakMode34
{
// Token: 0x040001AD RID: 429
Basic,
// Token: 0x040001AE RID: 430
Complex
}
}
@@ -0,0 +1,27 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000095 RID: 149
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Displacement/Twirl")]
public class Twirl : ImageEffectBase
{
// Token: 0x060001A5 RID: 421 RVA: 0x00012D95 File Offset: 0x00011195
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
ImageEffects.RenderDistortion(base.material, source, destination, this.angle, this.center, this.radius);
}
// Token: 0x040003BB RID: 955
public Vector2 radius = new Vector2(0.3f, 0.3f);
// Token: 0x040003BC RID: 956
[Range(0f, 360f)]
public float angle = 50f;
// Token: 0x040003BD RID: 957
public Vector2 center = new Vector2(0.5f, 0.5f);
}
}
@@ -0,0 +1,132 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000096 RID: 150
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
[AddComponentMenu("Image Effects/Camera/Vignette and Chromatic Aberration")]
public class VignetteAndChromaticAberration : PostEffectsBase
{
// Token: 0x060001A7 RID: 423 RVA: 0x00012E10 File Offset: 0x00011210
public override bool CheckResources()
{
base.CheckSupport(false);
this.m_VignetteMaterial = base.CheckShaderAndCreateMaterial(this.vignetteShader, this.m_VignetteMaterial);
this.m_SeparableBlurMaterial = base.CheckShaderAndCreateMaterial(this.separableBlurShader, this.m_SeparableBlurMaterial);
this.m_ChromAberrationMaterial = base.CheckShaderAndCreateMaterial(this.chromAberrationShader, this.m_ChromAberrationMaterial);
if (!this.isSupported)
{
base.ReportAutoDisable();
}
return this.isSupported;
}
// Token: 0x060001A8 RID: 424 RVA: 0x00012E84 File Offset: 0x00011284
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
if (!this.CheckResources())
{
Graphics.Blit(source, destination);
return;
}
int width = source.width;
int height = source.height;
bool flag = Mathf.Abs(this.blur) > 0f || Mathf.Abs(this.intensity) > 0f;
float num = 1f * (float)width / (1f * (float)height);
RenderTexture renderTexture = null;
RenderTexture renderTexture2 = null;
if (flag)
{
renderTexture = RenderTexture.GetTemporary(width, height, 0, source.format);
if (Mathf.Abs(this.blur) > 0f)
{
renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0, source.format);
Graphics.Blit(source, renderTexture2, this.m_ChromAberrationMaterial, 0);
for (int i = 0; i < 2; i++)
{
this.m_SeparableBlurMaterial.SetVector("offsets", new Vector4(0f, this.blurSpread * 0.001953125f, 0f, 0f));
RenderTexture temporary = RenderTexture.GetTemporary(width / 2, height / 2, 0, source.format);
Graphics.Blit(renderTexture2, temporary, this.m_SeparableBlurMaterial);
RenderTexture.ReleaseTemporary(renderTexture2);
this.m_SeparableBlurMaterial.SetVector("offsets", new Vector4(this.blurSpread * 0.001953125f / num, 0f, 0f, 0f));
renderTexture2 = RenderTexture.GetTemporary(width / 2, height / 2, 0, source.format);
Graphics.Blit(temporary, renderTexture2, this.m_SeparableBlurMaterial);
RenderTexture.ReleaseTemporary(temporary);
}
}
this.m_VignetteMaterial.SetFloat("_Intensity", 1f / (1f - this.intensity) - 1f);
this.m_VignetteMaterial.SetFloat("_Blur", 1f / (1f - this.blur) - 1f);
this.m_VignetteMaterial.SetTexture("_VignetteTex", renderTexture2);
Graphics.Blit(source, renderTexture, this.m_VignetteMaterial, 0);
}
this.m_ChromAberrationMaterial.SetFloat("_ChromaticAberration", this.chromaticAberration);
this.m_ChromAberrationMaterial.SetFloat("_AxialAberration", this.axialAberration);
this.m_ChromAberrationMaterial.SetVector("_BlurDistance", new Vector2(-this.blurDistance, this.blurDistance));
this.m_ChromAberrationMaterial.SetFloat("_Luminance", 1f / Mathf.Max(Mathf.Epsilon, this.luminanceDependency));
if (flag)
{
renderTexture.wrapMode = TextureWrapMode.Clamp;
}
else
{
source.wrapMode = TextureWrapMode.Clamp;
}
Graphics.Blit((!flag) ? source : renderTexture, destination, this.m_ChromAberrationMaterial, (this.mode != VignetteAndChromaticAberration.AberrationMode.Advanced) ? 1 : 2);
RenderTexture.ReleaseTemporary(renderTexture);
RenderTexture.ReleaseTemporary(renderTexture2);
}
// Token: 0x040003BE RID: 958
public VignetteAndChromaticAberration.AberrationMode mode;
// Token: 0x040003BF RID: 959
public float intensity = 0.036f;
// Token: 0x040003C0 RID: 960
public float chromaticAberration = 0.2f;
// Token: 0x040003C1 RID: 961
public float axialAberration = 0.5f;
// Token: 0x040003C2 RID: 962
public float blur;
// Token: 0x040003C3 RID: 963
public float blurSpread = 0.75f;
// Token: 0x040003C4 RID: 964
public float luminanceDependency = 0.25f;
// Token: 0x040003C5 RID: 965
public float blurDistance = 2.5f;
// Token: 0x040003C6 RID: 966
public Shader vignetteShader;
// Token: 0x040003C7 RID: 967
public Shader separableBlurShader;
// Token: 0x040003C8 RID: 968
public Shader chromAberrationShader;
// Token: 0x040003C9 RID: 969
private Material m_VignetteMaterial;
// Token: 0x040003CA RID: 970
private Material m_SeparableBlurMaterial;
// Token: 0x040003CB RID: 971
private Material m_ChromAberrationMaterial;
// Token: 0x02000097 RID: 151
public enum AberrationMode
{
// Token: 0x040003CD RID: 973
Simple,
// Token: 0x040003CE RID: 974
Advanced
}
}
}
@@ -0,0 +1,26 @@
using System;
using UnityEngine;
namespace UnityStandardAssets.ImageEffects
{
// Token: 0x02000098 RID: 152
[ExecuteInEditMode]
[AddComponentMenu("Image Effects/Displacement/Vortex")]
public class Vortex : ImageEffectBase
{
// Token: 0x060001AA RID: 426 RVA: 0x0001318B File Offset: 0x0001158B
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
ImageEffects.RenderDistortion(base.material, source, destination, this.angle, this.center, this.radius);
}
// Token: 0x040003CF RID: 975
public Vector2 radius = new Vector2(0.4f, 0.4f);
// Token: 0x040003D0 RID: 976
public float angle = 50f;
// Token: 0x040003D1 RID: 977
public Vector2 center = new Vector2(0.5f, 0.5f);
}
}
@@ -0,0 +1,9 @@
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]