Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question URP _MainTex vs _SourceTex vs _BlitTexture

Discussion in 'Universal Render Pipeline' started by _geo__, May 18, 2023.

  1. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,298
    I noticed that if I try to do a custom render pass with at fullscreen blit I can (have to) use different input texture names in the shader to access the automatically passed in camera color buffer.

    So far I've got:
    • _MainTex (works in SRP 12, 13, 14ish)
      • Though in some circumstances it seems the passed in texture has the wrong gamma (too bright)
    • _SourceTex (not sure in which SRP versions this is available)
      • Gives me the correct gamma
    • _BlitTexture (seems to have replaced _MainTex in SRP 15+, at least _MainTex is now always empty or maybe this is only set if the right arcane combination is used in the render pass code)
    Has anyone made sense of this? It seems all so "magical" that I am utterly confused as to how to use them and provide a coherent experience across multiple SRP versions.

    My actual problem is the wrong "gamma" of _MainTex in some circumstances. Sometimes it's okay, sometimes not, all within the sam project. It seems to depend on the camera settings somehow (renderPassEvent = RenderPassEvent.AfterRendering).

    Silly me > Solution: renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing instead of AfterRendering.
     
    Last edited: May 18, 2023