Old 07-12-2022, 04:20 PM   #1
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default Peephole wipe: x/y axis

I'm displaying a full screen image (JPG) at the end of a video, and I use the peephole wipe to transition from the video to the image, but I'd like to have the "hole", as it's getting smaller, shift over to the left (or right) so that the last thing you focus on is not the center of the video but off to the side (and a little lower than center).

A humorous accentuation you might say. It's possible it's intended to highlight a particular person's backside.... though that would be rude of me... so let's say it's not.

Can there be an X/Y coordinate added to Peephole Wipe?
fuzzball is offline   Reply With Quote
Old 07-13-2022, 04:10 AM   #2
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
I'm displaying a full screen image (JPG) at the end of a video, and I use the peephole wipe to transition from the video to the image, but I'd like to have the "hole", as it's getting smaller, shift over to the left (or right) so that the last thing you focus on is not the center of the video but off to the side (and a little lower than center).

A humorous accentuation you might say. It's possible it's intended to highlight a particular person's backside.... though that would be rude of me... so let's say it's not.

Can there be an X/Y coordinate added to Peephole Wipe?
That was my first hack I published quite a while ago :-)
Here is link: Peephole/vignette with ajustable center
There are a few videos artifacts if your go to far to the extremes of the screen but that should do it.
papagirafe is offline   Reply With Quote
Old 07-14-2022, 02:42 PM   #3
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

Ah yes.... I recall now... and even see that I had made the 2nd comment on that thread. The mind fades.

Unfortunately the artifacts become quite apparent when I x/y the peephole across the screen as it's being expanded, or it could just be when it interacts with the edge of the screen.

Since I'm looking to "present" the video using this it won't work, as it needs to go from size 0 to 2. As it hits the edge it gets noticeable.
fuzzball is offline   Reply With Quote
Old 07-14-2022, 03:38 PM   #4
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
Ah yes.... I recall now... and even see that I had made the 2nd comment on that thread. The mind fades.

Unfortunately the artifacts become quite apparent when I x/y the peephole across the screen as it's being expanded, or it could just be when it interacts with the edge of the screen.

Since I'm looking to "present" the video using this it won't work, as it needs to go from size 0 to 2. As it hits the edge it gets noticeable.
I think I have a patch for that problem: enlarge the project canvas for mixing and then crop to the region of interest (standard dimensions).
Code:
//patch
opw=project_w;
oph=project_h;
npw=project_w*=1.4;
nph=project_h*=1.4;
gfx_blit(0,0,(npw-opw)/2,(nph-oph)/2,opw,oph);

Last edited by papagirafe; 07-14-2022 at 06:13 PM. Reason: new info
papagirafe is offline   Reply With Quote
Old 07-15-2022, 07:27 AM   #5
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Hi Fuzzball,

I tested the patch concept and it works but there are several more steps to make it work without loosing video quality. I made a demo project to illustrate and as a bonus there is a video track analizer/selector in there...



Vignette patch demo.rpp
papagirafe is offline   Reply With Quote
Old 07-20-2022, 03:21 PM   #6
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Ok folks,

Here is a more permanent solution to this ajustable vignette position. I did a major rewite and simplification of the stock preset and guess what: no more video artifacts. A major rewrite means potential situations I've overlooked so let me know if there are problems.
Code:
//Peephole wipe / vignette v3
// by Papagirafe 
// major stock code simplification + adjustable vignette position
//@param size 'size' 1 0 8 1 0.01
//@param scale 'shaping' 1 .5 10 5.25 0.01
//@param div 'sub-divide' 32 8 256 36 1
//@param fgi 'fg src' 0 0 10 5 1
//@param bgi 'bg src' 1 0 10 5 1
//@param fga 'fg alpha' 1 0 1 0.5 0.01
//@param bga 'bg alpha' 1 0 1 0.5 0.01
//@param xoff "fg x offset" 0 -1 1 0 0.01
//@param yoff "fg y offset" 0 -1 1 0 0.01

function vignette(si,x,y,w,h, size, scale, alpha)
  local(divw, divh, xp, yp, dx, dy, p, yv,xsc, ysc, xr, yr, mask, sz, adj)
  global(div,project_w,project_h,colorspace)
(
  input_info(si,w,h);
  sz=max(min(w,h)*size*.5,1);
  adj=-scale/sz;

  mask = colorspace=='RGBA'?-1:-2;
  divw = w*.5; while (divw > div) ( divw *= 0.5 ); divw |= 0;
  divh = h*.5; while (divh > div) ( divh *= 0.5 ); divh |= 0;

  dx = w / (divw-1); dy = h / (divh-1);
  xsc = w / project_w; 
  ysc = h / project_h;
  yp=p=0;
  loop(divh,
    xp=0;
    yr = (yp+0.5)&mask;
    yv = sqr(yr-h*.5);
    loop(divw,
      xr = (xp+0.5)&mask;
      p[0]=(x + xr)*xsc; p[1] = (y + yr)*ysc;
      p[2] = alpha * max(min((sqrt(sqr(xr-w*.5)+yv)-sz)*adj,1),0);
      p += 3;
      xp += dx;
    );
    yp += dy;
  );
  gfx_xformblit(si,x,y,w,h,divw,divh,0,1);
);
////////////////////////////////
!project_wh_valid?( //get a rectangle that can contain both images
  input_info(fgi,fw,fh); input_info(bgi,fw,fh); 
  project_w=max(fw,bw); project_h=max(fh,bh);
);
xoff*=(project_w/2);
yoff*=(project_h/2);
gfx_set(0,0,0,1,0,-1,0);
gfx_blit(bgi,0);
bga<1?(
  gfx_a=1-bga;
  gfx_blit(fgi,0);
);
gfx_a=1;
vignette(fgi,xoff,yoff,fsw,fsh,size,scale,fga);

Last edited by papagirafe; 07-23-2022 at 04:46 AM. Reason: correcting typo in code
papagirafe is offline   Reply With Quote
Old 07-20-2022, 06:41 PM   #7
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

I can't seem to get it to do anything noticeable. I've put it as a video effect on a track which simply displays a JPG as the video thumbnail. I display that over the video and have the peephole open up as the music starts. But no matter what I do to the track settings the JPG displays with no peephole, and the video behind it is never seen.

The Cockos Peephole wipe is on the same track but disabled. When enabled it works fine.

No other FX are on the track, and removing the Cockos one had no effect either.
fuzzball is offline   Reply With Quote
Old 07-21-2022, 05:44 AM   #8
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
I can't seem to get it to do anything noticeable. I've put it as a video effect on a track which simply displays a JPG as the video thumbnail. I display that over the video and have the peephole open up as the music starts. But no matter what I do to the track settings the JPG displays with no peephole, and the video behind it is never seen.

The Cockos Peephole wipe is on the same track but disabled. When enabled it works fine.

No other FX are on the track, and removing the Cockos one had no effect either.
Aarghh! First, I found a stupid typo (now corrected) in the routine that tries to guess a decent project size when not set. Secondly when there is a resolution mismatch between the 2 tracks the results are not quite what I expected. I'll work on fix but I'll be on the move today so don't hold your breath :-)

The right conditions to make it work are simple though:
- First make sure you set the project's dimensions.
- Second add a "Basic helpers: Track opacity/zoom/pan" on each track. That will convert your track to the project's dimension and you can make sure that things are aligned properly.

That fix will change the inputs numbers for sure so here is my input stack analyzer. Just put it alone on an empty track on top of all others. That will help you find the right input numbers (minus 1 because the analyser comes after the vignette...)

