Problems with color mapping
in
Programming Questions
•
2 years ago
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:
Before each render this is called:
Color Method
Thanks for any help in advance!
--------------------------
live, love, create
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
int cp = 2;//EXPOSURE exposure = exposure + (cp*cr*1000)*rgbAdjust*cs
float cr = 2.0;
float cs = 2.0;
- 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
1