Followers 0

# TR's Glass Vignette

## 18 posts in this topic

TechnoRobbo's Glass Vignette v1.1

A Refraction-like distortion with an un-distorted center.

v1.1 - Alpha-friendly

Source Code

Hidden Content:

```
// Name: TR's Glass Vignette
// Title: TR's Glass Vignette
// Author: TechnoRobbo
// URL: http://www.technorobbo.com
#region UICode
double Amount1 = 0.761; // [0.001,1] Refraction
Pair<double, double> Amount2 = Pair.Create( 0.0 , 0.0 ); // Control Description
double Amount3 = 1.01; // [1.01,1.2] Chromatic Aberration
double Amount4 = 1; // [1,100] Zoom
#endregion
void Render(Surface dst, Surface src, Rectangle rect)
{
// Delete any of these lines you don't need
Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
int CenterX = ((selection.Right - selection.Left) / 2)+selection.Left;
int CenterY = ((selection.Bottom - selection.Top) / 2)+selection.Top;
double aberate = (Amount1 - .001)/.999;
aberate = 1 * aberate + Amount3 * (1-aberate);
aberate *= aberate;
Surface tmp = src.Clone();
tmp.Clear(ColorBgra.Transparent);
tmp.CopySurface(src,new System.Drawing.Point((int)(-Amount2.First * CenterX),
(int)(-Amount2.Second * CenterY)));
double CenterMax =Math.Sqrt(CenterX * CenterX + CenterY * CenterY);
double zoom =(101 - Amount4)/100;
for (int y = rect.Top; y < rect.Bottom; y++)
{
if (IsCancelRequested) return;
for (int x = rect.Left; x < rect.Right; x++)
{   double maxx =(x-CenterX);
double maxy =(y-CenterY);
double far = Math.Sqrt(maxx * maxx + maxy * maxy );
double rad = Math.Atan2(maxy ,maxx + .0001 );
double effect = far/CenterMax;
double refractR = Math.Pow(far,Amount1) * aberate ;
double refractB = Math.Pow(far,Amount1);
double offxS = Math.Cos(rad) * far * zoom + CenterX;
double offxR = Math.Cos(rad) * refractR * zoom + CenterX;
double offxB = Math.Cos(rad) * refractB * zoom + CenterX;
double offyS = Math.Sin(rad) * far * zoom + CenterY;
double offyR = Math.Sin(rad) * refractR * zoom + CenterY;
double offyB = Math.Sin(rad) * refractB * zoom + CenterY;
offxR = offxS * (1- effect) + offxR * effect;
offyR = offyS * (1- effect) + offyR * effect;
offxB = offxS * (1- effect) + offxB * effect;
offyB = offyS * (1- effect) + offyB * effect;
ColorBgra CPR = tmp.GetBilinearSample((float)offxR,(float)offyR);
ColorBgra CPB = tmp.GetBilinearSample((float)offxB,(float)offyB);
ColorBgra CP = ColorBgra.FromBgra(CPB.B,(byte)((CPR.G + CPB.G)/2),CPR.R,(byte)((CPR.A + CPB.A)/2));
dst[x,y] = CP;
}
}
tmp.Dispose();
}```

TRsGlassVignette.zip

Edited by TechnoRobbo
8

##### Share on other sites

Gosh.  That's a nice effect for such a (relatively) simple source.  I think I actually understand some of it

Many thanks for both the effect and the source TechnoRobbo!

1

##### Share on other sites

That's cool looking! Thank You for your work!

0

Cool plugin

Went from this:

To This:

3

##### Share on other sites

That is such a cool plugin. Thank yo so much TechnoRobbo.

Germany/Berlin

2

##### Share on other sites

EER - Thanks -the code is actually some unused routines from developing PasteWarp. It takes a warped mind to make a warped plugin.

CC4FH,DD and Seerose - Thank you, your kind. Nice examples too.

DD -It does look liike Darth Vader. I should have published it on May the 4th  not May the 5th. May the 4th be with you.

(OK, OK, I sense a disturbance in the force, like millions of voices groaning over a bad joke).

Edited by TechnoRobbo
2

##### Share on other sites

Oooh.  Now you can move the bean anywhere in the world you want to!  Like.

0

##### Share on other sites

Love it. Thanks TR.  Great images posted

Original

2

##### Share on other sites

Mottoman, I think you captured TR's avatar image beautifully.

1

##### Share on other sites

Mottoman, I think you captured TR's avatar image beautifully.

Now that I look again, you are right. Well spotted doughty.

0

##### Share on other sites

Ooooh - yet another really cool Plugin @TR - Many thanks.  So many possibilities - could play all day.

And .......... I get to sit on the Loch Ness Monster and be wiped out by a Tsunami at the same time

2

##### Share on other sites

Fun plugin TR - thanks!

Very creative examples from everyone too.

1

##### Share on other sites

Fun plugin TR - thanks!

Very creative examples from everyone too.

Indeed yes. Thanks for the creation TechnoRobbo. Fun to be had.

0

##### Share on other sites

Almost like polar inversion without the clutter. Clever.

0

##### Share on other sites

Oooh.  Now you can move the bean anywhere in the world you want to!  Like.

Honestly , I think that bean is weird. A city with architecture by Mies van der Rohe ,Frank LLoyd Wright and the Columbian Exposition legacy has a bean?

Many thanks to david. pixey , doughty, lloyd, treveroutla and especially to Mottoman for the turkey homage.

Red has pointed out that Alpha channel should be taken into consideration and I agree. I will publish have published an Alpha-friendly revision - Thanks Red (reps from me)

Edited by TechnoRobbo
0

##### Share on other sites

Honestly , I think that bean is weird. A city with architecture by Mies van der Rohe ,Frank LLoyd Wright and the Columbian Exposition legacy has a bean?

The bean is weird.  But being close to it is a fascinating experience.

Does calling it "cloud gate" make it better? ;-)

0

##### Share on other sites

nah, doesn't help. It's still like hanging dogs playing poker at the Louvre

0

##### Share on other sites

Hey, that is one classy piece of artwork.

0