docs.unity3d.com
    Show / Hide Table of Contents

    Class Blitter

    Various blit (texture copy) utilities for the Scriptable Render Pipelines.

    Inheritance
    Object
    Blitter
    Namespace: UnityEngine.Rendering
    Syntax
    public static class Blitter

    Methods

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, Single, Boolean)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport.

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, float mipLevel = 0F, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Single mipLevel

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, Material, Int32)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport. This overloads allows the user to override the default blit shader

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, Material material, int pass)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Material material

    The material to use when blitting

    Int32 pass

    pass to use of the provided material

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, Rect, Single, Boolean)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport. This overload allows user to override the viewport of the destination RTHandle.

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, Rect destViewport, float mipLevel = 0F, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Rect destViewport

    Viewport of the destination RTHandle.

    Single mipLevel

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    BlitCameraTexture(CommandBuffer, RTHandle, RTHandle, Vector4, Single, Boolean)

    Blit a RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport. This overload allows user to override the scale and bias used when sampling the input RTHandle.

    Declaration
    public static void BlitCameraTexture(CommandBuffer cmd, RTHandle source, RTHandle destination, Vector4 scaleBias, float mipLevel = 0F, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Vector4 scaleBias

    Scale and bias used to sample the input RTHandle.

    Single mipLevel

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    BlitCameraTexture2D(CommandBuffer, RTHandle, RTHandle, Single, Boolean)

    Blit a RThandle Texture2D RTHandle to another RTHandle. This will properly account for partial usage (in term of resolution) of the texture for the current viewport.

    Declaration
    public static void BlitCameraTexture2D(CommandBuffer cmd, RTHandle source, RTHandle destination, float mipLevel = 0F, bool bilinear = false)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    RTHandle destination

    Destination RTHandle.

    Single mipLevel

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    BlitColorAndDepth(CommandBuffer, Texture, RenderTexture, Vector4, Single, Boolean)

    Blit a 2D texture and depth buffer.

    Declaration
    public static void BlitColorAndDepth(CommandBuffer cmd, Texture sourceColor, RenderTexture sourceDepth, Vector4 scaleBias, float mipLevel, bool blitDepth)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    Texture sourceColor

    Source Texture for color.

    RenderTexture sourceDepth

    Source RenderTexture for depth.

    Vector4 scaleBias

    Scale and bias for sampling the input texture.

    Single mipLevel

    Mip level to blit.

    Boolean blitDepth

    Enable depth blit.

    BlitCubeToOctahedral2DQuad(CommandBuffer, Texture, Vector4, Int32)

    Blit a cube texture into 2d texture as octahedral quad. (projection)

    Declaration
    public static void BlitCubeToOctahedral2DQuad(CommandBuffer cmd, Texture source, Vector4 scaleBiasRT, int mipLevelTex)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source cube texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to sample.

    BlitCubeToOctahedral2DQuadSingleChannel(CommandBuffer, Texture, Vector4, Int32)

    Blit a cube texture into 2d texture as octahedral quad. (projection) Conversion between single and multi channel formats. RGB(A) to YYYY (luminance). R to RRRR. A to AAAA.

    Declaration
    public static void BlitCubeToOctahedral2DQuadSingleChannel(CommandBuffer cmd, Texture source, Vector4 scaleBiasRT, int mipLevelTex)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to blit.

    BlitOctahedralWithPadding(CommandBuffer, Texture, Vector2, Vector4, Vector4, Int32, Boolean, Int32)

    Blit a texture (which is a Octahedral projection) using a quad in the current render target.

    Declaration
    public static void BlitOctahedralWithPadding(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    Int32 paddingInPixels

    Padding in pixels.

    BlitOctahedralWithPaddingMultiply(CommandBuffer, Texture, Vector2, Vector4, Vector4, Int32, Boolean, Int32)

    Blit a texture (which is a Octahedral projection) using a quad in the current render target, by performing an alpha blend with the existing content on the render target.

    Declaration
    public static void BlitOctahedralWithPaddingMultiply(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    Int32 paddingInPixels

    Padding in pixels.

    BlitQuad(CommandBuffer, Texture, Vector4, Vector4, Int32, Boolean)

    Blit a texture using a quad in the current render target.

    Declaration
    public static void BlitQuad(CommandBuffer cmd, Texture source, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector4 scaleBiasTex

    Scale and bias for the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    BlitQuadSingleChannel(CommandBuffer, Texture, Vector4, Vector4, Int32)

    Bilinear Blit a texture using a quad in the current render target. Conversion between single and multi channel formats. RGB(A) to YYYY (luminance). R to RRRR. A to AAAA.

    Declaration
    public static void BlitQuadSingleChannel(CommandBuffer cmd, Texture source, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector4 scaleBiasTex

    Scale and bias for the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to blit.

    BlitQuadWithPadding(CommandBuffer, Texture, Vector2, Vector4, Vector4, Int32, Boolean, Int32)

    Blit a texture using a quad in the current render target.

    Declaration
    public static void BlitQuadWithPadding(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    Int32 paddingInPixels

    Padding in pixels.

    BlitQuadWithPaddingMultiply(CommandBuffer, Texture, Vector2, Vector4, Vector4, Int32, Boolean, Int32)

    Blit a texture using a quad in the current render target, by performing an alpha blend with the existing content on the render target.

    Declaration
    public static void BlitQuadWithPaddingMultiply(CommandBuffer cmd, Texture source, Vector2 textureSize, Vector4 scaleBiasTex, Vector4 scaleBiasRT, int mipLevelTex, bool bilinear, int paddingInPixels)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command buffer used for rendering.

    Texture source

    Source texture.

    Vector2 textureSize

    Source texture size.

    Vector4 scaleBiasTex

    Scale and bias for sampling the input texture.

    Vector4 scaleBiasRT

    Scale and bias for the output texture.

    Int32 mipLevelTex

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    Int32 paddingInPixels

    Padding in pixels.

    BlitTexture(CommandBuffer, RTHandle, Vector4, Single, Boolean)

    Blit a RTHandle texture.

    Declaration
    public static void BlitTexture(CommandBuffer cmd, RTHandle source, Vector4 scaleBias, float mipLevel, bool bilinear)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    Vector4 scaleBias

    Scale and bias for sampling the input texture.

    Single mipLevel

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    BlitTexture(CommandBuffer, RTHandle, Vector4, Material, Int32)

    Blit a RTHandle texture

    Declaration
    public static void BlitTexture(CommandBuffer cmd, RTHandle source, Vector4 scaleBias, Material material, int pass)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    Vector4 scaleBias

    Scale and bias for sampling the input texture.

    Material material

    Material to invoke when blitting.

    Int32 pass

    Pass idx within the material to invoke.

    BlitTexture2D(CommandBuffer, RTHandle, Vector4, Single, Boolean)

    Blit a RTHandle texture 2D.

    Declaration
    public static void BlitTexture2D(CommandBuffer cmd, RTHandle source, Vector4 scaleBias, float mipLevel, bool bilinear)
    Parameters
    Type Name Description
    CommandBuffer cmd

    Command Buffer used for rendering.

    RTHandle source

    Source RTHandle.

    Vector4 scaleBias

    Scale and bias for sampling the input texture.

    Single mipLevel

    Mip level to blit.

    Boolean bilinear

    Enable bilinear filtering.

    Cleanup()

    Release Blitter resources.

    Declaration
    public static void Cleanup()

    GetBlitMaterial(TextureDimension, Boolean)

    Returns the default blit material.

    Declaration
    public static Material GetBlitMaterial(TextureDimension dimension, bool singleSlice = false)
    Parameters
    Type Name Description
    TextureDimension dimension

    Dimension of the texture to blit, either 2D or 2D Array.

    Boolean singleSlice

    Blit only a single slice of the array if applicable.

    Returns
    Type Description
    Material

    Initialize(Shader, Shader)

    Initialize Blitter resources. Must be called once before any use

    Declaration
    public static void Initialize(Shader blitPS, Shader blitColorAndDepthPS)
    Parameters
    Type Name Description
    Shader blitPS
    Shader blitColorAndDepthPS
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023