docs.unity.cn
    Show / Hide Table of Contents

    Class XRPass

    XRPass holds the render target information and a list of XRView. XRView contains the parameters required to render (projection and view matrices, viewport, etc) When a pass has 2 views or more, single-pass will be active if the platform supports it. To avoid allocating every frame, XRView is a struct and XRPass is pooled.

    Inheritance
    Object
    XRPass
    Namespace: UnityEngine.Experimental.Rendering
    Syntax
    public class XRPass

    Constructors

    XRPass()

    Parameterless constructor. Note: in order to avoid GC, the render pipeline should use XRPass.Create instead of this method.

    Declaration
    public XRPass()

    Properties

    copyDepth

    If true, the render pipeline is expected to output a valid depth buffer to the renderTarget.

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

    cullingParams

    Parameters used for culling.

    Declaration
    public ScriptableCullingParameters cullingParams { get; }
    Property Value
    Type Description
    UnityEngine.Rendering.ScriptableCullingParameters

    cullingPassId

    Index used for culling. It can be shared between multiple passes.

    Declaration
    public int cullingPassId { get; }
    Property Value
    Type Description
    Int32

    enabled

    Returns true if the pass contains at least one view.

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

    foveatedRenderingInfo

    Native pointer from the XR plugin to be consumed by ConfigureFoveatedRendering.

    Declaration
    public IntPtr foveatedRenderingInfo { get; }
    Property Value
    Type Description
    IntPtr

    hasValidOcclusionMesh

    Returns true if the pass was setup with expected mesh and material.

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

    multipassId

    Index of the pass inside the frame.

    Declaration
    public int multipassId { get; }
    Property Value
    Type Description
    Int32

    renderTarget

    Destination render target.

    Declaration
    public RenderTargetIdentifier renderTarget { get; }
    Property Value
    Type Description
    UnityEngine.Rendering.RenderTargetIdentifier

    renderTargetDesc

    Destination render target descriptor.

    Declaration
    public RenderTextureDescriptor renderTargetDesc { get; }
    Property Value
    Type Description
    UnityEngine.RenderTextureDescriptor

    singlePassEnabled

    If true, the render pipeline is expected to use single-pass techniques to save CPU time.

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

    supportsFoveatedRendering

    Returns true if the pass can use foveated rendering commands.

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

    viewCount

    Returns the number of views inside this pass.

    Declaration
    public int viewCount { get; }
    Property Value
    Type Description
    Int32

    Methods

    ApplyXRViewCenterOffset(Vector2)

    Take a point that is center-relative (0.5, 0.5) and modify it to be placed relative to the view's center instead, respecting the asymmetric FOV (if it is used)

    Declaration
    public Vector4 ApplyXRViewCenterOffset(Vector2 center)
    Parameters
    Type Name Description
    UnityEngine.Vector2 center
    Returns
    Type Description
    UnityEngine.Vector4

    CreateDefault(XRPassCreateInfo)

    Default allocator method for XRPass.

    Declaration
    public static XRPass CreateDefault(XRPassCreateInfo createInfo)
    Parameters
    Type Name Description
    XRPassCreateInfo createInfo
    Returns
    Type Description
    XRPass

    GetOcclusionMesh(Int32)

    Returns the occlusion mesh for a given view.

    Declaration
    public Mesh GetOcclusionMesh(int viewIndex = 0)
    Parameters
    Type Name Description
    Int32 viewIndex
    Returns
    Type Description
    UnityEngine.Mesh

    GetProjMatrix(Int32)

    Returns the projection matrix for a given view.

    Declaration
    public Matrix4x4 GetProjMatrix(int viewIndex = 0)
    Parameters
    Type Name Description
    Int32 viewIndex
    Returns
    Type Description
    UnityEngine.Matrix4x4

    GetTextureArraySlice(Int32)

    Returns the destination slice index (for texture array) for a given view.

    Declaration
    public int GetTextureArraySlice(int viewIndex = 0)
    Parameters
    Type Name Description
    Int32 viewIndex
    Returns
    Type Description
    Int32

    GetViewMatrix(Int32)

    Returns the view matrix for a given view.

    Declaration
    public Matrix4x4 GetViewMatrix(int viewIndex = 0)
    Parameters
    Type Name Description
    Int32 viewIndex
    Returns
    Type Description
    UnityEngine.Matrix4x4

    GetViewport(Int32)

    Returns the viewport for a given view.

    Declaration
    public Rect GetViewport(int viewIndex = 0)
    Parameters
    Type Name Description
    Int32 viewIndex
    Returns
    Type Description
    UnityEngine.Rect

    InitBase(XRPassCreateInfo)

    Initialize the base class fields.

    Declaration
    public void InitBase(XRPassCreateInfo createInfo)
    Parameters
    Type Name Description
    XRPassCreateInfo createInfo

    Release()

    Default release method. Can be overridden by render pipelines.

    Declaration
    public virtual void Release()

    RenderOcclusionMesh(CommandBuffer)

    Generate commands to render the occlusion mesh for this pass. In single-pass mode : the meshes for all views are combined into one mesh, where the corresponding view index is encoded into each vertex. The keyword "XR_OCCLUSION_MESH_COMBINED" is also enabled when rendering the combined mesh.

    Declaration
    public void RenderOcclusionMesh(CommandBuffer cmd)
    Parameters
    Type Name Description
    UnityEngine.Rendering.CommandBuffer cmd

    StartSinglePass(CommandBuffer)

    Queue up render commands to enable single-pass techniques. Note: depending on the platform and settings, either single-pass instancing or the multiview extension will be used.

    Declaration
    public void StartSinglePass(CommandBuffer cmd)
    Parameters
    Type Name Description
    UnityEngine.Rendering.CommandBuffer cmd

    StopSinglePass(CommandBuffer)

    Queue up render commands to disable single-pass techniques.

    Declaration
    public void StopSinglePass(CommandBuffer cmd)
    Parameters
    Type Name Description
    UnityEngine.Rendering.CommandBuffer cmd

    Extension Methods

    AnalyticsUtils.ToNestedColumn<T>(T, Boolean)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, Boolean)
    ReflectionUtils.Invoke(Object, String, Object[])
    ReflectionUtils.SetField(Object, String, Object)
    ReflectionUtils.GetField(Object, String)
    ReflectionUtils.GetFields(Object)
    Back to top Copyright © 2023 Unity Technologies — Terms of use
    Generated by DocFX
    on 17 July 2023