• Members of the previous forum can retrieve their temporary password here, (login and check your PM).

HD RGB Fractals Infinite Zoom (Open Source Generator App)

Migrated topic.

skr_nexus

Rising Star
RGB Sierpinski Triangle
RGB Sierpinsi Pentagon

Attachment: Generator App

How to use:
Click Fractal X/7 to switch fractal type (restarts generation)
Click Size WxH/7 to switch resolution (restarts generation)
Click Zoom to switch zoom direction (restarts generation)
Click Period to change frame count (restarts generation)
Click Rotation to switch rotation direction (restarts generation)
Click Color to switch colors or make the hues animate (restarts generation)
Click Dot to change dot size - rendering depth (restarts generation)
-Smaller dots go deeper, more CPU time to render, but gives lesser saturation/brightness jumps on fractal depth steps.
Click Save PNG to export PNG of the currectly displayed frame.
Click Save GIF to export GIF (generation must be finished)
Click image to start/stop/continue zoom animation (seemless if generation finished)


Performance tips:
Dense fractals take longer to generate (7/7 triangle the hardest, 6/7 pentagon 2nd hardest)
Set the Dot size higher on dense fractals. It helps performance and still looks good.
Higher resolution take longer to generate (HD GIFs can take hours of CPU time)
 

Attachments

  • RgbFractalGen.zip
    314.1 KB · Views: 3
Was fixing few issues in the app, and added color cycling animation option. Reuploadeded attachment.
 
When I gave that messy code to chatGPT and asked it to figure out what it does, it understood it pretty well, that's impressive, the only thing it was wrong about was that the threading was used for separating rendering and responsivity, not for paralelizing the render process:

The given code appears to be an implementation of a fractal rendering program. It generates and renders fractals using a recursive approach. Here's a high-level overview of what the code does:

The code defines a Windows Forms application with a class Form1. It has various fields representing properties and parameters for generating and rendering fractals.

The Frac function is the core of the fractal generation. It uses recursion to calculate and plot points of the fractal. The function calculates the positions, angles, and colors of the points based on the current parameters and recursively generates child points.

The ColorDot function adds color values to a buffer based on the specified coordinates, color index, and blending factor. This function is responsible for coloring the points of the fractal.

The Generate function generates and renders the fractal by repeatedly adjusting parameters (size, angle, color, etc.) and calling the Frac function. It also processes the generated points, applies a depth of void algorithm, and creates a bitmap representing the rendered fractal.

The code involves memory management by storing previously computed values in lists (memoryX, memoryY, memoryS, memoryA). These lists store data related to fractal computations to avoid recomputation.

The program uses multi-threading (oThread and gThread) for rendering, indicating that it likely aims to optimize the rendering process by using separate threads.

The generated fractals are stored in a history of bitmaps, and the final rendered image is stored in the bmp bitmap.

The code also deals with hue cycling effects, generating GIF images, and other rendering-related functionalities.

Overall, this code aims to generate and render fractal images with various properties such as size, rotation, and colors, using a recursive approach. The code is quite complex and has room for optimization and refactoring to improve readability and maintainability.
 
I had to register a new account, because I got locked out, login wasn't accepting my password, and it says my e-mail is not registered, must have registered with some different address, but can't figure out which ones, neither I tried worked.
Anyway I've made some new updates to the generator, and will upload the new version and new renders shortly (possibly tomorrow).
Meanwhile I might try to finally rewrite the app into c++ for a better performance, as soon as I figure out how to start a c++ windows forms project, and how to convert the fast bitmap render function into c++, and how to rewrite the threading, then I should be able to rewrite it.
A sneak peek of what's coming is in my avatar.
Changelist:
-Fractal names
-Code and interface cleanup
-Custom resolutions and periods
-Optimizations
-New feature: flagarrays, allows for cuttings specific pieces of the fractal in a more complex fractal manner, enabling some cool new fractals.
-A lot of new fractals that use this new feature

First render:

edit: I'm nearly finished rewriting the entire c# generator into c++. The entire interface, fractal generation, and multithreading seems to be working in c++ already, and there seems to be some performance boost, maybe up to 50% faster, I've kinda expected more performance boost but still better than nothing i guess. All that is left is to translate the PNG and GIF export functions, and the translation would be fully complete, also meanwhile I'm uploading more of the new fractals onto my channel. When I'm finished translating, I'll upload both c# and c++ versions open source.

edit2: sadly after I imported the same optimization I've discovered in the c++ version into c#, it seems like both versions run at the exact same performace. So it looks like the c++ rewrite did not achieve me any performance boost after all.
 
