In my program
Strange Attractor Explorer, SAX, I have a really messed up coloring method and would like help on creating a new method. There just isn't enough information I can find on how to do this.
The coding is large and somewhat scattered so I will just highlight the coloring method.
First this was my plan,
The formula is looped for a designated amount of time via iterations, then a pixel plot is produced from the equation, if we find a strange attractor a vast amount of pixels are plotted and some are repeated. I want to color these pixels according to how many times they have been pegged by the formula.
So I have a method that just makes the pixel more exposed by the color of your choice.
Now I want to give the user a chance to make more color choices based one a sort of color mapping. Like what Chaoscope does but with the same idea of exposure to the more pegged pixels.
So how do I change my program to do this?
Here's the code for just the coloring method:
Variables:
//COLOR & ITERATION CONTROL
float rAdjust = 2.0;//Change Color, white is maxiterations/1000 float gAdjust = 3.5;//Keyboard input r-,R+,g-,G+,b-,B+ float bAdjust = 5.0;//Adjust these first before cp and cr and cs.
//Color will equal maxiterations 0-Maxiterations range int maxiterations = 50000;//Set by pressing f1-f8, f8 is changeable by pressing f,F
int[] exposure = new int[rWidth*rHeight];//records the hit times of each pixel point creates the brightness of that pixel in the coloring section
colorMode(RGB, maxiterations);//controls brightness. White will always be at the last iteration. This only effects the pixels hit separately. look at the coloring section.
Before each render this is called:
exposure[i] = round(cp*cr*1000);
Color Method
void colorPixels() { if(xint < rWidth && xint > 0) { if(yint < rHeight && yint > 0 ) { if(n>start)//Most numbers below one hundred aren't a part of the strange attractor { exposure[yint*rWidth+xint]++;
c = color(exposure[yint*rWidth+xint]*rAdjust*cs, exposure[yint*rWidth+xint]*gAdjust*cs, exposure[yint*rWidth+xint]*bAdjust*cs);
tmpPixels[yint*rWidth+xint] = c; } } } }
Thanks for any help in advance!
--------------------------
live, love, create
What it is: This program renders attractors using varied formulas I generated based on Mandelbrot's and the Quadratic Map.
It renders them similar to other programs but is not based on just one equation.
Why did I do this? This project was only an experiment and was for me to learn more about Attractors (and Processing) and to mess with formulas to produce different types of attractors. I never really meant it to be public.... but here it is.
How to interact with the program? First timers just press 0-9 or shift+0-9 to find a nice one, then 'f8' for a nicer looking version, now we wait a while. Right click to save an image in the directory of the program. Press 't' to save a text file of the rendering.
Also you can press 'f1' for faster rendering, then 'q' to randomize, wait a while for a random attractor to pop up. Then press f8 to render it better.
Press 'c' to change color randomly.
FULL MONTY *
Enter: Exit "Pause" screen
*
Spacebar: Opens "Pause" screen but actually doesn't pause it resets everything (I plan to fix that some day)
*
Arrow Keys: Zoom but also pushes the image away from the origin, which is based on where the fractal is to the origin. (I plan to fix this)
*
Mouse: Panning is just a click and drag from where the image is to where you want it based only on how far you drag the mouse.
*
Right-Click: saves an image to the .pde directory.
*
f-keys 1-8: change the iteration amount thus making it denser and also changes the coloring brightness since iteration amount is in the formula for coloring. (I thought it would be cool to see how much a pixel is hit in the formula process so this comes out as a brighter color for that pixel [needs a serious fix]). f1 is 10,000 times meaning it will loop the formula 10,000 times and record how many times each pixel gets hit. It then brightens that pixel based on what color you set it to start with. f8 is changeable by pressing 'f' & 'F', but it is not working well right now. It is set at 50,000,000 which is the best render available so far. It will also be the brightest so you must lower the bright values by pressing the comma key, period key brightens it more.
*
Formulas: It first starts out with formula 1 after the pause screen has been left. Keys 0-9 and shift+0-9 runs that respective formula. Only formula 7 uses exact quadratic, the rest are just experiments.
*
X&Y Coordinates: To change the starting x&y plots HOME and END will decrease and Increase respectively on the x-axis, PAGE U & DOWN decreases and increases respectively on the y-axis. This will change the attractor by mutating, shrinking, enlarging or just making it disappear. This is a way to explore the attractor and find new ones. This will only increase or decrease the number at the depth level in the current selected digit slot if 0
1.0000 if the first digit after the decimal point is selected it will increase or decrease the number from there. You can change which slot is selected by pressing 'w,x,y,z and d'. "d" for depth. 'w,x,y,z' for which slot. Depth is discussed later.
*Brightness: Keys ' *,
/ ,' "asterisk and backward-slash" for times and divide increase and decreases the brightness by a large amount (a whole number digit stays positive). Keys ' + , - ' (Plus and minus) can increase by decimal points / ratios. Keys ' , . ' ( comma and period ) increase and decrease respectively by whole numbers as well and was purely an accident that worked. By experiment I mess with those first. Then I mess with +- next. Unfortunately they don't work without reiterating the attractor all over again, I have not yet fixed this nor am sure how to fix it. Also the number each color starts with will increase the brightness as well. More on color later.
*
Color: 'R,r,G,g,B,b': R = increase Red's color from 0 black to whatever the max iteration is which would produce white. 'r' decreases. Same with green and Blue. This also only increase or decreases at the digit depth currently selected by pressing 'd' and/or 'w,x,y,z'. The problem with this method and the brightness, is the lack of color variety. (I plan to change it later.)
*Depth="W,X,Y,Z"&"D,d": This is how to select which digit slot to increase or decrease. At the current unchanged depth level, 'w' selects the first whole number slot to the left of the decimal i.e. 1. 'x' selects the tenth decimal place, 'y' the 100th, 'z' the 1,000th. 'D' & 'd' moves the selections up or down the place respectively. Press 'D' and 'w' selects the ten place '10', 'x' selects the one place '1', 'y' selects the tenth, and 'z' the 100th. 'd' would go smaller in respect to the 'D'.
*
Save: press 't' to save a text file holding all the variables for the image. There currently is no way to use that file to load the image, it has to be done manually in the source code. Under pressing key shift+0-9/0-9.
*
Random: 'q' creates a random image of the currently selected formula, the bailout method is if after the 100th iteration no new pixels are generated then it stops and regenerates a new 'x and y' coordinate.
*Random Color: 'c' generates a random color.
I have not been able to get a working web app (it's just a blank white box), I searched help but no luck at all.
but I have got Macosx and Windows working applications plus full source code for Processing and Java.
The Linux app is not tested since I can't get Ubuntu 10.10 to work with Java yet.
I tested it on Windows 7 64 and Mac OSX 10.4 PPC.
It's not fully documented yet but I have been very busy.
It's key input only with no GUI yet...
The instructions appear on the first frame (Though they aren't great instructions yet) and this (this post) is the reference I posted there.
I want to get the coloring method out of the draw loop and into a key called event, like when the user changes colors.
So far the method of coloring is really screwy and I need to clean it up.
Please let me know what ideas you have and any help at all would be more then welcomed.
I'm currently taking a break from it since I have been working on it non-stop for the past month or two... I lost track of time. This version 0.28 means I have made about 28 major changes. Version 0.07 was done in September 22 but I lost all previous versions before that one.