Vapoursynth GradFun3Mod
GradFun3Mod removes color banding in flat gradients: it smooths, keeps real detail with an elastic threshold and an edge mask, and dithers the result back to the clip's bit depth.
Filtering → Vapoursynth → DeBand

What it does
The picture is smoothed (bilateral, DFTTest or multi-stage SmoothGrad). The change is then limited: differences up to Threshold are taken fully, differences up to Threshold × Elast fade out, larger ones keep the source. A detail mask built from the luma protects edges and texture. The script works at 16 bit internally and dithers back to the clip's bit depth at the end; this dithering (error diffusion, ordered or void and cluster, optionally with noise) keeps the gradient smooth after lossy compression.
Settings
| Control | Parameter | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Planes | planes | all, chroma only, Y, U, V, YU, YV | all | Planes that are filtered; the others are only rounded back without noise. |
| Threshold | thr | 0.10 – 10.00 | 0.35 | Strength in 8-bit units at any bit depth; higher is stronger, with more detail loss and edge artifacts. |
| Radius | radius | 1 – 100 (2 – 9 with SmoothGrad multi-stage) | 12 | Size of the smoothing. |
| Elast | elast | 1.00 – 10.00 | 3.0 | Width of the soft zone above the threshold in which changes fade out instead of being cut. |
| Smooth mode | smode | DFTTest, Bilateral, SmoothGrad multi-stage, DFTTest Mod, Bilateral GPU | Bilateral | Smoothing method. DFTTest Mod is the legacy dfttest variant of GradFun3mod. "Bilateral GPU" behaves like "Bilateral"; whether a GPU is used is chosen in Tools: Bilateral. |
| Dither mode | mode | ordered (Bayer), round to closest, round, Filter Lite (Sierra-2-4A), Stucki, Atkinson, Floyd-Steinberg, Ostromoukhov, void and cluster | Filter Lite | How the result is brought back to the clip's bit depth. |
| Dither amplitude | ampo | 0 – 10 | 1 | Strength of the dither pattern. |
| Noise amplitude | ampn | 0 – 10 | 0 | Extra noise added while dithering; 0 = off. |
| Pattern size | pat | 4, 8, 16, 32 | 32 | Pattern width for void and cluster dithering. |
| dynamic noise | dyn | on/off | off | The ordered dither pattern changes every frame. |
| static noise | staticnoise | on/off | off | The added noise is the same in every frame. |
| Debug | debug | on/off | off | Preview only: shows the detail mask instead of the result. |
| Tools: Expr | – | akarin, cranexpr, std | akarin | Expression plugin; akarin needs AVX2. |
| Tools: RG | – | zsmooth, neo_smo | zsmooth | RemoveGrain implementation. |
| Tools: DFTTest | – | neo_fft, dfttest2cpu, dfttest2, vszipcu, vsfeel | – | DFTTest implementation (DFTTest modes): dfttest2cpu needs AVX2, dfttest2 CUDA (Windows), vszipcu CUDA, vsfeel Vulkan. |
| Tools: Bilateral | – | vszip, vszipcl, vszipcu, vsfeel | – | Bilateral implementation (Bilateral modes): vszip on the CPU, vszipcl OpenCL, vszipcu CUDA, vsfeel Vulkan. |
| Tools: BoxBlur | – | vszip, std | vszip | Box blur implementation (SmoothGrad multi-stage). |
Example
Default settings on a 10-bit YUV 4:2:0 source (640x356):
# debanding using GradFun3
clip = deband.GradFun3(clip, tools={'expr': 'akarin', 'dfttest': 'neo_fft', 'bilateral': 'vszip', 'rg': 'zsmooth', 'boxblur': 'vszip'})How Hybrid calls it
- GradFun3Mod works on 8–16-bit integer YUV clips; other formats are converted first.
- Threshold and amplitudes are passed as entered; the script treats the threshold as 8-bit scale itself.
- With a GPU implementation chosen in Tools: Bilateral, both bilateral entries use the GPU bilateral (same strength as on the CPU); otherwise they use the CPU bilateral.
- Values are only written when they differ from the defaults, which are the script's and fmtconv's own.
- With a 16-bit clip the script does not dither back, so the dither settings have no effect.
- GradFun3Mod also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).
Background
Origin
GradFun3 comes from Firesledge's Dither package for AviSynth; Gebbi's GradFun3mod added the legacy dfttest mode. The VapourSynth version is based on the ports in fvsfunc and muvsfunc. The resizing options of the original (4:4:4 output, resizer, width/height) are not supported.
Dithering
The dither settings are those of fmtconv's bitdepth function. Pattern size only matters for void and cluster, dynamic noise only for ordered dither. fmtconv also knows a quasirandom mode, which Hybrid does not offer.
Sources
- fvsfunc (GradFun3 port)
- fmtconv documentation (bitdepth)
- VapoursynthScriptsInHybrid (the script collection Hybrid uses)
- Hybrid's tooltips