← f_ notebook · docs/f-reference/f_tone_curve.md

f_tone_curve — Bpatcher Spec ​

Last updated: 2026-11-06Status: Working

Concept ​

Quick tonal shaping: brighten or darken shadows, mids and highlights separately. Each pixel's luma (Rec. 601) picks its band, and the band's dial is added equally to R, G and B, then clamped to 0-1; alpha passes through. The low_mid and mid_high breakpoints define the band boundaries (set on the two-handle slider or the numboxes; swapped handles are sorted); edge_falloff softens transitions between bands. All defaults are neutral, so the output equals the source until a dial moves.

It is not a curve editor (see References). At edge_falloff 0, the default, the bands meet at a hard step, so different lifts on either side leave a visible contour at the crossover (inferred from the codebox, not run; smoothstep with equal edges is undefined in GLSL).

Parameters ​

NameTypeRangeDefaultDescription
bypasstoggle0/10Native @bypass: passes the raw input texture. The codebox's Param bypass mix does not run from the toggle (G-bypass-native)
shadowsfloat-1 to 10Lift added to shadow tones
midtonesfloat-1 to 10Lift added to midtones
highlightsfloat-1 to 10Lift added to highlights
edge_fallofffloat0-10Softness of transitions between tonal bands
low_midfloat0-10.33Breakpoint between shadows and midtones
mid_highfloat0-10.67Breakpoint between midtones and highlights

Signal Chain ​

in0 (texture + control) → routepass jit_gl_texture jit_matrix → jit.gl.pix @name tone_curve @type char → out0

One inlet; the texture is required. There is no vs_inState, no vs_black fallback and no r draw, so the incoming texture is the only thing that triggers the pix: nothing connected means no output. @type char means 8-bit output, so a float input is quantized and clamped here.

Parameters routed via route bypass shadows midtones highlights edge_falloff low_mid mid_high; anything else goes to the pix.

Loose Threads ​

  • Bypass stays native (Matt, 2026-11-06; G-bypass-native). For a texture processor the visible result is the same source passthrough.
  • Uses the same low_mid / mid_high / edge_falloff parameters as f_luma_processor, but with different defaults (this module's edge_falloff default is 0.0, while luma_processor's is 0.1); consider whether these should always match when used in sequence.

References ​

The three-band smoothstep lift implemented here is an original construction; no external source was consulted. Despite the name, it is not a curve editor -- ideas/lut_curve_and_color_controls.md records both the naming critique and the dependent-texture 1x256 LUT successor design (flagged by Matt as "wants this pursued for real").

See docs/f-reference/f_tone_curve.md (this file) for the full parameter reference; see the ideas file for the LUT direction.

Source File ​

package/patchers/f_tone_curve.maxpat