makepad/apps/vj/resources/effects/155_trans_alpha_layer.splash
Admin cb49b032df vjfx: 104 presets, engine hooks + hold stage, the videomesh engine, the audio picture, livecodable effects, and mp4 thumbnail sheets
Squashed from work; the fine-grained history is under tag archive/work-2026-08-26:
- vjfx: 104 new presets — the transition lane fills out and the screen family goes wide
- vjfx: three lanes land — engine hooks + hold stage, the videomesh engine, and the audio picture
- vj: the thumbnail pipeline becomes one honest machine, and effects go livecodable
- vj: thumbnails become mp4 — hardware-coded sheets at measured-4K cells, and the bake stops racing the GPU
- store: the ceremony dies — batch publish, one transaction, and the engine stops re-reading its own log
- store: the ceremony dies — batch publish, one transaction, and the engine stops re-reading its own log
- vj: the console grows real transports, and the deck stops lying about reverse
- vj: reverse earns a memory, and the effects stop aging
- fab: a 3D creation shell and the viewer built on it
2026-08-26 08:49:48 +02:00

30 lines
1.2 KiB
Text

// ALPHA LAYER — deck B composites over deck A using B's OWN ALPHA
// channel as the per-pixel key, like laying a clip with real transparency
// on top of the program instead of a flat crossfade. OPACITY scales the
// whole layer, GAMMA bends B's alpha curve before it gates, PREMULT
// un-premultiplies B's colour by its own alpha first (off by default).
{
name: "Alpha Layer"
engine: "transition"
engage: "ramp"
p0: 1.0 p1: 0.5
dials: [
{name: "OPACITY", bind: "p0", default: 1.0},
{name: "GAMMA", bind: "p1", default: 0.5},
{name: "PREMULT", bind: "p2", default: 0.0}
]
shader: draw.DrawVjFxDuo {
trans: fn(uv: vec2, t: float) -> vec4 {
let a = self.deck_a(uv)
let b = self.deck_b(uv)
let curve = pow(4.0, self.user.y * 2.0 - 1.0)
let ba = pow(clamp(b.w, 0.0, 1.0), curve)
let opacity = self.user.x * clamp(t, 0.0, 1.0)
let k = ba * opacity
let unmult = b.xyz / max(b.w, 0.05)
let bc = b.xyz.mix(unmult, step(0.5, self.user.z))
let composite = a.xyz.mix(bc, k)
return vec4(composite.x, composite.y, composite.z, 1.0)
}
}
}