TechnoRobbo Posted July 28, 2013 Share Posted July 28, 2013 (edited) TechnoRobbo's Tilt-Shift Another Classic photographic simulation. https://en.wikipedia.org/wiki/Tilt%E2%80%93shift_photography Tilt Shift Photography is created by misaligning the lens with the film or image sensor. This misalignment actually shifts the depth of field. TR's Tilt-Shift is a directional gradient blur tool designed to easily achieve the effect. Menu: Effects - > Blurs Video Tutorial for image plane image music by TechnoRobbo Vanishing Point The Code Hidden Content: // Submenu: Blurs // Name: TR's TiltShift // Title: TR's TiltShift - v1.0 // Author: TechnoRobbo // URL: http://www.technorobbo #region UICode int Amount1 = 15; // [1,100] Blur Amount double Amount2 = 45; // [-180,180] Tilt double Amount3 = .5; // [0,1] Length #endregion public struct PointD { public double x, y; public PointD(double p1, double p2) { x = p1; y = p2; } } void Render(Surface dst, Surface src, Rectangle rect) { Rectangle sel = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); int CenterX = ((sel .Right - sel .Left) / 2)+sel .Left; int CenterY = ((sel .Bottom - sel .Top) / 2)+sel .Top; double rad = Amount2 * Math.PI/180; double diag = Math.Sqrt(sel.Width * sel.Width + sel.Height + sel.Height); ColorBgra CP = new ColorBgra(); //Test varaibles //Amount1 = 20; //Amount2 = -90; //Amount3 = .85; for (int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { //======================================== PointD position = new PointD(x-CenterX,y-CenterY); double oldx = position.x ; position.x =(float)Math.Cos(rad) * (float)position.x - Math.Sin(rad) * position.y + CenterX; double length =diag * Amount3 + 1; double val =1 - Math.Min(1,position.x /length); //quadratics val *=val; int Amount =(int)((double)Amount1 * val); //=========================================================== if (Amount>0){ int y1= y - Amount; int y2 = y + Amount; int x1= x - Amount; int x2 = x + Amount; int A=0,R=0,G=0,B=0,D=0; for (int j=y1;j<y2;j++){ for (int i=x1;i<x2;i++){ CP = src.GetBilinearSampleClamped(i,j); A += CP.A; R += CP.R; G += CP.G; B += CP.B; D++; } } if (D==0){D=1;} CP.A = Int32Util.ClampToByte(A/D); CP.R = Int32Util.ClampToByte(R/D); CP.G = Int32Util.ClampToByte(G/D); CP.B = Int32Util.ClampToByte(B/D); }else{ CP=src[x,y]; } dst[x,y] = CP; } } } TRsTiltShift.zip Edited December 28, 2015 by TechnoRobbo 5 Quote Go out there and be amazing. Have Fun, TRSome Pretty Pictures Some Cool Plugins Link to comment Share on other sites More sharing options...
mottoman Posted July 28, 2013 Share Posted July 28, 2013 I like this. I like this a lot. Thank you. Quote Link to comment Share on other sites More sharing options...
Alpha1OfDons Posted August 16, 2013 Share Posted August 16, 2013 Awesome Plugin Quote Link to comment Share on other sites More sharing options...
SAND33P Posted August 27, 2013 Share Posted August 27, 2013 Great work, this cuts down allot of work time for me working with blurred layers and gradients! Quote Link to comment Share on other sites More sharing options...
JB3 Posted January 21, 2014 Share Posted January 21, 2014 dude,,, you're a madman,,, i mostly make wallpapers for phones, pc & tablets & this stuff you're doing is awesome!!! i've downloaded 6 or 7 of yours already & still lookin',,, great work,,, if i wasn't broke i'd send you a hundy,,, tyvm!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.