Hi all,
Just wondering for colour format using by terragen software.
For example:
Normal colour code for representing colour BLUE:
Hue. = 140 Red = 0
Sat. = 240 Green = 128
Lum. = 120 Blue = 255
But terragen is representing as follows:
Blue Colour---------> "0 0.2195000052 1"
Any clue for decoding this would be great help!!
Thanks,
Prasad.
Here's an example using a cloud color from one of my TGD files.
high_colour = "0.3000000119 0.3000000119 0.3000000119"
A guess: 1 full color. The elements are RGB units. So this is a gray color.
Interesting that the numbers have so many decimal places. It's far more precise than I can see.
The colour is represented internally as a floating point: e.g red = 255 is stored as 255/255 = 1.0000
@mogn
Yep. Same thing in POV-Ray, but you have to specify your color in that format too. I can guess the color represented by three numbers between 1 and 0 easily, as I've been working with Celestia for a few years and it uses that color format as well as POV-Ray.
Thanks guys...
I will investigate on that formula and get back to you if I am struck again...
thanks again...
-Prasad
Quote from: mogn on February 17, 2010, 11:19:14 PM
The colour is represented internally as a floating point: e.g red = 255 is stored as 255/255 = 1.0000
That process is correct only when RGB are 255 or 0 i.e 255/255 = 1(terragen format) and 0/255 = 0(terragen format).
When RGB are with different values then terragen format is having different values other than diving by 255.
Any other clues???
I think there is some gamma correction going on.
You can also enter values larger than 1.
The standard Windows and Mac colour pickers do not correct for the gamma of the screen, so the values are not in a linear colour space. E.g. a G value of 100 is not half the brightness of 200, it actually produces much less than half the brightness. That is just the way most computer screens work or are setup to work for legacy reasons.
Inside the renderer it's important to work in a linear colour space so that 0.5 really means half the amount of light of 1. The RGB values you see in Terragen's XML document are in a linear colour space. A value of 1 usually means 100% albedo or reflectivity (unless it has some other meaning such as light intensity or luminance), and 1 is mapped to 255 in OS colour pickers. When you edit a colour in the colour picker, the linear RGB values are first gamma corrected by 2.2 (i.e. raised to the power of 1/2.2), then multiplied by 255, then it shows those values in the colour picker. It does this so that the OS colour picker showing on your screen shows a colour which is similar to the intended colour in linear space. When you are finished editing a colour, the inverse happens. They are divided by 255, then raised to the power of 2.2 (because that's approximately what your screen does to the light it sends to your eyes) and then you have linear colour space values which can be used by the rest of the renderer.
It can get a lot more complicated, but that's how it works in Terragen 2 at the moment.