Code:
//input stack analyzer
// by papagirafe
//@param src src 0 0 100 50 1
//@param 3:opacity 'text opacity' 0.5 0 1 0.5 0.1
function update_param(p*,val)( on_parameter_change(p); p=val; on_parameter_change(p,1););
src=((src+0.5)|0);
src>=(ic=input_count())?update_param(src,ic-1);
input_info(src,w,h); 
gfx_set(0,0,0,1);
gfx_fillrect(0,0,w,h);
gfx_blit(src,1);
gfx_setfont(min(project_h,project_w)*0.07);
w&&h?input_get_name(src,#iname):#iname="no track";
sprintf(#debug,"[%d]:(%dx%d) %s",src,w,h,#iname);
gfx_str_measure(#debug,tw,th);
gfx_set(0,0,0,opacity,0,-1,0); 
gfx_fillrect(0,0,tw,th);
gfx_set(1,1,1,opacity,0,-1,0);  
gfx_str_draw(#debug,0,0);

Last edited by papagirafe; 07-28-2022 at 04:24 AM.
papagirafe is offline   Reply With Quote
Old 07-31-2022, 05:02 PM   #9
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Hiho!

I finally put aside some time to correct the misbehavior when sources sizes don't match. You are no longer obliged to add size correcting presets on the sources. I am cooking up a much better version of this "vignette" in the upcoming GiraFX library. In the mean time, here is the fixed version (v3.01):

Code:
//Peephole wipe / vignette v3.01
// by Papagirafe 
// 3.0 major stock code simplification + adjustable vignette position
// 3.01 source size mismatch behavior fixed
//@param size 'size' 1 0 8 1 0.01
//@param scale 'shaping' 1 .5 10 5.25 0.01
//@param div 'sub-divide' 32 8 256 36 1
//@param fgi 'fg src' 0 0 10 5 1
//@param bgi 'bg src' 1 0 10 5 1
//@param fga 'fg alpha' 1 0 1 0.5 0.01
//@param bga 'bg alpha' 1 0 1 0.5 0.01
//@param xoff "fg x offset" 0 -1 1 0 0.01
//@param yoff "fg y offset" 0 -1 1 0 0.01

function vignette(si,x,y,w,h, size, scale, alpha)
  local(divw, divh, xp, yp, dx, dy, p, yv,xsc, ysc, xr, yr, mask, sz, adj)
  global(div,project_w,project_h,colorspace)
(
  sz=max(min(w,h)*size*.5,1);
  adj=-scale/sz;

  mask = colorspace=='RGBA'?-1:-2;
  divw = w*.5; while (divw > div) ( divw *= 0.5 ); divw |= 0;
  divh = h*.5; while (divh > div) ( divh *= 0.5 ); divh |= 0;

  dx = w / (divw-1); dy = h / (divh-1);
  xsc = w / project_w; 
  ysc = h / project_h;
  yp=p=0;
  loop(divh,
    xp=0;
    yr = (yp+0.5)&mask;
    yv = sqr(yr-h*.5);
    loop(divw,
      xr = (xp+0.5)&mask;
      p[0]=(x + xr)*xsc; p[1] = (y + yr)*ysc;
      p[2] = alpha * max(min((sqrt(sqr(xr-w*.5)+yv)-sz)*adj,1),0);
      p += 3;
      xp += dx;
    );
    yp += dy;
  );
  gfx_xformblit(si,x,y,w,h,divw,divh,0,1);
);
////////////////////////////////
!project_wh_valid?(project_w=1280;project_h=720); 
gfx_set(0,0,0,1,0,-1,0);
fgi2=gfx_img_alloc(project_w,project_h);
gfx_dest=fgi2; gfx_blit(fgi,1);
gfx_dest=-1; gfx_blit(bgi,1);

bga<1?(
  gfx_a=1-bga;
  gfx_blit(fgi,1);
);
vw=max(min(fgw,fgh)*size*.5,1);
xoff*=project_w/2;
yoff*=project_h/2;
gfx_a=1;
vignette(fgi2,xoff,yoff,project_w,project_h,size,scale,fga);
gfx_img_free(fgi2);
papagirafe is offline   Reply With Quote
Old 08-04-2022, 04:17 PM   #10
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

An interesting thing happens with this vignette when you use an envelope to open and close the peephole.

1) Stretch an image out across the timeline.
2) Add Peephole Wipe v3.01.
3) Click on the size parameter and then show it on track envelope.
4) Put two points on the track envelope and then drag one of them to the top or bottom to create a "slope."

Results: The slope is not uniform like you would expect. It develops a sharp angle when it crosses the center line. The bottom half of the envelope is 0-1 and the top half is 1-8.

Is this the intended behavior?
fuzzball is offline   Reply With Quote
Old 08-04-2022, 06:32 PM   #11
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
An interesting thing happens with this vignette when you use an envelope to open and close the peephole.

1) Stretch an image out across the timeline.
2) Add Peephole Wipe v3.01.
3) Click on the size parameter and then show it on track envelope.
4) Put two points on the track envelope and then drag one of them to the top or bottom to create a "slope."

Results: The slope is not uniform like you would expect. It develops a sharp angle when it crosses the center line. The bottom half of the envelope is 0-1 and the top half is 1-8.

Is this the intended behavior?
=-O Wow! That's new! It's obviously not intended and it look like a bug in Reaper or a memory conflict of some kind. To patch the bug just add a 3rd point before the bump and push it upto the ending point.
papagirafe is offline   Reply With Quote
Old 08-04-2022, 06:38 PM   #12
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

I had already tried that but then it goes slow for the first half (which is 0-1, and then speeds up for the 2nd half, which is 1-8. An 8-1 ratio of speed in the 1st half vs 2nd half.

The issue didn't start in this version. It was a while back.

I assumed you had a good reason why the size parameter goes from 0-8 instead of 0-2 like the Cockos version does.
fuzzball is offline   Reply With Quote
Old 08-05-2022, 04:00 AM   #13
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
I had already tried that but then it goes slow for the first half (which is 0-1, and then speeds up for the 2nd half, which is 1-8. An 8-1 ratio of speed in the 1st half vs 2nd half.

The issue didn't start in this version. It was a while back.

I assumed you had a good reason why the size parameter goes from 0-8 instead of 0-2 like the Cockos version does.
Oh boy! Trying to hack the original preset turned out to be even more difficult than anticipated. Since there seems to be an important interest for this functionality by looking at the thread stats, I will release, as soon as I am finished with my current rush, a pre-version of my new improved peephole/vignette preset. Stay tuned!
papagirafe is offline   Reply With Quote
Old 08-05-2022, 06:54 AM   #14
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,369
Default

so..

i have another way to get around with moving vignettes,
using leafac's way to deal with masking using black and white pictures.

in the second track is a picture of a vignette , black and white

setting contrast an brightness with the usual videoprozessor (Track opacity) to set the edges and transitions
and the position with the usual videoproc (Brightness/contrast...)

and some key-animation-stuff on appropriate parameters

above is a picture (a video will do here too) with the mascing videoprocessor on it, taking the next video as mask

For demo purposes and for fun i made a templateproject.

and here is the rendered result as video (no tone) 1920 1200

and no, it's not me holding the hose into the wind

i'm looking forward to the GiraFX-Stuff

Last edited by bobobo; 08-05-2022 at 10:57 PM.
bobobo is offline   Reply With Quote
Old 08-05-2022, 11:31 AM   #15
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Hi Folks,

I was waiting for some input in my current project, so I was able to prepare the new pre-release Peephole/Vignette preset. First, to duplicate the original functionality (and improve on it) it now consists of 2 presets:
1) a pure Vignette transparency preset to apply to your foreground source
2) an improved version of "Image overlay" that can select fg/bg source and more

