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 15th April 2017, 07:52   #1  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Overlay Marker Masks, Work-In-Progress

This is a work currently in progress.

You are free to give advise or suggestions here.

Currently there are only a few functions working at all, they are liable to change args etc at any time.

The marker functions are intended to be used together with Overlay, as masks.

Some of the early posts are likely to be expanded if any functions are added, and I will deliberately use up several posts to reserve some space, as 16 KB max post in Usage Forum is a bit limiting.
__________________
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 ???

Last edited by StainlessS; 15th April 2017 at 09:58.
StainlessS is offline   Reply With Quote
Old 15th April 2017, 07:53   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
ResizePadded.avs, a utility function for use with the marker functions.

Code:
# ResizePadded.avs

Function ResizePadded(clip clp,Int W, Int H,
    \ Int "xMod",Int "yMod",
    \ Float "Bicub_b",Float "Bicub_c",
    \ Int "src_left", Int "src_top", Int "src_width", Int "src_height",
    \ Bool "Pad_Rec601"
    \ ) {
/*
    https://forum.doom9.org/showthread.php?t=174496
    Req RT_Stats, mt_Tools v2.0.

    Intended for downsize, where return clip dimensions are modulo xMod,yMod but some of result frame (right and bottom) may be padding,
    ie if resize to W=29,H=29, and xMod=4,yMod=4, then frame will be 32x32, x=0,y=0,w=29,h=29 is valid graphic, 
    but rightmost and bottom most 3 pixels are padding only. 
    For use where mask used to apply valid graphic using eg Overlay.
    Any Padding area will be returned as BLACK (0 for RGB or Y of YUV [not rec601 16 unless Pad_Rec601==True]).
    
    Args:-
      W,H        Output size for return clip 
                   Same colorspace as input clip, output may be Right and Bottom padded to Black, to comply with xMod,yMod requirement.
                    
      xMod,      Default = natural colorspace alignment requirement of input and output clips, 
      yMod         eg for YV411:- xMod=4,yMod=1. YV12:- xMod=yMod=2. YV16/YUY2:- xMod=2,yMod=1. Y8/YV24/RGB/24/32:- xMod=yMod=1.
            
      Bicub_b,   BicubicResize() b and c args. (If supplied as args, BEST SUPPLY BOTH Bicub_b and Bicub_c)          
      Bicub_c      Default:-  
                    DownSize b = -0.5, c = 0.25,  Groucho2004,Didée:- https://forum.doom9.org/showthread.php?p=1802716#post1802716
                    Upsize,  b =  0.0, c = 0.5,   Catmull-Rom spline, sharp.
                      Avisynth BicubicResize() defaults are:- b=1.0/3, c=1.0/3
                       
      src_left,  Source clip area to resize, all default 0, meaning full frame, as in Crop(0,0,0,0).                            
      src_top,               
      src_width, 
      src_height
      
      Pad_Rec601 Default False.
                   We normally return any YUV padding as Black Y=0, will change to padding Y = 16 if this set true.
                   NOTE, If using this function for resizing mask for use with overlay, you are UNLIKELY to
                     want to change this to True (you may get ghosts in your overlays).
                     If resizing a graphic intended for Overlay clip (together with a mask), then it probably makes little/no
                     difference whether you set Pad_rec601 to true or false. 
                   RGB padding is always returned as Black $000000.
*/
    clp                             myName="ResizePadded: "
    DefXmod = RT_ColorSpaceXMod     DefYmod = RT_ColorSpaceYMod(Laced=False)    # Natural ColorSpace alignment for input clip     
    xMod=Default(xMod,DefXmod)      yMod=Default(yMod,DefYmod)
    Assert(0 < xMod && xMod % DefXmod == 0, RT_String("%sIllegal xMod(%d, DefXMod=%d)",myName,xMod,DefXmod)) 
    Assert(0 < yMod && yMod % DefYmod == 0, RT_String("%sIllegal yMod(%d, DefYMod=%d)",myName,yMod,DefYMod)) 
    Bicub_b = Default(Bicub_b, (W<clp.Width) ? -0.5  : 0.0)
    Bicub_c = Default(Bicub_c, (W<clp.Width) ?  0.25 : 0.5)
    src_left = Default(src_left,0)  src_top = Default(src_top,0)    src_width = Default(src_width,0)    src_height = Default(src_height,0)
    Pad_Rec601 = Default(Pad_Rec601,False)
    Assert(0 <= src_left < Width, RT_string("%s0 <= src_left(%d) < Width(%d)",myName,src_left,Width)) 
    Assert(0 <= src_top < Height, RT_string("%s0 <= src_top(%d) < Height(%d)",myName,src_top,Height)) 
    src_width = (src_width  <= 0) ? width  - src_left + src_width  : src_width 
    src_height= (src_height <= 0) ? height - src_top  + src_height : src_height 
    Assert(0 < src_width  <= Width,  RT_String("%s0 < src_width(%d)  <= Width(%d)",myName,src_width,Width)) 
    Assert(0 < src_height <= Height, RT_String("%s0 < src_height(%d) <= Height(%d)",myName,src_height,Height)) 
    CanvasW=(W+xMod-1)/xMod*xMod    CanvasH=(H+yMod-1)/yMod*yMod    # O/P frame size (rounded up to next multiple of xMod,yMod if necessary)
    iPadR=CanvasW-W                 iPadB=CanvasH-H                 # O/P padding pixels (Right and Bottom)
    fPadR=Float(iPadR)*src_width/W  fPadB=Float(iPadB)*src_height/H # Fractional pixels to reach into source clip to achieve padding. 
    BicubicResize(CanvasW, CanvasH, b=Bicub_b, c=Bicub_c , 
            \ src_left  = src_left,        src_top    = src_top, 
            \ src_width = src_width+fPadR, src_height = src_height+fPadB
            \ )
    # Padding to BLACK : Cannot use LetterBox for YUV as will be set to Y=16 not Y=0 [Unless Pad_Rec601=True, then OK].
    Last = (0 == iPadR == iPadB) ? Last 
        \ : (IsRGB() || Pad_Rec601) ? Letterbox(0,iPadB,0,iPadR)
        \ : mt_merge(Last,
                \ Last.BlankClip(Color_Yuv=$008080),
                \ Last.mt_lutspa(relative=false,expr=RT_String("x %d >= y %d >= | 255 0 ?",W,H),chroma="-128"),luma=true)                          
    Return Last
}
__________________
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 ???

