Search Unity

OnRenderImage Not working

Discussion in 'Scripting' started by IvanFosse, Jun 18, 2018.

  1. IvanFosse

    IvanFosse

    Joined:
    May 2, 2017
    Posts:
    6
    Hello I am using the LW template and I tried to make a post process shader.
    This is the script attache to the gameobject that hold the main camera
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class ViewEffect : MonoBehaviour
    5. {
    6.     public Material mat;
    7.     void OnRenderImage(RenderTexture src, RenderTexture dest)
    8.     {
    9.         Debug.Log("Test");
    10.         Graphics.Blit(src, dest, mat);
    11.     }
    12. }
    Can someone help me to figure out why is it not working ?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,799
    Onrenderimage doesn’t work with lwrp.
     
  3. IvanFosse

    IvanFosse

    Joined:
    May 2, 2017
    Posts:
    6
    So is there an another way to do that ?
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,799
    Probably? Haven’t spent too much time with srp, I’m waiting for them to stabilize first.
     
  5. IvanFosse

    IvanFosse

    Joined:
    May 2, 2017
    Posts:
    6
    What is srp ?
    and well i'm now stuck. I have a black and white renderTexture and I want to blend the current camera with:
    the black color make the pixel in gray color and the white color make the pixel normal and I can't figure it out how.
     
  6. IvanFosse

    IvanFosse

    Joined:
    May 2, 2017
    Posts:
    6
    Singtaa likes this.
  7. battou

    battou

    Joined:
    Jan 25, 2011
    Posts:
    222
    So do I need to install Stack V2 on top of LWRP? There is stack v1 I believe that comes with lwrp. But custom effects dont work on mobile when using it.
     
  8. Branxord

    Branxord

    Joined:
    May 13, 2018
    Posts:
    15
    Hey, i have the same code and problem as you, but i'm not working on LWRP, it's just the 3D common template, how do i fix this?
     
  9. farshidhss

    farshidhss

    Joined:
    Apr 4, 2015
    Posts:
    8
    hi any updates on this? perhaps a sample code? would have been ideal if shader graph had some basic master node to support image effects.
     
  10. Branxord

    Branxord

    Joined:
    May 13, 2018
    Posts:
    15
    the only update i can provide from my side is that i thought i was working in the 3D template but i was actually on LWRP, sorry about that