Search Unity

Bug RenderSettings.fog no longer working on PreRender and PostRender

Discussion in 'Universal Render Pipeline' started by DanjelRicci, Oct 18, 2020.

  1. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    Using Unity 2019.4.9 LTS, I believe this happened after updating URP from 7.3.1 to 7.5.1. I have a script for disabling fog on selected cameras, pretty much identical to this one in the docs. It just doesn't work anymore, I still see the fog in the Camera where I attach the script to.

    EDIT: looks like this only happens in the editor because my Android/Quest build is fine. This is probably part of this same issue, where I can't see URP MSAA anymore but only when playing in the editor. Something is happening to the editor URP camera I suppose.
     
    Last edited: Oct 19, 2020
  2. revolute

    revolute

    Joined:
    Jul 28, 2014
    Posts:
    50
    The best workaround I would recommend (that works in both) is using RenderPipelineManager.beginCameraRendering and endCameraRendering callbacks. Simply compare the camera value from the argument to the camera you wish to modify and toggle its fog state. My game has 2 different fog values that are used and I am using 7.4.3 URP.
     
    DanjelRicci likes this.
  3. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    Thanks, that worked for the fog!