View Full Version : Bloom Effect
matfra
20th October 2012, 22:41
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.
MJLives12
27th March 2013, 16:22
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
6th April 2013, 03:58
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!
MJLives12
6th April 2013, 04:01
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! :)
MJLives12
6th April 2013, 04:06
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)
}
IanB
6th April 2013, 22:37
Hint: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.
White = Blankclip (Mask, Color=$FFFFFF)You can also use the Colour_YUV option to specify non-gamut yuv values.
MJLives12
28th April 2013, 04:37
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!
MJLives12
19th June 2013, 05:35
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.:D
creaothceann
19th June 2013, 16:49
Feel free to edit. :D
How about the 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)
}
StainlessS
19th June 2013, 17:01
Agreed, much more readable.
MJLives12
30th June 2013, 16:13
Thx :)
MJLives12
26th July 2013, 01:58
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)
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
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.