← All scene elements
SCENE ELEMENT / 13

Shader

Procedural surfaces and runtime-controlled uniforms.

LIVE WEB PLAYER

See it respond.

The same raylib runtime, compiled to WebAssembly. Load this example, inject MQTT messages and watch its published events.

Loading WebAssembly…
MQTT I/O
Waiting for runtime…

The browser requires a user action before the scene is loaded. Click Load demo scene first. MQTT is emulated and never leaves this page. Shaders are disabled in the web build; GPIO is hardware-only.

Full-rectangle fragment shader with configurable uniforms. Shader files are loaded from media/assets/.

Configuration

FieldDescription
typeshader
fileFragment shader filename
pos, sizeRender rectangle
uniformsObject of initial float/int/bool/vector values
time_uniformUniform automatically updated from runtime seconds
audio_amplitude_uniformUniform fed from global audio amplitude
audio_progress_uniformUniform fed from audio progress 0..1
audio_active_uniformInteger uniform indicating active audio

Copy-and-paste JSON

json
{
  "type": "shader",
  "id": "starfield",
  "file": "stars.fs",
  "pos": [0, 0],
  "size": [1920, 1080],
  "uniforms": {
    "speed": 1.5,
    "star_density": 0.5,
    "brightness": 0.8
  },
  "layer": 0
}

MQTT

text
ergs/rpi01/update/starfield              {"speed":2.0,"brightness":1.0}
ergs/rpi01/cmd/starfield/uniform/speed    2.0
ergs/rpi01/cmd/shader/uniform/speed       2.0
ergs/rpi01/cmd/__shader__/uniform/speed   2.0