Log in

View Full Version : funny "night vision" effect


feisty2
1st October 2015, 16:28
so I was like, writing something like dither_limit_dif16, but different from that, like, an alternative but works differently more or less, anyway, it's called "thr_merge"

AND, I haphazardly found it could be used to do some real chilling night vision stuff besides, like, dither_limit_dif16 sort of thing


import vapoursynth as vs
core = vs.get_core()

def thr_merge (flt, src, ref=None, thr=0.0009765625, elast=None):
ref = src if ref is None else ref
elast = thr / 2 if elast is None else elast
BExp = ["x {thr} {elast} + z - 2 {elast} * / * y {elast} z + {thr} - 2 {elast} * / * +".format (thr=thr, elast=elast)]
BDif = core.std.Expr (src, "0.0")
PDif = core.std.Expr ([flt, src], "x y - 0.0 max")
PRef = core.std.Expr ([flt, ref], "x y - 0.0 max")
PBLD = core.std.Expr ([PDif, BDif, PRef], BExp)
NDif = core.std.Expr ([flt, src], "y x - 0.0 max")
NRef = core.std.Expr ([flt, ref], "y x - 0.0 max")
NBLD = core.std.Expr ([NDif, BDif, NRef], BExp)
BLDD = core.std.Expr ([PBLD, NBLD], ["x y - 0.5 +"])
BLD = core.std.MergeDiff (src, BLDD)
UDN = core.std.Expr ([flt, ref, BLD], ["x y - abs {thr} {elast} - > z x ?".format (thr=thr, elast=elast)])
clip = core.std.Expr ([flt, ref, UDN, src], ["x y - abs {thr} {elast} + < z a ?".format (thr=thr, elast=elast)])
return clip

clp = rule6
clp = core.std.ShufflePlanes(clp, planes=0, colorfamily=vs.GRAY)
clp = core.fmtc.bitdepth(clp, fulls=False, fulld=True, bits=32, flt=True)
clp2 = core.std.Expr (clp, "0.0")
clp = thr_merge (clp,clp2,thr=0.5, elast=0.32)
clp.set_output ()


before & after
http://i.imgur.com/Fl33z4r.png
http://i.imgur.com/LgNZQr6.png

guess Sparktank's gonna dig this, like, yeah, make the shit reeeeeaaaal tripppppy

and, here's to my first thread as a college freshman

Sparktank
2nd October 2015, 05:00
guess Sparktank's gonna dig this, like, yeah, make the shit reeeeeaaaal tripppppy

:devil: You bet!

"night vision" alone cought my eye and then after seeing who posted.
There's a lot of peeps here who have a lot of fun discovering things.
Almost as if you guys all sit around the same Newton Tree waiting for that special apple ;)

I will definitely mark all this down and have a good look at it later.

Im still trying to consolidate all my archives of avisynth-related material into one location and remove outdated stuff.

one day I will really crack down on all the fun stuff here and make a compilation trailer to showcase avisynth. :devil::devil:

feisty2
2nd October 2015, 05:41
Im still trying to consolidate all my archives of avisynth-related material into one location and remove outdated stuff.

one day I will really crack down on all the fun stuff here and make a compilation trailer to showcase avisynth. :devil::devil:

it's a vaporsynth thing and... I'm not saying avisynth sucks but, vaporsynth is better in so many ways, like Expr here, takes up to 26 inputs and the RPN tool for avisynth (masktools) takes up to 3 inputs and nothing more than 8bits (Expr takes 8bits/16bits or even 32bits float), and people should at least try to switch to vaporsynth, and if that doesn't work so well, still no sweat to go back to avisynth

Sparktank
2nd October 2015, 07:23
DGdecNV recently got vs included, so this should be an excellent time to switch and try things out.

I've already got a lot of the vs plugins downloaded and ready to set up.

wonkey_monkey
2nd October 2015, 19:53
I'm not saying avisynth sucks but...

Oh, now it's on! ;)

What you've accidentally done is to implement something similar to solarisation (https://en.wikipedia.org/wiki/Solarisation).

Quick Avisynth approximation:

a=[source]
b=overlay(a,a,mode="multiply").levels(0,1,224,0,255)
c=overlay(a,b,mode="subtract")