Last edited by StainlessS; 16th April 2017 at 23:57. Reason: Updated
StainlessS is offline   Reply With Quote
Old 15th April 2017, 07:57   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hit_Marker.avs, Intended for use via some kind of detector to show detection Hit, or Miss.
Code:
Function Hit_Marker(int W, Int H, Bool "Hit", Int "BW", Int "BH",Int "PW",Int "PH",Bool "YV12",Bool "Mod2") {
/*
    Req RT_Stats & mt_tools v2.     http://forum.doom9.org/showthread.php?t=174527
    Creates a marker mask WxH, for use with Overlay as Mask arg.    
    Intended for use via some kind of detector to show detection Hit, or Miss.     
    Returns Single frame clip with null audio, the marker top left hand side is aligned to 0,0.
            Default return clip colorspace is Y8 for Avisynth v2.6 and above, or YV12 if defunct version.
    Args:-
        W,H,    Size of marker mask (can be odd), return clip dimensions are rounded up to next multiple of 2 if YV12 return clip.
                  Bare minimum usable size is 4x4 with defaulted BW, BH, PW, PH.       
        HIT,    Default False, returns marker as angled corners (Thickness set by BW and BH).
                        True,  returns marker as angled corners + outer perimeter where perimeter thickness set by PW and PH.
        BW,     Default Max(W/8,1). Horizontal thickness of the marker corners.
        BH,     Default Max(H/8,1). Vertical   thickness of the marker corners.
        PW,     Default Max(BW/8,1). Horizontal thickness of the vertical perimeter.
        PH,     Default Max(BH/8,1). Vertical thickness of the horizontal perimeter.
        YV12,   Default False if Avisynth version 2.6 or greater(Y8), else true(YV12). Selects return clip colorspace.
        Mod2,   Default True. If Y8 then round odd dimensions up modulo 2 (the mask is still WxH).
        
    Example:-
        Import("Hit_Marker.avs")
        WW=128  HH=WW   HIT=True
        BlankClip
        Yell=Last.BlankClip(Width=WW,Height=HH,Length=1,Color=$FFFF00)
        Return OverLay(Yell,x=(Width-WW)/2,y=(Height-HH)/2,mask=Hit_Marker(WW,HH,HIT))
*/         
    Hit=Default(hit,False)                    BW=Max(Default(BW,W/8),1)   BH=Max(Default(BH,H/8),1)
    BW2=(W>4)?BW*2:BW                         BH2=(H>4)?BH*2:BH          
    PW=Max(Default(PW,BW/8),1)                PH=Max(Default(PH,BH/8),1)  is26 = VersionNumber>=2.6            
    YV12=(!is26) ? True : Default(YV12,False) Mod2=Default(Mod2,True)     Mod = (YV12||Mod2) ? 2 : 1   
    CanvasW=(W+Mod-1)/Mod*Mod                 CanvasH=(H+Mod-1)/Mod*Mod
    Rpn= RT_String("x %d < x %d >= | y %d < | y %d >= | x %d < x %d >= | & y %d < y %d >= | & ",BW,W-BW,BH,H-BH,BW2,W-BW2,BH2,H-BH2)
    Rpn= (Hit) ? Rpn + RT_String("x %d < x %d >= | y %d < | y %d >= | | ",PW,W-PW,PH,H-PH) : Rpn 
    Rpn= Rpn + RT_String("x %d < y %d < & & 255 0 ?",W,H)
    Blankclip(width=CanvasW,height=CanvasH,Length=1,pixel_type=YV12?"YV12":"Y8").Killaudio
    return mt_lutspa(relative = false,yExpr=Rpn, chroma = "-128")
}
Demo Client, Left, miss on top, hit on Bottom, Right other settings
Code:
Import("Hit_Marker.avs")

Function Sub(clip c,string tit){c.ScriptClip("Subtitle("+Chr(34)+tit+Chr(34)+",align=5)")}

W=256
H=256
K=BlankClip(Width=W,height=H)
Y=K.BlankClip(Color=$FFFF00)
R=K.BlankClip(Color=$FF0000)
A=K.Overlay(Y,Mask=Hit_Marker(W,H,False))                               # Default Miss
B=K.Overlay(R,Mask=Hit_Marker(W,H,True))                                # Default Hit
L=StackVertical(A.Addborders(16,16,16,16).Sub("Default MISS"),B.Addborders(16,16,16,16).Sub("Default HIT"))
C=K.Overlay(Y,Mask=Hit_Marker(W,H,false,BW=W/5,BH=H/5))                 # Miss, Thicker than default Corners
D=K.Overlay(R,Mask=Hit_Marker(W,H,True,BW=1,BH=1,PW=W/4,PH=H/4))        # Hit, Thicker than default perimeter
R=StackVertical(C.Addborders(16,16,16,16).Sub("Thick CORNERS"),D.Addborders(16,16,16,16).Sub("Thick PERIMETER"))
StackHorizontal(L,R)
return last


Further meaning can be related, by using different colors for the overlay clip (as above).
Here: hit detection:- https://forum.doom9.org/showthread.p...05#post1775305
__________________
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 ???

Last edited by StainlessS; 1st August 2018 at 07:06. Reason: Update
StainlessS is offline   Reply With Quote
Old 15th April 2017, 07:58   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Elliptical_Marker.avs. Probably complete.
Code:
# Elliptical_Marker.avs

