before showing you next time the final result of this galaxy coloration project in form of representative, individually colored galaxies, let me tell you a bit more about the strategy and custom tools that I have used.
Custom tools (Maple) were essential for trying out various color profiles quickly, notably in comparison to my reference SDSS set that is matched to the RC3 galaxy catalog:
First of all, how can we parametrize complex RGB color profiles for individual galaxies most easily and intuitively
, i.e matched to the actual requirements of the project?
The trick is to compose the galaxy color profiles NOT in R,G,B color space but rather in the so-called H,S,V space
. Here H=Hue, S=Saturation
("color intensity") and V=Value
The transformation between RGB and HSV is a standard task in image manipulation. I have also written a corresponding C++ method in Celestia long ago.
Why is color matching in the HSV basis so much simpler?
Well in first approximation
, during the coloration process, one may set the V
alue (<=> brightness) and the S
aturation (<=> "color intensity") equal to some convenient, constant value across a galaxy
! Then the coloration task reduces to just parametrizing the desired H
ue profile (instead of THREE profiles for the individual R,G,B colors!). After the color transition (Hue) is settled correctly, one then proceeds to tune both the two intensities (S and V) in a second step.
The latter does interfere very little with the Hue settings
, which makes the coloration task so much simpler and more intuitive.
The Hue is usually given in degrees within the range 0 <= H <= 360 degrees. Here is a nice circular Hue display
(from The GIMP):
In this example, the Hue is located along the circle, increasing counter-clockwise. Presently we have set H=0 (white bar on circle). The actual color with V=100% and S=20% is displayed as well at the bottom.
For Celestia (.Sci), we need to map the Hue values across a galaxy to a field, the so-called colorindex
, with 256 (r,g,b) - triplet entries (i = 0..255). These triplets denote the sprite color starting from the galaxy center (i=0) and increasing towards its periphery (i = 255).
What I needed next was a mathematical function that allows to implement intuitively
-- yet precisely-- the transition of the Hue from a desired starting value (hue0
) to a final one (hue1
), at a particular location of the colorindex (i=i0
) with a certain "transition speed" = slope
Hence I determined a very flexible and intuitive hue-transfer function from the ansatz
hue = a - b * tanh(-i /c+slope)
involving the 4 parameters a, b, c, slope
besides the colorindex i.
The three parameters a, b, c were fixed in terms of hue0, hue1, i0 and slope
with Maple from the 3 conditions:
- at i -> 255 ~ 'infinity': hue = hue1;
- at i = 0 : hue = hue0;
- at i = i0 : hue = (hue0 + hue1) / 2;
i.e. i0 = hue transition point in i
The result then reads:
hue = hue1 + (hue1 - hue0)/sl * ( -1 + tanh( i * (slope - arctanh(sl / 2 - 1))/i0 - slope)));
with hue-transition "engine"
sl = tanh(slope) + 1;
As desired, the transition hue0 -> hue1 gets much sharper for increasing slope parameter. Remember that the hyperbolic tangens, tanh(x), varies between -1 and +1.
For Saturation and Value profiles in the second step, I also chose some flexible, intuitive forms. As a last convenience, I implemented the option of skipping a certain band of colors (green!)
during the hue transition.
The resulting tool and the ImageTools
package of Maple 13 then allowed quickly AND intuitively to try out any desired H, (and S,V) profiles in terms of a realistic RGB test image.
Notably after these considerations, I can just measure the initial and final H,S,V values of any SDSS galaxies with the GIMP "pipette" tool and Maple/C++ code do the rest.
Here are some actual example plots generated with my corresponding Maple code:
Look e.g. at this SDSS galaxy, NGC 3344 with a measured value B-V = 0.57
according to the RC3 galaxy catalog. As you can see, it's indeed quite blue
but still with an ochre/orange center ... So a "visual blueness" B-V=0.57 seems adequate.
According to the GIMP "pipette tool", the colorindex profile should start around Hue = ochre/orange ~ 37 in the galaxy center
, transiting quickly (slope = 5.0, say) to Hue=blue ~ 208 in the outer regions
. In addition the green band of hue (50<H<180) must be skipped
during the transition!
Here is what my Maple tools display for such a configuration:
First the corresponding plots of Hue, Saturation and Value
(Click for Big!
Note that a more realistic behaviour of S,V than a constant has also been implemented. Again the "pipette tool" provides central and peripheral values for the galaxy under consideration...
Then, after my Maple code combined quickly the H,S,V layers and transformed them to RGB color space, here is the image content of the colorindex (i=0..255)
: combined layers in RGB space,
: R,G,B layers displayed separately as grayscale images.
Since my modified C++ code in galaxy.cpp has all these considerations implemented as well, Here is the color result of Celestia.Sci for this configuration.
Suppose, I now wanted to see what the galaxy would look like with a somewhat redder central region (and everything else the same) I just enter hue0=17, say (instead of 37) and Maple instantaneously gives this:
A Celestia.Sci run indeed confirms the redder center:
I hope this was kind of instructive? However, the actual procedure was considerably more involved