Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Graphics.SetRenderTarget

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public static function SetRenderTarget(setup: RenderTargetSetup): void;
public static void SetRenderTarget(RenderTargetSetup setup);
public static function SetRenderTarget(rt: RenderTexture): void;
public static void SetRenderTarget(RenderTexture rt);
public static function SetRenderTarget(rt: RenderTexture, mipLevel: int): void;
public static void SetRenderTarget(RenderTexture rt, int mipLevel);
public static function SetRenderTarget(rt: RenderTexture, mipLevel: int, face: CubemapFace): void;
public static void SetRenderTarget(RenderTexture rt, int mipLevel, CubemapFace face);
public static function SetRenderTarget(colorBuffer: RenderBuffer, depthBuffer: RenderBuffer): void;
public static void SetRenderTarget(RenderBuffer colorBuffer, RenderBuffer depthBuffer);
public static function SetRenderTarget(colorBuffers: RenderBuffer[], depthBuffer: RenderBuffer): void;
public static void SetRenderTarget(RenderBuffer[] colorBuffers, RenderBuffer depthBuffer);
public static function SetRenderTarget(colorBuffer: RenderBuffer, depthBuffer: RenderBuffer, mipLevel: int): void;
public static void SetRenderTarget(RenderBuffer colorBuffer, RenderBuffer depthBuffer, int mipLevel);
public static function SetRenderTarget(colorBuffer: RenderBuffer, depthBuffer: RenderBuffer, mipLevel: int, face: CubemapFace): void;
public static void SetRenderTarget(RenderBuffer colorBuffer, RenderBuffer depthBuffer, int mipLevel, CubemapFace face);

Parámetros

Descripción

Sets current render target.

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 RenderTexture, or specific cubemap face of a cubemap RenderTexture.

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

Calling SetRenderTarget with just a RenderTexture argument is the same as setting RenderTexture.active property.

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.