You are a gem in the programming space of RU-vid. You've inspired a lot of other successful programmers on here and also me (just as a hobbyist, but still). Keep making what you love and we'll love it
@@spaztor7723 well, as a starter for visualizations like this I recommend processing/p5.js. it's not the fastest, the sturdiest or prettiest, but the ease of use is unparalleled. I have spent countless hours in it and I've loved every second
@@spaztor7723i dont even know what “constant;” does but i have adhd, autism, the determination of someone trying undertale for the 1st time and doing true genocide, an ungodly amount of love for cool stuff like fractals, a BEAST of a computer and i am going to do this.
Writing a fractal render was one of my favorite projects of all times. I hope you making this as accessible as you did with this video opens allows others to experience the awe when their code creates beauty in front of their eyes.
In a highschool programming class right now, and seeing this has raised motivation to the max. Still going over the basics (in python), but one day I will make something like this. Thank you Pezzza for the inspiration and I hope my comment is meaningful in some way.
Good luck on your journey! If I were to make a suggestion, use a language that supports multithreading, like C++! Or, you could learn a shader language🙂 (GPUs aren't *quite* as bad at using double-precision as it might sound, although they are still pretty slow at it. There are techniques to mitigate this, though!)
Go for it! The output of these fractal images looks really complex, but the math is simple. Some of the biggest bang for the buck is to be had displaying a color palette instead of a grayscale gradient. Then your renders will come to life.
If you want arbitrary precision while using your GPU, you can use perturbative techniques by computing only a few points with high precision on your CPU, and then computing all other points in low precision on the GPU. Choosing the points is tricky, though
I have written a program that renders Julia Sets by using texture mapping to do the inverse iteration method. Basically if you compute the inverse of the function and map the entire plane backwards it will eventually converge to the Julia Set. I'm using this for a music visualizer so we blend the frames together and the Julia Set emerges as the points with colour. I have video of it running. I blends a sort of oscilloscope visualization on top of the frame and then uses that as input to do the Julia Set inverse iteration in the next frame. You can see how the copies of the scope shrink and copy around to build up the shape of the set. The nice thing about doing the inverse iteration with texture mapping is that you *actually* compute the forward function to determine the source pixel for the texture map operation, the texture mapping to the output effectively makes it doing the inverse. The other nice thing about this is that precision isn't really critical and GPUs are REALLY good at texture mapping. I have written the same thing for both CPU and GPU (via OpenGL 2.1, so it runs on a potato), can't do a zoom though, the algorithm requires you to keep an image of the entire circle that the Julia Set might be in (that is the same circle you use as the escape radius). I have explained this poorly I know. Video of it running: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-PD1ZlkNf7GQ.html It's open source so code is at: github.com/Spudd86/julia-vis
Your videos are always inspiring. I remember the time I was myself trying to render Julia sets, I was really happy to see the results. I hope other people try this as well as this is very rewarding!
I've always seen Mandelbrot used for these types of videos, very neat to see another type used. The difference in where the pixel coordinates go in the looping equation seems to be the only real difference, being C for Mandelbrot, and Z_0 for this. Very nice video
@@tjavado yeah, that's what was said in the video, I just thought it was a nice alternative. Tbh I probably would've clicked off if it was Mandelbrot again :P
Came across this channel a few days ago, and I must say this is one of the best channels for programming and math. I have an exam, after that, I plan to binge watch all you videos. The Cool Chicken is a very cool guy.
There's another cool fractal you can make called the mandelbrot set using the same equation. You're currently rendering julia sets. For julia sets, you set c to a fixed position on the plane while changing z for every pixel. Instead for the mandelbrot set, you just set c so it also changes with z. I personally think the mandelbrot set looks way better than the julia sets since it's a combination of all possible julia sets for every pixel.
You can also pull out an extra 4x to 8x performance (depending on your cpu) by using SIMD instructions instead of your normal floating point math. It’s a lot of effort to manually code with SIMD instructions, but worth it for the better perf.
@@Henrix1998 unfortunately, its too complex for compilers to translate into SIMD instructions as you have to change the code logic quite a bit from regular Mandelbrot code in order to make full use of the SIMD instructions
@@puddleglum5610 Maybe by creating a "computeNextFor8pixels" which does just that (taking also 8 times the input and returning a struct or something like that), and turning optimizations up? I've had good luck doing that with random number generators (like pcg64), don't see why this should be any harder for the compiler.
@@user-sl6gn1ss8p Just use SSE/AVX intrinsics, not too complicated in this case. If you have to rewrite the code just for the compiler to better optimize, you might as well optimize it manually.
Thank you so much for this! I'm in a rush but I wanted to express that your simple, straightforward explanation and approach to fractal rendering has opened my mind to the possibility of doing something similar myself! I've been hoping for this knowledge for a long time. Thank you so much for creating this video as a vessel by which I can begin my journey of understanding!
Very beautiful video! All the aspects were so well done. Especially underrated is the sound mixing and the music that follows the camera down at the end. Thank you very much for making this! For 11 minutes of watch time it probably took much longer than that to make and produce. I appreciate the time and effort you took.
The one thing that keeps blowing my mind every time in his videos is how he can optimize the shit out of the rendering time with just "simple" logic and few lines of code, and then he basically says "I can optimize it even more but I don't want to" 😎
A quick tip for getting more detail in the fractal: instead of making the gradient have more range, you can just use a mod function or a sin function to color it based on the iteration count. Kind of like how Wikipedia does it.
Kid: "What if it's made of dragons? And the dragons are made of even SMALLER dragons? And those are made of even SMALLER dragons? And it's just that, forever?" Parent: "Fractal." Kid: :O I think we've all asked the "what if it's made of more of it" question before.
The fractals here are Julia Sets. If anyone following along wants to generate the Mandelbrot set instead, it’s quite easy. Instead of an arbitrary C value, for each pixel, set C equal to the complex coordinate of that pixel. So, instead of Z(n+1) = Z(n)^2 + C, replace C with Z(0).
Thank you so much for making this video. I was always interested in making a fractal render but just didnt know what to do or the steps involved, I felt paralysed. This was really helpful. I need to learn to problem solve on my own too without being baby fed :)
I think basically everyone here knows about the Mandelbrot set and Julia sets, but those who don't should check out Numberphile's video about it with Ben Sparks. It's amazing.
Great video! I've made a fractal renderer using a shader in WEBGL (there's a video on my channel if you're interested) and ran into the same issue of not having double precision, I'd love to find a way around this. I haven't tried animating my fractals yet! I'll have to try it, thanks for the inspiration!
@@kaiprzadka6896 Not as far as I can tell. Since I made mine with JavaScript, and therefore WebGL, the specification for GLSL is pretty bare bones (it's not even required by the spec to have high-precision floats!). I'll have to look into it further though, thanks for the lead!
@@BarneyCodesMy first instinct is to preform some terrible bodging with frankensteined ints or arrays to make a very slow but functional high precision number.
@@ladyravendale1 I had wondered about trying that too, even just somehow trying to use two floats for each number (two floats == double precision right??).. Haven't actually attempted it though. Let me know if you give it a go!
@@BarneyCodes I most likely wouldn’t use two floats, instead just a bunch of ints. I can’t really imagine how you would string together floats for higher precision since by nature the decimal point floats, and since you would have 2+ I don’t really see how that would work. A big issue with most non int numerical classes in JS type languages is a lack of easy bit manipulation/reading. At least to my mind it would be far easier to use 1 int as an x bit mantissa, then however many more ints as the actual value. Write some bastardized version of the normal float implementation, treating your ints as registers, and there you go.
Have you looked into using perturbation to eliminate the float issue? I was able to build simple cpu and gpu renderers, but was not able to follow the perturbed maths to get that buttery smooth deep rendering
You inspired me that much so I just finished my Julia explorer in C++SDL. It is 1am 😅 with 16 threads on my i7 6gen it is not super fast. I have idea of caching images and showing them until next frame is finished being rendered. Bit it wont help with animated fractals.
i made a program in 9th grade creating the mandelbrot set using 255 iterations. it had terrible performance but i liked it. made it with turbo pascal back then
Nice video! But I don't understand why you resorted to CPU execution.. Most GPUs actually support double precision (at least all that support OpenGL 4.0.0 [natively! looking at you, Apple M1 :/]). I wrote a clumsy unoptimized fractal renderer once too and it ran flawlessly on GPUs (smooth motion/zooming) with full double-precision (max zoom ca. by factor one quadrillion) and I'm sure there's some optimizations that would make it much better if I had the time (and intelligence) to implement them. Anyways love how polished yours turned out! Congrats on (almost) 100k!
Your really good at making simulations! I have a suggestion. You should try making a simulation like the powder toy "TPT" for short but in 3D! That would be pretty cool.
What softwares and modules do you use for visualizing? I know C++ but never knew how to do stuff like this. Can you make a tutorial video to get it to stuff like this. PLS. Really love your videos. I can probably do this in JS tho pretty hard (i am still learning), by learning the concepts used in this video. But i want to know how to do it in C++ My laptop will prolly blow up tho xD, i don't have any GPU ad its not a gaming laptop lol
Not giving yourself enough credit by saying it's simple. Great work. Staring into infinite similarly. Love fractals and will get round to trying program some for myself.
Julia sets, like many other fractals, are highly self similar. I wonder if there have been attempts to exploit that, particularly for recursive escape sequences. Instead of just stopping after n iterations, you could look what number you ended up with. This number could be used as an index into a coarser version of the fractal. Doing this you doubled your number of iterations with a virtually unnoticeable loss of precision. You can also use this technique as a replacement of supersampling for anti-aliasing. Particularly on the GPU, using the pre-rendered version as a texture, this should be highly efficient and simple to implement. Iterating this technique for performance seems straightforward, but requires some extra work. Regions near the border of the fractal can't be used for indexing because complete copies of the entire fractal lie inside a single pixel. On the other hand, regions far from the border are smooth and there is little point rendering them to higher precision. What you want to do is some kind of sparsely populated multiresolution texture, i.e. some areas are low-resolution and some areas are high-resolution, and some areas are "not yet computed". You could fill this by increasing the resolution each time you start over, while only computing regions with unknown behaviour. For julia sets, initially only the behaviour outside the radius 2 disc is known. In the second step, you would calculate one or a few iterations for points inside the disc. If you end up with a point outside the disc, you can update that texel with the new value. In the third step, you know have more known values in your texture. For the others, again you compute a few values until you end in a known smooth area (texel is known and similar to its surroundings) then you can add the iterations of that known texel to the iterations it took to get there, updating the "unknown region" more. As you keep doing this, you increase the resolution occasionally. Now some Julia sets, like the Mandelbrot set, have a true interior (rather than just an exterior and a border). For escape sets, interior usually means convergence to a stationary/cyclic sequence, like the exterior is escape to infinity, while the border is chaotic. In that case you need an "escape" region (a region with known behaviour of the sequence) for the interior as well, because you only want high resolution for the border.
nice video i wish you would have talked about the fact that there was colour banding tho because only 8 bits per channel were used instead of 10 or higher
In the final zooming-in-sequence the spot seems to be picked very nicely to allow a nice view the entire time. If one ends up in a dark-spot or bright-spot I think zooming in further would be pointless. As I could not see any camera-movement my question is: How does one pick such a spot? Is it just a bit of trying-around by hand until it fits or is there a more clever way to do it?