View Full Version : Toon-v0.8x
Soulhunter
25th April 2007, 16:43
# Toon v0.8
#
# req: MaskTools151, aWarpSharp
function Toon(clip input) {
input.Expand().Inpand()
Subtract(input,last)
Overlay(last, aWarpsharp(depth=32), mode="lighten")
lines = last
Inpand()
Levels(110,1,120,0,255,false)
Overlay(lines, BlankClip(last,color=$808080), mask=last)
Invert().Greyscale()
Subtract(input,last)
}
Looks familiar, but simplified... >.>
Bye
MOmonster
26th April 2007, 17:13
Nice, I'll test the function if I find the time for it.
This is my older toonmodification (basic idea but different code):
####################
## LineDarkenToon ##
####################
# LineDarkenToon use the idea of mf_toon (0.5) for linedarken.
# I wanted a really small fast code like FastLineDarken but with similar output like
# mf_toon and this is the result.
#
# needed filters:
# - WarpSharp
# - MaskTools v2
# - AWarpSharp
#
# Common parameters are sstrength, sdboost and srange.
# If speed is most important for you, test fast=true.
# With fast=true no edgemask will be created, just a simple fast weighting.
# But this looks imho still better than FastLineDarken.
function linedarken_toon(clip orig, float "sstrength", "sdboost", int "srange", "warpdepth", bool "fast")
{
###### parameters ######
sstr = string(default(sstrength, 180)/255.0)
srange = default(srange, 0)
sdboost = default(sdboost, 1.0)
wdepth = default(warpdepth, 8)
fast = default(fast, false)
###### filtering ######
sharp = orig.Unsharpmask(300, 4, 0)
orig.mt_edge(thy1=3,thy2=255,mode="prewitt",Y=3,V=1,U=1)
mt_lut("x "+string(srange)+" + 195 / 1.0 "+string(sdboost)+" / ^ 255 *",U=1,V=1).mt_inflate().mt_inflate().mt_inflate()
linemask = mt_lutxy(orig, last, yexpr="300 1 x 255 / - 255 y - * x 1.14 ^ + - "+sstr+" *", uexpr="x", vexpr="x")
fast==false ? mt_merge(orig, sharp, linemask, Y=3, U=2, V=2) :
\ mt_lutxy(orig,sharp,"x y < 40 y < | x y x - 1 x 255 / - 2 ^ * 1 y 128 / - 4 ^ * "+sstr+" * x + ?",U=2,V=2)
final = wdepth<=0 ? last : awarpsharp(last,cm=1,depth=wdepth,blurlevel=1)
return final
}
Soulhunter
5th July 2007, 21:12
As there's no feedback, lets make things a bit more interesting!
Here are some screenshots + a updated version...
Original:
http://img393.imageshack.us/img393/5643/deathnoteoriginalrn8.png
mfToon v0.32
http://img106.imageshack.us/img106/6610/deathnotemftoon032ji9.png
mfToon v0.45
http://img527.imageshack.us/img527/1769/deathnotemftoon045na7.png
mfToon v0.52
http://img527.imageshack.us/img527/8729/deathnotemftoon052wc4.png
vmToon v0.7
http://img106.imageshack.us/img106/2892/deathnotevmtoon07ne7.png
toon v0.81
http://img393.imageshack.us/img393/2007/deathnotetoon081jn3.png
The function:
# Toon v0.81
#
# changelog: fixed global darkening issue
# req: MaskTools151, aWarpSharp
function Toon(clip input) {
input.Expand().Inpand()
Subtract(last, input)
Overlay(last, aWarpsharp(depth=32), mode="darken")
lines = last
Expand()
Levels(130,1,140,0,255,false)
Overlay(BlankClip(last, color=$808080), lines, mask=last)
Greyscale()
Subtract(input, last)
}
Bye
shadowhaze
5th July 2007, 23:33
Looks very promising. I've been trying vmToon, but it seems extrememly slow - 5 to 6 FPS when running my aviscript in Virtual Dub (full processing mode, XVID output). My computer's fairly fast (AMD Brisbane AM2 @ 2.93Ghz + 1GB of DDR2 @ 840MHz) so I'm thinking there's either an error in my script (don't know how as it's very simple) or vmToon & Deen are just really slow.
Is this faster? I'd like to try it. I'm assuming I just need to
(1)copy this into notepad and label it .avsi
# Toon v0.81
#
# changelog: fixed global darkening issue
# req: MaskTools151, aWarpSharp
function Toon(clip input) {
input.Expand().Inpand()
Subtract(last, input)
Overlay(last, aWarpsharp(depth=32), mode="darken")
lines = last
Expand()
Levels(130,1,140,0,255,false)
Overlay(BlankClip(last, color=$808080), lines, mask=last)
Greyscale()
Subtract(input, last)
}
and (2) make sure I have masktools and awarpsharp. Is that right? I have MaskTools v2 - alpha 2. Will that work or should I use v 1.51?
OT: any suggestions on a good, but not painfully slow denoiser/smoother for anime? I'm currently using Deen "w3d", but I'm thinking there's others that are newer, better and faster. I've see positive comments about MVDegrain2, as well as PeachSmoother + VagueDenoiser.
Thanks for all your help. Definite newbie here, and I'm not good with software anyway (hardware's so much easier IMO)
shadowhaze
5th July 2007, 23:46
In case it helps, I've attached a jpg of a filtered frame [Deen("w3d",3,5,5), vmToon(strength=32)] vs. the raw image. vmToon seemed to work fine, but there's still a lot of noise left - especially for this section when in motion.
Also, I forgot to ask whether I need to use "ConvertToYV12()" before using Toon v.81 on an avi file.
Thanks again for your help.
Soulhunter
6th July 2007, 00:28
I'm assuming I just need to
(1)copy this into notepad and label it .avsi
...
and (2) make sure I have masktools and awarpsharp. Is that right? I have MaskTools v2 - alpha 2. Will that work or should I use v 1.51?
1. Right, or paste it in the script where you call it
2. You need MaskTools v 1.51
OT: any suggestions on a good, but not painfully slow denoiser/smoother for anime?
I mainly use...
- Deen [Ok and fast]
- DCTFun4b [Good and fast]
- FrFun7 [Good but slow]
- FFT3DFilter [Good but slow]
- FrFun3b [Very good but also very slow]
Bye
acrespo
6th July 2007, 01:42
As I understand to convert in Masktools 2.0 the script will be:
# Toon v0.82
#
# changelog: fixed global darkening issue
# req: MaskTools20, aWarpSharp
function Toon(clip input) {
input.mt_expand().mt_inpand()
Subtract(last, input)
Overlay(last, aWarpsharp(depth=32), mode="darken")
lines = last
mt_expand()
Levels(130,1,140,0,255,false)
Overlay(BlankClip(last, color=$808080), lines, mask=last)
Greyscale()
Subtract(input, last)
}
Didée
6th July 2007, 04:33
It won't go into my head why utilization of masktools won't go into mf's head.
Optimization plan:
- use masktools v2 (it should be forbidden to still use old v1.5 masktools for "new" scripts)
- compact the pedestrian combination of basic filters to the needed minimum
Stepwise:
Step 0.5: replace ex/inpand with mt_ex/inpand
(script posted by acrespo)
Step 1 (Step 0.5+0.5) : replace remaining filters with masktools' counterparts:
input.mt_Expand().mt_Inpand()
mt_MakeDiff(last, input)
mt_Logic(last, aWarpsharp(depth=32), "min")
lines = last
mt_Expand()
mt_Lut("x 130 - 255 140 130 - / *")
mt_Merge(BlankClip(last, color=$808080), lines, last)
mt_MakeDiff(input, last, U=2,V=2)
This also gets rid of unnecessary chroma plane operations.
Step 2: compact filterchain
Target is the Levels().Overlay() combo. This [1'clip'filter]+[3'clip'filter] can be expressed by one single [2'clip'filter], which is obviously cheaper.
input.mt_Expand().mt_Inpand()
mt_MakeDiff(last, input)
mt_Logic(aWarpsharp(depth=32), "min")
mt_LutXY(mt_Expand(),"y 130 < 128 y 140 > x x y 130 - 255 140 130 - / * * 128 255 y 130 - 255 140 130 - / * - * + 255 / ? ?")
mt_MakeDiff(input, last,U=2,V=2)
Note: After this change, the script is not pixel-identical to Toon v0.81 anymore. This is because the optimized version is more precise (rounding issues).
Speed comparison:
Used a tenfold "Toon().Toon().Toon...." combo, let render 500 frames, computed fps.
Toon v0.81: ~2.1 fps (100%)
Step 0.5. : ~2.85 fps (136%)
Step 1 : ~4.7 fps (224%)
Step 2 : ~4.9 fps (233%, and better rounding)
Olé !
Soulhunter
6th July 2007, 04:41
ROFL! Thanks Didée...
Cant await to see mf's reaction! ;D
Soulhunter
6th July 2007, 16:22
# Toon v0.82
#
# Idea by mf
# Speedups by Didee
#
# Req: MaskTools2, aWarpSharp
function Toon(clip input) {
input.mt_Expand().mt_Inpand()
mt_MakeDiff(last, input)
mt_Logic(aWarpSharp(depth=32), "min")
mt_LutXY(mt_Expand(),"y 130 < 128 y 140 > x x y 130 - 255 140 130 - / * * 128 255 y 130 - 255 140 130 - / * - * + 255 / ? ?")
mt_MakeDiff(input, last,U=2,V=2)
}
shadowhaze
6th July 2007, 18:41
Thanks Soulhunter & Didée!
Any instructions on how to change the parameters (strength, etc.)?
FWIW - even though I think it does a great job, I couldn't take vmToon's slow speed anymore so I'm trying a combination of FastLineDarken(strength=32,thinning=0) followed by LimitedSharpenFaster (Smode=3 (default??)). I'll compare withToon v0.82 later today or tomorrow.
Soulhunter - thanks for the smoother rec. I'm trying DCTFun4b(2,2) w/ VagueDenoiser instead of Deen.
DarkT
8th July 2007, 19:38
Toon v0.82 darkens a bit too much for my taste, vmtoon 0.7x allowed me better control of that - which isn't there anymore in 0.82.
Another thing which I don't like in 0.82 is the asharp's settings, I'v tried varying 16 to 32, to make the line thinner, but it creates jaggy edges, my solution was to use warpsharp(not the awarpsharp) with 128, that gave me better results - though I am not sure what the speed difference of awarpsharp and warpsharp is...
Anyway, thanks :).
MOmonster
9th July 2007, 07:35
@Soulhunter
Sorry for my late reaction. I tested the function and likes the idea. But yes, parameters are necessary: I modificated it to my needs:
function toon(input, float "str", int "l_thr", int "u_thr", int "wdepth", int "wlevel")
{
sstr = string(default(str,1.0))
lthr = string(128+default(l_thr,2))
uthr = string(128+default(u_thr,12))
ludiff = string(default(u_thr,12)-default(l_thr,2))
wdepth = default(wdepth,32)
wlevel = default(wlevel,2)
input.mt_expand().mt_inpand().mt_makediff(input)
mt_logic(last,last.aWarpsharp(depth=wdepth,blurlevel=wlevel,cm=0), "min")
mt_lutxy(last,last.mt_expand(),"y "+lthr+" <= 128 y "+uthr+" >= x "+uthr+" y - 128 * x y "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?")
return mt_makediff(input,last,U=2,V=2)
}
The parameters are:
str - strength (default: 1.0)
l_thr - lower thresh (default: 2)
u_thr - upper thresh (default: 12)
wdepth - warpdepth (default: 32)
wlevel - warplevel (default: 2)
With default settings it gives the same output as Didee´s speedup version.
@DarkT
Maybe it helps if to set the blurlevel=1. As far as I know warpsharp is a good amount slower than awarpsharp.
Prim3
10th July 2007, 06:01
Neat script. I like it. Are they the parameters for Toon v0.82?
foxyshadis
10th July 2007, 11:38
They're parameters for the edit that momonster just posted, not the original.
Warpsharp is definitely slower, almost one third of the speed.
MOmonster
11th July 2007, 10:56
If toon is still not fast enough, what about this:
###############
## Toon v0.82 edit ##
###############
# function created by mf
# support by Soulhunter ;-)
# ported to masktools v2 and optimized by Didee (0.82)
# added parameters and smaller changes by MOmonster (0.82 edited)
# toon v0.8 is the newest light-weight build of mf´s nice line darken function mf_toon
#
# needed filters:
# - MaskTools v2
# - AWarpSharp
#
# parameters:
# str - strength of the line darken 1.0
# l_thr - lower threshold for the linemask 2
# u_thr - upper threshold for the linemask 12
# wdepth - warping depth (awarpsharp readme) 32
# wlevel - warping level (awarpsharp readme) 2 (1 is faster)
# fast - gives better speed with only a little
# difference to the default output false
function toon(input, float "str", int "l_thr", int "u_thr", int "wdepth", int "wlevel", bool "fast")
{
sstr = string(default(str,1.0))
lthr = string(128+default(l_thr,2))
uthr = string(128+default(u_thr,12))
ludiff = string(default(u_thr,12)-default(l_thr,2))
wdepth = default(wdepth,32)
wlevel = default(wlevel,2)
fast = default(fast,false)
input.mt_expand().mt_inpand().mt_makediff(input)
mt_logic(last,last.aWarpsharp(depth=wdepth,blurlevel=wlevel,cm=0), "min")
fast==true ? mt_lut("x "+lthr+" <= 128 x "+uthr+" >= x "+uthr+" x - 128 * x x "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?") :
mt_lutxy(last,last.mt_expand(),"y "+lthr+" <= 128 y "+uthr+" >= x "+uthr+" y - 128 * x y "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?")
return mt_makediff(input,last,U=2,V=2)
}
With fast=true one filtering step is removed. And if you now set wlevel=1 you come into speed levels from FastLineDarken.
As foxyshadis said, they are parameters of my edit, but of course the edit works the same way as the original (that has no parameters), there are no other filter-calls than in Didee's version.
squid_80
11th July 2007, 14:37
Warpsharp is definitely slower, almost one third of the speed.
Slightly OT: Does anyone at all have any source code for aWarpSharp, or am I going to have to resort to drastic measures in order to try and make a x64 build?
Didée
11th July 2007, 15:28
Yes. :)
TheRyuu
11th July 2007, 16:51
How does it compare to FastLineDarkenMOD in both quality and speed?
Since I've found fast line darken (mod) it's the only thing I've ever used for line darkening since it's faster then anything I've found.
Since no one really ever used the sharpening part of vmtoon anyway :p
I use this:
FastLineDarkenMOD(thinning=0, strength=60)
#############################
# FastLineDarken 1.3 MT MOD #
#############################
#
# Written by Vectrangle, last update 12 Sept 04
#
# * requires mt_masktools v2
# * requires yv12 input
#
# Usage is FastLineDarken(strength, luma_cap, threshold, thinning),
# named parameters are supported eg FastLineDarken(thinning=0)
#
# Note that you must import this avs into your script using import("...\FastLineDarken.avs")
#
# Parameters are:
# strength (integer) - Line darkening amount, 0-256. Default 48. Represents the _maximum_ amount
# that the luma will be reduced by, weaker lines will be reduced by
# proportionately less.
# luma_cap (integer) - value from 0 (black) to 255 (white), used to stop the darkening
# determination from being 'blinded' by bright pixels, and to stop grey
# lines on white backgrounds being darkened. Any pixels brighter than
# luma_cap are treated as only being as bright as luma_cap. Lowering
# luma_cap tends to reduce line darkening. 255 disables capping. Default 191.
# threshold (integer) - any pixels that were going to be darkened by an amount less than
# threshold will not be touched. setting this to 0 will disable it, setting
# it to 4 (default) is recommended, since often a lot of random pixels are
# marked for very slight darkening and a threshold of about 4 should fix
# them. Note if you set threshold too high, some lines will not be darkened
# thinning (integer) - optional line thinning amount, 0-256. Setting this to 0 will disable it,
# which is gives a _big_ speed increase. Note that thinning the lines will
# inherently darken the remaining pixels in each line a little. Default 24.
#
# Changelog:
# 1.3 - added ability to thin lines, now runs much slower unless thinning=0. Changed the defaults (again)
# 1.2 - huge speed increase using yv12lutxy =)
# - weird darkening issues gone (they were caused by yv12layer)
# - show option no longer available due to optimizations. Use subtract() instead
# 1.1 - added luma_cap option
# 1.0 - initial release
#
function FastLineDarkenMOD( clip c, int "strength", int "luma_cap", int "threshold", int "thinning")
{
## parameters ##
str = string(default(strength, 48) /128.)
lum = string(default(luma_cap, 191))
thr = string(default(threshold, 4))
thinning = default(thinning,24)
thn = string(thinning /16.)
## filtering ##
exin = c.mt_expand().mt_inpand()
diff = mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").mt_convolution("1 1 1","1 1 1",y=3,u=0,v=0)
thick = mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
thin = mt_lutxy(c.mt_expand(),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)
return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
}
Terranigma
11th July 2007, 17:14
Yes, that was the script I posted, here's an updated version that's a bit faster thanks to King Didée
##############################
# FastLineDarken 1.3x MT MOD #
##############################
#
# Written by Vectrangle
# Didée: - Speed Boost, Updated: 11th May 2007
#
# * requires masktools 1.5.1 -- http://jourdan.madism.org/~manao/
# * requires yv12 input
#
# Usage is FastLineDarken(strength, luma_cap, threshold, thinning),
# named parameters are supported eg FastLineDarken(thinning=0)
#
# Note that you must import this avs into your script using import("...\FastLineDarken.avs")
#
# Parameters are:
# strength (integer) - Line darkening amount, 0-256. Default 48. Represents the _maximum_ amount
# that the luma will be reduced by, weaker lines will be reduced by
# proportionately less.
# luma_cap (integer) - value from 0 (black) to 255 (white), used to stop the darkening
# determination from being 'blinded' by bright pixels, and to stop grey
# lines on white backgrounds being darkened. Any pixels brighter than
# luma_cap are treated as only being as bright as luma_cap. Lowering
# luma_cap tends to reduce line darkening. 255 disables capping. Default 191.
# threshold (integer) - any pixels that were going to be darkened by an amount less than
# threshold will not be touched. setting this to 0 will disable it, setting
# it to 4 (default) is recommended, since often a lot of random pixels are
# marked for very slight darkening and a threshold of about 4 should fix
# them. Note if you set threshold too high, some lines will not be darkened
# thinning (integer) - optional line thinning amount, 0-256. Setting this to 0 will disable it,
# which is gives a _big_ speed increase. Note that thinning the lines will
# inherently darken the remaining pixels in each line a little. Default 24.
#
# Changelog:
# 1.3 - added ability to thin lines, now runs much slower unless thinning=0. Changed the defaults (again)
# 1.2 - huge speed increase using yv12lutxy =)
# - weird darkening issues gone (they were caused by yv12layer)
# - show option no longer available due to optimizations. Use subtract() instead
# 1.1 - added luma_cap option
# 1.0 - initial release
#
function FastLineDarkenMOD( clip c, int "strength", int "luma_cap", int "threshold", int "thinning")
{
## parameters ##
str = string(default(strength, 48) /128.)
lum = string(default(luma_cap, 191))
thr = string(default(threshold, 4))
thinning = default(thinning,24)
thn = string(thinning /16.)
## filtering ##
exin = c.mt_expand().mt_inpand()
diff = mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").RemoveGrain(20,-1)
thick = mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
thin = mt_lutxy(c.mt_expand(),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)
return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
}
Leak
15th July 2007, 19:44
Yes. :)
To drastic measures, that is - unless you can pry the sources out of MarcFD's hands... :(
np: The Orb - Assassin (The Oasis Of Rhythms Mix) (Assassin)
Didée
15th July 2007, 20:12
squid_80 posed a question of the form "either this or that". And since at least one of both possibilities is necessarily true, the only logical answer was "yes". :D
BTW, remember this (http://forum.doom9.org/showthread.php?t=87514)? ;)
OT @ Leak: Do you have TAFKAP in your playlist?
Leak
15th July 2007, 21:07
squid_80 posed a question of the form "either this or that". And since at least one of both possibilities is necessarily true, the only logical answer was "yes". :D
Believe me, I've wisecracked that way often enough to know it when I see it, but I just didn't think it was warranted here - wouldn't want to confuse squid_80 any more than neccessary... :D
OT @ Leak: Do you have TAFKAP in your playlist?
Nah, no ex-princes here... not quite my taste, basically... :)
(Although I probably should ditch my Orb-only playlist, which was caused by the arrival of "Orb Sessions Volume 2" on my doorstep, for something else... :))
np: The Orb - The Land Of Green Ginger (Bicycles & Tricycles)
squid_80
16th July 2007, 03:40
Believe me, I've wisecracked that way often enough to know it when I see it, but I just didn't think it was warranted here - wouldn't want to confuse squid_80 any more than neccessary... :DDon't worry, I got what I wanted (PM me if interested).
Soulhunter
3rd November 2007, 22:17
*cough* (http://forum.doom9.org/showthread.php?p=1061616#post1061616)
real.finder
24th April 2020, 00:32
## mToon Toon v0.82 edit
## 2020.04.23 HBD mod base on MOmonster edit
###############
# function created by mf
# support by Soulhunter ;-)
# ported to masktools v2 and optimized by Didee (0.82)
# added parameters and smaller changes by MOmonster (0.82 edited)
# toon v0.8 is the newest light-weight build of mf´s nice line darken function mf_toon
#
# needed filters:
# - MaskTools v2
# - AWarpSharp2
#
# parameters:
# str - strength of the line darken 1.0
# l_thr - lower threshold for the linemask 2
# u_thr - upper threshold for the linemask 12
# wdepth - warping depth (awarpsharp readme) 32
# wlevel - warping level (awarpsharp readme) 2 (1 is faster)
# fast - gives better speed with only a little
# difference to the default output false
function mtoon(input, float "str", float "l_thr", float "u_thr", int "wdepth", int "wlevel", bool "fast", bool "lite")
{
sisavs26 = !(VersionNumber() < 2.60)
sstr = string(default(str,1.0))
lthr = string(128+default(l_thr,2))
uthr = string(128+default(u_thr,12))
ludiff = string(default(u_thr,12)-default(l_thr,2))
wdepth = default(wdepth,32)
wlevel = default(wlevel,2)
fast = default(fast,false)
lite = default(lite,false)
input.mt_expand().mt_inpand().mt_makediff(input)
lite ? last : mt_logic(last,last.aWarpsharp2(depth=wdepth,blur=wlevel,chroma=1), "min")
fast==true ? sisavs26 ? mt_lut("x "+lthr+" <= 128 x "+uthr+" >= x "+uthr+" x - 128 * x x "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?", scale_inputs="allf", use_expr=2) : mt_lut("x "+lthr+" <= 128 x "+uthr+" >= x "+uthr+" x - 128 * x x "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?") : \
sisavs26 ? mt_lutxy(last,last.mt_expand(),"y "+lthr+" <= 128 y "+uthr+" >= x "+uthr+" y - 128 * x y "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?", scale_inputs="allf", use_expr=1) : mt_lutxy(last,last.mt_expand(),"y "+lthr+" <= 128 y "+uthr+" >= x "+uthr+" y - 128 * x y "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?")
return mt_makediff(input,last,U=2,V=2)
}
mToon since it base on MOmonster edit
kedautinh12
26th April 2020, 10:46
## mToon Toon v0.82 edit
## 2020.04.23 HBD mod base on MOmonster edit
###############
# function created by mf
# support by Soulhunter ;-)
# ported to masktools v2 and optimized by Didee (0.82)
# added parameters and smaller changes by MOmonster (0.82 edited)
# toon v0.8 is the newest light-weight build of mf´s nice line darken function mf_toon
#
# needed filters:
# - MaskTools v2
# - AWarpSharp2
#
# parameters:
# str - strength of the line darken 1.0
# l_thr - lower threshold for the linemask 2
# u_thr - upper threshold for the linemask 12
# wdepth - warping depth (awarpsharp readme) 32
# wlevel - warping level (awarpsharp readme) 2 (1 is faster)
# fast - gives better speed with only a little
# difference to the default output false
function mtoon(input, float "str", float "l_thr", float "u_thr", int "wdepth", int "wlevel", bool "fast", bool "lite")
{
sisavs26 = !(VersionNumber() < 2.60)
sstr = string(default(str,1.0))
lthr = string(128+default(l_thr,2))
uthr = string(128+default(u_thr,12))
ludiff = string(default(u_thr,12)-default(l_thr,2))
wdepth = default(wdepth,32)
wlevel = default(wlevel,2)
fast = default(fast,false)
lite = default(lite,false)
input.mt_expand().mt_inpand().mt_makediff(input)
lite ? last : mt_logic(last,last.aWarpsharp2(depth=wdepth,blur=wlevel,chroma=1), "min")
fast==true ? sisavs26 ? mt_lut("x "+lthr+" <= 128 x "+uthr+" >= x "+uthr+" x - 128 * x x "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?", scale_inputs="allf", use_expr=2) : mt_lut("x "+lthr+" <= 128 x "+uthr+" >= x "+uthr+" x - 128 * x x "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?") : \
sisavs26 ? mt_lutxy(last,last.mt_expand(),"y "+lthr+" <= 128 y "+uthr+" >= x "+uthr+" y - 128 * x y "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?", scale_inputs="allf", use_expr=1) : mt_lutxy(last,last.mt_expand(),"y "+lthr+" <= 128 y "+uthr+" >= x "+uthr+" y - 128 * x y "+lthr+" - * + "+ludiff+" / ? 128 - "+sstr+" * 128 + ?")
return mt_makediff(input,last,U=2,V=2)
}
mToon since it base on MOmonster edit
I don't see it in your github
real.finder
26th April 2020, 15:06
I don't see it in your github
https://github.com/realfinder/AVS-Stuff/blob/Community/avs%202.5%20and%20up/mToon.avsi
still didn't add these to master tree
ChaosKing
26th April 2020, 17:22
Is master or community = stable?
real.finder
26th April 2020, 17:39
Is master or community = stable?
master = stable :sly:
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.