Function Elliptical_Marker(int w,Int h,
        \ Float "iRad",
        \ Float "oSoft",Int "oFI",Int "oFO",
        \ Float "iSoft",Int "iFI",Int "iFO",
        \ Int "cInt",Int "cExt",Int "cHub",Int "cPad",
        \ Bool "YV12",Bool "Mod2") {
/*
    Elliptical_Marker by StainlessS.  http://forum.doom9.org/showthread.php?t=174527

    Req mt_tools2, RT_Stats.    
    Creates an Elliptical marker mask WxH, for use with Overlay as Mask arg.
    Returns single frame clip with null audio, the marker top left hand side is aligned to 0,0, and is contained in the area WxH.
    The Default return clip colorspace is Y8 for Avisynth v2.6 and above, or YV12 if defunct version.
    
      The Elliptical mask radius described below is normalised to 1.0, no matter whether WxH is square or not.
    A radius of 1.0 lies on the outer edge of the elliptical mask, and the origin at mask center (center of WxH).
    The Mask is optionally a Disk(iRad=0.0) or Ring(0.0<iRad), and optional softening/feathering of outer and inner edges.
    A Ring mask (0.0 < iRad), has a Hub (hollow bit in the middle), and inner softening is applied from the inside edge of the Ring(iRad).
    A Disk Mask (0.0 = iRad), has no Hub, and inner softening is again applied from iRad outwards but in this case iRad=0.0 ie the origin.
    The 'Thickness' of a Ring/Disk is 1.0 - iRad, so for a Disk, it is always 1.0.
    oSoft and iSoft control softening of the mask Thickness, eg oSoft=0.2 and iSoft=0.1, applies softening to the outermost 0.2
    and innermost 0.1 of the ThickNess. The part of the Thickness that is not softened, we will call the 'Interior', and in this case 
    would be the distance bewteen 0.1 and 1.0-0.2, ie 0.7 of the ThickNess.
    In a case where iSoft and oSoft sum to more than 1.0, they will both self scale so that they sum to 1.0. 
    Where:- sumSoft=oSoft+iSoft, and where 1.0 < sumSoft then. 
      oSoft=oSoft/sumSoft, iSoft=iSoft/sumSoft
    So, if eg iSoft=0.5 and oSoft=1.0 they will scaled to iSoft=0.333, oSoft = 0.666 and so inner and outer softening will meet 
    0.333 from inner ring edge, or 0.666 from outer edge. Where oSoft and iSoft sum to 1.0 or more, Interior will be 0.0.                                   
    The part of a mask that lies more than 1.0 distant from the origin, we will call the 'Exterior", ie outside of the Ellipse.
    The part of a frame that lies outside of WxH, we will call 'Padding", and will only exist if W or H was odd, and either 
    return frame is YV12, or Mod2 is true, it is NOT part of a mask.
    NOTE, For an Overlay mask, The nearer to 255 the mask, the more opaque the overlayed clip, the nearer to 0, the more transparent. 
          
    w,h,   Size of marker mask (can be odd), return clip dimensions are rounded up to next multiple of 2 if YV12 or Mod2 return clip.
    iRad,  Default 0.0(Disk). 0.0 <= iRad < 1.0. If 0.0 < iRad, then is a Ring Mask with a central 'hollow' region or hub.
             If iRad=0.0, then is a Disk Mask and arg cHub has NO FUNCTION AT ALL (there is no Hub).      
             iRad is the Inner radius, distance from center or origin to inside of the Ring, an iRad of 0.5 would
             create a Ring Mask with a central hollow hub mid way between origin and the ellipse edge at radius of 1.0.
             The outer 'ThickNess' of the ring is therefore 1.0-iRad.     
    oSoft, Default 0.0. 0.0 <= oSoft : 0.0 = No outer softening. (Hard Outer Edge)
             If oSoft is greater than 0.0, then applies softening/feathering to the outer edge of the ellipse Thickness.
             For a disk (where iRad=0.0), an oSoft of 1.0 applies softening all of the way to the center or origin of the disk.
             oSoft controls the distance from ellipse edge, with 1.0 being the radius of the disk, 0.1 would soften just the
             outer 0.1 of the Thickness of the disk.
    oFI,   Default 255. 0 -> 255. Outer edge, Innermost softening value.
    oFO,   Default 0.   0 -> 255. Outer edge, Outermost softening value.                 
             The outer edge of Thickness is softened by interpolating linearly between these two values.
    iSoft, Default 0.0. 0.0 <= iSoft : 0.0 = No inner softening. (If Ring, Hard inner Edge)
             If iSoft is greater than 0.0, then applies softening/feathering to the inner Thickness.
             For a disk (where iRad=0.0), an iSoft of 1.0 applies softening all of the way to outer edge of the disk.
    iFI,   Default 0.   0 -> 255. Inner edge, Innermost softening value.
    iFO,   Default 255. 0 -> 255. Inner edge, Outermost softening value.                 
             The inner edge of Thickness is softened by interpolating linearly between these two values.
    cInt,  Default 255, Color of non softened or Interior of mask (mask inspection/special effect).
    cExt,  Default 0,   Color of 'invald' mask, Exterior to Ellipse, (mask inspection/special effect).
    cHub,  Default 0,   Color of 'invald' mask, Ring hollow center, (mask inspection/special effect).
    cPad,  Default 0,   Color of extra padding where odd dimensions and YV12, ie not part of mask. (usually not changed, mask inspection).    
    YV12,  Default False if Avisynth version 2.6 or greater(Y8), else true(YV12). Selects return clip colorspace.
    Mod2,  Default True. If Y8 then round odd dimensions up modulo 2 (the mask is still WxH with possible padding).    
    Example:-
        Import("Elliptical_marker.avs")
        WW=320  HH=320  iRad=0.5 oSoft=0.5  iSoft=0.5  
        BlankClip.KillAudio
        Sym=Colorbars.BicubicResize(WW,HH).KillAudio
        msk=Elliptical_Marker(sym.width,sym.height,iRad=iRad,oSoft=oSoft,iSoft=iSoft)
        OverLay(Last,Sym,x=(width-Sym.width)/2,y=(height-Sym.height)/2,mask=msk)
*/    
    myName="Elliptical_Marker: "
    iRad=Default(iRad,0.0)          # 0.0 < iRad then Ring, else disk
    oSoft=Default(oSoft,0.0)        # Outer softening distance
    oFI=Default(oFI,255)            # Outer edge, Innermost softening value.
    oFO=Default(oFO,0)              # Outer edge, Outermost softening value. 
    iSoft=Default(iSoft,0.0)        # Inner softening distance
    iFI=Default(iFI,0)              # Inner edge, Innermost softening value.
    iFO=Default(iFO,255)            # Inner edge, Outermost softening value.
    cInt=Default(cInt,255)          # Interior Color (mask color, white)
    cExt=Default(cExt,0)            # Exterior to ellipse (Invalid black) color
    cHub=Default(cHub,0)            # Ring Hub (Invalid black) color
    cPad=Default(cPad,0)            # Padding color (not part of mask, black)
    is26=VersionNumber>=2.6         YV12=(!is26) ?True:Default(YV12,False)  Mod2=Default(Mod2,True)     Mod=(YV12||Mod2) ?2:1   
    CanvasW=(w+Mod-1)/Mod*Mod       CanvasH=(h+Mod-1)/Mod*Mod
    Assert(0.0 <= iRad < 1.0,RT_String("%s0.0 <= iRad < 1.0 (%f)",myName,iRad))
    Assert(0.0 <= oSoft,RT_String("%s0.0 <= oSoft (%f)",myName,oSoft))
    Assert(0.0 <= iSoft,RT_String("%s0.0 <= iSoft (%f)",myName,iSoft))
    SoftSum=oSoft+iSoft  oSoft=(SoftSum>1.0)?oSoft/SoftSum:oSoft  iSoft=(SoftSum>1.0)?1.0-oSoft:iSoft
    Thick=1.0-iRad       oRim=1.0-Thick*oSoft                     iRim=iRad+Thick*iSoft   
    wMid = (w-1)/2.0     wMul = 2.0/w      hMid = (h-1)/2.0       hMul = 2.0/h
    oFade = 255 / Max(1.0-oRim,0.001)      iFade = 255 / Max(iRim-iRad,0.001)
    ###
    # Normalizing H and V distances 0.0->1.0. (irrespective of elliptical squishing)          
    # We dont use mt_lutspa(relative=true) due to padding complications.
    # Dist from center origin, 0->1.0, by Pythagoras (1.0 is placed 1/2 pixel outside of ellipse [outside of WxH])
    # DIST = "(((((x-wMid)*wMul)^2) + (((y-hMid)*hMul)^2))^.5)"
    # OMELT="((1.0-DIST)*oFade)"       IMELT="((DIST-iRad)*iFade)"                   
    # OZ="((((256-OMELT)*oFO) + (OMELT*oFI) + 128) / 256.)"
    # IZ="((((256-IMELT)*iFI) + (IMELT*iFO) + 128) / 256.)"                   
    # CHK="(x>=WW|y>=HH)"   # Padding area check.
    # InFix="CHK ? cPad :(DIST >= 1. ? cExt :(DIST < iRad ? cHub :((DIST <= iRim) ? IZ :(DIST < oRim ? cInt : OZ))))"
    ###
    Rpn= "x WW >= y HH >= | 0 x wMid - wMul * 2 ^ y hMid - hMul * 2 ^ + .5 ^ 1. >= cExt x wMid - wMul * 2 ^ y hMid - hMul " +
        \ "* 2 ^ + .5 ^ iRad < cHub x wMid - wMul * 2 ^ y hMid - hMul * 2 ^ + .5 ^ iRim <= 256 x wMid - wMul * 2 ^ y hMid " +
        \ "- hMul * 2 ^ + .5 ^ iRad - iFade * - iFI * x wMid - wMul * 2 ^ y hMid - hMul * 2 ^ + .5 ^ iRad - iFade * iFO * " +
        \ "+ 128 + 256. / x wMid - wMul * 2 ^ y hMid - hMul * 2 ^ + .5 ^ oRim < cInt 256 1. x wMid - wMul * 2 ^ y hMid - "  +
        \ "hMul * 2 ^ + .5 ^ - oFade * - oFO * 1. x wMid - wMul * 2 ^ y hMid - hMul * 2 ^ + .5 ^ - oFade * oFI * + 128 + "  +
        \ "256. / ? ? ? ? ?"    
    Fnd=RT_String("oFade\niFade\nwMid\nwMul\nhMid\nhMul\noRim\niRim\niRad\nWW\nHH\ncInt\ncExt\ncHub\ncPad\noFI\noFO\niFI\niFO\n")
    Rep=RT_String("%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%f\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",
        \ oFade,iFade,wMid,wMul,hMid,hMul,oRim,iRim,iRad,W,H,cInt,cExt,cHub,cPad,oFI,oFO,iFI,iFO)
    Rpn=RT_StrReplaceMulti(Rpn,Fnd,Rep)
    Blankclip(width=CanvasW,height=CanvasH,Length=1,pixel_type=YV12?"YV12":"Y8").Killaudio
    Last.mt_lutspa(relative=false,Yexpr=RPN, chroma = "-128" )
    return Last
}
We see Distance 1.0 as outside of ellipse, to avoid single pixel spike (nobble) every 90 degrees from 12 O-Clock.
Update, now native RPN, works on XP without latest version MaskTools Infix -> RPN conversion (mt_Polish dont work for XP).
__________________
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 ???

