Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th October 2012, 22:41   #1  |  Link
matfra
Registered User
 
Join Date: Jul 2009
Posts: 111
Bloom Effect

Can someone tell me a good script to apply bloom effect.
Im looking for a very fast script. All I found on internet work slow.
matfra is offline   Reply With Quote
Old 27th March 2013, 16:22   #2  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
This is the fastest I have.
Runs 30 fps on 1.6 ghz core 2 duo in realtime (Resize a 720p to 480p)

code:

##########################
#toon and some bloom(experimental)#
##########################
spline16resize(720,480)

ConvertToYV12()

Q = mt_lutxy(gaussresize(width/4,height/4,2,2,-2,-2,p=1)
\ .bilinearresize(last.width,last.height,1,0)
\ , expr="x y - abs -0.50 * x +"
\ ,vexpr="x y - abs +1.00 * x +",V=3,U=3,Y=3)

mt_lut(bilinearresize(width/18,height/12,26,12,-26,-12)
\ .fastgaussblur(96)
\ .bilinearresize(last.width,last.height)
\ ,yexpr="x y - abs +1.5 * x +" ,uexpr="x y - abs -1.0 * x y +",vexpr="x y - abs +1.0 * x y +",Y=3,U=3,v=3)

G = last

BLEND_MT_ALPHA2(Q,G,BLmode = "lighten", OPAC = 0.25,cmode=3)

ColorYUV(gain_y=0, off_y=10, gamma_y=0, cont_y=80)
MJLives12 is offline   Reply With Quote
Old 6th April 2013, 03:58   #3  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
ColorBloom (make old gameplay videos look like current gen with glow effects) copy and paste in avsi file put it in Avisynth plugin directory folder :

Code:

Function ColorBloom_MT (clip Last, int "radius", int "min", int "max", float "sat") {

radius = Default (radius, 5)
edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4)
min = Default (min, 254)
max = Default (max, min + 1)
sat = Default (sat, 128)

ConvertToYV12

blm = Mergeluma(last, Levels(min, 1, max, 0, 235, false), 1)
\ .GaussResize(width/edges,height/edges,p=1)
\ .BilinearResize(width,height)
\ .ColorYUV(cont_u=sat,cont_v=sat)
\ .Levels(1, 1, 75, 0, 255, false)
bloommask = MT_Lutxy(Merge(blm
\ ,BlankClip(blm,color_yuv=$FF8080),0.5)
\ ,yexpr="x y > x y"
\ ,uexpr="x 255 == x 255 y y * 255 x - / min ?"
\ ,vexpr="x 255 == x 255 y y * 255 x - / min ?"
\ ,chroma="process",Y=3,U=3,V=3)

MT_Merge (last, bloommask, blm,luma=true,chroma="process") #set luma to true because chroma looks rough.


}


Just experimenting,feel free to edit, Have fun!

Last edited by MJLives12; 4th May 2013 at 00:56. Reason: Rename to colorbloom with few changes
MJLives12 is offline   Reply With Quote
Old 6th April 2013, 04:01   #4  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
Faster script (actionman133 Glow script, used with MT_Merge, because my comp is slow), copy and paste in avsi file put it in Avisynth plugin directory folder :

Code:

Function FastGlow (clip Last, int "radius", int "min", int "max") {

radius = Default (radius, 5)
edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4)
min = Default (min, 254)
max = Default (max, min + 1)

Mask = ConvertToYV12 ().Levels (min, 1, max, 0, 255, false)
Mask = Mask.AddBorders (edges, edges, edges, edges).FastGaussBlur(24).Crop (edges, edges, edges * -1, edges * -1).Levels (0, 1, 127, 0, 255, False)
White = Blankclip (Mask).Invert ("Y")

MT_Merge (last,White,mask,luma=true) #Similar to overlay but no strings

}

Feel free to edit have fun!

Last edited by MJLives12; 4th May 2013 at 00:52. Reason: Credentials
MJLives12 is offline   Reply With Quote
Old 6th April 2013, 04:06   #5  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
Toon (Experimental) and Color Glow(Experimental) copy and paste in avsi file put it in Avisynth plugin directory folder :

Code:

Function ToonWGlow (clip Last, int "radius", int "min", int "max", int "opacity") {

radius = Default (radius, Round (Width / 120.0))
edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4)
min = Default (min, 254)
max = Default (max, min + 1)
opacity = Default (opacity, 1.0)

