Light flickering in and out of existence on camera movement (URP)

Hello, I’ve encountered a strange problem with lighting. Distant (or more accurately relatively small) light sources seem to flicker in and out of existence or at least have very differing brightness when camera moves and especially when camera rotates.

  • Using Unity 2019.3.13f1, URP project.

Details:

  • The light sources themselves are
    simple mesh material (cylinder) with high
    intensity emission - the bloom simply
    makes them and this issue to be visible at a distance.
  • If camera does not move, rotate
    and/or if objects themselves do not
    move - light does not flicker.
  • It is not the fault of bloom or HDR -
    I’ve disabled both and zoomed out and
    still the barely visible 1 pixel
    light sources behave in same way -
    flicker in and out of existence.
  • It is also very noticeable that even
    range indicating rings don’t have
    uniform blur, seems to be a sine or
    sinc function pattern (Horizontally along the green one).
  • If camera moves towards the source:
    flickering occurs in
    sin(distance_to_source) pattern,
    fairly high sensitivity.
  • It is not a scale issue, exactly same
    behavior occurs when scale is 100
    times smaller at relatively same distance - it is a relative size
    issue.
  • In the example pictures the camera is
    in the same position and is rotated
    very slightly to the right side. Small movements are enough to change which ships in a distance are brighter. The expected/desired behavior for all ships to be uniformly bright all the time, without a dependence on camera rotation.

What am I trying to achieve:

  • I’m trying to make distant spaceships
    to be visible in The expanse style:
    the drives of ships emit light and
    ideally create lens flare. More importantly be visible from the front side, this is where simple point light and reflections off the ship aren’t enough. And since URP
    does not support lens flares (Nothing
    free at least), I’ve found out that
    highly emissive material and blur
    makes a satisfactory result.
  • Personally I don’t have enough
    experience and wouldn’t know where to
    start in order to make the desired
    lens flare or bright light source
    effect. I was in fact quite surprised
    that camera cannot directly see point
    light sources, those light sources
    only create light (so also shadows)
    on materials. So maybe there are
    vastly better way to achieve what I
    aim for.

camera-rightwards-1 camera-rightwards-2 camera-rightwards-3 ship-model-1 ship-model-2

What you’re seeing here is aliasing. Due to performance considerations, we cannot render objects with infinite amounts of detail. Each pixel on screen doesn’t actually represent the whole area that it covers - instead, you can think of it like a raycast; each pixel shoots one ray at its centre, and that pixel is drawn if the ray hits something. As such, when you have an object that is smaller than a single pixel, sometimes the rays will hit and it will be drawn, other times the rays will completely miss the object and so it won’t. This is also why you cannot directly ‘see’ light sources - in 3D rendering (disregarding area lights) light sources are infinitely small, and so we don’t bother visualising them directly; instead you would need to hint to their position through the scene itself. The only ‘proper’ solution for this is to render at a higher resolution, but that is practically never feasible, so we have a few workarounds known as anti-aliasing. MSAA is the most common and most accurate as it actually works by taking multiple samples per pixel in unstable areas. However, this isn’t supported everywhere and can be quite expensive. Other solutions come as a post-processing filter on the image, which wouldn’t really help in this case as the unstable pixel needs to be already rendered for it to be filtered. More recently we have seen the two techniques combined in the form of TAA, but that requires use of motion vectors and as such also isn’t supported everywhere (and this is a scenario in which it can still fail).

The only guaranteed fix here would be to either manually scale up the emissive objects when they are far away to make sure that they are larger than a single pixel or to use a lens flare system like you suggested.