public void SetRenderTarget (Rendering.RenderTargetIdentifier rt);
public void SetRenderTarget (Rendering.RenderTargetIdentifier rt, Rendering.RenderBufferLoadAction colorLoadAction, Rendering.RenderBufferStoreAction colorStoreAction, Rendering.RenderBufferLoadAction depthLoadAction, Rendering.RenderBufferStoreAction depthStoreAction);
public void SetRenderTarget (Rendering.RenderTargetIdentifier rt, int mipLevel);
public void SetRenderTarget (Rendering.RenderTargetIdentifier rt, int mipLevel, CubemapFace cubemapFace);
public void SetRenderTarget (Rendering.RenderTargetIdentifier rt, int mipLevel, CubemapFace cubemapFace, int depthSlice);
public void SetRenderTarget (Rendering.RenderTargetIdentifier color, Rendering.RenderTargetIdentifier depth);
public void SetRenderTarget (Rendering.RenderTargetIdentifier color, Rendering.RenderTargetIdentifier depth, int mipLevel);
public void SetRenderTarget (Rendering.RenderTargetIdentifier color, Rendering.RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace);
public void SetRenderTarget (Rendering.RenderTargetIdentifier color, Rendering.RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice);
public void SetRenderTarget (RenderTargetIdentifier[] colors, Rendering.RenderTargetIdentifier depth);
public void SetRenderTarget (Rendering.RenderTargetBinding binding);

Parameters

rt为颜色和深度缓冲区设置的渲染目标。
color设置为颜色缓冲区的渲染目标。
colors设置为颜色缓冲区的渲染目标 (MRT)。
depth设置为深度缓冲区的渲染目标。
mipLevel渲染目标的要达到的 Mip 级别。
cubemapFace立方体贴图渲染目标要渲染到的立方体贴图面。
depthSlice要设置的 3D 或数组渲染目标的切片。
loadActionLoad action that is used for color and depth/stencil buffers.
storeActionStore action that is used for color and depth/stencil buffers.
colorLoadActionLoad action that is used for the color buffer.
colorStoreActionStore action that is used for the color buffer.
depthLoadActionLoad action that is used for the depth/stencil buffer.
depthStoreActionStore action that is used for the depth/stencil buffer.

Description

添加“设置活动的渲染目标”命令。

可通过若干种方式指示要使用的渲染纹理:RenderTexture 对象、用 GetTemporaryRT 创建的临时渲染纹理或内置的临时纹理之一 (BuiltinRenderTextureType)。上述所有形式的渲染纹理都用 RenderTargetIdentifier 结构来表示,该结构使用隐式转换运算符,实现键入时保存。

在命令缓冲区执行期间,不必显式保留活动的渲染目标(当前的渲染目标将被保存并在之后恢复)。

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.

请注意,在线性颜色空间中,设置正确的 sRGB<-> 线性颜色转换 状态非常重要。受之前渲染的内容的影响,当前状态可能不是您预期的状态。 您应考虑在执行 SetRenderTarget 或任何其他手动渲染之前,将 GL.sRGBWrite 设置为 需要的值。

Rendering.RenderTargetIdentifier.Clear is currently not supported. A subsequent call to ClearRenderTarget has the same effect and is optimized on graphics APIs that support clear load actions.

另请参阅:GetTemporaryRTClearRenderTargetBlitRenderTargetIdentifier