Search Unity

Volumetrics of Spotlight are Flickering and Waving in HDRP

Discussion in 'High Definition Render Pipeline' started by NotoMuteki, Oct 4, 2020.

  1. NotoMuteki

    NotoMuteki

    Joined:
    Feb 8, 2018
    Posts:
    42
    I'm using spotlight with volumetrics in HDRP project.
    The volumetrics seem fine in the closer look, but when the camera goes far from the spotlight,
    the core of spotlight starts flickering and ripples appear on the volumetric.
    Like this video:


    I thought it's the matter of the resolution of volumetric, so I toggled on "High Quality" in Volumetric setting.
    SetHighQualityOn.png
    And here is the result:

    It looks little better but still flickering and waving, so I think this is not the solution.

    Is there any settings or preference to fix those flickering and waving?
    My spotlight setting is like this:
    SpotlightSetting.png
    Unity Version: 2019.4.2f1
    HDRP Version: 7.4.3
     
  2. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Hey, play with Slice Distribution Uniformity and Filter in your volume handling Fog:

    https://docs.unity3d.com/Packages/c....high-definition@7.1/manual/Override-Fog.html


    Also, on the camera's frame settings, make sure you have the "Reprojection" activated for the Volumetric Fog. Alternatively, you might want to upgrade to more recent version of HDRP (and Unity), as you'll get many more controls over fog quality. However, I understand this might not be possible.
     
  3. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Actually my problem here https://forum.unity.com/threads/density-volume-disappear-to-early.980649/ aligns with problem in this thread.

    What I got problem with is Density Volume.

    First of why is it that when "Depth Extent" is disabled it got some default arbitrary unknown value when it should be camera far plane.

    So I had to enable and increase Depth Extent on my Fog settings for density volume volumetric fog not to disappear.
    Unfortunately it started to wave.

    And yes I got Reprojection enabled also slice distribution and filter don't prevent waving.
     
  4. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    Some explanations:

    the volumetric fog is a camera-based effect, and the volumetric fog has a limited distance.

    Imagine the fog in your frame is divided into tiny cells, that fits within the truncated pyramid formed by the viewing angle of the camera, up to a maximum distance called "Depth Extend" in the Fog volume component (that's actually called frustum voxel = froxel).

    Now, if you want to see the volumetric fog really far away, that froxel will need to be "stretched" along the depth axis of the camera. And you will therefore lose precision along this axis, given that there is a limited number of cells along that axis. This explains the waves you see (= the transition between each slice).

    As I said previously, you probably want to upgrade to HDRP 9/10, as it offers the ability to control the exact number of depth slices you want to have in your froxel. upload_2020-10-5_14-52-31.png


    Or, you might as well not use the volumetric system for these lights, and rely on an old school transparent shader applied to a custom mesh to simulate the volumetric effect, like many games did, and still do. But there might be some performance costs associated with the overdraw that the volumetric fog doesn't have.

    tldr: high-quality long-distance volumetric fog is not trivial
     

    Attached Files:

    koirat likes this.
  5. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Thank you.
    Upgraded to HDRP 9
    Increasing Slice Count increased quality considerably, with expense of performance naturally.
     
  6. NotoMuteki

    NotoMuteki

    Joined:
    Feb 8, 2018
    Posts:
    42
    Thank you for quick response and detailed explanations.
    I confirmed "Reprojection" was on in the project setting,
    and set "Slice Distribution Uniformity" as 1 and toggled on "Filter" in Fog setting.
    setting.png
    Here is the result:


    As the filter blurs volumetrics and a uniform distribution is same level precision regardless of the distance to the camera, it looks far better than previous videos, but still remains flickering on the center of spotlights.

    I'm feeling like waving on surface of volumetric and flickering on the core of light differ the source of the problem,
    but as you say those flickering may be fixed by controls over fog quality in newer HDRP,
    so I will consider upgrading Unity to 2020 and HDRP to 9.
    My project relies on multiple 3rd party tools(Enviro, EasyRoads3D, Vegetation Studio, etc),
    so I'll have to look into whether those tools are compatible with 2020 or not.
     
  7. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    I bet :).

    Since we are doing that great in this thread I also got small fast question.
    Basically my volumetric light with fog appears kind of like it is made out of stripes (this is not encoding glich on the attached image), like there are distinct borders between brightens the further form light source the haze is. Is this normal and cannot be changed into smooth transition ?

     
  8. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    197
    I was wondering if anyone else is seeing capped performance on HQ Volumetric lighting in 2020.1.x. I opened up a bug report, but fps get capped <40fps on builds only (in editor is fine) (Win/x86-64/.Net4/ILC2PP) or has a workaround.
     
  9. pierred_unity

    pierred_unity

    Unity Technologies

    Joined:
    May 25, 2018
    Posts:
    433
    I don't see any banding in this image on my monitor. Are you sure the problem isn't coming from your screen that could have difficulty handling very smooth gradients?

    Check this website: http://www.lagom.nl/lcd-test/gradient.php

    There are many tests to check the quality of your monitor.
     
  10. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    It looks like it was the angle I was looking at the monitor. I'm myself surprised that difference is so noticeable.
    I was preparing some explanation to this "issue" so I'm posting the image in case somebody else got this problem.

     
  11. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    Could you make HDRP 9 available in 2020.1.7+?
     
  12. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    It is available, you have to enable preview packages and than it will be possible to upgrade.