Log inGet started
World

Procgen Effects Showcase

Branchmain
Branchesmain
Commit99ff90d12c

README.md

RiftFlicker

RiftFlicker drives a Light's intensity so it breathes, flickers and surges with the arcane rift. It sits on an entity with a Light component and sets that light's intensity every frame. It is a local-only visual: its fields are NoSync, and every peer runs its own flicker.

The fx_rift scene uses it on four lights. rift_heart_light runs the defaults. rift_rim_light_1, rift_rim_light_2 and rift_rim_light_3 run base = 9, breathe = 0.05, flicker = 0.3, flickerRate = 17, surge = 0.4 and surgeRate = 3.3, with phases 0.37, 0.74 and 1.11 so they pulse out of step.

It runs at executionOrder = 0.

Fields

FieldTypeDefaultDescription
basenumber18Intensity the light sits around, in the Light component's units.
breathenumber0.1Share of base the slow breathing swings by.
flickernumber0.15Share of base the fast noise flicker swings by.
flickerRatenumber11How fast the flicker noise changes, in cycles per second.
surgenumber0.45Share of base a surge adds at its peak.
surgeRatenumber2.1Angular rate of the surge cycle, in radians per second (matches the spark bursts).
phasenumber0Offset into the cycle, in seconds, so several lights do not pulse in lockstep.

How the intensity is computed

With t the component's own running clock plus phase:

s = max(0, sin(t * surgeRate))
k = 0.78 + breathe * sin(t * 1.7)
         + flicker * math.noise(t * flickerRate, phase * 3.1)
         + surge * s^12
intensity = base * max(k, 0.2)

Lifecycle

  • update(dt): advances the clock by dt and sets the light's intensity.
  • editorUpdate(dt): does the same while engine.paused is true, so edit-running ticks it once per frame.