pascal 19 Posted February 1 Share Posted February 1 (edited) This plugin can be used to render Julia set fractals using a variety of settings. Adding color options would have made the UI too big, but it can be achieved using my Duotone Gradient Mapping plugin. I hope you enjoy this one! Download: Advanced Julia Fractal.zip Can be found in Effects > Render > Advanced Julia Fractal Previews: Code: (Made in a few hours, so there is probably a lot to improve) // Name: Advanced Julia Fractal // Submenu: Render // Author: Pascal // Title: Advanced Julia Fractal // Version: 1.0.0 // Desc: // Keywords: // URL: // Help: #region UICode IntSliderControl ca = 0; //[-300,300] Real part of constant IntSliderControl cb = 0; //[-300,300] Imaginary part of constant IntSliderControl zoom = 5000; // [1,100000] Zoom IntSliderControl xoff = 0; // [-10000,10000] Offset X IntSliderControl yoff = 0; // [-10000,10000] Offset Y IntSliderControl iterations = 50; //[1,200] Iterations IntSliderControl type = 0; //[0,3] Render type CheckboxControl innerCol = false; //Inner color CheckboxControl invert = false; //Invert CheckboxControl trans = false; //Transparency CheckboxControl invertTrans = false; //Invert Transparency IntSliderControl thresh = 0; //[0,1000] Clean IntSliderControl bright = 0; //[-100,100] Brightness IntSliderControl contr = 0; //[0,100] Contrast CheckboxControl alpha = false; //Preserve alpha #endregion public void Render(Surface dst, Surface src, Rectangle rect) { Rectangle selection = EnvironmentParameters.SelectionBounds; int sw = selection.Right-selection.Left; int sh = selection.Bottom-selection.Top; int dw = selection.Left; int dh = selection.Top; ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { if (IsCancelRequested) return; CurrentPixel = src[x,y]; double a = x-dw; double b = y-dh; double ca = this.ca/100f; double cb = this.cb/200f; double dx = (double)xoff; double dy = (double)yoff; double zoom = Math.Pow(this.zoom/100000f,2)*100000f; float val = fractal( (a-sw/2)/zoom + dx/10000f, (b-sh/2)/zoom + dy/10000f, ca, cb, iterations, type ); double thresh = this.thresh/1000f; if(val<thresh || innerCol && val >= (iterations-1)/(float)iterations){ val=0; } if(invert){ val = 1-val; } val+= bright/100f; val = limit(val,0,1); val = contrast(val,contr); val = limit(val,0,1); CurrentPixel.R = (byte)limit(val*255,0,255); CurrentPixel.G = (byte)limit(val*255,0,255); CurrentPixel.B = (byte)limit(val*255,0,255); byte A = CurrentPixel.A; CurrentPixel.A = 255; if(trans){ if(!invert^invertTrans){ CurrentPixel.A = CurrentPixel.R; } else{ CurrentPixel.A = (byte)(255-CurrentPixel.R); } } if(alpha){ CurrentPixel.A = (byte)(CurrentPixel.A*A/255); } dst[x,y] = CurrentPixel; } } } private float fractal(double x, double y,double ca, double cb, int n, int type){ if(type == 0 && x*x+y*y<n && n>0){ return fractal(x*x-y*y+ca,2*x*y+cb,ca,cb,--n,type); } if(type == 1 && Math.Abs(x+y)<2 && n>0){ return fractal(x*x-y*y+ca,2*x*y+cb,ca,cb,--n,type); } if(type == 2 && y<2 && n>0){ return fractal(x*x-y*y+ca,2*x*y+cb,ca,cb,--n,type); } if(type == 3 && x<2 && n>0){ return fractal(x*x-y*y+ca,2*x*y+cb,ca,cb,--n,type); } else{ return 1-n/(float)iterations; } } private float limit(float v, int min, int max){ if(v>max)v=max; else if(v<min)v=min; return v; } private float contrast(float x, double c){ double y; c = Math.Pow(c/2,3); if(x <= .5f){ y = .5f * Math.Pow(2*x, (c/500)+1); } else{ y = 1 - .5f * Math.Pow(2 - 2*x, (c/500)+1); } return (float)y; } Edited February 3 by pascal 3 6 Quote Link to post Share on other sites
Red ochre 1,635 Posted February 2 Share Posted February 2 I like this, many thanks for sharing. 1 1 Quote Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings Link to post Share on other sites
Ladybug 264 Posted February 2 Share Posted February 2 Really like the plugin. Thanks @pascal. 2 1 Quote Click on the Painting Easel to view my paint.net Gallery creations! Link to post Share on other sites
nitenurse79 719 Posted February 2 Share Posted February 2 Interesting plugin @pascal After some experimenting I have created this basic Jackson Pollock artwork. Thanks for sharing your plugins. 1 Quote Link to post Share on other sites
Pixey 4,912 Posted February 2 Share Posted February 2 I love this to bits @pascal 👍 Thank you. 2 Quote How I made Jennifer & Halle in Paint.net My Gallery | My Deviant Art "Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon. Link to post Share on other sites
Manc 218 Posted February 2 Share Posted February 2 (edited) Like it. Here's my effort.🙃 I think it look's a bit like a teddy bear. Thanks @pascal.😉 Edited February 2 by Manc 1 Quote Link to post Share on other sites
Rick Brewster 1,766 Posted February 6 Share Posted February 6 looks like an owl to me! Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to post Share on other sites
Manc 218 Posted February 6 Share Posted February 6 40 minutes ago, Rick Brewster said: looks like an owl to me! Thanks @Rick Brewster You're the third person to say that. Quote Link to post Share on other sites
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.