Skip to main content

Module shaders

Module shaders 

Source
Expand description

libplacebo user shaders (mpv .hook format) generated by ffcine.

Structs§

LookParams
Parameters of look: the prototype’s post-LUT grade (render.py grade_filters).

Functions§

alpha
Alpha for a crate::Layer: opacity times a rounded-rectangle mask with corner radius in layer pixels (antialiased over one pixel), as an OUTPUT hook. Both can be per-frame tracks.
background
A generated background replacing the picture (split-screen backdrop, render.py layout_bg): the colour bg_r/g/b, darkened towards the edges by 1 − vignette · ((1.5 (x − ½))² + (1.8 (y − ½))²).
finish
Per-shot finishing after the look, as one PREOUTPUT hook (the prototype’s post filters in render.py): darken (RGB multiplier), ffmpeg’s vignette (angle in radians; the factor is cos(angle · d)^4 with d the distance from the middle over the half diagonal, 0 past it), the shutter flash (lift: blacks raised towards white, out = lift + (1 - lift) in, as colorlevels romin), then a fade towards fade_r/g/b (fade 1 = the picture, 0 = the colour, ffmpeg’s fade on gamma-encoded values). fade and lift are per-frame tracks.
layer_alpha
Alpha for a comp layer (ffcine-comp, docs/compositing.md#placement): alpha’s opacity and rounded corners (radius, texture pixels), times a shape mask: shape 0 none, 1 rectangle, 2 ellipse, inside mask_x/y/w/h (fractions of the texture), with a soft edge feather texture pixels wide centred on the shape’s edge (antialiased over one pixel at 0), and invert (1 keeps the outside). radius and feather are horizontal texture pixels; ky is how many vertical texture pixels make one horizontal (a layer scaled unevenly). An OUTPUT hook; every value can be a per-frame track.
look
The prototype’s post-LUT chain as one PREOUTPUT hook (gamma-encoded RGB after the LUT), its parameters as //!PARAMs so every variant shares one compiled shader: exposure (stops, a gain in display-linear light, gamma 2.4), then colorbalance (rs/bs = ±0.4 w, rm = w, gm = −tint, bm = −w, rh/bh = ±0.6 w, pl=0, ffmpeg’s shadow/mid/highlight weights), then curves (y = x^(1/gamma), y −= contrast/π · ½ sin 2πy, y = lift + (gain − lift) y, evaluated exactly instead of through 17 spline points), then the Rec.709-luma saturation matrix.
motion_blur
Directional motion blur for whip transitions: blur output pixels along (dir_x, dir_y) (32 taps, box), a PREOUTPUT hook. blur is a per-frame track; 0 passes the picture.
solid
A solid colour layer’s picture (ffcine-comp): solid_r/g/b (gamma-encoded output values, as background) replacing the picture, a PREOUTPUT hook ahead of the finish.
unsharp
ffmpeg’s unsharp=5:5:amount (luma only) as a PREOUTPUT hook: after scaling and the LUT, on gamma-encoded RGB, where the CPU chain runs it. The 5x5 kernel is the separable binomial [1 4 6 4 1]/16 blur, out = in + amount * (in - blur) on BT.601 luma (what ffmpeg’s auto-inserted RGB -> YUV conversion uses); adding the same delta to R, G and B moves Y only.