docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct CustomPassUtils.OverrideCameraRendering

    Overrides the current camera, changing all the matrices and view parameters for the new one. It allows you to render objects from another camera, which can be useful in custom passes for example.

    Implements
    IDisposable
    Inherited Members
    ValueType.Equals(object)
    ValueType.GetHashCode()
    ValueType.ToString()
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: UnityEngine.Rendering.HighDefinition
    Assembly: Unity.RenderPipelines.HighDefinition.Runtime.dll
    Syntax
    public struct CustomPassUtils.OverrideCameraRendering : IDisposable

    Constructors

    OverrideCameraRendering(CustomPassContext, Camera)

    Overrides the current camera, changing all the matrices and view parameters for the new one.

    Declaration
    public OverrideCameraRendering(CustomPassContext ctx, Camera overrideCamera)
    Parameters
    Type Name Description
    CustomPassContext ctx

    The current custom pass context.

    Camera overrideCamera

    The camera that will replace the current one.

    Examples
    using (new CustomPassUtils.OverrideCameraRendering(ctx, overrideCamera))
    {
        ...
    }

    OverrideCameraRendering(CustomPassContext, Camera, float)

    Overrides the current camera, changing all the matrices and view parameters for the new one.

    Declaration
    public OverrideCameraRendering(CustomPassContext ctx, Camera overrideCamera, float overrideAspectRatio)
    Parameters
    Type Name Description
    CustomPassContext ctx

    The current custom pass context.

    Camera overrideCamera

    The camera that will replace the current one.

    float overrideAspectRatio

    The aspect ratio of the override camera. Especially useful when rendering directly into a render texture with a different aspect ratio than the current camera.

    Examples
    CoreUtils.SetRenderTarget(ctx.cmd, renderTexture.colorBuffer, renderTexture.depthBuffer, clearFlag);
    
    float aspectRatio = renderTexture.width / (float)renderTexture.height;
    using (new HDRenderPipeline.OverrideCameraRendering(ctx, overrideCamera, aspectRatio))
    {
        ...
    }

    Implements

    IDisposable
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)