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.
  2. Dismiss Notice

URP possible Camera enable/disable post process with script?

Discussion in 'Universal Render Pipeline' started by kamylo, Feb 20, 2020.

  1. kamylo

    kamylo

    Joined:
    Jan 20, 2017
    Posts:
    1
    Hi,

    for a project where we use URP with render texture on camera. I try to enable disable post-process on the camera with C# script but could find a way to enable this parameter.

    Am I missing something?

    Since we use spout to stream the camera to VJ software I'd like to not interrupt the video stream, so I keep the same camera for all the scene. I need the alpha on the render texture for most of the scene (since currently unsupported by URP post-process), but for some I could manage without alpha and use some post-processing effect with the camera background.

    Thanks in advance for any help on that.
     
  2. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    did you found the solution?
    I'm also looking for the same.
     
  3. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    You should be able to toggle the enable bool on the Volume component. Or the setActive bool on the game object which has the Volume component.

    The ones corresponding to these UI check boxes:

    Screen Shot 2020-03-06 at 10.49.18 am.png
     
    soorya696 likes this.
  4. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    779
    Or you could set the Volume's Weight to zero.
     
    soorya696 likes this.
  5. FranFndz

    FranFndz

    Joined:
    Sep 20, 2018
    Posts:
    178
    use
    myCamera.UniversalAdditionalCameraData.postprocess
    and set it to False;

    Volume do not turn off all the post effect. you can still profile some blits.


    like this
    _cam = Camera.main;
    _UAC = _cam.GetComponent<UniversalAdditionalCameraData>();
    _postProcessStatus = _UAC.renderPostProcessing;

    There is a call to get the AdditionalCamera from unity.
    something like
    _cam.GetAdditionalCameraData()
     
  6. soorya696

    soorya696

    Joined:
    Dec 13, 2018
    Posts:
    71
    thanks. this helped me.
     
  7. freso

    freso

    Joined:
    Mar 19, 2013
    Posts:
    72
    Where in the documentation is this mentioned?
     
    FranFndz likes this.
  8. FranFndz

    FranFndz

    Joined:
    Sep 20, 2018
    Posts:
    178
    i would like to know as well lol
     
    dubezOniner and freso like this.
  9. freso

    freso

    Joined:
    Mar 19, 2013
    Posts:
    72
    I mean, URP is stable and final. Not in preview any more. Of course it's described in the documentation. Right? :p

    (But thanks for your info. Helped me)
     
  10. FranFndz

    FranFndz

    Joined:
    Sep 20, 2018
    Posts:
    178
    For mobile i dont think is final, still many bugs and some tools doesnt work properly.
    Also, there is "Experimental" in some places.

    But yes, i also would like documentation even if it is experimental or PC only.
    I did my own documentation :/
     
    Last edited: Mar 11, 2021
    JJunior likes this.
  11. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    112
    Thanks for the tip!
    Here is a quick copy paste:

    //Post Processing
    UnityEngine.Rendering.Universal.UniversalAdditionalCameraData uac = this.GetComponent<Camera>().GetComponent<UnityEngine.Rendering.Universal.UniversalAdditionalCameraData>();
    uac.renderPostProcessing = true;