Avisynth mfToon

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

mfToon darkens and sharpens the outlines of cartoons and anime. It is the classic line-darkening script by mf and is slow.

Filtering → Avisynth → Line → Darkening

mfToon controls in Hybrid
mfToon controls in Hybrid

What it does

mfToon builds a line mask with edge detection tuned for drawn lines and darkens the lines under it. Optionally it sharpens the picture (XSharpen on a supersampled copy) and warps the chroma towards the luma edges with aWarpSharp, so colour does not bleed over the outlines.

Typical uses:

  • Strengthen weak outlines in old or soft animation.
  • Use Show to see which lines would be darkened.
  • For a faster result try FastLineDarken.

The filter works on progressive material.

Settings

Control Parameter Range Hybrid default Meaning
Super sampling factor (w/h) ssw / ssh 0–1000 4 / 4 Supersampling factor for the line detection, horizontal and vertical.
Strength strength 0–255 255 Line darkening strength.
Show show on/off off Paint the lines that would be darkened in magenta instead of darkening them. The sharpen pass is switched off too.
Sharpen sharpen on/off on Apply the XSharpen pass.
Sharpen strength / threshold xstren / xthresh 0–255 255 / 255 XSharpen strength and threshold. Only available with Sharpen on.
Detail range / boost drange / dboost 0–255 / 0.1–100 64 / 1.0 Range and boost of the detail that is protected from darkening.
Chroma warping cwarp on/off on Warp chroma towards the luma edges with aWarpSharp.
Warp depth / blur / threshold wdepth / wblur / wthresh 0–100 / 1–100 / 0.0–1.0 16 / 1 / 0.5 aWarpSharp depth, blur level and threshold. Only available with Chroma warping on.
Debug debug, doutput on/off off Show the processing stage "rclip1" with an overlay of the settings.

Example

Default settings on a 10-bit YUV 4:2:0 source. Hybrid converts to 8 bit and back:

# Converting from 10 to 8bit for mfToon
ConvertBits(8)
mfToon()
# Converting from 8 to 10bit for encoder
ConvertBits(10)

How Hybrid calls it

  • The mfToon script is loaded together with masktools2, aWarpSharpMT and warpsharp.
  • Only parameters that differ from the defaults are written.
  • The script only accepts 8-bit YV12. Hybrid converts other input to 8 bit YV12 and back to the original bit depth afterwards.
  • mfToon also offers the common options and can be added to the filter queue several times.

Background

  • "mfToon v0.52 by mf". The version used here is modified to use masktools2 instead of the old YV12Layer function. The author asks that it is not claimed as one's own work.
  • It relies on the old aWarpSharp (warpsharp.dll), XSharpen, UnsharpMask and BicubicResize.
  • The script has more parameters (twidth, theight, dlimit, scolor, dclip). Hybrid does not offer them.
  • The masktools2 port is discussed on Doom9: thread 170439.

Sources

See also: Avisynth mToon, Avisynth Hysteria, Vapoursynth Toon