Class PostProcessLayer | Post Processing | 2.3.0
docs.unity3d.com
    Show / Hide Table of Contents

    Class PostProcessLayer

    This is the component responsible for rendering post-processing effects. It must be put on every camera you want post-processing to be applied to.

    Inheritance
    Object
    PostProcessLayer
    Namespace: UnityEngine.Rendering.PostProcessing
    Syntax
    public sealed class PostProcessLayer : MonoBehaviour

    Fields

    antialiasingMode

    The anti-aliasing method to use for this camera. By default it's set to None.

    Declaration
    public PostProcessLayer.Antialiasing antialiasingMode
    Field Value
    Type Description
    PostProcessLayer.Antialiasing

    breakBeforeColorGrading

    If true, it will stop applying post-processing effects just before color grading is applied. This is used internally to export to EXR without color grading.

    Declaration
    public bool breakBeforeColorGrading
    Field Value
    Type Description
    Boolean

    debugLayer

    The debug layer is reponsible for rendering debugging information on the screen. It will only be used if this layer is referenced in a PostProcessDebug component.

    Declaration
    public PostProcessDebugLayer debugLayer
    Field Value
    Type Description
    PostProcessDebugLayer
    See Also
    PostProcessDebug

    fastApproximateAntialiasing

    Fast Approximate Anti-aliasing settings for this camera.

    Declaration
    public FastApproximateAntialiasing fastApproximateAntialiasing
    Field Value
    Type Description
    FastApproximateAntialiasing

    finalBlitToCameraTarget

    If true, it will render straight to the backbuffer and save the final blit done by the engine. This has less overhead and will improve performance on lower-end platforms (like mobiles) but breaks compatibility with legacy image effect that use OnRenderImage.

    Declaration
    public bool finalBlitToCameraTarget
    Field Value
    Type Description
    Boolean

    fog

    Fog settings for this camera.

    Declaration
    public Fog fog
    Field Value
    Type Description
    Fog

    stopNaNPropagation

    If true, it will kill any invalid / NaN pixel and replace it with a black color before post-processing is applied. It's generally a good idea to keep this enabled to avoid post-processing artifacts cause by broken data in the scene.

    Declaration
    public bool stopNaNPropagation
    Field Value
    Type Description
    Boolean

    subpixelMorphologicalAntialiasing

    Subpixel Morphological Anti-aliasing settings for this camera.

    Declaration
    public SubpixelMorphologicalAntialiasing subpixelMorphologicalAntialiasing
    Field Value
    Type Description
    SubpixelMorphologicalAntialiasing

    temporalAntialiasing

    Temporal Anti-aliasing settings for this camera.

    Declaration
    public TemporalAntialiasing temporalAntialiasing
    Field Value
    Type Description
    TemporalAntialiasing

    volumeLayer

    A mask of layers to consider for volume blending. It allows you to do volume filtering and is especially useful to optimize volume traversal. You should always have your volumes in dedicated layers instead of the default one for best performances.

    Declaration
    public LayerMask volumeLayer
    Field Value
    Type Description
    LayerMask

    volumeTrigger

    This is transform that will be drive the volume blending feature. In some cases you may want to use a transform other than the camera, e.g. for a top down game you'll want the player character to drive the blending instead of the actual camera transform. Setting this field to null will disable local volumes for this layer (global ones will still work).

    Declaration
    public Transform volumeTrigger
    Field Value
    Type Description
    Transform

    Properties

    cameraDepthFlags

    The current flags set on the camera for the built-in render pipeline.

    Declaration
    public DepthTextureMode cameraDepthFlags { get; }
    Property Value
    Type Description
    DepthTextureMode

    haveBundlesBeenInited

    Returns true if the bundles have been initialized properly.

    Declaration
    public bool haveBundlesBeenInited { get; }
    Property Value
    Type Description
    Boolean

    sortedBundles

    Pre-ordered effects mapped to available injection points.

    Declaration
    public Dictionary<PostProcessEvent, List<PostProcessLayer.SerializedBundleRef>> sortedBundles { get; }
    Property Value
    Type Description
    Dictionary<PostProcessEvent, List<PostProcessLayer.SerializedBundleRef>>

    Methods

    BakeMSVOMap(CommandBuffer, Camera, RenderTargetIdentifier, Nullable<RenderTargetIdentifier>, Boolean, Boolean)

    Utility method to bake a multi-scale volumetric obscurance map for the current camera. This will only work if ambient occlusion is active in the scene.

    Declaration
    public void BakeMSVOMap(CommandBuffer cmd, Camera camera, RenderTargetIdentifier destination, RenderTargetIdentifier? depthMap, bool invert, bool isMSAA = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    The command buffer to use for rendering steps

    Camera camera

    The camera to render ambient occlusion for

    RenderTargetIdentifier destination

    The destination render target

    Nullable<RenderTargetIdentifier> depthMap

    The depth map to use. If null, it will use the depth map from the given camera

    Boolean invert

    Should the result be inverted?

    Boolean isMSAA

    Should use MSAA?

    GetBundle(Type)

    Grabs the bundle for the given effect type.

    Declaration
    public PostProcessBundle GetBundle(Type settingsType)
    Parameters
    Type Name Description
    Type settingsType

    An effect type.

    Returns
    Type Description
    PostProcessBundle

    The bundle for the effect of type

    GetBundle<T>()

    Grabs the bundle for the given effect type.

    Declaration
    public PostProcessBundle GetBundle<T>()
        where T : PostProcessEffectSettings
    Returns
    Type Description
    PostProcessBundle

    The bundle for the effect of type

    Type Parameters
    Name Description
    T

    An effect type.

    GetSettings<T>()

    Gets the current settings for a given effect.

    Declaration
    public T GetSettings<T>()
        where T : PostProcessEffectSettings
    Returns
    Type Description
    T

    The current state of an effect

    Type Parameters
    Name Description
    T

    The type of effect to look for

    HasActiveEffects(PostProcessEvent, PostProcessRenderContext)

    Checks if this layer has any active effect at the given injection point.

    Declaration
    public bool HasActiveEffects(PostProcessEvent evt, PostProcessRenderContext context)
    Parameters
    Type Name Description
    PostProcessEvent evt

    The injection point to look for

    PostProcessRenderContext context

    The current render context

    Returns
    Type Description
    Boolean

    true if any effect at the given injection point is active, false otherwise

    HasOpaqueOnlyEffects(PostProcessRenderContext)

    Checks if this layer has any active opaque-only effect.

    Declaration
    public bool HasOpaqueOnlyEffects(PostProcessRenderContext context)
    Parameters
    Type Name Description
    PostProcessRenderContext context

    The current render context

    Returns
    Type Description
    Boolean

    true if opaque-only effects are active, false otherwise

    Init(PostProcessResources)

    Initializes this layer. If you create the layer via scripting you should always call this method.

    Declaration
    public void Init(PostProcessResources resources)
    Parameters
    Type Name Description
    PostProcessResources resources

    A reference to the resource asset

    InitBundles()

    Initializes all the effect bundles. This is called automatically by the framework.

    Declaration
    public void InitBundles()

    Render(PostProcessRenderContext)

    Renders all effects not in the BeforeTransparent bucket.

    Declaration
    public void Render(PostProcessRenderContext context)
    Parameters
    Type Name Description
    PostProcessRenderContext context

    The current post-processing context.

    RenderOpaqueOnly(PostProcessRenderContext)

    Renders effects in the BeforeTransparent bucket. You should call HasOpaqueOnlyEffects(PostProcessRenderContext) before calling this method as it won't automatically blit source into destination if no opaque-only effect is active.

    Declaration
    public void RenderOpaqueOnly(PostProcessRenderContext context)
    Parameters
    Type Name Description
    PostProcessRenderContext context

    The current post-processing context.

    ResetHistory()

    This method should be called whenever you need to reset any temporal effect, e.g. when doing camera cuts.

    Declaration
    public void ResetHistory()

    UpdateVolumeSystem(Camera, CommandBuffer)

    Updates the state of the volume system. This should be called before any other post-processing method when running in a scriptable render pipeline. You don't need to call this method when running in one of the builtin pipelines.

    Declaration
    public void UpdateVolumeSystem(Camera cam, CommandBuffer cmd)
    Parameters
    Type Name Description
    Camera cam

    The currently rendering camera.

    CommandBuffer cmd

    A command buffer to fill.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023