SetRenderTarget
Add a "set active render target" command.
Read time 23 minutesLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
SetRenderTarget(RenderTargetIdentifier)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier rt)
Parameters
Render target to set for both color & depth buffers.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier rt, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction)
Parameters
Render target to set for both color & depth buffers.
Load action that is used for color and depth/stencil buffers.
Store action that is used for color and depth/stencil buffers.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderBufferLoadAction, RenderBufferStoreAction)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier rt, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction)
Parameters
Render target to set for both color & depth buffers.
Load action that is used for the color buffer.
Store action that is used for the color buffer.
Load action that is used for the depth/stencil buffer.
Store action that is used for the depth/stencil buffer.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, int)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel)
Parameters
Render target to set for both color & depth buffers.
The mip level of the render target to render into.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, int, CubemapFace)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel, CubemapFace cubemapFace)
Parameters
Render target to set for both color & depth buffers.
The mip level of the render target to render into.
The cubemap face of a cubemap render target to render into.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, int, CubemapFace, int)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier rt, int mipLevel, CubemapFace cubemapFace, int depthSlice)
Parameters
Render target to set for both color & depth buffers.
The mip level of the render target to render into.
The cubemap face of a cubemap render target to render into.
Slice of a 3D or array render target to set.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth)
Parameters
Render target to set as a color buffer.
Render target to set as a depth buffer.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier, int)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth, int mipLevel)
Parameters
Render target to set as a color buffer.
Render target to set as a depth buffer.
The mip level of the render target to render into.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier, int, CubemapFace)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace)
Parameters
Render target to set as a color buffer.
Render target to set as a depth buffer.
The mip level of the render target to render into.
The cubemap face of a cubemap render target to render into.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, RenderTargetIdentifier, int, CubemapFace, int)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier color, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice)
Parameters
Render target to set as a color buffer.
Render target to set as a depth buffer.
The mip level of the render target to render into.
The cubemap face of a cubemap render target to render into.
Slice of a 3D or array render target to set.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction, RenderTargetIdentifier, RenderBufferLoadAction, RenderBufferStoreAction)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier color, RenderBufferLoadAction colorLoadAction, RenderBufferStoreAction colorStoreAction, RenderTargetIdentifier depth, RenderBufferLoadAction depthLoadAction, RenderBufferStoreAction depthStoreAction)
Parameters
Render target to set as a color buffer.
Load action that is used for the color buffer.
Store action that is used for the color buffer.
Render target to set as a depth buffer.
Load action that is used for the depth/stencil buffer.
Store action that is used for the depth/stencil buffer.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier[], RenderTargetIdentifier)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth)
Parameters
Render targets to set as color buffers (MRT).
Render target to set as a depth buffer.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetIdentifier[], RenderTargetIdentifier, int, CubemapFace, int)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice)
Parameters
Render targets to set as color buffers (MRT).
Render target to set as a depth buffer.
The mip level of the render target to render into.
The cubemap face of a cubemap render target to render into.
Slice of a 3D or array render target to set.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetBinding, int, CubemapFace, int)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetBinding binding, int mipLevel, CubemapFace cubemapFace, int depthSlice)
Parameters
The mip level of the render target to render into.
The cubemap face of a cubemap render target to render into.
Slice of a 3D or array render target to set.
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.
SetRenderTarget(RenderTargetBinding)
Add a "set active render target" command.
public void SetRenderTarget(RenderTargetBinding binding)
Parameters
Remarks
Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with CommandBuffer.GetTemporaryRT, or one of built-in temporary textures (BuiltinRenderTextureType). All that is expressed by a RenderTargetIdentifier struct, which has implicit conversion operators to save on typing.
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
Variations of this method are available which take extra arguments such as mipLevel (int) and cubemapFace to enable rendering into a specific mipmap level of a RenderTexture, or specific cubemap face of a cubemap RenderTexture. Overloads setting a single RenderTarget and without explicit mipLevel, cubemapFace and depthSlice respect the mipLevel, cubemapFace and depthSlice values that were specified when creating the RenderTargetIdentifier. Overloads setting multiple render targets will set mipLevel, cubemapFace, and depthSlice to 0, Unknown, and 0 unless otherwise specified. If specified, it will use the specified mipLevel, cubemapFace, and depthSlice for all targets.
Note that in Linear color space, it is important to have the correct sRGB<->Linear color conversion state set. Depending on what was rendered previously, the current state might not be the one you expect. You should consider setting GL.sRGBWrite as you need it before doing SetRenderTarget or any other manual rendering.
Clear is currently not supported. A subsequent call to CommandBuffer.ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.
Additional Resources: CommandBuffer.GetTemporaryRT, CommandBuffer.ClearRenderTarget, CommandBuffer.Blit, RenderTargetIdentifier.