Version: 2020.3
言語: 日本語
public static void SetRenderTarget (RenderTexture rt, int mipLevel= 0, CubemapFace face= CubemapFace.Unknown, int depthSlice= 0);
public static void SetRenderTarget (RenderBuffer[] colorBuffers, RenderBuffer depthBuffer);
public static void SetRenderTarget (RenderBuffer colorBuffer, RenderBuffer depthBuffer, int mipLevel= 0, CubemapFace face= CubemapFace.Unknown, int depthSlice= 0);
public static void SetRenderTarget (RenderTargetSetup setup);

パラメーター

rt アクティブなレンダーターゲットとして設定する RenderTexture
mipLevel レンダリングするミップマップレベル (ミップマップしない場合は 0)
face レンダリングするキューブマップ表面 (キューブマップでないときは、Unknown)
depthSlice レンダリングするデプススライス (3D か 2D 配列レンダリングターゲットでない場合は 0)
colorBuffer レンダリングするカラーバッファ
depthBuffer レンダリングするデプスバッファ
colorBuffers レンダリングするカラーバッファ (複数レンダリングターゲット効果用)
setup 完全なレンダリングターゲット設定情報

説明

レンダーターゲットを設定します。

This function sets which RenderTexture or a RenderBuffer combination will be rendered into next. Use it when implementing custom rendering algorithms, where you need to render something into a render texture manually.

Variants with mipLevel and face arguments enable rendering into a specific mipmap level of a render texture, or specific cubemap face of a cubemap RenderTexture. Variants with depthSlice allow rendering into a specific slice of a 3D or 2DArray render texture.

The function call with colorBuffers array enables techniques that use Multiple Render Targets (MRT), where fragment shader can output more than one final color.

RenderTexture 引数だけを指定する SetRenderTarget の呼び出しは RenderTexture.active プロパティー設定と同じです。

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.

See Also: RenderTexture, Graphics.activeColorBuffer, Graphics.activeDepthBuffer, SystemInfo.supportedRenderTargetCount.