Vapoursynth Toon

From wiki.selur.net
Jump to navigation Jump to search

Toon (v0.82 edit by mf, Soulhunter, Didée and MOmonster) is a lightweight line darkener for drawn material that sharpens its line signal with AWarpSharp2.

Filtering → Vapoursynth → Line

Toon controls in Hybrid
Toon controls in Hybrid

What it does

The difference between a grey-closed copy of the picture and the source marks the lines. This line signal is sharpened with AWarpSharp2, thresholded and scaled by Strength, and subtracted from the luma. Chroma is not changed.

Settings

Control Parameter Range / values Hybrid default Meaning
Strength str 0.01 – 10 1.0 How strongly lines are darkened.
Line threshold (l/u) l_thr / u_thr 0 – 99 / 1 – 100 2 / 12 Below the lower threshold nothing is darkened, above the upper one full strength is used, with a ramp in between (8-bit scale). Lower always stays below upper.
Blur blur 0 – 100 2 Blur passes on AWarpSharp2's edge mask.
Depth depth −128 – 127 32 AWarpSharp2 warp depth.
Tools: Expr – akarin, cranexpr, std akarin (std without AVX2) Expression evaluator.
Tools: Warp – warp, awarp warp AWarpSharp2 plugin, or AWarp with an emulated edge mask (not bit-identical).

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# line darkening using Toon
clip = linedarken.Toon(clip, tools={'expr': 'akarin', 'warp': 'awarp'})

How Hybrid calls it

  • Toon works on 8–16-bit integer YUV and gray clips; float clips are converted to an integer format first.
  • Values are only written when they differ from the defaults; Hybrid's defaults are the script's defaults.
  • The thresholds are scaled to the bit depth by the script, so 8- and 16-bit results are nearly identical.
  • Only the luma is processed; the chroma is copied back. The line signal is padded by 6 pixels before warping and cropped back afterwards.
  • Toon also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Sources