Class RenderingUtils
Contains properties and helper functions that you can use when rendering.
Inherited Members
Namespace: UnityEngine.Rendering.Universal
Syntax
public static class RenderingUtils
Properties
fullscreenMesh
Returns a mesh that you can use with UnityEngine.Rendering.CommandBuffer.DrawMesh(UnityEngine.Mesh,UnityEngine.Matrix4x4,UnityEngine.Material) to render full-screen effects.
Declaration
public static Mesh fullscreenMesh { get; }
Property Value
Type | Description |
---|---|
Mesh |
Methods
ReAllocateIfNeeded(ref RTHandle, ScaleFunc, in RenderTextureDescriptor, FilterMode, TextureWrapMode, Boolean, Int32, Single, String)
Re-allocate dynamically resized RTHandle if it is not allocated or doesn't match the descriptor
Declaration
public static bool ReAllocateIfNeeded(ref RTHandle handle, ScaleFunc scaleFunc, in RenderTextureDescriptor descriptor, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0F, string name = "")
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | RTHandle to check (can be null) |
ScaleFunc | scaleFunc | Function used for the RTHandle size computation. |
RenderTextureDescriptor | descriptor | Descriptor for the RTHandle to match |
FilterMode | filterMode | Filtering mode of the RTHandle. |
TextureWrapMode | wrapMode | Addressing mode of the RTHandle. |
Boolean | isShadowMap | Set to true if the depth buffer should be used as a shadow map. |
Int32 | anisoLevel | Anisotropic filtering level. |
Single | mipMapBias | Bias applied to mipmaps during filtering. |
String | name | Name of the RTHandle. |
Returns
Type | Description |
---|---|
Boolean | If an allocation was done |
ReAllocateIfNeeded(ref RTHandle, in RenderTextureDescriptor, FilterMode, TextureWrapMode, Boolean, Int32, Single, String)
Re-allocate fixed-size RTHandle if it is not allocated or doesn't match the descriptor
Declaration
public static bool ReAllocateIfNeeded(ref RTHandle handle, in RenderTextureDescriptor descriptor, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0F, string name = "")
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | RTHandle to check (can be null) |
RenderTextureDescriptor | descriptor | Descriptor for the RTHandle to match |
FilterMode | filterMode | Filtering mode of the RTHandle. |
TextureWrapMode | wrapMode | Addressing mode of the RTHandle. |
Boolean | isShadowMap | Set to true if the depth buffer should be used as a shadow map. |
Int32 | anisoLevel | Anisotropic filtering level. |
Single | mipMapBias | Bias applied to mipmaps during filtering. |
String | name | Name of the RTHandle. |
Returns
Type | Description |
---|---|
Boolean |
ReAllocateIfNeeded(ref RTHandle, Vector2, in RenderTextureDescriptor, FilterMode, TextureWrapMode, Boolean, Int32, Single, String)
Re-allocate dynamically resized RTHandle if it is not allocated or doesn't match the descriptor
Declaration
public static bool ReAllocateIfNeeded(ref RTHandle handle, Vector2 scaleFactor, in RenderTextureDescriptor descriptor, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Repeat, bool isShadowMap = false, int anisoLevel = 1, float mipMapBias = 0F, string name = "")
Parameters
Type | Name | Description |
---|---|---|
RTHandle | handle | RTHandle to check (can be null) |
Vector2 | scaleFactor | Constant scale for the RTHandle size computation. |
RenderTextureDescriptor | descriptor | Descriptor for the RTHandle to match |
FilterMode | filterMode | Filtering mode of the RTHandle. |
TextureWrapMode | wrapMode | Addressing mode of the RTHandle. |
Boolean | isShadowMap | Set to true if the depth buffer should be used as a shadow map. |
Int32 | anisoLevel | Anisotropic filtering level. |
Single | mipMapBias | Bias applied to mipmaps during filtering. |
String | name | Name of the RTHandle. |
Returns
Type | Description |
---|---|
Boolean | If the RTHandle should be re-allocated |
SetViewAndProjectionMatrices(CommandBuffer, Matrix4x4, Matrix4x4, Boolean)
Set view and projection matrices.
This function will set UNITY_MATRIX_V
, UNITY_MATRIX_P
, UNITY_MATRIX_VP
to given view and projection matrices.
If setInverseMatrices
is set to true this function will also set UNITY_MATRIX_I_V
and UNITY_MATRIX_I_VP
.
Declaration
public static void SetViewAndProjectionMatrices(CommandBuffer cmd, Matrix4x4 viewMatrix, Matrix4x4 projectionMatrix, bool setInverseMatrices)
Parameters
Type | Name | Description |
---|---|---|
CommandBuffer | cmd | CommandBuffer to submit data to GPU. |
Matrix4x4 | viewMatrix | View matrix to be set. |
Matrix4x4 | projectionMatrix | Projection matrix to be set. |
Boolean | setInverseMatrices | Set this to true if you also need to set inverse camera matrices. |
SupportsGraphicsFormat(GraphicsFormat, FormatUsage)
Checks if a texture format is supported by the run-time system. Similar to UnityEngine.SystemInfo.IsFormatSupported(UnityEngine.Experimental.Rendering.GraphicsFormat,UnityEngine.Experimental.Rendering.FormatUsage), but doesn't allocate memory.
Declaration
public static bool SupportsGraphicsFormat(GraphicsFormat format, FormatUsage usage)
Parameters
Type | Name | Description |
---|---|---|
GraphicsFormat | format | The format to look up. |
FormatUsage | usage | The format usage to look up. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the graphics card supports the given |
SupportsRenderTextureFormat(RenderTextureFormat)
Checks if a render texture format is supported by the run-time system. Similar to SupportsRenderTextureFormat, but doesn't allocate memory.
Declaration
public static bool SupportsRenderTextureFormat(RenderTextureFormat format)
Parameters
Type | Name | Description |
---|---|---|
RenderTextureFormat | format | The format to look up. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the graphics card supports the given |