Skip to Content
Starlight

Effect modules: shaders as data

An effect module is a shader effect saved as data: a small settings file and shader code. You use it in a layer's effect list like a built-in effect.

A module is a folder effects/<name>/ in the project. It holds effect.json (the name, the params, the passes) and the shader code: main.wgsl and main.glsl. The files hold only the inside of one function. Starlight writes all the code around it, so a module can only do maths on the pictures. It cannot read files or change your project. That is why a module needs no trust prompt.

  • Use it by its name in effects:, for example - ripple: { amount: 0.02 }.
  • When you save a file in the folder, Starlight loads the new version at once.
  • A module that breaks a rule, or that does not compile on this computer's graphics card, is not loaded. A line under the canvas says why, and the effect's box in the graph has a dashed outline. Layers that use it look plain.
  • The rules: each file at most 64 KB; no # lines, no while loops; every for loop counts to at most 256. The full list is in docs/effects.md.
  • A change to a module makes the pre-renders that use it stale.