Vixen
dd8b0a81
csharp
public sealed class LightStreakRenderer

The anamorphic smear a bright highlight gets, which bloom cannot produce.

Read the guide page for this →

Remarks

Not bloom with a direction. Bloom is isotropic because the scatter it models is: light spreading a short way in every direction from where it landed. A streak comes from an aperture that is not round — an anamorphic lens squeezes a wide image onto a normal frame with a cylindrical element, so what diffracts and scatters inside it is stretched along one axis. No radius of an isotropic blur is that shape.

Three kinds of pass, and the middle one runs several times. A threshold into a reduced target, then BlurPasses separable blurs along Direction, then a composite that adds the result onto the scene. The blurs ping-pong between two planes of the same size and each one's stride is (2·Samples + 1) times the last, so three passes of four taps reach 729 texels for the cost of 27 samples rather than 729.

⚠ Each pass steps in its source's texel grid, not the frame's. The bright plane is at Scale of the frame, so a stride measured in the frame's texels would be a fraction of a texel and every tap would land back where it started — a streak subtly too short and too soft, which no screenshot answers. It is the mistake the bloom chain records having made, and TexelSize is set per pass from the plane that pass reads for that reason.

⚠ Before the tonemap, like LensFlareRenderer. A streak is light arriving at the sensor and has to be able to blow out; added after the curve it is a wash over the picture.

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

Fields and properties (17)

  • public required string Source

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

  • public string Output

    The name the result is published under.

  • public PixelFormat Format

    The format of the targets it declares.

  • public float Scale

    The fraction of the frame the streak is built at.

  • public float Threshold

    Luminance above which a pixel streaks, in the source's units.

  • public int BlurPasses

    How many blur passes run, each reaching further than the last.

  • public int Samples

    How many taps each side of the centre one blur pass takes.

  • public Vector2 Direction

    The axis the smear runs along, in UV. Normalised before it reaches the shader.

  • public float Attenuation

    How fast a tap fades per texel of separation. Below one, or the streak never ends.

  • public float Intensity

    How bright the finished streak is added back.

  • public Vector3 Tint

    A tint on the streak, for the blue a coated anamorphic element is known for.

  • 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.

Methods (3)

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

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

Used by (2)

  • LightStreakImageTestsVixen.Graphics.Golden.Tests
  • PostEffectFactoryVixen.Rendering.PostFx