Skip to content

shader[n]

Your song's own shaders, four slots of them. Write a .fsh, or bring a .frag from a Psych mod as it is.

How to use it

shader[0] to shader[3] - set file and it runs, "" stops it. The file is a .fsh (MineFunkin's form: vec4 effect(vec2 uv)) or a Psych / Flixel .frag (taken as it is) in the song folder, its events/ or shaders/ folder. A .frag's own uniforms are set with setShaderFloat.

Whether shaders from a song run at all is the player's choice (Options › MineFunkin › Song effects): by default a server's song must pass MineFunkin's shader check, the player's own songs run freely. status says what became of a file.

How to write one: Your own shaders.

Example code

-- A shader from the song folder, faded in, its first number pulsing on the beat.
function onStart()
    shader[0].file = "shaders/ripple.fsh"
    shader[0].amount = 0
    tween(shader[0].amount, 1, beats(2))
end

function onBeat(b)
    shader[0].a = 1
    tween(shader[0].a, 0, beats(1), "quadOut")
end

Properties

Property Kind Default
shader[n].file text "" The shader file: .fsh or .frag, up to 32 KB. "" = off.
shader[n].target choice "screen" What it covers: "screen" (everything), "world" (only the world) or "terrain" (the …
shader[n].amount number 1 How much of it shows: 0 = none, 1 = all (it's blended over the picture).
shader[n].a number 0 A number for the shader: params.x in a .fsh.
shader[n].b number 0 A number for the shader: params.y.
shader[n].c number 0 A number for the shader: params.z.
shader[n].d number 0 A number for the shader: params.w.
shader[n].status text, read "off" What became of the file: "off" (no file), "loading", "active", "fight only" …

shader[n].file

text shader[n].file = ""

The shader file: .fsh or .frag, up to 32 KB. "" = off.

shader[n].target

choice shader[n].target = "screen"

What it covers: "screen" (everything), "world" (only the world) or "terrain" (the world without the fighters) - like fx.target. The last two in fights only.

One of: "screen", "world", "terrain" (what they do).

shader[n].amount

number shader[n].amount = 1

How much of it shows: 0 = none, 1 = all (it's blended over the picture).

shader[n].a

number shader[n].a = 0

kept at the song's end

A number for the shader: params.x in a .fsh.

shader[n].b

number shader[n].b = 0

kept at the song's end

A number for the shader: params.y.

shader[n].c

number shader[n].c = 0

kept at the song's end

A number for the shader: params.z.

shader[n].d

number shader[n].d = 0

kept at the song's end

A number for the shader: params.w.

shader[n].status

text shader[n].status = "off"

read only

What became of the file: "off" (no file), "loading", "active", "fight only" (target world / terrain outside a fight), "disabled" (the player switched song shaders off), "missing", "unreadable", "refused" (the shader check said no - the event log says why), "broken" (doesn't compile - the log has the driver's message), "too heavy" (switched off for this song: it took over 25 ms a frame).