Vixen
02b45cc4
csharp
public sealed class LensFlareRenderer

What a bright source does to the rest of the frame, rather than to its own pixels.

Read the guide page for this →

Remarks

Not bloom with a different name. Bloom is light scattered a short way from where it landed. A flare is light that reflected off the back of one lens element and the front of another, so it lands somewhere else entirely — and where it lands is not arbitrary. A ghost of a highlight sits on the line from that highlight through the centre of the frame, at a distance set by which pair of elements it bounced between, which is why the whole effect is one vector and a list of scale factors.

Two passes. A threshold into a quarter-resolution target, then a gather that adds the ghosts, the halo and the starburst onto the scene. A full-resolution gather over a dozen ghosts is a dozen dependent reads per pixel of an image that is mostly black.

⚠ Before the tonemap and before !Bloom. A flare is light arriving at the sensor, so it has to be able to blow out. Added after the curve it could only ever be a wash over the picture, and a highlight already at white would gain a ghost brighter than itself.

⚠ Threshold is in the source's units. In a physically lit frame that is cd/m² and nothing is near one, so the usual value of one would flare the floor. The same argument !Bloom's threshold makes, and the same failure if it is left at the default.

Fields and properties (25)

  • public required string Source

    The linear HDR colour the flare is built from and added onto.

  • public string Output

    The name the result is published under.

  • public PixelFormat Format

    The format of the target it declares.

  • public float Threshold

    Luminance above which a pixel contributes to a flare.

  • public int Ghosts

    How many ghosts are traced along the centre vector.

  • public float GhostSpacing

    How far apart consecutive ghosts are, as a fraction of the vector to the centre.

  • public float GhostIntensity

    How bright the ghosts are.

  • public bool UseHalo

    Whether the halo ring is drawn.

  • public float HaloRadius

    How far out the halo ring sits, in UV.

  • public float HaloThickness

    How thick it is.

  • public float HaloIntensity

    How bright it is.

  • public float ChromaticOffset

    How far the three channels are sampled apart, in UV. Zero is no fringing.

  • public bool UseStarburst

    Whether the diaphragm's diffraction spikes are drawn.

  • public float StarburstBlades

    How many diffraction spikes.

  • public float StarburstIntensity

    How strongly the spikes modulate the ghosts.

  • public float StarburstAngle

    A rotation on the spike pattern, in radians.

  • public Vector3 Tint

    A tint on the whole flare, for a lens with a coloured coating.

  • public RenderView? View

    The view whose lens supplies the blade count, or null for StarburstBlades.

  • public EffectPipelineDescriber? Modules

    Where shader modules come from.

  • public DescriptorAllocator? Descriptors

    Where descriptor sets come from.

  • public SamplerCache? Samplers

    Where the samplers come from.

  • public IGraphicsDevice? Device

    The device its pipelines and uniform buffers are created on.

  • public int PassCount

    How many passes the last build declared.

  • public IReadOnlyList<FullScreenRenderer> Passes

    The chain's passes, for a test or an inspector.

  • public float Blades

    How many blades the spikes are drawn for.

Methods (3)

  • public void Apply(in PostProcessOverlay overlay)
  • protected override void Build(GraphicsCompositor compositor, CompositorFrame frame)

    Declares this node's render-graph passes.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (2)

  • PostEffectFactoryVixen.Rendering.PostFx
  • PostEffectTestsVixen.Rendering.PostFx.Tests