C++ Mandelbrot Set Viewer banner

C++ Mandelbrot Set Viewer

23 devlogs
50h 29m 22s

Made in Raylib

Viewer to zoom in and look at the pretty patterns of the Mandelbrot set!

yefoi

Made the website for the viewer! very minimalist design but im ok with that, I’ve decided to try and make the preview switch you to a different tab where that runs the web assembly, which I think is more clean.

It’s a pretty small site but I had to remake it like 3 times because I didn’t like it. I feel like just having this is enough.

Attachment
0
yefoi

JULIA SET IS WORKING 🎉🎉🎉🎉

Honestly much harder than working out the mandelbrot set, but it felt a lot better when I finished it, because the actual math is very similar except something else gets parameterized and you just set a point on the mandelbrot set as your constant.

I also made small UI dividers and organized the sidebar so it is actually kind of usable instead of messy lol, which I am pretty happy with. I’m running into the issue of the thing being too large though, so I might add a way to scroll down.

However, something that I do need to do is make a better point selector for the Julia set, I think I’d want to make a little mandelbrot texture and then let the user drag a point to choose instead of using regular entering, would be more intuitive.

Attachment
1

Comments

yefoi
yefoi 10 days ago

sorry idk why everything is so big

yefoi

Finalized design of the popups, and also fixed sensitivity issues. These popups are supposed to give you more information about how to use the viewer, web limitations, crash reports etc, because a lot of people generally don’t like reading readmes anyways.

I also started working on a julia set implementation! Right now everything breaks with values other than 0 0 2, but it is progress regardless! picture attached, I need to make a better viewer to how to chose this, probably what im gonna do next.

Attachment
Attachment
0
yefoi

Remade the loading screen and fixed bugs about it!! in the previous version of this I didn’t really know what i was doing and vibe coded everything, but now it works well now!

Brought back mouse movement too, but still can’t get zooming right.

Attachment
0
yefoi

First devlog in over a week! I had finals so I had to put off a lot of this coding stuff, but im excited because I’m almost done with this project and I can ship with ~45 hours maybe?

So sad that i’m slowing down…

The biggest thing that I did was a custom function in UI that can create a popup to show information (For ex, nudging to switch to arbitrary precision, general info when first loaded)

Heres more some little stuff I did:

  • Loading text
  • Fixed minor bugs with UI like thread inputs
  • fixed mirror image bug when zooming out
  • Manual refresh option with “R”
Attachment
0
yefoi

Moved all of the rendering stuff (INCLUDING arbitrary precision) to renderBrot to further cut down on space in the main file which I am quite happy with this change took off ~200 more lines. Worked on the website more and then also organized my code.

Attachment
Attachment
0
yefoi

Started relearning web design to make a website for the viewer, setting up emscripten to get raylib working. Threading and gmp doesnt work because of wasm limitations…

Attachment
0
yefoi

Low detail mode and uldm mode for 4x and 16x faster rendering since the pixels are bigger, useful when arbitrary precision library is used. Mouse zooming now responds to how strongly you scroll not just if youre scrolling up or down. Inputs now use strings instead of c strings and an option for using keyboard / mouse interchangably

Attachment
Attachment
0
yefoi

Cut down the UI into this bit and main file went from ~900 lines to now 600

Attachment
0
yefoi

Zooming with mouse is fixed because it was buggy, but most importantly the checkboxes and positioning drawing is now in a different file! saved a lot of space in my main file but the text input ones arent in yet

Attachment
0
yefoi

Timing and detail level functionalities. Timer is to give the user time to zoom in or adjust the frame to what they want to see so they dont have to move nonstop, detail level reduces detail which is good for slower computers or arbitrary complexity

Attachment
0
yefoi

Added functionality that allows mouse movement and zooming to also register as offset input, that didn’t take me too long but I tried two times to try and split my main file into two separate files and no matter what I tried to do it wouldn’t work because I’m not smart… my main file is getting close to some thousand lines

Attachment
0
yefoi

Stretchable window, better ui. made it so that selecting one option deselects the others stuff like that. Collapsing window

Attachment
0
yefoi

Arbitrary precision libraries implemented. Now technically there is infinite zoom for the viewer. If you have it on, you could technically zoom in forever albeit it will get very slow very quickly.

The effective limit for this program used to be a zoom of e+16 because thats where long double precision ends, but GMP extends this technically indefinitely I think…

There are a lot of issues with optimization and performance though, after zoom exceeds e+30 the program starts taking up like 700%+ of my macs cpu usage and ends up taking ~30-40 seconds to render one screen. I’ll see what I can do to make it better.

Attachment
0
yefoi

Cleaner UI and customizable amount of threads being used, dynamic iteration changing for the best experience

Attachment
0
yefoi

I just multithreaded so hard I made the mistake of going in raw and just trying to do without any help or tutorials so I struggled a little but now it works and its quite a bit faster so I am happy with it

It’s hardcoded at four threads right now because I wanted simplicity but I’m going to make it customizable

2

Comments

yefoi
yefoi about 1 month ago

Also my mouse doesnt do the rainbow wheel once its super zoomed in now so that is a win

isuliau
isuliau about 1 month ago

from what little I know from c++ this is really impressive! Love the commitment!

yefoi
  • Editable iteration and zoom speed
  • Made the periodicty checking actually work
    All of the rendering is also now no longer hard coded so the dimensions of the viewer can be whatever
    Dynamic detail option that turns up the iterations as you zoom in
Attachment
0
yefoi

GOT COLORS!!!!!! 😸😸

Coloring rectangles based on how many iterations it takes them to escape the mandelbrot set
Also added a zooming rectangle when you press m so that you can actually see where you’re about to go in terms of zooming
Things to work on are probably UI, an option to turn up the detail, access arbitrary precision libraries, sharing position, and maybe a little built in game that would encourage you to find the different locations in the mandelbrot set…

Attachment
0
yefoi

Better zooming UI (the blue square) to show where exactly it is, performance improvements, fixed the periodicity checking because it didnt work. Better information in the top corner.

Considering designing a better ui, adding a slider for detail amount, and then finally making the heat map thing! been putting off that for a while. maybe then an option to switch to arbitrary precision libraries because as you can see in the video theres a limit

2

Comments

yefoi
yefoi about 1 month ago

i think performance is better but fps is lower compared to last devlog because i set target at 120

blitzy
blitzy about 1 month ago

there’s audio in your video btw

really cool and very fast! I wonder if you can do some sort of dynamic precision thing to get more zoom

yefoi
  • Now able to zoom in on the mandelbrot set
  • Instead of recalculating all the time, the app only recalculates the position after each movement you do (For ex, moving, zooming in, etc.)
  • Changed all of the floats to doubles and then to long doubles to maximize size, I was hitting precision errors all the time
  • Began to implement a heat map thing but I don’t want to create that right now
  • Local coordinates rather than global coordinates for drawing out the points
0
yefoi

made the mandelbrot set show up!! issue is is that its incredibly slow and movement slows down a lot, the zooming feature that I tried to get working also literally doesn’t work so I’ll have to figure that out, but the thing shows up now! That’s huge

0
yefoi

Sorry, nothing impressive yet!! :(

Set up the raylib environment and made basic movement, this is my second time using raylib so I’m kind of clueless but thats ok (Crossed lines are the origin)

Attachment
0