Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Blit(source, destination) on main camera always all black

Discussion in 'Image Effects' started by jgmakes, Nov 4, 2019.

  1. jgmakes

    jgmakes

    Joined:
    Jan 10, 2019
    Posts:
    75
    I'm trying to run the default Image Effect Shader (a simple color inverse) on the main camera in 2019.2.10. For some reason, even this base effect renders all black pixels.

    I'm passing in the postprocessMaterial, which is using the custom shader, and the following is the only code on my main camera. When I put a breakpoint on the Graphics.Blit() call, the "destination" texture comes up as null. That seems wrong, no?

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class CameraScript : MonoBehaviour {
    5.  
    6.     public Material postprocessMaterial;
    7.  
    8.     void OnRenderImage(RenderTexture source, RenderTexture destination){
    9.         // Should the destination be null?
    10.         // When the postprocessMaterial is added as a third arg, the all black is inverted to all white
    11.         Graphics.Blit(source, destination);
    12.     }
    13. }
    14.  
    I found this technique used in a bunch of tutorials verbatim but they're probably not the most recent unity builds.

    Thanks :)

    ## EDIT
    The same setup appears to be working fine in 2018.4.11, though surprisingly the destination param is still null.
     
    Last edited: Nov 4, 2019
  2. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Which renderpipeline are you using? Standard, or some SRP (LWPR/URP/HDRP) ?