Log inGet started
World

Procgen Effects Showcase

Branchmain
Branchesmain
Commit99ff90d12c

README.md

fx_spark_mat

Additive glow material for the sparks of the energy-shield effect. ShieldFx.module resolves it by name in M.start and makes it the material of one of its GPU-instanced pools: a single draw whose instance transforms and lane data the module writes from Luau every frame. ShieldFxDriver on the ShieldDome entity in the fx_shield scene starts the effect and steps it each frame. This material's pool is "spark": up to 260 instances of a 6-sided tapered prism along +x with a pointed tail at x = 0 and a blunt head at x = 1, whose uv.x runs from tail to head. Each spark is stretched along its velocity (length 0.08 + 0.028 x speed, at most 0.75, width 0.075). Every impact sprays 22 or more sparks that live 0.55 to 1.85 s, and each incoming streak sheds shorter-lived sparks (0.25 to 0.6 s) from its head while in flight; lane 0 carries (age / life, 1, 0, 0).

Shader: fx_glow (fx_glow.shader). Its header describes one additive shader for every small emissive thing in the shield effect: form picks the look, and per-instance lane 0 carries (life 0..1, brightness, seed, 0). The forms are 0 tracer streak, 1 soft flare blob, 2 spark and 3 burning fragment. The output is the form's colour times brightness times gain, with alpha 1. For form 2 the heat is 1 - life; the colour is mix(color1, color2, heat^2), brighter toward the head of the streak and fading out with the heat.

Render state: blend: additive, cull: none, depth_write: false.

Properties

  • form: 2: selects the spark.
  • gain: 1.8: multiplier on the output.
  • color1: { r: 1.0, g: 0.35, b: 0.05, a: 1.0 }: colour of an aged spark.
  • color2: { r: 1.0, g: 0.95, b: 0.7, a: 1.0 }: colour of a new spark.