Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create better color growth script #21

Merged
merged 1 commit into from Oct 4, 2019

Conversation

scribblemaniac
Copy link
Contributor

I saw a video of the color growth script and wanted to play around with it. Unfortunately it was really slow. I have optimized it quite a bit, mostly by using more appropriate data types and removing some unnecessary complexity. For reference, a 256x256 image (--WIDTH 256 --HEIGHT 256 --GROWTH_CLIP "(1,5)" -q 5 -s 0) takes me ~7.5 minutes to generate with the original script, and ~5 seconds to generate with this new script.

I also added a few new features:

  • Random color mutation base. By using -c random or --COLOR_MUTATION_BASE random, each origin point will be assigned a color randomly.
  • Border blending which causes the pixels to blend with their neighbor under some situations. It helps remove the very hard edges between significantly different 'mutations'. Enabled by default, disabled with --BORDER_BLEND False.
  • Tiling. By having the growing color to loop from any one side to the opposite side, the generated image becomes seamlessly tileable. Disabled by default, enabled with --TILEABLE True.

Random color mutation base, border blending, and tiling support
added. Script heavily optimized for speed.
@earthbound19
Copy link
Owner

Wow, thanks for this! I'll have a look and merge as appropriate.

I have had the same complaint about speed and wondered if the algorithm is optimal and how it could be optimized. If you've done so much of that work, super fantastic! :)

@earthbound19 earthbound19 merged commit 786475a into earthbound19:master Oct 4, 2019
@scribblemaniac
Copy link
Contributor Author

No problem. Let me know how it works for you.

@earthbound19
Copy link
Owner

earthbound19 commented May 31, 2020

@scribblemaniac, I pasted your improved version (color_growth_fast.py) over the original color_growth.py, after I copied the original slower version to /_deprecated/color_growth_v1.py, so you know. I've continued development (of new features and bug fixes) on it.

Also, I don't know whether you saw that the faster version sacrifices a feature of the slower version in which --GROWTH_CLIP deliberately allowed values below zero or higher than 8. This feature caused cells to not grow sometimes or to excessively grow (respectively).

The slow version, for example, with a clip rate of (-12,3), can produce a result like this:

2020_05_31__14_38_38__6eda9d_colorGrowth-Py_v1

Where the fast version does unexpected stuff (including rendering a lot of things in the first frame), like this:

2020_05_31__14_42_05___colorGrowthPy

I haven't investigated what causes that behavior change. I also haven't yet examined what it is you did that sped things up so much :) but I'm very happy to sacrifice the possibility of outsized clip rates for the faster speed. I would bet that reintroducing the possibility of outsized clip rates would slow things down again.

I'd love to get this algorithm into a compiled language or even parallel processing (like multithreaded or a GPU if possible) to add that feature back without sacrificing speed, and with (I would hope) much faster speed anyway.

earthbound19 added a commit that referenced this pull request Aug 26, 2020
Create better color growth script
earthbound19 added a commit that referenced this pull request Aug 26, 2020
Create better color growth script
earthbound19 added a commit that referenced this pull request Aug 26, 2020
Create better color growth script
earthbound19 added a commit that referenced this pull request Oct 8, 2023
Create better color growth script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants