using System; namespace UnityEngine.Rendering.PostProcessing { /// /// This asset is used to store references to shaders and other resources we might need at /// runtime without having to use a `Resources` folder. This allows for better memory management, /// better dependency tracking and better interoperability with asset bundles. /// public sealed class PostProcessResources : ScriptableObject { /// /// All the shaders used by post-processing. /// [Serializable] public sealed class Shaders { /// /// The shader used for the bloom effect. /// public Shader bloom; /// /// The shader used for internal blit copies. /// public Shader copy; /// /// The shader used for built-in blit copies in the built-in pipeline. /// public Shader copyStd; /// /// The shader used for built-in blit copies in the built-in pipeline when using a /// texture array (for stereo rendering). /// public Shader copyStdFromTexArray; /// /// The shader used for built-in blit copies in the built-in pipeline when using a /// double-wide texture (for stereo rendering). /// public Shader copyStdFromDoubleWide; /// /// The shader used to kill the alpha. /// public Shader discardAlpha; /// /// The shader used for the depth of field effect. /// public Shader depthOfField; /// /// The shader used for the final pass. /// public Shader finalPass; /// /// The shader used to generate the grain texture. /// public Shader grainBaker; /// /// The shader used for the motion blur effect. /// public Shader motionBlur; /// /// The shader used for the temporal anti-aliasing effect. /// public Shader temporalAntialiasing; /// /// The shader used for the sub-pixel morphological anti-aliasing effect. /// public Shader subpixelMorphologicalAntialiasing; /// /// The shader use by the volume manager to interpolate between two 2D textures. /// public Shader texture2dLerp; /// /// The uber shader that combine several effects into one. /// public Shader uber; /// /// The shader used to bake the 2D lookup table for color grading. /// public Shader lut2DBaker; /// /// The shader used to draw the light meter monitor. /// public Shader lightMeter; /// /// The shader used to draw the histogram monitor. /// public Shader gammaHistogram; /// /// The shader used to draw the waveform monitor. /// public Shader waveform; /// /// The shader used to draw the vectorscope monitor. /// public Shader vectorscope; /// /// The shader used to draw debug overlays. /// public Shader debugOverlays; /// /// The shader used for the deferred fog effect. /// public Shader deferredFog; /// /// The shader used for the scalable ambient occlusion effect. /// public Shader scalableAO; /// /// The shader used for the multi-scale ambient occlusion effect. /// public Shader multiScaleAO; /// /// The shader used for the screen-space reflection effect. /// public Shader screenSpaceReflections; /// /// Returns a copy of this class and its content. /// /// A copy of this class and its content. public Shaders Clone() { return (Shaders)MemberwiseClone(); } } /// /// All the compute shaders used by post-processing. /// [Serializable] public sealed class ComputeShaders { /// /// The compute shader used for the auto-exposure effect. /// public ComputeShader autoExposure; /// /// The compute shader used to compute an histogram of the current frame. /// public ComputeShader exposureHistogram; /// /// The compute shader used to bake the 3D lookup table for color grading. /// public ComputeShader lut3DBaker; /// /// The compute shader used by the volume manager to interpolate between two 3D textures. /// public ComputeShader texture3dLerp; /// /// The compute shader used to compute the histogram monitor. /// public ComputeShader gammaHistogram; /// /// The compute shader used to compute the waveform monitor. /// public ComputeShader waveform; /// /// The compute shader used to compute the vectorscope monitor. /// public ComputeShader vectorscope; /// /// The compute shader used for the first downsampling pass of MSVO. /// public ComputeShader multiScaleAODownsample1; /// /// The compute shader used for the second downsampling pass of MSVO. /// public ComputeShader multiScaleAODownsample2; /// /// The compute shader used for the render pass of MSVO. /// public ComputeShader multiScaleAORender; /// /// The compute shader used for the upsampling pass of MSVO. /// public ComputeShader multiScaleAOUpsample; /// /// The compute shader used to a fast gaussian downsample. /// public ComputeShader gaussianDownsample; /// /// Returns a copy of this class and its content. /// /// A copy of this class and its content. public ComputeShaders Clone() { return (ComputeShaders)MemberwiseClone(); } } /// /// A set of textures needed by the sub-pixel morphological anti-aliasing effect. /// [Serializable] public sealed class SMAALuts { /// /// The area lookup table. /// public Texture2D area; /// /// The search lookup table. /// public Texture2D search; } /// /// A set of 64x64, single-channel blue noise textures. /// public Texture2D[] blueNoise64; /// /// A set of 256x256, single-channel blue noise textures. /// public Texture2D[] blueNoise256; /// /// Lookup tables used by the sub-pixel morphological anti-aliasing effect. /// public SMAALuts smaaLuts; /// /// All the shaders used by post-processing. /// public Shaders shaders; /// /// All the compute shaders used by post-processing. /// public ComputeShaders computeShaders; #if UNITY_EDITOR /// /// A delegate used to track resource changes. /// public delegate void ChangeHandler(); /// /// Set this callback to be notified of resource changes. /// public ChangeHandler changeHandler; void OnValidate() { if (changeHandler != null) changeHandler(); } #endif } }