Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

CommandBuffer.Blit

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public method Blit(source: Texture, dest: Rendering.RenderTargetIdentifier): void;
public void Blit(Texture source, Rendering.RenderTargetIdentifier dest);
public method Blit(source: Texture, dest: Rendering.RenderTargetIdentifier, mat: Material): void;
public void Blit(Texture source, Rendering.RenderTargetIdentifier dest, Material mat);
public method Blit(source: Texture, dest: Rendering.RenderTargetIdentifier, mat: Material, pass: int): void;
public void Blit(Texture source, Rendering.RenderTargetIdentifier dest, Material mat, int pass);
public method Blit(source: Texture, dest: Rendering.RenderTargetIdentifier, scale: Vector2, offset: Vector2): void;
public void Blit(Texture source, Rendering.RenderTargetIdentifier dest, Vector2 scale, Vector2 offset);
public method Blit(source: Rendering.RenderTargetIdentifier, dest: Rendering.RenderTargetIdentifier): void;
public method Blit(source: Rendering.RenderTargetIdentifier, dest: Rendering.RenderTargetIdentifier, mat: Material): void;
public method Blit(source: Rendering.RenderTargetIdentifier, dest: Rendering.RenderTargetIdentifier, mat: Material, pass: int): void;
public void Blit(Rendering.RenderTargetIdentifier source, Rendering.RenderTargetIdentifier dest, Material mat, int pass);
public method Blit(source: Rendering.RenderTargetIdentifier, dest: Rendering.RenderTargetIdentifier, scale: Vector2, offset: Vector2): void;
public void Blit(Rendering.RenderTargetIdentifier source, Rendering.RenderTargetIdentifier dest, Vector2 scale, Vector2 offset);

Parameters

source Source texture or render target to blit from.
dest Destination to blit into.
mat Material to use.
pass Shader pass to use (default is -1, meaning "all passes").
scale Scale applied to the source texture coordinate.
offset Offset applied to the source texture coordinate.

Description

Add a "blit into a render texture" command.

This is similar to Graphics.Blit - it is mostly for copying from one (render)texture into another, potentially using a custom shader.

Source texture or render target will be passed to the material as "_MainTex" property.

Render texture to use can be indicated in several ways: a RenderTexture object, a temporary render texture created with 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.

Note that Blit changes the currently active render target. After Blit executes, dest becomes the active render target.

See Also: GetTemporaryRT, RenderTargetIdentifier.

Did you find this page useful? Please give it a rating: