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

Edge detection beneath fog

Discussion in 'Universal Render Pipeline' started by TyroByte, May 26, 2021.

  1. TyroByte

    TyroByte

    Joined:
    Mar 16, 2017
    Posts:
    25
    Greetings,

    I am using URP 7.5.3 (I believe 2019.4.20f1). Is there any way to create a custom renderer feature which allows for edge detection? Currently, all most all edge detection solution for URP renders on top of fog, regardless of Render Event chosen.

    Fog is set to exponential and render event before transparent.

    Edit: For testing, I am using the Flat Kit Toon Shading Asset's outline renderer feature.
     
  2. burningmime

    burningmime

    Joined:
    Jan 25, 2014
    Posts:
    845
    If you're talking about default fog where things in the distance are grayed out, that's basically done as part of the render of the object. There's not a separate fog layer; the object is drawn with the fog already applied.

    Only thing I can think of is you could draw the fog yourself (using the camera depth texture to know how much fog to apply to each pixel) as a post-process pass instead of using the built in fog (and that way you could put it anywhere in the pipeline you want). There's also volumetric fog which is its own thing but might not be good for all hardware.
     
  3. TyroByte

    TyroByte

    Joined:
    Mar 16, 2017
    Posts:
    25
    Thanks for the reply, In the end the performance impact was too much so I settled on post processing fog only and discarded post processing based outlines.