Log inGet started
World

Anvil Crown

Branchmain
Branchesmain
Commit0c3c8404d1

README.md

vfx — the storm you can see

The inside of the supercell: the cloud walls, the weather falling through it, the light it makes for itself, and the water on the canopy between the pilot and all of it.

local Vfx = require("game.vfx.vfx")

Requiring it is all the wiring there is. The module registers a system with the AnvilDirector from its own top level, sets A.claims.vfx (which stands the director's stand-in shaft down), and builds itself onto the scene's StormSky, StormBackdrop and StormNear anchors on the next tick. VfxHost.component is the component that does the requiring for a loaded scene — put it on one entity and the storm is live.

What it puts in the shaft

LayerWorld ZWhat it is
VfxCloudFar44the far wall of the shaft — solid weather with cloud structure on it
VfxCloudDeep32the body of the storm
VfxCloudMid18patchy cloud, the layer that carries most of the parallax
VfxBeams14volumetric shafts raked down from the top of the storm
VfxCloudVeil7thin cloud drifting just behind the play plane
VfxRainFar−4rain between the play plane and the camera
VfxHail−10hail — the CORE band's own weather
VfxRainNear−17the near sheet, big and fast

Each is a camera-facing slab fitted to its own distance and re-fitted whenever the window aspect moves, so the shaft always runs past the edge of the frame. Behind them, vfx_sky replaces the engine's default sky, which draws a ground plane and a horizon line straight across the middle of a shaft that has neither.

In front of everything, the anvil_storm_glass post-process carries the water on the canopy (beads that refract, streaks that lean with the crosswind), the distance haze that makes lost sight a real loss of depth, the strike, and the airframe's shake.

The one number: flash

Everything the strike touches reads one value — the max of A.rules.flash() (the storm slice's state.boltPower) and this module's own envelope, which it runs off the bolt bus event. A strike therefore lights the whole shaft whether the storm publishes its power through state, through the event, or through both. Until A.claims.storm is set, this module fires its own strikes on the storm's cadence constants, so the shaft is never a still picture.

Reading and driving it

Vfx.report()               -- built? layers, scroll, flash, band, post-process
Vfx.strike(power, x)       -- fire one strike (power 0..1, x in world units)
Vfx.holdFlash(0.45, -4.5)  -- pin the shaft at a flash value, for a capture
Vfx.holdFlash(nil)         -- hand the strike back to its own envelope
Vfx.rebuild()              -- rebuild the slabs on the next tick

What it owns

KeyLight and FillLight (colour and intensity, per band, lifted by every strike), the eight slabs above, the vfx_* materials and the storm_* shaders, and the anvil_storm_glass post-process. It does not touch BoltLight — the storm slice spikes that — the camera, or anything on the play plane.