Last edited:
I'm trying to put the heavy CPU computations into a pure unmanaged c++ class, hopefully that will finally give me the performance boost I expected from rewriting c# to c++.
 
I'm really about to give up, I've finished rewriting it into pure unmanaged c++, in hoped that the computation could run as fast as possible with no overhead, and it turned out even slower than c sharp or managed c++. I don't get it, why? I even added a bunch of optimization to make it even faster, and yet it's somehow slower. And even worse, I really struggle to make the multithreading in unmanaged c++ work correctly without crashing, spent an entire day trying to make it work, and when I finally got some solution that dind'y crash and made it finally work in parallel, it slowed down like 20x. At least in the managed c sharp and managed c++ the multithreading wasn't that much of a pain in the ass and actually made in faster. But here in the unmanaged c++ that is supposed to be faster than anything, everything i try do do to make it faster just makes it slower.
 
I had to register a new account, because I got locked out, login wasn't accepting my password, and it says my e-mail is not registered, must have registered with some different address, but can't figure out which ones, neither I tried worked.
Anyway I've made some new updates to the generator, and will upload the new version and new renders shortly (possibly tomorrow).
Meanwhile I might try to finally rewrite the app into c++ for a better performance, as soon as I figure out how to start a c++ windows forms project, and how to convert the fast bitmap render function into c++, and how to rewrite the threading, then I should be able to rewrite it.
A sneak peek of what's coming is in my avatar.
Changelist:
-Fractal names
-Code and interface cleanup
-Custom resolutions and periods
-Optimizations
-New feature: flagarrays, allows for cuttings specific pieces of the fractal in a more complex fractal manner, enabling some cool new fractals.
-A lot of new fractals that use this new feature

First render:

edit: I'm nearly finished rewriting the entire c# generator into c++. The entire interface, fractal generation, and multithreading seems to be working in c++ already, and there seems to be some performance boost, maybe up to 50% faster, I've kinda expected more performance boost but still better than nothing i guess. All that is left is to translate the PNG and GIF export functions, and the translation would be fully complete, also meanwhile I'm uploading more of the new fractals onto my channel. When I'm finished translating, I'll upload both c# and c++ versions open source.

edit2: sadly after I imported the same optimization I've discovered in the c++ version into c#, it seems like both versions run at the exact same performace. So it looks like the c++ rewrite did not achieve me any performance boost after all.
Welcome back, sorry to hear about your login difficulties! It should be possible to merge you back into your old account if you wish, once trav or another admin-oriented mod has a spare moment.

