Mandelbrot in Real-Time: Fractal Shaders with P5js
Vložit
- čas přidán 11. 07. 2024
- Code from video: editor.p5js.org/BarneyCodes/s...
Mandelbrot Wikipedia: en.wikipedia.org/wiki/Mandelb...
When the Mandelbrot set is visualised it produces some amazing fractal patterns. A while ago I made a Mandelbrot plotter using P5js but it was too slow to let me explore the fractal in real time, so in this video I upgrade my code to use a shader instead!
The big advantage of using a fragment shader for this is that the GPU can run the code for a whole bunch of pixels all at the same time, instead of having to do them one after the other, like the CPU does and this makes it SO MUCH FASTER for this sort of code!
Follow me:
Support the channel: www.youtube.com/@BarneyCodes/...
Twitter: / barneycodes
Reddit: / barneycodes
Chapters:
0:00 The Mandelbrot Set
0:29 Visualising the set
0:50 First attempt
1:20 Why a shader?
1:51 Fragment Shader
3:35 Vertex Shader
4:00 Bringing it together with JavaScript
5:50 Dragging
6:30 Zooming
7:14 Float inaccuracies
7:35 Adding colour
8:20 Thanks Dan!
8:37 Exploring the Mandelbrot Set
#creativecoding #p5js #javascript
If you'd like to see what else I'm working on, it would be great if you could wishlist my game Star Mining Co. on Steam! s.team/a/2584800/
Another great video. Thanks, Barney! Congrats on the shout-out from Dan.
Thanks Steve, very kind! I was very surprised when I saw it!
I like your p5js video, plz keep making it!
Thank you, I will!
Somehow on my algorithm. Great vid.
Thanks!
Great code and explanation, Barney!
Thanks!
I just did a similar think in processing but without shaders, this will help me a lot, thank you for your great video (I used doubles instead of float so I can zoom way more!)
Glad you found the video useful! Doubles is a great idea, I'll have to try that! I think they might not be supported in some versions of GLSL, so fingers crossed!
@@BarneyCodes that's what I was thinking, might try it too
Would love to hear how you go!
@@BarneyCodes oh, I thought I sent you a link to my code but I think CZcams delete those messages automatically 😂, maybe you can find it somewhere
I think you're right, must be an anti-spam/scam thing. I'll have a look and see if I can find it!
there’s a cool game concept somewhere in this code..
I hadn't even thought of that! Maybe a sort of searching game? You get given a screenshot of a section of the Mandelbrot and you have to explore to find that section?
If you make a game out of it, please let me know! I'd love to give it a try!
Have you tried doubles? They are of course much slower tho
I think WebGL doesn't support doubles unfortunately, but if/when I move this to WebGL 2 or WebGPU I'll definitely use doubles!
@@BarneyCodes I see, interesting. Very nice channel by the way!
Thank you!