Mask = ConvertToYV12 ().Levels (min, 1, max, 0, 255, false) #Copied from Glow.avsi
Mask = MT_Lutxy( Mask.AddBorders (edges, edges, edges, edges).FastGaussBlur(24).Crop (edges, edges, edges * -1, edges * -1) #Copied from Glow.avsi
\ ,yexpr="x y - abs -0.3 * x +"
\ ,uexpr="x y > x y ?"
\ ,vexpr="x y > x y ?"
\ ,chroma="process",Y=3,U=3,V=3)

White = ColorYUV(Mask,cont_u=opacity,cont_v=opacity).sharpen(0.5)

MT_Merge (Last, White, mask,luma=true,Y=4,U=4,V=4)

}
MJLives12 is offline   Reply With Quote
Old 6th April 2013, 22:37   #6  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
Hint:
Code:
White = Blankclip (Mask).Invert ("Y")
For a static clip is slow, each requested frame starts with a static black frame and calculates a new white frame.

This simply returns a static white frame with no calculation involved.
Code:
White = Blankclip (Mask, Color=$FFFFFF)
You can also use the Colour_YUV option to specify non-gamut yuv values.
IanB is offline   Reply With Quote
Old 28th April 2013, 04:37   #7  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
Glow for 1.6 ghz dual cpu

Cool I'll try color_yuv

White Light (using resize method,also taking from glow script,good for 30 fps source 720X480p I have slow cpu) copy and paste in code save as Bloom(or any name).avsi put it in Avisynth plugin directory folder :

Code:

Function Bloom_MT (clip Last, int "radius",int "min", int "max",int "sat") {

radius = Default (radius, 5)
edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4)
min = Default (min, 254)
max = Default (max, min +1)

Mask = ConvertToYV12 ().Levels(min, 1, max, 0, 255, false)

Mask = Mask.GaussResize(width/edges,height/edges,p=1)
\ .BilinearResize(width,height)
white = Blankclip (Mask,color_yuv=$FF8080) #Ultra White (BlankClip forum)

MT_Merge (last,White,mask,luma=true)


}

Example :

Bloom_MT(min=200,max=235)

Also ToonWGlow (edited)

Code :

Function ToonWGlow (clip Last, int "min", int "radius", int "max", int "sat",int "blr", bool "luma") {

radius = Default (radius, 1)
edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4)
min = Default (min,254)
max = Default (max, 255)
max = Round (max * 219 / 255.0) + 16
sat = Default (sat, 2)
blr = Default (blr, 24)
luma = Default (luma, true)

ConvertToYV12

blm = MT_Lutxy(AddBorders (edges ,edges ,edges ,edges)
\ .FastGaussBlur(blr).Crop (edges, edges, -edges, -edges)
\ .Tweak(sat=sat)
\ ,yexpr="x y - abs -0.5500 * x +"
\ ,uexpr=" y 128 < x y * 128 /"
\ ,vexpr=" y 128 < x y * 128 /",Y=3,U=3,V=3)

bloommask = MergeChroma(last,blm.Levels (min, 1, max, 0, 255, false),1)



MT_Merge (last, blm, bloommask,Y=4,U=3,V=3,luma=luma)

}

Example (with bloom_mt applied) :

Q = Bloom_MT(min=200,max=235)

ToonWGlow(Q,radius=10,min=235,max=200,blr=92,luma=true,sat=2)



Feel free to edit have fun!
Attached Images
 

Last edited by MJLives12; 28th April 2013 at 06:07. Reason: Change tweak
MJLives12 is offline   Reply With Quote
Old 19th June 2013, 05:35   #8  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
Bloom effect with modes

Code :

Function CBloom_MT (clip Last, int "threshold", int "edges", int "radius"
\ , int "min", int "max", int "thresholds", string "mode", float "opacity") {

radius = Default (radius, Round (Width / 120.0))
edges = Default (edges, Round (Width / 120.0))
min = Default (min, 254)
max = Default (max, min +1)
threshold = Default (threshold, 250)
threshold = Round (Threshold * 219 / 255.0) + 16
thresholds = Default (thresholds, 128)
mode= Default(mode, "lighten")
opacity = Default (opacity, 0.5)

cbloom1 = YLevelsC(min, 1, max, 0, 255)
\ .GaussResize(width/radius,height/radius,p=1)
\ .BilinearResize(width,height,1,0)

bloommask = cbloom1.Levels (16, 1, threshold, 0, 255, false)

Overlay (last, MT_lutxy(bloommask
\ .ColorYUV(cont_u=thresholds,cont_v=thresholds)
\ ,yexpr="256 300 x - 256 y - * 256 / -"
\ ,uexpr=" y 128 < x y * 128 /"
\ ,vexpr=" y 128 < x y * 128 /"
\ ,Y=3,U=3,V=3), mask = cbloom1,mode=mode,opacity=opacity)

}



