User Rating 0.0 β˜…β˜…β˜…β˜…β˜…
Total Usage 0 times
Click canvas to set flare center
Is this tool helpful?

Your feedback helps us improve.

β˜… β˜… β˜… β˜… β˜…

About

Lens flares in visual effects are not random artifacts. They result from specific optical interactions: internal reflections between lens elements, diffraction around aperture blades, and scattering from coating imperfections. Replicating these phenomena procedurally requires modeling each component independently. The hotspot is a high-intensity radial gradient with exponential falloff governed by I = I0 β‹… eβˆ’kr2. Streaks emerge from diffraction spikes whose angular distribution depends on aperture blade count. Iris ghosts are secondary reflections positioned along the optical axis at distances proportional to element spacing. This tool computes all four components (hotspot, streaks, iris, halo) on a Canvas element using a seeded PRNG (Mulberry32) for reproducibility. Output is a transparent PNG suitable for screen or add blend mode compositing. The tool approximates optical behavior. It does not simulate wave-optics diffraction patterns or real lens element geometry.

lens flare sci-fi procedural vfx compositing png generator light effect photoshop flare overlay

Formulas

The hotspot intensity at distance r from center follows a Gaussian-like radial falloff:

I(r) = I0 β‹… exp(βˆ’k β‹… r2)

where I0 = peak intensity (normalized to 1.0), k = falloff coefficient controlling hotspot tightness, r = pixel distance from flare center.

Streak ray direction angles for an n-blade aperture:

ΞΈi = 2Ο€n β‹… i + Ο†

where i ∈ {0, 1, …, n βˆ’ 1}, Ο† = rotation offset. Each streak intensity decays linearly from center: Istreak = 1 βˆ’ dL where d is distance along the ray and L is maximum streak length.

Iris ghost positions are reflected through the frame center. For a light source at position P and frame center C, ghost j appears at:

Gj = C + tj β‹… (C βˆ’ P)

where tj is a spacing factor unique to each ghost element, typically sampled from a seeded PRNG.

The Mulberry32 PRNG used for deterministic seed-based generation:

t = (seed + 0x6D2B79F5) & 0xFFFFFFFF
t = (t &xor; (t >>> 15)) Γ— (t | 1)
output = ((t &xor; (t + (t &xor; (t >>> 7)) Γ— (t | 61))) >>> 0) Γ· 4294967296

All color computation uses HSL with the user-selected H as base hue. Chromatic dispersion in iris ghosts shifts hue by Β±30Β° per ghost index.

Reference Data

ComponentOptical OriginVisual CharacterKey ParameterTypical Scale
HotspotDirect light source imageBright core, soft falloffFalloff exponent k0.5 - 2.0Γ— source size
Diffraction StreaksAperture blade edgesRadial lines from centerBlade count, rotation4, 6, or 8 blades
Iris GhostsInter-element reflectionsColored circles along axisElement count, spacing3 - 12 ghosts
Halo RingSpherical aberrationLarge soft circleRing radius, dispersion0.3 - 0.8Γ— frame
Chromatic RingLateral chromatic aberrationRainbow-edged ringDispersion width2 - 10 px
Anamorphic StreakCylindrical lens elementHorizontal blue lineAspect ratio, hue shiftFull frame width
StarburstFilter cross-hatchingFine radial raysRay count, thinness12 - 32 rays
Orb GhostDust on front elementLarge faint circleSize, opacity50 - 200 px
Sensor BloomCCD/CMOS overflowVertical smearBloom height10 - 100% frame
Coating FlareAnti-reflective coating failureGreen/magenta washHue, coverageQuadrant-scale
Veil GlareMulti-surface scatterOverall contrast reductionIntensity5 - 25% opacity
Edge FlareLens barrel reflectionBright crescent at frame edgePosition, curvatureCorner regions

Frequently Asked Questions

The seed initializes a Mulberry32 pseudo-random number generator. This PRNG determines ghost positions (spacing factors t_j), sizes, and opacity values. Each seed produces a unique but deterministic sequence. Two renders with the same seed and parameters will always produce identical output, but changing the seed by even 1 reshuffles the entire ghost distribution.
The PNG exports with a transparent (alpha = 0) background. Place it on a layer above your image and set the blend mode to Screen or Linear Dodge (Add). Screen mode mathematically computes Output = 1 βˆ’ (1 βˆ’ Base) Γ— (1 βˆ’ Flare), which preserves the underlying image while adding light. Never use Normal blend mode - the black fringe from semi-transparent pixels will be visible.
Streak scale controls the overall length of diffraction spikes as a multiplier of the canvas diagonal. Streak balance controls asymmetry: at 0.5 (centered), rays extend equally in both directions. At 0.0 or 1.0, rays are biased to one side, simulating partial obstruction of the aperture. This mimics real anamorphic lenses where one blade set is partially occluded.
This matches real optical physics. Iris ghosts are caused by light reflecting between lens elements. Each reflection inverts the image through the optical center. The ghost position formula G_j = C + t_j Γ— (C βˆ’ P) places ghosts along the line from the source through the center, on the far side. This is why in real footage, lens ghosts always appear diametrically opposite to the light source.
Yes. The canvas width and height fields accept any pixel dimensions up to 8192 Γ— 8192. The canvas element renders at the specified resolution regardless of display size. The preview scales to fit, but the exported PNG will be at full resolution. Be aware that canvases exceeding approximately 16 megapixels (e.g., 4096 Γ— 4096) may fail on mobile browsers due to memory limits.
The base hue H (0-360Β°) is applied differently per component. The hotspot uses H at high lightness (near white core fading to saturated edge). Streaks use H at medium saturation. Iris ghosts shift hue by Β±30Β° per ghost index to simulate chromatic aberration - ghost 0 might be at Hβˆ’60Β°, ghost 5 at H+90Β°. The halo uses H with a rainbow gradient spanning Β±60Β° around the ring circumference. This chromatic spread is what makes the flare look optically plausible.