Last edited by StainlessS; 2nd May 2017 at 22:16. Reason: Updated
StainlessS is offline   Reply With Quote
Old 15th April 2017, 08:02   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Demo Client for Elliptical_Marker (modification of this posted here:- https://forum.doom9.org/showthread.p...34#post1802634 )

BouncingBallMovie.avs
Code:
# BouncingBallMovie.avs

Import("Elliptical_Marker.avs")
Import("ResizePadded.avs")

Function DrawBounce(clip c) {   # Physical window coords
    Squash = (G_Squish>0 && G_bounceY == 0.0) 
    B = (Squash) ? G_Squashed_Ball : G_Ball
    Xrel=(Squash) ? G_Squish : 0
    Yrel=(Squash) ? G_Squish *2 : 0
    ScaleLogY = (G_bounceY * G_bounceYSCale)
    phyX = Round(G_bounceX * (c.Width - G_BallSZ)) - XRel
    phyY = Round((1.0-ScaleLogY) * (c.Height - G_BallSZ)) + Yrel
    (G_Sym.IsClip)                             
        \ ? c.Overlay(Squash?G_Sym_Squashed:G_Sym,x=phyX,y=phyY,mask=B) 
        \ : c.OverLay(B.BlankClip(Color=G_BALLCOLOR,Length=1),x=phyX,y=phyY,Mask=B)    
    return Last
}    

Function MoveBounce(clip c) {   # Logical coords (0.0 -> 1.0, cartesian)
    bX = G_bounceX + G_bounceXstep
    Global G_bounceXstep = (0.0 < bX < 1.0) ? G_bounceXstep : -G_bounceXstep    # Wall Bounce, Switch direction next time
    Global G_bounceX = (bX < 0.0) ? 0.0 : (1.0 < bX) ? 1.0 : bX 
    bY = Sin(G_bounceAngle)
    Global G_bounceY = (bY < 0.0) ? 0.0 : bY
    bAng = G_bounceAngle + G_bounceAngleStep
    Global G_bounceAngle = (PI < bAng) ? 0.0 : bAng 
    return c.DrawBounce
}

Function RandF() {return Rand / 32767.0}

###### CONFIG
#Avisource("D:\V\XMen2.avi")
#ColorBars.KillAudio#.ShowFrameNumber
BlankClip(Length=24*60*60)
#####
#SYMCLIP=Avisource("D:\V\XMen2.avi")
SYMCLIP=ColorBars.KillAudio#.ShowFrameNumber
#SYMCLIP=Last

###
Rand(Seed=True)
###
Global G_BALLCOLOR          = $C020FF # Ball Color, where SYM=False
BALLSZ                      = 200
SQUISH                      = 0      # Squashed ball when hits bottom, about 0 -> 8
SYM                         = True    # False = Plain bouncing ball
iRad                        = 0.0     # 0.0 <= iRad < 1.0   : Inner radius for RING : 0.0 = Elliptical Disk .
oSoft                       = 0.0     # 0.0 <= oSoft  : 0.0 = Hard Outer Edge
iSoft                       = 0.0     # 0.0 <= iSoft  : 0.0 = Hard Inner Edge
oFI                         = 255     # Outer edge, Innermost softening value. (Default 255)
oFO                         = 0       # Outer edge, Outermost softening value. (Default 0)
iFI                         = 0       # Inner edge, Innermost softening value. (Default 0)
iFO                         = 255     # Inner edge, Outermost softening value. (Default 255)
#
CINT                        = 255     # Mask Interior color (nearly always 255)
CEXT                        = 0       # Mask Invalid Exterior color (nearly always 0)
CHUB                        = 0       # Mask Invalid Hollow Ring center (nearly always 0)

###  GENERAL CONTROL for bouncer (1.0=norm) 
SPEED                       = 1.0
BOUNCEHEIGHT                = 1.0
#####   END OF CONFIG   ################

### LEAVE BELOW ALONE
Global G_bounceXstep        = (0.01 + RandF * 0.01) * SPEED    # Xpos increment
Global G_bounceAngleStep    = (0.05 + RandF * 0.17) * SPEED     # Step angle
Global G_bounceYScale       = BOUNCEHEIGHT
### Start pos
Global G_bounceX            = RandF                          # Current X position
Global G_bounceY            = RandF                          # Current Y position
Global G_bounceAngle        = RandF * PI
######
Global G_Ball               = Elliptical_Marker(BALLSZ,BALLSZ,
                                \ iRad=iRad,
                                \ oSoft=oSoft,oFi=OFI,oFO=OFO,
                                \ iSoft=iSoft,iFi=IFI,iFO=IFO,
                                \ cInt=CINT,cExt=CEXT,cHub=CHUB,YV12=True)
Global G_Squashed_Ball      = (SQUISH>0) 
                                \ ? Elliptical_Marker(BALLSZ+2*SQUISH,BALLSZ-2*SQUISH,
                                \ iRad=iRad,
                                \ oSoft=oSoft,oFi=OFI,oFO=OFO,
                                \ iSoft=iSoft,iFi=IFI,iFO=IFO,
                                \ cInt=CINT,cExt=CEXT,cHub=CHUB,YV12=True)
                                \ : 0
Global G_Sym                = (SYM) ? SYMCLIP.ResizePadded(BALLSZ,BALLSZ) : 0
Global G_Sym_Squashed       = (SYM&&SQUISH>0)  ? SYMCLIP.ResizePadded(BALLSZ+2*SQUISH,BALLSZ-2*SQUISH): 0
Global G_BallSZ             = BALLSZ
Global G_Squish             = SQUISH

###        
ScriptClip("return MoveBounce")
__________________
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 ???

Last edited by StainlessS; 2nd May 2017 at 23:22. Reason: Updated
StainlessS is offline   Reply With Quote
Old 26th April 2017, 16:29   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Here Experiment2.avs
Code:
# EllipticalMarker_Experiment2.avs

Import("Elliptical_Marker.avs")

WW       =128
HH       =128

oFI      = Undefined  # Use Default settings
oFO      = Undefined  # Use Default settings
iFI      = Undefined  # Use Default settings
iFO      = Undefined  # Use Default settings

CINT     = 255       # Mask Interior color (nearly always 255)
CEXT     = 0         # Mask Invalid External color (nearly always 0)
CHUB     = 0         # Mask Invalid color, Hollow Ring center (nearly always 0)

BD=4

# Outer disk softening
A=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
B=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=0.25,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
C=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=0.50,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
D=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=1.00,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
V1=StackVertical(A.AddBorders(BD,BD,BD,BD),B.AddBorders(BD,BD,BD,BD),C.AddBorders(BD,BD,BD,BD),D.AddBorders(BD,BD,BD,BD))
# Inner and Outer disk softening
E=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=0.125, oFI=OFI,oFO=OFO,iSoft=0.125,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
F=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=0.250, oFI=OFI,oFO=OFO,iSoft=0.250,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
G=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=0.375, oFI=OFI,oFO=OFO,iSoft=0.375,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
H=Elliptical_Marker(WW,HH,iRad=0.00,oSoft=0.500, oFI=OFI,oFO=OFO,iSoft=0.500,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
V2=StackVertical(E.AddBorders(BD,BD,BD,BD),F.AddBorders(BD,BD,BD,BD),G.AddBorders(BD,BD,BD,BD),H.AddBorders(BD,BD,BD,BD))
# Hard edge rings
I=Elliptical_Marker(WW,HH,iRad=0.20,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
J=Elliptical_Marker(WW,HH,iRad=0.40,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
K=Elliptical_Marker(WW,HH,iRad=0.60,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
L=Elliptical_Marker(WW,HH,iRad=0.80,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
V3=StackVertical(I.AddBorders(BD,BD,BD,BD),J.AddBorders(BD,BD,BD,BD),K.AddBorders(BD,BD,BD,BD),L.AddBorders(BD,BD,BD,BD))
# Soft outer Rings
M=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.25,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
N=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.50,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
O=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.75,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
P=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=1.00,  oFI=OFI,oFO=OFO,iSoft=0.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
V4=StackVertical(M.AddBorders(BD,BD,BD,BD),N.AddBorders(BD,BD,BD,BD),O.AddBorders(BD,BD,BD,BD),P.AddBorders(BD,BD,BD,BD))
# Soft inner Rings
Q=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.25, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
R=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.50, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
S=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=0.75, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
T=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.00,  oFI=OFI,oFO=OFO,iSoft=1.00, iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
V5=StackVertical(Q.AddBorders(BD,BD,BD,BD),R.AddBorders(BD,BD,BD,BD),S.AddBorders(BD,BD,BD,BD),T.AddBorders(BD,BD,BD,BD))
# Soft inner and outer Rings
U=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.125, oFI=OFI,oFO=OFO,iSoft=0.125,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
V=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.250, oFI=OFI,oFO=OFO,iSoft=0.250,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
W=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.375, oFI=OFI,oFO=OFO,iSoft=0.375,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
X=Elliptical_Marker(WW,HH,iRad=0.50,oSoft=0.500, oFI=OFI,oFO=OFO,iSoft=0.500,iFI=IFI,iFO=IFO,cInt=CINT,cExt=CEXT,cHub=CHUB)
V6=StackVertical(U.AddBorders(BD,BD,BD,BD),V.AddBorders(BD,BD,BD,BD),W.AddBorders(BD,BD,BD,BD),X.AddBorders(BD,BD,BD,BD))
StackHorizontal(V1,V2,V3,V4,V5,V6)

return last.ConvertToRGB32
__________________
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 ???

Last edited by StainlessS; 1st August 2018 at 07:11.
StainlessS is offline   Reply With Quote
Old 26th April 2017, 22:53   #7  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
I am not sure what it does. Is it a screen measuring tool? A moving "spotlight effect"? Help me out here.
raffriff42 is offline   Reply With Quote
Old 26th April 2017, 23:21   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Just masks for use with Overlay (I cocked up in a few places, I Overlayed the mask in the Hit_Marker thing, instead of using it as mask arg to Overlay,
I guess I copied something in error, and kept on copying the same error).
Try out the BouncingBallMovie thing, you will not need further info, maybe look see at the link in Hit_Marker post, to see an actual use for it.

Or below is Bouncing ball (reduced size frame, overlayed on itself through a circular mask), in the bouncingballmovie script, it produces a ball
that bounces around the screen, ad-infinitum (whilst movie is playing, or can watch eg XMEN2 with StarWars ball bouncing around on top of it).

__________________
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 ???

Last edited by StainlessS; 1st August 2018 at 07:12.
StainlessS is offline   Reply With Quote
Old 26th April 2017, 23:39   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Raff, here:- http://www.mediafire.com/file/nh8mze...gBallMovie.mp4

200KB, or also as BouncingBallMovie.mp4 on SendSpace below in my sig.

Just a black frame with bouncing Colorbars ball, 30 secs.

EDIT: Use something like
Code:
Import("Elliptical_marker.avs")
ColorBars.KillAudio
sym=Last.BicubicResize(100,100)
msk=sym.Elliptical_Marker(sym.width,sym.height,oSoft=0.1)
OverLay(Last,sym,x=(width-sym.width)/2,y=(height-sym.height)/2,mask=msk)
Produces this (oSoft=0.1, gives soft/feathered outer edge, outer 0.1 of radius).



EDIT: The different shapes in Experiment2.avs are just differing elliptical mask effects, which in those cases are all circular (w==h).

EDIT: The 20th Century Fox thing above has hard outer edge and some weird center effect with something like iRad=0.25 (hollow annulus or ring), and iSoft=0.2 (inner annulus feathering), and cHub=255 (solid white filling center of mask annulus).
The color settings are only intended for inspection of masks but could also be used for weird effects.
__________________
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 ???

Last edited by StainlessS; 1st August 2018 at 07:15.
StainlessS is offline   Reply With Quote
Old 27th April 2017, 00:13   #10  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Oh so it has gravity eh? I was expecting something like the original Pong. This is better!

So (leading question) you're updating some global variables every frame, and the ScriptClip moves the marker based on the globals' current values; something like that?
raffriff42 is offline   Reply With Quote
Old 27th April 2017, 00:28   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Yup, something exactly like that.

But no, not gravity, took decades of trials to come up with working anti-gravity code, so will now bounce around until the cows come home.

EDIT: I left in some gravity, you can set SQUISH to some number (about 4) to have the ball flatten/squish slightly when it hits the deck,
I had it switched off for that demo black frame mp4.

A lot of the BouncingBallMovie script, is configuration, just change them and see what effect it has. (you could spend months playing with the settings).

I just changed a few settings to create the black frame colorbars ball clip.

EDIT: OK, changed my mind, there is some gravity in that script, but there is also anti-gravity, that was the hard bit to achieve
__________________
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 ???

Last edited by StainlessS; 27th April 2017 at 00:43.
StainlessS is offline   Reply With Quote
Old 27th April 2017, 01:55   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Raff, a more exiting ColorBars bouncing movie, with added Squish when ball hits bottom, maybe you can see it, maybe not.

http://www.mediafire.com/file/ijyrq5...BallMovie2.mp4

Also on SendSpace, in sig below.

~ 1MB, 60 secs.

EDIT: Squish would be easier to see if hard edge ball.
__________________
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 ???

Last edited by StainlessS; 27th April 2017 at 02:34.
StainlessS is offline   Reply With Quote
Old 30th April 2017, 22:38   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hit_Marker.avs, Elliptical_Marker.avs and BouncingBallMovie.avs Updated.

Elliptical_Marker.avs, now works on XP without Infix -> Polish conversion (native RPN).
__________________
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 offline   Reply With Quote
Old 1st May 2017, 20:03   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Hit_Marker.avs Update. Hit marker perimeter thickness configurable.
__________________
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 offline   Reply With Quote
Old 2nd May 2017, 22:20   #15  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Elliptical_Marker.avs, EllipticalMarker_Experiment2.avs, and BouncingBallMovie.avs update. Perhaps complete.

EDIT: Hoop
Code:
Import("Elliptical_marker.avs")
Return Elliptical_Marker(320,320,iRad=0.75,oSoft=0.5,iSoft=0.5)


EDIT: Hoop-La
Code:
Import("Elliptical_marker.avs")
# View inner HUB and out Exterior (Not Black)
A=Elliptical_Marker(320,320,iRad=0.75,oSoft=0.5,iSoft=0.5,cExt=128,chub=128)
# Inverted Inner/outer fading
B=Elliptical_Marker(320,320,iRad=0.75,oSoft=0.5,iSoft=0.5,cExt=128,chub=128,oFI=0,OFO=255,IFI=255,IFO=0)
Return StackHorizontal(A,B)


EDIT:
Hoop-La-La
Code:
Import("Elliptical_marker.avs")
WW=320  HH=320  iRad=0.75 oSoft=0.5  iSoft=0.5  
BlankClip.KillAudio
Sym=Colorbars.BicubicResize(WW,HH).KillAudio
msk=Elliptical_Marker(sym.width,sym.height,iRad=iRad,oSoft=oSoft,iSoft=iSoft)
OverLay(Last,Sym,x=(width-Sym.width)/2,y=(height-Sym.height)/2,mask=msk)


EDIT: Hoop-LaLaLa
Code:
Import("Elliptical_marker.avs")
msk1=Elliptical_Marker(320,320,iRad=0.75,oSoft=0.5,iSoft=0.5)
msk2=Elliptical_Marker(240,240,iRad=0.50,oSoft=0.5,iSoft=0.5)
msk3=Elliptical_Marker(120,120,iRad=0.25,oSoft=0.5,iSoft=0.5)
M=msk1
M=OverLay(M,msk2,x=(M.width-msk2.width)/2,y=(M.height-msk2.height)/2,mask=msk2)
M=OverLay(M,msk3,x=(M.width-msk3.width)/2,y=(M.height-msk3.height)/2,mask=msk3)
Sym=Colorbars(width=M.Width,height=M.Height).KillAudio
BlankClip
OverLay(Sym,x=(width-Sym.width)/2,y=(height-Sym.height)/2,mask=M)
__________________
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 ???

Last edited by StainlessS; 1st August 2018 at 07:17.
StainlessS is offline   Reply With Quote
Old 21st November 2017, 15:51   #16  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
i just stumbled upon this...

Is there any way to do something that is hard to explain?

case scenario #1:
static background image (say a screenshot from a movie)
and use the Elliptical_marker to create a "flashlight" spot on the screen and then slowly move from side to side showing different parts of the screen only visible in the flashlight spot?

to create something like a trivia: "Name that movie" (like you would see in theaters)

(dynamic Elliptical_marker image; static background)

case scenario #2:
for the Elliptical_marker to animate into a fishbowl effect and have it slowly move from side to side of the video.
the video in the background plays normally, but the fishbowl spot moves and distorts as if moving a magnifying glass across the screen.

to create something funky one would use in a fancy opening titles sequence.

(dynamic Elliptical_marker image; static background)

case scenario #3:
with the 20th Century Fox logo in mind,
can you animate the hit marker(s) to enlarge from the tiniest spot (nothing) to fill the screen then disappear.
like its radiating outward repeatedly. like broadcasting a signal.

the idea would be take a scene/shot like this (from x-men):

(for both background and Elliptical_marker)

and have it expand from a point on screen with the same image expanding to make it look funky to illustrate more that he's using his powers.

taking on the inspiration from the cartoons:

(except the cartoons didnt have an infinite number of same images shooting outwards)

the hardest idea would be once it reaches a 1:1 size that matches the backgound movie, the Elliptical_marker fades and disappears (and not go over the original resolution).

(static Elliptical_marker image; static background)


------------

CS#1 would also work if the background was blurred and the Elliptical_marker was the clear spot over the blurred image.
(dynamic Elliptical_marker image; static background)
heck, even if the background was greyscaled and the Elliptical_marker was the original colors.
(dynamic Elliptical_marker image; static background)


The image of the Colorbars is what gave me the idea of thinking of the fishbowl/magnifying glass effect.
Those really old magnifying glasses that had a tiny dot for greater amplification in the bottom.


CS#1 also makes me think of Pink Panther opening titles (pretty sure it was used as such) to try and find the Pink Panther on-screen for their opening animations.
Adventures of TinTin? I know one of the popular posters is black with a spotlight on TinTin running with his dog.

------------

Just something to mull on.
I really can't remember why I was browsing doom9 in the first place and next thing you know, I got a dozen tabs open.

Thanks for these ideas! Been looking for a lot of new stuff lately.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 22nd November 2017, 08:04   #17  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Sparky,

Below SpotExpose.avs, bouncing spotlight exposes bits of background movie, thing (quick hack).

Sorry, dont have time for other probs, but wait with interest to see what you can come up with.

The Lens type stuff could not be done with the marker funcs, need something like DavdHorman funcs for that, I think. (lenses do more than fade).

Code:
# SpotExpose.avs

Import("Elliptical_Marker.avs")
Import("ResizePadded.avs")

Function DrawOver(clip c) {   # Physical window coords
    ScaleLogY = (G_bounceY * G_bounceYSCale)
    phyX = Round(G_bounceX * (c.Width - G_BallSZ))
    phyY = Round((1.0-ScaleLogY) * (c.Height - G_BallSZ))
    O=G_OVER.Crop(phyX,phyY,G_BallSZ,G_BallSZ)
    c.Overlay(O,x=phyX,y=phyY,mask=G_MASK)
    return Last
}

Function MoveBounce(clip c) {   # Logical coords (0.0 -> 1.0, cartesian)
    bX = G_bounceX + G_bounceXstep
    Global G_bounceXstep = (0.0 < bX < 1.0) ? G_bounceXstep : -G_bounceXstep    # Wall Bounce, Switch direction next time
    Global G_bounceX = (bX < 0.0) ? 0.0 : (1.0 < bX) ? 1.0 : bX
    bY = Sin(G_bounceAngle)
    Global G_bounceY = (bY < 0.0) ? 0.0 : bY
    bAng = G_bounceAngle + G_bounceAngleStep
    Global G_bounceAngle = (PI < bAng) ? 0.0 : bAng
    return c.DrawOver   # Modified to call DrawOver
}

Function RandF() {return Rand / 32767.0}

###### CONFIG
#Avisource("D:\V\XMen2.avi")
#Avisource("1941 Flint Michigan Parade [Low, 360p].mp4.AVI")
ColorBars.KillAudio.ShowFrameNumber
#####
SYMCLIP=Last.ConvertToYV24          # Overlaying clip
BASECLIP=SYMCLIP.BlankClip          # Background clip

###
Rand(Seed=True)
###
BALLSZ                      = 100     # MOD 2 only else crop problems
iRad                        = 0.00    # 0.0 <= iRad < 1.0   : Inner radius for RING : 0.0 = Elliptical Disk .
oSoft                       = 0.5     # 0.0 <= oSoft  : 0.0 = Hard Outer Edge
iSoft                       = 0.0     # 0.0 <= iSoft  : 0.0 = Hard Inner Edge
oFI                         = 255     # Outer edge, Innermost softening value. (Default 255)
oFO                         = 0       # Outer edge, Outermost softening value. (Default 0)
iFI                         = 0       # Inner edge, Innermost softening value. (Default 0)
iFO                         = 255     # Inner edge, Outermost softening value. (Default 255)
#
CINT                        = 255     # Mask Interior color (nearly always 255)
CEXT                        = 0       # Mask Invalid Exterior color (nearly always 0)
CHUB                        = 0       # Mask Invalid Hollow Ring center (nearly always 0)

###  GENERAL CONTROL for bouncer (1.0=norm)
SPEED                       = 1.0
BOUNCEHEIGHT                = 1.0
#####   END OF CONFIG   ################

### LEAVE BELOW ALONE
Global G_bounceXstep        = (0.01 + RandF * 0.01) * SPEED    # Xpos increment
Global G_bounceAngleStep    = (0.05 + RandF * 0.17) * SPEED     # Step angle
Global G_bounceYScale       = BOUNCEHEIGHT
### Start pos
Global G_bounceX            = RandF                          # Current X position
Global G_bounceY            = RandF                          # Current Y position
Global G_bounceAngle        = RandF * PI
######
Global G_MASK               = Elliptical_Marker(BALLSZ,BALLSZ,
                                \ iRad=iRad,
                                \ oSoft=oSoft,oFi=OFI,oFO=OFO,
                                \ iSoft=iSoft,iFi=IFI,iFO=IFO,
                                \ cInt=CINT,cExt=CEXT,cHub=CHUB,YV12=False)
Global G_OVER               = SYMCLIP
Global G_BallSZ             = BALLSZ

###
BASECLIP.ScriptClip("return MoveBounce")
#ConvertToRGB24 # If player cannot play YV24
EDIT: SpotExpose.mp4 demo, (~1.4MB, 60 secs):- http://www.mediafire.com/file/zpu19e...SpotExpose.mp4

EDIT: Splotlight chosen similar to post #6, Experiment2.avs Left hand column, 3rd one down.

EDIT: I guess I could have used overlay to overlay mask onto Blankclip (same size as SYMCLIP) at x,y render pos, and used result as mask to avoid cropping.
__________________
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 ???

Last edited by StainlessS; 22nd November 2017 at 08:24.
StainlessS is offline   Reply With Quote
Old 22nd November 2017, 08:35   #18  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Thank you! That is really really neat!

I am definitely going to have a look at this and see what I can do.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 22nd November 2017, 08:45   #19  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Modified as per last prev edit.

Code:
# SpotExpose.avs
Import("Elliptical_Marker.avs")

Function DrawOver(clip c) {   # Physical window coords
    ScaleLogY = (G_bounceY * G_bounceYSCale)    PhyX=Round(G_bounceX*(c.Width-G_BallSZ))  phyY=Round((1.0-ScaleLogY)*(c.Height-G_BallSZ))
    M=G_MASKBASE.Overlay(G_MASK,x=phyX,y=phyY)  Return c.Overlay(G_OVER,mask=M)
}

Function MoveBounce(clip c) {   # Logical coords (0.0 -> 1.0, cartesian)
    bX = G_bounceX + G_bounceXstep
    Global G_bounceXstep = (0.0 < bX < 1.0) ? G_bounceXstep : -G_bounceXstep    # Wall Bounce, Switch direction next time
    Global G_bounceX = (bX < 0.0) ? 0.0 : (1.0 < bX) ? 1.0 : bX
    bY = Sin(G_bounceAngle)                     Global G_bounceY = (bY < 0.0) ? 0.0 : bY
    bAng = G_bounceAngle + G_bounceAngleStep    Global G_bounceAngle = (PI < bAng) ? 0.0 : bAng
    return c.DrawOver
}

Function RandF() {return Rand / 32767.0}

###### CONFIG
Avisource("D:\1941 Flint Michigan Parade [Low, 360p].mp4.AVI")
#ColorBars.KillAudio.ShowFrameNumber
#####
Crop(0,0,Width/4*4,Height/4*4)
ConvertToYV12
SYMCLIP=Last
###
Rand(Seed=True)
BALLSZ                      = 160     #
iRad                        = 0.0     # 0.0 <= iRad < 1.0   : Inner radius for RING : 0.0 = Elliptical Disk .
oSoft                       = 0.3     # 0.0 <= oSoft  : 0.0 = Hard Outer Edge
iSoft                       = 0.0     # 0.0 <= iSoft  : 0.0 = Hard Inner Edge
oFI                         = 255     # Outer edge, Innermost softening value. (Default 255)
oFO                         = 0       # Outer edge, Outermost softening value. (Default 0)
iFI                         = 0       # Inner edge, Innermost softening value. (Default 0)
iFO                         = 255     # Inner edge, Outermost softening value. (Default 255)
#
CINT                        = 255     # Mask Interior color (nearly always 255)
CEXT                        = 0       # Mask Invalid Exterior color (nearly always 0)
CHUB                        = 0       # Mask Invalid Hollow Ring center (nearly always 0)
###  GENERAL CONTROL for bouncer (1.0=norm)
SPEED                       = 1.0
BOUNCEHEIGHT                = 1.0
#####   END OF CONFIG   ################
### LEAVE BELOW ALONE
Global G_bounceXstep        = (0.01 + RandF * 0.01) * SPEED    # Xpos increment
Global G_bounceAngleStep    = (0.05 + RandF * 0.17) * SPEED     # Step angle
Global G_bounceYScale       = BOUNCEHEIGHT
### Start pos
Global G_bounceX            = RandF                          # Current X position
Global G_bounceY            = RandF                          # Current Y position
Global G_bounceAngle        = RandF * PI
######
Global G_MASK               = Elliptical_Marker(BALLSZ,BALLSZ,
                                \ iRad=iRad,
                                \ oSoft=oSoft,oFi=OFI,oFO=OFO,
                                \ iSoft=iSoft,iFi=IFI,iFO=IFO,
                                \ cInt=CINT,cExt=CEXT,cHub=CHUB,YV12=False)
Global G_OVER               = SYMCLIP
Global G_BallSZ             = BALLSZ
Global G_MASKBASE           = SYMCLIP.BlankClip(Color_YUV=$008080)
SYMCLIP.BlankClip.ScriptClip("return MoveBounce")
No probs with crop and odd ball size, works very well, suggest use same method for future stuff.

EDIT: There will be no audio, maybe save in var and afterwards dub.

EDIT: Changed from Mt_lutspa to BlankClip for Y=0 G_MASKBASE.

EDIT: Return G_MASK prior to final line
__________________
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 ???

Last edited by StainlessS; 1st August 2018 at 07:21.
StainlessS is offline   Reply With Quote
Old 22nd November 2017, 13:50   #20  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Sparky,

Replace Global G_MASK = etc, in above script with this
Code:
BALLSZ_2 = BALLSZ*3/8*2
BALLSZ_3 = BALLSZ/4*2
msk1=Elliptical_Marker(BALLSZ,BALLSZ,iRad=0.75,oSoft=0.5,iSoft=0.5)
msk2=Elliptical_Marker(BALLSZ_2,BALLSZ_2,iRad=0.50,oSoft=0.5,iSoft=0.5)
msk3=Elliptical_Marker(BALLSZ_3,BALLSZ_3,iRad=0.25,oSoft=0.5,iSoft=0.5)
M=msk1
M=OverLay(M,msk2,x=(M.width-msk2.width)/2,y=(M.height-msk2.height)/2,mask=msk2)
Global G_MASK=OverLay(M,msk3,x=(M.width-msk3.width)/2,y=(M.height-msk3.height)/2,mask=msk3)
and leave remaining lines intact,

will produce a more cryptic Name That Movie trivia type thing.

G_MASK


MP4 demo, (~2MB, 60 secs):- http://www.mediafire.com/file/tp7290...potExpose2.mp4

EDIT: Looks kinda like intro to a James Bond movie.
The trick is to look 'through' the bouncing hoops and the movie is immediately clearer.
__________________
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 ???

Last edited by StainlessS; 1st August 2018 at 07:22.
StainlessS is offline   Reply With Quote
Reply

Tags
mask, overlay

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 22:35.


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