Copied from bloom effect but using gaussresize and mt_lutxy for color enhancement, example:

CBloom_MT(radius=12,min=127,max=250,threshold=100,thresholds=128,mode="blend",opacity=1) #720 X 480 size

and oh, feel free to edit.
MJLives12 is offline   Reply With Quote
Old 19th June 2013, 16:49   #9  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 360
Quote:
Originally Posted by MJLives12 View Post
Feel free to edit.
How about the [code] tag...

Code:
function CBloom_MT(clip c, int "Threshold", int "Edges", int "Radius", int "Min", int "Max", int "Thresholds", string "Mode", float "Opacity")  {
        c
        Radius     =       default(Radius    , round(Width / 120.0))
        Edges      =       default(Edges     , round(Width / 120.0))
        Min        =       default(Min       , 254                 )
        Max        =       default(Max       , Min + 1             )
        Threshold  = round(default(Threshold , 250) * 219 / 255.0  ) + 16
        Thresholds =       default(Thresholds, 128                 )
        Mode       =       default(Mode      , "lighten"           )
        Opacity    =       default(Opacity   , 0.5                 )

        CBloom1   = YLevelsC(Min, 1, Max, 0, 255).GaussResize(Width / Radius, Height / Radius, P=1).BilinearResize(Width, Height, 1, 0)
        BloomMask = CBloom1.Levels(16, 1, Threshold, 0, 255, false).ColorYUV(Cont_U=Thresholds, Cont_V=Thresholds)

        Overlay(MT_LUTxy(BloomMask, YExpr="256 300 x - 256 y - * 256 / -", UExpr="y 128 < x y * 128 /", VExpr="y 128 < x y * 128 /", Y=3, U=3, V=3), Mask=CBloom1, Mode=Mode, Opacity=Opacity)
}

Last edited by creaothceann; 19th June 2013 at 16:52.
creaothceann is offline   Reply With Quote
Old 19th June 2013, 17:01   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,904
Agreed, much more readable.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is online now   Reply With Quote
Old 30th June 2013, 16:13   #11  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
bloom effect

Thx
MJLives12 is offline   Reply With Quote
Old 26th July 2013, 01:58   #12  |  Link
MJLives12
Registered User
 
Join Date: Mar 2012
Posts: 29
'80s neon effect (experimental, using bloom with chroma)

Try this one, I took the bloom script with box blur and added fps for stabilize speed to make real time possible! Also I use r g b adjust chroma and luma to get neon effect (which I'm experimenting)
Code:
Function CBloom (clip Last, int "min", int "max", int "threshold", int "radius", float "sat", float "cfps", float "afps") {

LoadVirtualDubPlugin("C:\Program Files\AviSynth 2.5\plugins\BoxBlur.vdf", "BoxBlur")
radius = Default (radius, Round (Width / 120.0))
min = Default (min, 200)
max = Default (max, min +1)
threshold = Default (threshold, 250)
threshold = Round (Threshold * 219 / 255.0) + 16
sat = Default (sat, 2)
cfps = Default (cfps, 25)
afps = Default (afps, 25)

ChangeFps(cfps)

Assumefps(afps)

cbloom = YLevelsG (min, 1, max, 0, 255)
cbloom = cbloom.ConvertToRGB ().RGBAdjust (sat,sat,sat)
\ .BoxBlur (radius, 3, 1000).ConvertToYV12 ()
\ .Levels (0, 0.8, threshold, 0, 235, false)
MT_lutxy (cbloom
\ , uexpr=" y 128 < x y * 128 /"
\ , vexpr=" y 128 < x y * 128 /", Y = 2, U = 3, V = 3)
bloommask = BlankClip (cbloom).Invert ("Y")

MaskedMerge (last, bloommask, cbloom)


}
CBloom (radius=12, sat=3,threshold=127)

enjoy

Last edited by MJLives12; 26th July 2013 at 02:03. Reason: Rename script
MJLives12 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:03.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.