The vignette efficiently delivers better image quality, smoother transparency gradient and easier to understand parameters. The "crop to vignette" acts like a cropping/framing tool. Take note that without the image overlay, this preset seems to do nothing but in fact it create a vignette exclusively in the alpha plane.

The newer "Image overlay" is adding bg/fg source control on my already improved version I released in July. There is a special "toggle" parameter in there that, when set, will recalculate the fg/bg inputs to standard values. This parameter returns to 0 by itslef. Last but not least, the "zoom mode" param allows to automatically set the zoom to maximize width or height of the fg source.

*** 2022-08-09: added flag for single processing ***



*****Peephole/vignette *******
Code:
//girafx:peephole/vignette
// by papagirafe
// v1.0/2002.08.05: initial release 
// v1.01/2002.08.06: added "invert mask" feature
// *** warning: transparency only filter, requires "image overlay"
//@param radius radius 1 0 4 2 0.01
//@param grw "gradient width" 0.5 0 1 0.5 0.001
//@param xoff xoff 0 -1 1 0 0.01
//@param yoff yoff 0 -1 1 0 0.01
//@param c2v "crop to vignette" 0 0 1 0.5 1
//@param im "invert mask" 0 0 1 0.5 1

input_info(0,w,h)?(
  colorspace='RGBA';
  #code[0]="
  rad=sqrt((x-cx)^2+(y-cy)^2);
  rad>pr?a=0:rad>=pr2?a=255*(pr-rad)/(pr-pr2):a=255;
  x+=1;x==vw?(y+=1;x=0);
  ";
  #code[1]="
  rad=sqrt((x-cx)^2+(y-cy)^2);
  rad>pr?a=255:rad>=pr2?a=255-(255*(pr-rad))/(pr-pr2):a=0;
  x+=1;x==vw?(y+=1;x=0);
  ";
  x=y=0;
  pr=(radius*min(w,h)/2)|0;
  pr2=max(0,(1-grw)*pr)|0;
  c2v?(cx=cy=pr;sx=(1+xoff)*w/2-pr;sy=(1+yoff)*h/2-pr;vw=vh=project_w=project_h=2*pr):
      (cx=(1+xoff)*w/2;cy=(1+yoff)*h/2;sx=sy=0;vw=project_w=w;vh=project_h=h);
  gfx_blit(0,0, 0,0,vw,vh, sx,sy,vw,vh);
  gfx_evalrect(0,0,vw,vh,#code[im],1); 
);
******* overlay image ***********
Code:
//Image overlay w/rot/auto-zoom/src ctl 
//  by papagirafe
//v1.1 added rotation
//v1.21 added video source control & fg auto-zoom 
//@param opacity 'opacity' 1
//@param zmode "zoom mode" 0 0 2 1 1      0=manual, 1=maximize height, 2=maximize width
//@param zoom 'zoom' 0 -15 15 0 0.01
//@param xoffs 'X offset' 0 -1 1 0 0.01
//@param yoffs 'Y offset' 0 -1 1 0 0.01
//@param rota "rotation" 0 -360 360 0 0.1
//@param cxoff 'rot axis x offset' 0 -1 1 0 0.01
//@param cyoff 'rot axis y offset' 0 -1 1 0 0.01

//@param10:fg "fg input" 0 0 40 20 1
//@param bg "bg input" 1 0 40 20 1
//@param reset "auto inputs values" 0 0 1 0.5 1
//@paramfilter 'filter' 0 0 1 0.5 1
//@param use_srca 'alpha channel' 1 0 1 0.5 1
function refresh_param(p*,val)(on_parameter_change(p);p=val; on_parameter_change(p,1));
function set_origin(ox,oy)(this.ox=ox;this.oy=oy);
function rotate_coord(x,y,rota)
  instance(r,phi)
(
  this.x=x-this.ox; this.y=y-this.oy;
  r=sqrt(this.x^2+this.y^2);
  phi=2*atan(this.y/(this.x+r))+rota;
  this.x=r*cos(phi);
  this.y=r*sin(phi);
);
function calc_extra_rot(w,h,rota,ox,oy)
  local(a,rx,ry,rxmax,rymax,ox,oy)
(
  rxmax=rymax=0;
  rx=w>>1; ry=h>>1; 
  ox=(ox*w)|0; oy=(oy*h)|0;
  a.set_origin(rx,ry);  
  a.rotate_coord(0+ox,0+oy,rota); abs(a.x)>rxmax?rxmax=abs(a.x|0); abs(a.y)>rymax?rymax=abs(a.y|0);
  a.rotate_coord(w+ox,0+oy,rota); abs(a.x)>rxmax?rxmax=abs(a.x|0); abs(a.y)>rymax?rymax=abs(a.y|0);
  a.rotate_coord(0+ox,h+oy,rota); abs(a.x)>rxmax?rxmax=abs(a.x|0); abs(a.y)>rymax?rymax=abs(a.y|0);
  a.rotate_coord(w+ox,h+oy,rota); abs(a.x)>rxmax?rxmax=abs(a.x|0); abs(a.y)>rymax?rymax=abs(a.y|0);
  max(rxmax/rx,rymax/ry);
);

ic=input_count();
reset==1?(refresh_param(fg,0);refresh_param(bg,input_track(0));refresh_param(reset,0));
use_srca && fg != bg ? colorspace='RGBA';
input_info(bg,img1w,img1h) && project_wh_valid===0 ?  ( project_w = img1w; project_h = img1h; );

a = opacity < 0.01 ? 0 : opacity > 0.99 ? 1 : opacity;

fg != bg && input_info(fg,sw,sh) ? (
  gfx_blit(bg,0);
  a>0?(
    gfx_a=a;
    gfx_mode = (filter>0.5 ? 256 : 0)|(use_srca?0x10000:0);
    rota*=$pi/180;

    zmode==1?refresh_param(zoom,10*log10(z=project_h/sh)):
    zmode==2?refresh_param(zoom,10*log10(z=project_w/sw)):
    z=10^(zoom/10);

    dw = (sw*z)|0;
    dh = (sh*z)|0;
    x = (project_w - dw + (project_w + dw)*xoffs)*.5;
    y = (project_h - dh + (project_h + dh)*yoffs)*.5;
    sc=calc_extra_rot(dw,dh,rota,cxoff,cyoff);
    sc2=sc*.5 - 0.5;
    gfx_rotoblit(fg,rota,(x-dw*sc2)|0,(y-dh*sc2)|0,dw*sc,dh*sc, -sw*sc2, -sh*sc2, sw*sc, sh*sc,0,(cxoff*dw)|0,(cyoff*dh)|0);
 );
);

Last edited by papagirafe; 08-09-2022 at 06:15 AM. Reason: bug correction, added flag to prevent multi-processing.
papagirafe is offline   Reply With Quote
Old 08-05-2022, 02:22 PM   #16
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

If I wanted to take these two scripts, and replace the one script "Peephole wipe / vignette" - can you describe to me the steps?

With "Peephole wipe / vignette" I put it as the only script on the foreground image and open a hole using the Size parameter (after reversing inside input and outside input).
fuzzball is offline   Reply With Quote
Old 08-05-2022, 02:39 PM   #17
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
If I wanted to take these two scripts, and replace the one script "Peephole wipe / vignette" - can you describe to me the steps?

With "Peephole wipe / vignette" I put it as the only script on the foreground image and open a hole using the Size parameter (after reversing inside input and outside input).
Basically you just need to chain them:

Bottom track:
background image/video (+optionaly fx=resize to project dim)
Top track:
foreground image/video
1 "new vignette fx"
2 "new image overlay fx" with zoom mode set to 1 or 2 and
then set "auto input values"

Your image should appear, go back to vignette to adjust size/pos/gradient
papagirafe is offline   Reply With Quote
Old 08-05-2022, 02:55 PM   #18
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

Can you tell me how to do it so that the foreground image opens up with a hole in the center to reveal the background image?

Currently when you reveal the background image it's because the foreground image shrinks in from the edge.

I tried fiddling with the fg input and bg input on the overlay, but I end up feeling like a doofus when I can't get it to work.

On the original Peephole/wipe there's a Inside Input and Outside Input to swap those.
fuzzball is offline   Reply With Quote
Old 08-05-2022, 04:27 PM   #19
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
Can you tell me how to do it so that the foreground image opens up with a hole in the center to reveal the background image?

Currently when you reveal the background image it's because the foreground image shrinks in from the edge.

I tried fiddling with the fg input and bg input on the overlay, but I end up feeling like a doofus when I can't get it to work.

On the original Peephole/wipe there's a Inside Input and Outside Input to swap those.
I suspect that your definition of BG/FG is the exact oposite of mine which also make sense. The vignette has to go on the item/track that is peircing through the other.
papagirafe is offline   Reply With Quote
Old 08-05-2022, 11:01 PM   #20
bobobo
Human being with feelings
 
bobobo's Avatar
 
Join Date: Oct 2014
Posts: 1,369
Default

hi papa

i tested your new scripts and it looks weird here in editor ..
but it works

creating a track with an item containng both videoprocs first the peephole followed by the overlay proc
in the second track is the background item
you described this in your posting

playing around with the params i get a vignette (the item of the first track "vignetted" over the background.

BUT

if i animate the params things goes crazy. it seams to take some rounds to get things right.
the result of the chages take some time (and sometimes repetitions) to chime in.. crazy

BUT rendered output seams to be ok

that shows that the videoprocessor has something to do..

i made a demo
and here is a rendered video

the reset "auto inputs values" works only when zomm set to manual. i had to learn this

and i changed the link in my posting above concerning the demo project.
now it's the correct demo.


Last edited by bobobo; 08-06-2022 at 03:24 AM.
bobobo is offline   Reply With Quote
Old 08-06-2022, 05:16 AM   #21
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by bobobo View Post
hi papa

i tested your new scripts and it looks weird here in editor ..
but it works

creating a track with an item containng both videoprocs first the peephole followed by the overlay proc
in the second track is the background item
you described this in your posting

playing around with the params i get a vignette (the item of the first track "vignetted" over the background.

BUT

if i animate the params things goes crazy. it seams to take some rounds to get things right.
the result of the chages take some time (and sometimes repetitions) to chime in.. crazy

BUT rendered output seams to be ok

that shows that the videoprocessor has something to do..

i made a demo
and here is a rendered video

the reset "auto inputs values" works only when zomm set to manual. i had to learn this

and i changed the link in my posting above concerning the demo project.
now it's the correct demo.

Thanks for testing Bobobo! I tried your demo and I didn't see anything unexpected on the editor on my machine. I suspect that the method I used improves quality but at the price of higher cpu/gpu usage and beyond a certain treshold things gets wild on the editor.

Fuzzball: I added an "invert mask" on the vignette that should restore the behavior you are use to. I updated the code on my publication from yesterday
papagirafe is offline   Reply With Quote
Old 08-06-2022, 04:20 PM   #22
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

Quote:
Originally Posted by papagirafe View Post
Fuzzball: I added an "invert mask" on the vignette that should restore the behavior you are use to. I updated the code on my publication from yesterday
Woah, now we're getting somewhere. It's murder on the CPU but it renders up with very high quality. Nice! It's almost TOO perfect/uniform after my being used to all the fuzzy artifacts of the other FXs that I've used for the purpose.

The only thing I dare suggest would be to make the Peephole independent of the Image Overlay (so you just need the one FX).
fuzzball is offline   Reply With Quote
Old 08-06-2022, 06:45 PM   #23
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
Woah, now we're getting somewhere. It's murder on the CPU but it renders up with very high quality. Nice! It's almost TOO perfect/uniform after my being used to all the fuzzy artifacts of the other FXs that I've used for the purpose.

The only thing I dare suggest would be to make the Peephole independent of the Image Overlay (so you just need the one FX).
Glad you liked it! I was suprised too of the gradient visual quality on first run. As for making it into a single FX, it sort of go the opposite direction of what I am doing in my upcoming Girafx lib (for strong design reasons), so for the moment I'll leave it to the community to fuse it into a single FX :-)
papagirafe is offline   Reply With Quote
Old 08-07-2022, 11:36 AM   #24
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

I'm starting to see the reason behind you originally setting the Radius to go up to 8. I've noticed that if I have the Radius at the new maximum of 4 and increase the Gradient Width to more than the default of .5, it starts to impinge on the corners/edge of the project.

As it is now I'll use the required image overlay to make the foreground image invisible during the actual video, and transition it to visible before shrinking the hole down.

I'm going to try to soon post an example of the video transition I'm working on. Just rendering the last 30 or so seconds, since it renders at 0.1% speed now.
fuzzball is offline   Reply With Quote
Old 08-07-2022, 12:05 PM   #25
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

Here's an example of what I'm trying to do. It's rough yet, but I think shows off the FX well.

Using two images in the foreground and one video behind them. The first image in the chain is the white thumbnail, the 2nd is a deep dark blue starfield, and the 3rd is the video, which in this case has no actual connection to the music... it's just a video I threw in to have something there. The audio will go away also to be replaced by my rendition. This is literally just a proof of concept.

The white thumbnail image and the blue starfield image both begin closing the hole in the radius at the same time, but the blue starfield is using a larger gradient width, so it looks more like a blue iris full of stars.

https://www.youtube.com/watch?v=a-V95asOiPQ

I have a nice little green screen star twinkle somewhere around here and I'll put it right at the spot where everything disappears. Should look nice.
fuzzball is offline   Reply With Quote
Old 08-07-2022, 02:24 PM   #26
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
Here's an example of what I'm trying to do. It's rough yet, but I think shows off the FX well.

Using two images in the foreground and one video behind them. The first image in the chain is the white thumbnail, the 2nd is a deep dark blue starfield, and the 3rd is the video, which in this case has no actual connection to the music... it's just a video I threw in to have something there. The audio will go away also to be replaced by my rendition. This is literally just a proof of concept.

The white thumbnail image and the blue starfield image both begin closing the hole in the radius at the same time, but the blue starfield is using a larger gradient width, so it looks more like a blue iris full of stars.

https://www.youtube.com/watch?v=a-V95asOiPQ

I have a nice little green screen star twinkle somewhere around here and I'll put it right at the spot where everything disappears. Should look nice.
My motivation behind all the tedious work of coding presets is to unleash the artistic creative process and you are definitely proving me right: thanks for sharing!
As for the limits I put for the parameters, if needed you can safely increase the one for radius and the precision for gradient wihtout additional impact on performance.
papagirafe is offline   Reply With Quote
Old 08-09-2022, 04:00 PM   #27
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

Quote:
Originally Posted by papagirafe View Post
My motivation behind all the tedious work of coding presets is to unleash the artistic creative process and you are definitely proving me right: thanks for sharing!
As for the limits I put for the parameters, if needed you can safely increase the one for radius and the precision for gradient wihtout additional impact on performance.
Thanks for your hard work. Your math skills are way beyond me.

End result is amazing, though very CPU intensive. It takes my i5 laptop close to 30 minutes to render a 3 minute video.

Now that I know why you had the radius at 8 I see that it's useful, as long as the automation "slope" doesn't get weird like it was before.

As far as how to make that change, I'm not versed in the language. I'm a MSSSQL guy.
fuzzball is offline   Reply With Quote
Old 08-09-2022, 05:58 PM   #28
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
Thanks for your hard work. Your math skills are way beyond me.

End result is amazing, though very CPU intensive. It takes my i5 laptop close to 30 minutes to render a 3 minute video.

Now that I know why you had the radius at 8 I see that it's useful, as long as the automation "slope" doesn't get weird like it was before.

As far as how to make that change, I'm not versed in the language. I'm a MSSSQL guy.
My math skills are not what they used to be but as I was studying the extremely badly documented evalrect() function, I saw that it processes each pixel individualy and realized that with only the radius it was easy to know if a pixel is inside or outside a circle! As for the preset language, EEL2, it´s not so complicated for basic things.

Performance wise, the toll on the CPU really bugged me so I went back and decided to see if I could translate the evalrect() code into a tranform matrix to feed xformblit()...and the answer is yes! I tried it: the quality is almost the same and it now works in real time!!! I made a quick (but unflexible) preset that restores most of the original vignette functionality and ... tada! ... it also allows ellipses! BTW as you wished, it's a single preset but the sources might be reversed from what you are used to.

Here is the new code to test:
Code:
//girafx:elliptical vignette xfb
// by papagirafe
// v0.9
//@param radius radius 1 0 4 2 0.01
//@param df "focal dist" 0 0 2 1 0.001
//@param thickness "thickness" 0.1 0 1 0.5 0.001
//@param rota rotation 0 -90 90 0 1
//@param xoff xoff 0 -1 1 1 0.01
//@param yoff yoff 0 -1 1 1 0.01
//@param hdivs precision 100 32 196 96 4

input_info(0,w,h)?(
  colorspace='RGBA';
  project_w=w; project_h=h;
  rota=rota*$pi/180; 
  df*=min(w,h)/2;
  cx=(1+xoff)*w/2;
  cy=(1+yoff)*h/2;
  f1x=cx+cos(rota-$pi)*df; f1y=cy+sin(rota-$pi)*df;
  f2x=cx+cos(rota)*df; f2y=cy+sin(rota)*df;
  pr=ceil(radius*min(w,h));
  pr2=max(0,(1-thickness)*pr);

  xtcorr=1.0069;  //border effect compensation factor 
  tx=0;ty=1;ta=2; 
  vdivs=(h/w*hdivs)|0;
  incrx=w/hdivs*xtcorr;
  incry=h/vdivs*xtcorr;
  i=0;x=0;y=0;
  loop(vdivs, 
    loop(hdivs, 
      rad=sqrt((x-f1x)^2+(y-f1y)^2) + sqrt((x-f2x)^2+(y-f2y)^2);    
      xt[i+tx]=x; 
      xt[i+ty]=y;
      xt[i+ta]=rad>pr?0:rad>=pr2?1*(pr-rad)/(pr-pr2):1;
      i+=3;
      x+=incrx; 
    );
    y+=incry;
    x=0; 
  );
  gfx_blit(input_track());
  gfx_xformblit(0, 0,0,w,h, hdivs,vdivs,xt,1);
);
papagirafe is offline   Reply With Quote
Old 08-11-2022, 05:47 PM   #29
fuzzball
Human being with feelings
 
fuzzball's Avatar
 
Join Date: Dec 2020
Posts: 214
Default

Quote:
Originally Posted by papagirafe View Post
...the sources might be reversed from what you are used to.
Is there a relatively easy way to reverse the source order? The project I'm working on now has a lot of work invested in the order in which the images and videos stack up.

There is a 1920x1080 image on the top of the stack through which I want to "poke a hole". Behind that are multiple videos superimposed upon each other using horizontal wipe and various effects. So I can't put the effect on the background images because there are more than one of them showing at one time. It needs to go on the foreground.
fuzzball is offline   Reply With Quote
Old 08-12-2022, 04:26 AM   #30
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by fuzzball View Post
Is there a relatively easy way to reverse the source order? The project I'm working on now has a lot of work invested in the order in which the images and videos stack up.

There is a 1920x1080 image on the top of the stack through which I want to "poke a hole". Behind that are multiple videos superimposed upon each other using horizontal wipe and various effects. So I can't put the effect on the background images because there are more than one of them showing at one time. It needs to go on the foreground.
Assuming you know the sources numbers, here is a patched code (untested). You can compare the two codes to help you learn how to do small tweaks on video processor code :-)
Code:
//girafx:elliptical vignette xfb
// by papagirafe
// v0.9
//@param radius radius 1 0 4 2 0.01
//@param df "focal dist" 0 0 2 1 0.001
//@param thickness "thickness" 0.1 0 1 0.5 0.001
//@param rota rotation 0 -90 90 0 1
//@param xoff xoff 0 -1 1 1 0.01
//@param yoff yoff 0 -1 1 1 0.01
//@param hdivs precision 100 32 196 96 4
//@param hsrc "hole src" 1 0 20 10 1
//@param psrc "pierced src" 0 0 20 10 1

input_info(hsrc,w,h)?(
  colorspace='RGBA';
  project_w=w; project_h=h;
  rota=rota*$pi/180; 
  df*=min(w,h)/2;
  cx=(1+xoff)*w/2;
  cy=(1+yoff)*h/2;
  f1x=cx+cos(rota-$pi)*df; f1y=cy+sin(rota-$pi)*df;
  f2x=cx+cos(rota)*df; f2y=cy+sin(rota)*df;
  pr=ceil(radius*min(w,h));
  pr2=max(0,(1-thickness)*pr);

  xtcorr=1.0069;  //border effect compensation factor 
  tx=0;ty=1;ta=2; 
  vdivs=(h/w*hdivs)|0;
  incrx=w/hdivs*xtcorr;
  incry=h/vdivs*xtcorr;
  i=0;x=0;y=0;
  loop(vdivs, 
    loop(hdivs, 
      rad=sqrt((x-f1x)^2+(y-f1y)^2) + sqrt((x-f2x)^2+(y-f2y)^2);    
      xt[i+tx]=x; 
      xt[i+ty]=y;
      xt[i+ta]=rad>pr?0:rad>=pr2?1*(pr-rad)/(pr-pr2):1;
      i+=3;
      x+=incrx; 
    );
    y+=incry;
    x=0; 
  );
  gfx_blit(psrc);
  gfx_xformblit(hsrc, 0,0,w,h, hdivs,vdivs,xt,1);
);
papagirafe is offline   Reply With Quote
Old 11-08-2022, 08:22 AM   #31
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,318
Default

Can I set the vignette to white?
Bunus: Inside to solid white (so transition into all white)
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
G-Sun is offline   Reply With Quote
Old 11-08-2022, 09:56 AM   #32
papagirafe
Human being with feelings
 
papagirafe's Avatar
 
Join Date: Aug 2020
Location: Brasil
Posts: 690
Default

Quote:
Originally Posted by G-Sun View Post
Can I set the vignette to white?
Bunus: Inside to solid white (so transition into all white)
You need to combine with a white background image (the filter can be reversed if you need so with "invert mask"). In your case you need to use the combination of presets found in post https://forum.cockos.com/showthread.php?p=2583694
papagirafe is offline   Reply With Quote
Old 11-08-2022, 09:58 AM   #33
G-Sun
Human being with feelings
 
G-Sun's Avatar
 
Join Date: May 2010
Location: Norway
Posts: 7,318
Default

Quote:
Originally Posted by papagirafe View Post
You need to combine with a white background image (the filter can be reversed if you need so with "invert mask"). In your case you need to use the combination of presets found in post https://forum.cockos.com/showthread.php?p=2583694
Thanks!
__________________
Reaper x64, win 11
Composer, text-writer, producer
Bandcamp
G-Sun is offline   Reply With Quote
Reply

Thread Tools
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 -7. The time now is 05:29 AM.


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