docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class HDRenderUtilities

    Various utilities to perform rendering with HDRP

    Inheritance
    object
    HDRenderUtilities
    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 static class HDRenderUtilities

    Methods

    ComputeCameraSettingsFromProbeSettings(ProbeSettings, ProbeCapturePositionSettings, out CameraSettings, out CameraPositionSettings, ulong, float, float)

    Compute the camera settings from the probe settings

    Declaration
    public static void ComputeCameraSettingsFromProbeSettings(ProbeSettings settings, ProbeCapturePositionSettings position, out CameraSettings cameraSettings, out CameraPositionSettings cameraPositionSettings, ulong overrideSceneCullingMask, float referenceFieldOfView = 90, float referenceAspect = 1)
    Parameters
    Type Name Description
    ProbeSettings settings

    The probe settings.

    ProbeCapturePositionSettings position

    The probe position.

    CameraSettings cameraSettings

    The produced camera settings.

    CameraPositionSettings cameraPositionSettings

    The produced camera position.

    ulong overrideSceneCullingMask

    Override of the scene culling mask.

    float referenceFieldOfView

    The reference field of view.

    float referenceAspect

    The reference aspect ratio.

    CreatePlanarProbeDepthRenderTarget(int)

    Create the depth texture used as target for a realtime planar reflection probe.

    Declaration
    public static RenderTexture CreatePlanarProbeDepthRenderTarget(int planarSize)
    Parameters
    Type Name Description
    int planarSize

    The size of the texture

    Returns
    Type Description
    RenderTexture

    The texture used as planar reflection probe target

    CreatePlanarProbeRenderTarget(int, GraphicsFormat)

    Create the texture used as target for a realtime planar reflection probe.

    Declaration
    public static RenderTexture CreatePlanarProbeRenderTarget(int planarSize, GraphicsFormat format)
    Parameters
    Type Name Description
    int planarSize

    The size of the texture

    GraphicsFormat format

    The planar probe format. It must match the format set in the asset.

    Returns
    Type Description
    RenderTexture

    The texture used as planar reflection probe target

    CreateReflectionProbeRenderTarget(int)

    Create the texture used as target for a realtime reflection probe.

    Declaration
    [Obsolete("Use CreateReflectionProbeRenderTarget with explicit format instead #from(2021.1) #breakingFrom(2021.1)", true)]
    public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize)
    Parameters
    Type Name Description
    int cubemapSize

    The cubemap size.

    Returns
    Type Description
    RenderTexture

    The texture to use as reflection probe target.

    CreateReflectionProbeRenderTarget(int, GraphicsFormat)

    Create the texture used as target for a realtime reflection probe.

    Declaration
    public static RenderTexture CreateReflectionProbeRenderTarget(int cubemapSize, GraphicsFormat format)
    Parameters
    Type Name Description
    int cubemapSize

    The cubemap size.

    GraphicsFormat format

    The cubemap format. It must match the format set in the asset.

    Returns
    Type Description
    RenderTexture

    The texture to use as reflection probe target.

    CreateReflectionProbeTarget(int)

    Create the texture target for a baked reflection probe.

    Declaration
    public static Cubemap CreateReflectionProbeTarget(int cubemapSize)
    Parameters
    Type Name Description
    int cubemapSize

    The size of the cubemap.

    Returns
    Type Description
    Cubemap

    The target cubemap.

    GenerateRenderingSettingsFor(ProbeSettings, ProbeCapturePositionSettings, List<CameraSettings>, List<CameraPositionSettings>, List<CubemapFace>, ulong, ProbeRenderSteps, bool, float, float)

    Generate the camera render settings and camera position to use to render a probe.

    Declaration
    public static void GenerateRenderingSettingsFor(ProbeSettings settings, ProbeCapturePositionSettings position, List<CameraSettings> cameras, List<CameraPositionSettings> cameraPositions, List<CubemapFace> cameraCubeFaces, ulong overrideSceneCullingMask, ProbeRenderSteps renderSteps, bool forceFlipY = false, float referenceFieldOfView = 90, float referenceAspect = 1)
    Parameters
    Type Name Description
    ProbeSettings settings

    The probe settings to use.

    ProbeCapturePositionSettings position

    The probe position to use.

    List<CameraSettings> cameras

    Will receives the camera settings.

    List<CameraPositionSettings> cameraPositions

    Will receives the camera position settings.

    List<CubemapFace> cameraCubeFaces

    Will receive the camera cube face settings.

    ulong overrideSceneCullingMask

    Override of the scene culling mask.

    ProbeRenderSteps renderSteps

    The rendering steps to perform for this probe.

    bool forceFlipY

    Whether to force the Y axis flipping.

    float referenceFieldOfView

    The reference field of view.

    float referenceAspect

    The reference aspect ratio.

    Render(CameraSettings, CameraPositionSettings, Texture, uint)

    Perform a rendering into target.

    Declaration
    public static void Render(CameraSettings settings, CameraPositionSettings position, Texture target, uint staticFlags = 0)
    Parameters
    Type Name Description
    CameraSettings settings

    Settings for the camera.

    CameraPositionSettings position

    Position for the camera.

    Texture target

    Target to render to.

    uint staticFlags

    Only used in the Editor for cubemaps. This is a bitmask of UnityEditor.StaticEditorFlags, only objects with these flags are rendered.

    Examples

    How to perform rendering into a 2D render target:

    using UnityEngine;
    using UnityEngine.Rendering;
    using UnityEngine.Rendering.HighDefinition;
    using UnityEngine.Experimental.Rendering;
    
    class StandardRenderingExample
    {
       public void Render()
       {
           // Copy default settings and adjust them for the custom rendering.
           var cameraSettings = CameraSettings.defaultCameraSettingsNonAlloc;
           cameraSettings.frustum.fieldOfView = 60.0f;
           var cameraPosition = CameraPositionSettings.NewDefault();
           cameraPosition.position = new Vector3(0, 1, 0);
    
           // Create the 2D render target
           var rt = new RenderTexture(128, 128, 1, GraphicsFormat.B8G8R8A8_UNorm);
    
           // Perform the custom rendering into the render target
           HDRenderUtilities.Render(cameraSettings, cameraPosition, rt);
    
           // Implement the custom render target processing.
    
           // Release the render target when the processing is done, RenderTexture variables are not garbage collected like normal managed types.
           rt.Release();
       }
    }

    How to perform a cubemap rendering:

    using UnityEngine;
    using UnityEngine.Rendering;
    using UnityEngine.Rendering.HighDefinition;
    using UnityEngine.Experimental.Rendering;
    
    class CubemapRenderExample
    {
       public void Render()
       {
           // Copy the default settings and adjust them for the custom rendering.
           // Frustum settings from cameraSettings are ignored because the render target is a cubemap.
           var cameraSettings = CameraSettings.defaultCameraSettingsNonAlloc;
           var cameraPosition = CameraPositionSettings.NewDefault();
           cameraPosition.position = new Vector3(0, 1, 0);
    
           // Create the cubemap render target
           var rt = new RenderTexture(128, 128, 1, GraphicsFormat.B8G8R8A8_UNorm)
           {
               dimension = TextureDimension.Cube
           };
    
           // Perform the custom rendering into the cubemap
           HDRenderUtilities.Render(cameraSettings, cameraPosition, rt);
    
           // Implement the custom render target processing.
    
           // Release the render target when the processing is done, RenderTexture variables are not garbage collected like normal managed types.
           rt.Release();
       }
    }

    Render(ProbeSettings, ProbeCapturePositionSettings, Texture, bool, bool, uint, float, float)

    Performs a rendering of a probe.

    Declaration
    public static void Render(ProbeSettings settings, ProbeCapturePositionSettings position, Texture target, bool forceFlipY = false, bool forceInvertBackfaceCulling = false, uint staticFlags = 0, float referenceFieldOfView = 90, float referenceAspect = 1)
    Parameters
    Type Name Description
    ProbeSettings settings

    The probe settings to use.

    ProbeCapturePositionSettings position

    The probe position to use.

    Texture target

    The texture to render into.

    bool forceFlipY

    Whether to force Y axis flipping.

    bool forceInvertBackfaceCulling

    Whether to force the backface culling inversion.

    uint staticFlags

    The static flags filters to use.

    float referenceFieldOfView

    The reference field of view.

    float referenceAspect

    The reference aspect.

    Render(ProbeSettings, ProbeCapturePositionSettings, Texture, out CameraSettings, out CameraPositionSettings, bool, bool, uint, float, float)

    Render a probe

    Declaration
    public static void Render(ProbeSettings settings, ProbeCapturePositionSettings position, Texture target, out CameraSettings cameraSettings, out CameraPositionSettings cameraPositionSettings, bool forceFlipY = false, bool forceInvertBackfaceCulling = false, uint staticFlags = 0, float referenceFieldOfView = 90, float referenceAspect = 1)
    Parameters
    Type Name Description
    ProbeSettings settings

    The probe settings to use

    ProbeCapturePositionSettings position

    The probe position to use

    Texture target

    The target texture.

    CameraSettings cameraSettings

    The camera settings used during the rendering

    CameraPositionSettings cameraPositionSettings

    The camera position settings used during the rendering.

    bool forceFlipY

    Whether to force the Y axis flipping.

    bool forceInvertBackfaceCulling

    Whether to force the backface culling inversion.

    uint staticFlags

    The static flag to use during the rendering.

    float referenceFieldOfView

    The reference field of view.

    float referenceAspect

    The reference aspect ratio.

    In This Article
    Back to top
    Copyright © 2025 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)