Thread: Toon-v0.8x
View Single Post
Old 26th April 2007, 17:13   #2  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
Nice, I'll test the function if I find the time for it.

This is my older toonmodification (basic idea but different code):
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
}

Last edited by MOmonster; 26th April 2007 at 17:16.
MOmonster is offline   Reply With Quote