Search Unity

Rough reflections

Discussion in 'High Definition Render Pipeline' started by spiegelball, Mar 18, 2020.

  1. spiegelball

    spiegelball

    Joined:
    Mar 2, 2020
    Posts:
    16
    Hey guys,

    I am trying to setup a material which produces rough reflections and so far I didn't manage to get the desired results.

    This is my scene. The tree object shall be reflected by the ground. On the right I use a planar reflection probe. Screen space reflection is active. The red bar seperates the two reflection areas (SSR on the left and SSR + planar reflection probe on the right):
    scene.PNG

    Smoothness = 1:
    screen_1920x720_2020-03-18_17-27-48.png

    Smoothness = 0.7:
    screen_1920x720_2020-03-18_17-28-32.png

    Smoothness = 0.7, SSR deactivated:
    screen_1920x720_2020-03-18_17-29-15.png

    Notes:
    - The reflection looks incorrect. It seems that the reflection shader uses a perfectly reflected ray (perfectly in terms of "reflected by a flat surface") to sample from a blurred reflection map. Look how blurred the reflection is close to the trunk in the last picture. I'd expect that internally not the reflection map is blurred, but the distribution of the reflection vectors "grows" according to the roughness value of the material, but the sampling happens from an unblurred texture.
    - Blending between reflection probe and SSR effect looks wrong (possible due to the same reason).

    Am I missing something or just running into a known limitation.
     
  2. Remy_Unity

    Remy_Unity

    Unity Technologies

    Joined:
    Oct 3, 2017
    Posts:
    704
    You're running into a known limitation.
    While technicaly using multiple samples in SSR in possible, it would be to expensive, the solution is to do only one ray, and sample in a blurred color buffer.
    As for the planar probe part, I would suggest that you use a material that has SSR disabled on it.
    Internally we don't make a difference between planar and cube reflection probes, and SSR will always take priority on them, when in the case of a planar probe, the probe will probably have a better reflection informations then SSR.

    Last, if you have the option, you can try DXR raytraced reflections.
     
  3. spiegelball

    spiegelball

    Joined:
    Mar 2, 2020
    Posts:
    16
    Thanks for the explanation. I understand the performance limitation for multiple samples. However, couldn't this be solved with TAA? For each sample the direction of the reflected ray is randomized (according to normal and roughness values) and different samples are then accumulated by the TAA stage.
     
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Is there a code snippet for that anywhere? was interested in poking about with it with URP myself

    edit: sorry mis-read
    - bit off topic as it's HDRP