Hi guys i am very exited to release this project after long time working on some optimization features to allow the app to run very complex calculations and show complex visuals with amazing speed!
That’s really well done. Animation mode is a lot of fun.
As you have it coded, when the depth and branch factor are high, the drawing of course slows down as the work grows exponentially. The way you are currently drawing, you set the stroke weight, the color, and then make a separate line() call per segment. It would be far more efficient for the graphics if you could batch all those lines calls together inside of beginShape(LINES) / endShape(). Unfortunately, beginShape() doesn’t let you change the stroke weight between drawing the lines, so at best you could only batch together the drawing of one level at a time. One possibility would be to walk the tree multiple times, once per level, and draw each level of branches separately. Another would be to store up the vertices into separate lists and do a single batch render of each list afterwards. Another would be to draw the branches as QUADS which would involve a bit more math to compute the corners yourself.
Another approach is to recognize that, in the case where you don’t use randomness, each branch is identical to its sibling branches. If you stored a branch as a PShape, you could render each sibling branch with a single draw call with a rotate in between.
By far the fastest rendering approach would be to use a shader rendering a two triangle strip for each line segment. Each vertex could compute which segment it lies in and then walk the tree to compute its own position.
Thanks so much, the main part was creating the optimization. before optimizing it got super lagy when using high iterations and branches. can’t wait to release my main project for free soon. the advanced mandelbrot viewer. it got really solid optimization too and it may or may not be the strongest Mandelbrot viewer so far in processing 4.3
Oh and i just noticed all the great suggestions you brought up. ill promise ill look into each one you gave me and try to implement them for testing. if ill end up upgrading to a newer version with your advice ill be sure to let you know. thanks so much for your great comment!
Wow, great example, i might try to learn from it in order to improve mine later. ill make an update post when the next big update will release i already thought about many more exiting features i want to add like auto changing colors with hsl \ custom gradient based color shifting, and having a seed you can share with an import \ export sytstem to share your settings with others, as well as improving the overall stability and performance