Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Difference between RenderTexture.GetTemporary and CommandBuffer.GetTemporaryRT

Discussion in 'High Definition Render Pipeline' started by starkr, Nov 15, 2019.

  1. starkr

    starkr

    Joined:
    Sep 5, 2019
    Posts:
    2
    Greetings, I was working on a certain post-processing effect and found myself in need of creating some temporary render textures.

    Now it appears that I can proceed in two different ways:
    * either by creating a temporary render texture using RenderTexture.GetTemporary , which returns an instance of render texture;
    * or by using CommandBuffer.GetTemporaryRT(int nameID,...), which will create a temporary render texture at some point in time, and that can be referenced by its global shader property 'nameID'.

    When should one way of creating temporary render textures be preferred over another? Is it purely based on whether a global texture needs to be created (latter case), or a shader-specific one (former)? Thank you for your time!

    Unity version: 2018.4
     
    patricksi and Circool like this.