Have you tried asking some of the chat regulars about your code? (It's way outside my field.) Sounds like you have a case of "Verschlimmbesserung" - making things worse in an attempt to improve them :LOL:
 
So here's the current source code (and builds) of all 3 versions - Cs, CppManaged, Cpp. CppManaged seems to be the fastest so far. Cpp should be the faster, maybe it just needs some fixes.
All three language version are made to as much 1:1 as possible, with the same layout, same variable orders and names, same function orders and names, same class names, and as much similar code as posible with the same commentary. They might be useful for someone who wants to learn how to translate betwen c sharp and c++.

Cpp's Parallel Iteration is broken and crashing, so it's disabled for now. So beware - enabling it by checking the Paralel iterations checkbox in the Cp pversion will likely crash the app. The build are almost indistinguishable from eath other, other than the differeces in speed, the crashes of the Cpp version, and Delay being in millisecods in Cs instead of 1/100 seconds in Cpp and CppManaged.

So if anyone is proficient in pure c++ threading, some help would be appreciated. Basically the functions FractalGenerator::GenerateFractal and FractalGenerator::WaitForThreads in the Cpp version need to get the like 15 lines of the threading code rewritten to somethign that actually works and actually makes the generation faster.
In the Cs and CppManaged, the same threading is only like 10 lines of code and it works.

edit: reupload some crash fixes for gif exports and when turning off void.
 

Attachments

  • RgbFractalGen_1.32_beta.zip
    600 KB · Views: 0
Last edited:
So I just did another rewrite for better efficiency, and now somehow it's doing motion blur, totally unintentionally, no idea how it happened, but it looks cool :D i am probably not clearing the frame buffer properly. I'm contamplating turning taming accident into an actual feature.
edit: uploaded the new version 1.4, that cointains the feature.
bluer.png
 

Attachments

  • RgbFractalGen_1.4_beta.zip
    488.4 KB · Views: 0
Last edited:
Since I've been so far unsuccessful in making the pure C++ paralalel threading of frame generation, I've tried to approach the whole paralllelism for a different angle. Since spliting the recursive fractal function into dynamic threads seems to be nearly impossible, I've just paralleized whole batches of frame generation instead, where each frame is generated by one thread, but each thread is busy with a different frame, so multiple frames are being generated at the same time, and each threads doesn't have to worry about splitting its own load or sharing data with other threads. That required extensive rework, and now it semms to be mostly working, but for some reason the generated images claim they are not unlocked even though I have made sure they were. And also for some reason the generation halts at the last few frames. And it also still seems a lot slower than either the C sharp or managed C++. So I'm really giving up on the pure C++ for now, it just never seems to even be worth it even when I manage to make it work design it efficiently.
SInce the C sharp is still the performancfe king, I'll just generate the loops in that one, this time with all the new features like the motion blur, preview of one frame in the attachments.
 

Attachments

  • mblur.png
    mblur.png
    10 MB · Views: 3
  • CppManaged_v1.52.zip
    11.7 MB · Views: 0
  • Cs_v1.52.zip
    285 KB · Views: 2
I'm looking forward to playing around with this after you get it working.
The Cs and CppManaged have always been working. And I just improved the Cs from v1.4 to v1.5 by making the color transitions smoother. Just download the Cs_v1.5.zip above your post and you get play with it right away. In about an hour I should update the CppManaged version to 1.5 as well, but so far the Cs is still superior even in performance.
edit: 1.51 had a crashing bug, it's fixed in 1.52
 
Last edited:
New version 1.6 soon:
-Simplified and documented fractal definitions for easier making and adding new fractals
-New parameters: Default Zoom, Default Spin, Horizonal Flip
-New Modes: Only Image, Parallel Animation Frames
-Fixed fractal point color light normalization. (dark when thin, overflowing when dense)
-Parametrized CutFunction - instead of having a lot of individual variations of cuttings, I aded a slider that lets you choose from a vast larger number of variation possibilities with one fractal, kinda like choosing a seed number for rules.
-Antispin seting - looks trippy with some fractals where it fits, example gif in attachments.

So here is one more teaser - like with the motion blur bug turneds feature, I have made a mistake in rewriting the fractal rules to those simplified forms and forgot to rotate the central pentagon, which made the fractal overlap in most cases, but some variations looked nice, so I added those to the list: this is the Koch Pentaflake liek above but with the center piece not rotated, looks like a pentagonal version of the Hexaflake_NoCornerInner, and a NonRotated Pentaflake_NoOuter also looks ok I guess:
 

Attachments

  • pentaNR_NoOuter - Copy.png
    pentaNR_NoOuter - Copy.png
    19.5 MB · Views: 3
  • pentaNR_Koch - Copy.png
    pentaNR_Koch - Copy.png
    19.8 MB · Views: 3
  • antispin.gif
    antispin.gif
    6.1 MB · Views: 3
Last edited:
v1.64:
-fixed some bugs, especially in CppManaged
-Flip Horizontal is now redundat (can be achieved by selecting a complementary cutFunction seed and 180 defaultAngle), so it has been removed
-In its place is now defaultHue allowing you to shift the hue of the fractal.
-More Color options, allowing BGR variants that imo look nicer than the original RGB palette because the child color mix together with parents to give nicer hues of red green and blue.
-fixed and fully automated the prediction of loop frames, removed the Frames/3 checkBox that did this manually, and replaced it with extra period multiplier
-allowed to write to a different temp gif file if it fails to open
 

Attachments

  • RgbFractalGen_v1.64.zip
    808.2 KB · Views: 0
Last edited:
So I was playing with the cutfunctions, and trying to make analogous ones to that nice Pentaflake_NoKoch, the one for Hexaflake turned out really beautiful and interesting. The cutfunction for the pentaflake erased a pentastar koch curve shaped void between the pentaflakes. With the hexaflake however, the voids are shaped like bats/moths/birds, and there are beatuful connecting needles with minihexaflakes, reminiscent of the needles on mandelbrot. And just like with the pentaflake, it makes the edge curves nicely colorfully distinct:
 

Attachments

  • HexaKoch.png
    HexaKoch.png
    19.7 MB · Views: 1
Last edited:
New version 1.7! (so far only Cs version)
-Expanded cutfunctions and their parameters
-Allowed to select and combine different child angles and child colors, this together with functions lets you make like a million different fractals.
-Added Help button showing readme.txt
-Some examples of all the new different fractals it can make are in the attachment
 

Attachments

  • RgbFractalGenCs_v1.7.zip
    384.7 KB · Views: 0
  • parameters.png
    parameters.png
    4 MB · Views: 4
Last edited:
Back
Top Bottom