Search Unity

Unity SSR Solution for URP

Discussion in 'Assets and Asset Store' started by JoshuaLim007, Apr 13, 2023.

  1. JoshuaLim007

    JoshuaLim007

    Joined:
    Sep 24, 2018
    Posts:
    4
    Github: JoshuaLim007/Unity-ScreenSpaceReflections-URP: SSR solution for Unity URP (github.com)

    I finished a screen space reflection shader a little while ago and thought I should share it on the Unity Forums. It works on Unity URP 12 and newer. So, Unity 2021 LTS and above. It runs reasonably well around 2 ms for both the Hi-Z buffer generation and the multi-pass reflection shader on a rtx 3070 at 1440p. Built it specifically for desktop and haven't tested it on mobile or xr devices.

    I believe this is the only screen space reflection solution other than Shiny-SSR. Most what I've seen are either planar shaders or material bound reflections shaders.

    Screenshots:

     
  2. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,766
    Looks great, amazed no one else has replied. Looking forward to giving it a go. Well done :)
     
    JoshuaLim007 likes this.
  3. Saismirk

    Saismirk

    Joined:
    Aug 2, 2014
    Posts:
    4
    How can this be used with custom lighting models? That is, to access the SSR result like the URP Lit shader would?
     
  4. JoshuaLim007

    JoshuaLim007

    Joined:
    Sep 24, 2018
    Posts:
    4
    Sorry for the late reply.
    I store the results of the SSR within the following render target name:
    uniform sampler2D _ReflectedColorMap;

    You can sample this texture like any other texture like this:
    float4 reflectedUv = tex2D(_ReflectedColorMap, i.uv);


    Despite the name, this texture contains only the reflected normalized screen space position in the r and g channels. The b channel contains the smoothness value and the alpha channel contains the reflection mask value. I haven't designed this solution around custom lighting models so this is just a workaround..
     
  5. RogDolos

    RogDolos

    Joined:
    Oct 16, 2012
    Posts:
    42
    This looks spectacular. Any chance on a Forward+ version of this?
     
    Julian-Unity3D and bdb400 like this.
  6. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    192
    I wouldn't mind seeing a Forward+ version of this!