docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class HDUtils

    Various utility functions for HDRP.

    Inheritance
    object
    HDUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering.HighDefinition
    Assembly: Unity.RenderPipelines.HighDefinition.Runtime.dll
    Syntax
    public class HDUtils

    Properties

    clearTexture3D

    Default 1x1x1 3D texture initialized with Color.clear.

    Declaration
    public static Texture3D clearTexture3D { get; }
    Property Value
    Type Description
    Texture3D

    clearTexture3DRTH

    Default 1x1x1 3D RTHandle initialized with Color.clear.

    Declaration
    public static RTHandle clearTexture3DRTH { get; }
    Property Value
    Type Description
    RTHandle

    hdrpSettings

    Current HDRP settings.

    Declaration
    public static RenderPipelineSettings hdrpSettings { get; }
    Property Value
    Type Description
    RenderPipelineSettings

    Methods

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, float, bool)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport.

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, float mipLevel = 0, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    float mipLevel

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, Material, int)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport. This overloads allows the user to override the default blit shader

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, Material material, int pass)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Material material

    The material to use when blitting

    int pass

    pass to use of the provided material

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, Rect, float, bool)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport. This overload allows user to override the viewport of the destination RTHandle.

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, Rect destViewport, float mipLevel = 0, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Rect destViewport

    Viewport of the destination RTHandle.

    float mipLevel

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, Vector4, float, bool)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport. This overload allows user to override the scale and bias used when sampling the input RTHandle.

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, Vector4 scaleBias, float mipLevel = 0, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Vector4 scaleBias

    Scale and bias used to sample the input RTHandle.

    float mipLevel

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    BlitCameraTexture2D(CommandBuffer, RTHandle, RTHandle, float, bool)

    Blit a RThandle Texture2D RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport.

    Declaration
    public static void BlitCameraTexture2D(CommandBuffer cmd, RTHandle source, RTHandle destination, float mipLevel = 0, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    float mipLevel

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    BlitOctahedralWithPadding(CommandBuffer, Texture, Vector2, Vector4, Vector4, int, bool, int)

    Blit a texture (which is a Octahedral projection) using a quad in the current render target.

    Declaration
    public static void BlitOctahedralWithPadding(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    int mipLevelTex

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    int paddingInPixels

    Padding in pixels.

    BlitOctahedralWithPaddingMultiply(CommandBuffer, Texture, Vector2, Vector4, Vector4, int, bool, int)

    Blit a texture (which is a Octahedral projection) using a quad in the current render target, by performing an alpha blend with the existing content on the render target.

    Declaration
    public static void BlitOctahedralWithPaddingMultiply(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    int mipLevelTex

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    int paddingInPixels

    Padding in pixels.

    BlitQuad(CommandBuffer, Texture, Vector4, Vector4, int, bool)

    Blit a texture using a quad in the current render target.

    Declaration
    public static void BlitQuad(CommandBuffer cmd, Texture source, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector4 scaleBiasTex

    Scale and bias for the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    int mipLevelTex

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    BlitQuadWithPadding(CommandBuffer, Texture, Vector2, Vector4, Vector4, int, bool, int)

    Blit a texture using a quad in the current render target.

    Declaration
    public static void BlitQuadWithPadding(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    int mipLevelTex

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    int paddingInPixels

    Padding in pixels.

    BlitQuadWithPaddingMultiply(CommandBuffer, Texture, Vector2, Vector4, Vector4, int, bool, int)

    Blit a texture using a quad in the current render target, by performing an alpha blend with the existing content on the render target.

    Declaration
    public static void BlitQuadWithPaddingMultiply(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    int mipLevelTex

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    int paddingInPixels

    Padding in pixels.

    BlitTexture(CommandBuffer, RTHandle, Vector4, float, bool)

    Blit a RTHandle texture.

    Declaration
    public static void BlitTexture(CommandBuffer cmd, RTHandle source, Vector4 scaleBias, float mipLevel, bool bilinear)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    Vector4 scaleBias

    Scale and bias for sampling the input texture.

    float mipLevel

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    BlitTexture2D(CommandBuffer, RTHandle, Vector4, float, bool)

    Blit a RTHandle texture 2D.

    Declaration
    public static void BlitTexture2D(CommandBuffer cmd, RTHandle source, Vector4 scaleBias, float mipLevel, bool bilinear)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    Vector4 scaleBias

    Scale and bias for sampling the input texture.

    float mipLevel

    Mip level to blit.

    bool bilinear

    Enable bilinear filtering.

    DrawFullScreen(CommandBuffer, Material, RTHandle, MaterialPropertyBlock, int)

    Draw a full screen triangle with a material. This will automatically set the viewport of the destination RTHandle based on the current camera parameters.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RTHandle colorBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    Command Buffer used for rendering.

    Material material

    Material used for rendering.

    RTHandle colorBuffer

    Destination RTHandle.

    MaterialPropertyBlock properties

    Optional material property block.

    int shaderPassId

    Optional pass index to use.

    DrawFullScreen(CommandBuffer, Material, RTHandle, RTHandle, MaterialPropertyBlock, int)

    Draw a full screen triangle with a material. This will automatically set the viewport of the destination RTHandle based on the current camera parameters.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RTHandle colorBuffer, RTHandle depthStencilBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    Command Buffer used for rendering.

    Material material

    Material used for rendering.

    RTHandle colorBuffer

    Destination RTHandle.

    RTHandle depthStencilBuffer

    Destination Depth Stencil RTHandle.

    MaterialPropertyBlock properties

    Optional material property block.

    int shaderPassId

    Optional pass index to use.

    DrawFullScreen(CommandBuffer, Material, RenderTargetIdentifier[], RTHandle, MaterialPropertyBlock, int)

    Draw a full screen triangle with a material. This will automatically set the viewport of the destination RTHandle based on the current camera parameters.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Material material, RenderTargetIdentifier[] colorBuffers, RTHandle depthStencilBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    Command Buffer used for rendering.

    Material material

    Material used for rendering.

    RenderTargetIdentifier[] colorBuffers

    Array of RenderTargetIdentifier for multiple render target rendering.

    RTHandle depthStencilBuffer

    Destination Depth Stencil RTHandle.

    MaterialPropertyBlock properties

    Optional material property block.

    int shaderPassId

    Optional pass index to use.

    DrawFullScreen(CommandBuffer, Rect, Material, RenderTargetIdentifier, CubemapFace, MaterialPropertyBlock, int, int)

    Draw a full screen triangle with a material. This will render into the destination texture with the specified viewport.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Rect viewport, Material material, RenderTargetIdentifier destination, CubemapFace cubemapFace, MaterialPropertyBlock properties = null, int shaderPassId = 0, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    Command Buffer used for rendering.

    Rect viewport

    Destination viewport.

    Material material

    Material used for rendering.

    RenderTargetIdentifier destination

    Destination RenderTargetIdentifier.

    CubemapFace cubemapFace

    Optional cubemap face to render to.

    MaterialPropertyBlock properties

    Optional Material Property block.

    int shaderPassId

    Optional pass index to use.

    int depthSlice

    Optional depth slice to render to.

    DrawFullScreen(CommandBuffer, Rect, Material, RenderTargetIdentifier, MaterialPropertyBlock, int, int)

    Draw a full screen triangle with a material. This will render into the destination texture with the specified viewport.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Rect viewport, Material material, RenderTargetIdentifier destination, MaterialPropertyBlock properties = null, int shaderPassId = 0, int depthSlice = -1)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    Command Buffer used for rendering.

    Rect viewport

    Destination viewport.

    Material material

    Material used for rendering.

    RenderTargetIdentifier destination

    Destination RenderTargetIdentifier.

    MaterialPropertyBlock properties

    Optional Material Property block.

    int shaderPassId

    Optional pass index to use.

    int depthSlice

    Optional depth slice to render to.

    DrawFullScreen(CommandBuffer, Rect, Material, RenderTargetIdentifier, RTHandle, MaterialPropertyBlock, int)

    Draw a full screen triangle with a material. This will render into the destination texture with the specified viewport.

    Declaration
    public static void DrawFullScreen(CommandBuffer commandBuffer, Rect viewport, Material material, RenderTargetIdentifier destination, RTHandle depthStencilBuffer, MaterialPropertyBlock properties = null, int shaderPassId = 0)
    Parameters
    Type Name Description
    CommandBuffer commandBuffer

    Command Buffer used for rendering.

    Rect viewport

    Destination viewport.

    Material material

    Material used for rendering.

    RenderTargetIdentifier destination

    Destination RenderTargetIdentifier.

    RTHandle depthStencilBuffer

    Destination Depth Stencil RTHandle.

    MaterialPropertyBlock properties

    Optional Material Property block.

    int shaderPassId

    Optional pass index to use.

    DrawRendererList(ScriptableRenderContext, CommandBuffer, RendererList)

    Draw a renderer list.

    Declaration
    [Obsolete("Please use CoreUtils.DrawRendererList instead.")]
    public static void DrawRendererList(ScriptableRenderContext renderContext, CommandBuffer cmd, RendererList rendererList)
    Parameters
    Type Name Description
    ScriptableRenderContext renderContext

    Current Scriptable Render Context.

    CommandBuffer cmd

    Command Buffer used for rendering.

    RendererList rendererList

    Renderer List to render.

    GetBakedLightingRenderConfig()

    Returns the render configuration for baked static lighting, this value can be used in a RendererListDesc call to render Lit objects.

    Declaration
    [Obsolete("Use GetRendererConfiguration() instead. #from(23.2).")]
    public static PerObjectData GetBakedLightingRenderConfig()
    Returns
    Type Description
    PerObjectData

    GetBakedLightingWithShadowMaskRenderConfig()

    Returns the render configuration for baked static lighting with shadow masks, this value can be used in a RendererListDesc call to render Lit objects when shadow masks are enabled.

    Declaration
    [Obsolete("Use GetRendererConfiguration() instead. #from(23.2).")]
    public static PerObjectData GetBakedLightingWithShadowMaskRenderConfig()
    Returns
    Type Description
    PerObjectData

    GetBlitMaterial(TextureDimension, bool)

    Returns the HDRP default blit material.

    Declaration
    public static Material GetBlitMaterial(TextureDimension dimension, bool singleSlice = false)
    Parameters
    Type Name Description
    TextureDimension dimension

    Dimension of the texture to blit, either 2D or 2D Array.

    bool singleSlice

    Blit only a single slice of the array if applicable.

    Returns
    Type Description
    Material

    GetRendererConfiguration(bool, bool)

    Returns the render configuration that should be used in a RendererListDesc call to render Lit objects.

    Declaration
    public static PerObjectData GetRendererConfiguration(bool apv, bool shadowMask)
    Parameters
    Type Name Description
    bool apv

    True if APV is enabled

    bool shadowMask

    True if shadow mask is enabled

    Returns
    Type Description
    PerObjectData

    Returns the render configuration that should be used in a RendererListDesc call to render Lit objects.

    NormalizeColor(Color)

    Normalize the input color.

    Declaration
    public static Color NormalizeColor(Color color)
    Parameters
    Type Name Description
    Color color

    Input color.

    Returns
    Type Description
    Color

    Normalized color.

    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)