Atmosphere and Water Color

So I am trying to get a figure out values from /list-gameservers endpoint. The only two I am having trouble with are atmosphereColor and waterColor. I cannot figure out what format they are in.

The initial thought, thanks to @Simoyd, was they were in Lab format just like how the Goo mutations work, but if that is the case, I do not understand the multiplier to get them to their correct values because these ones are all way too small.

For example, Serp has a very white/gray atmosphere and water. The Values returned from the API are

Atmosphere: 0.8999999761581421, 0.8999999761581421, 0.8999999761581421
Water: 0.28125301003456116, 0.2812429964542389, 0.28124499320983887

Making the assumption those are Lab values without any type of multiplier, I get #060301 and #020100, which are very black, not white.

Any ideas?

Here is a full reference list of all of the perm world colors:
World Name Atmosphere Color Water Color
Sochaltin I [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Finata [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Lamblis [0.7015489935874939, 0.9234399795532227, 1.2521649599075317] [0.2534419894218445, 0.2826719880104065, 0.3489759862422943]
Circarpous I [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Besevrona [2.770395040512085, 0.0, 4.30767297744751] [0.5547199845314026, 0.09834100306034088, 1.2877830266952515]
Beckon [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Pheminorum [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Biitula [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Delta Cancret [2.0403590202331543, 0.651872992515564, 0.0] [0.321384996175766, 0.2741290032863617, 0.23354099690914154]
Serpensarindi [0.8999999761581421, 0.8999999761581421, 0.8999999761581421] [0.28125301003456116, 0.2812429964542389, 0.28124499320983887]
Storis II [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Seginiakai [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Grovidias Te [2.0403590202331543, 0.651872992515564, 0.0] [0.321384996175766, 0.2741290032863617, 0.23354099690914154]
Till [0.7015489935874939, 0.9234399795532227, 1.2521649599075317] [0.2534419894218445, 0.2826719880104065, 0.3489759862422943]
Alnitans [0.0, 1.0514659881591797, 2.049738883972168] [0.0, 0.33189499378204346, 0.6076689958572388]
Lasaina [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Lutrion [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Boori [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Arie [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Antar VI [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Maryx [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Angel I [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Cardass [1.2832900285720825, 0.8769189715385437, 0.0] [0.4635390043258667, 0.25371700525283813, 0.0171549990773201]
Kada I [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Shedu Tier [0.0, 1.2182209491729736, 0.39789900183677673] [0.0, 0.38262298703193665, 0.10516999661922455]
Minorengle [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Alcyon [4.066154956817627, 0.0, 0.4921799898147583] [1.2404420375823975, 0.012655000202357769, 0.11739999800920486]
Trior [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Refgar [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Niia Zed Ka [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Alder [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Imoco [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Sorissi [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Gloviathosa [2.0403590202331543, 0.651872992515564, 0.0] [0.321384996175766, 0.2741290032863617, 0.23354099690914154]
Cephonex Merika [0.7015489935874939, 0.9234399795532227, 1.2521649599075317] [0.2534419894218445, 0.2826719880104065, 0.3489759862422943]
Gellis [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Raxxa [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Gyosha Ophin [2.0403590202331543, 0.651872992515564, 0.0] [0.321384996175766, 0.2741290032863617, 0.23354099690914154]
Xa Frant [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Imdaari [0.7015489935874939, 0.9234399795532227, 1.2521649599075317] [0.2534419894218445, 0.2826719880104065, 0.3489759862422943]
Eresho [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Tana VII [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Flan [0.0, 1.2182209491729736, 0.39789900183677673] [0.0, 0.38262298703193665, 0.10516999661922455]
Galan [1.2832900285720825, 0.8769189715385437, 0.0] [0.4635390043258667, 0.25371700525283813, 0.0171549990773201]
Malurialakrib [0.8999999761581421, 0.8999999761581421, 0.8999999761581421] [0.28125301003456116, 0.2812429964542389, 0.28124499320983887]
Kol Huroo [0.8999999761581421, 0.8999999761581421, 0.8999999761581421] [0.28125301003456116, 0.2812429964542389, 0.28124499320983887]
Houchus I [0.0, 1.0514659881591797, 2.049738883972168] [0.0, 0.33189499378204346, 0.6076689958572388]
Norkyna [2.770395040512085, 0.0, 4.30767297744751] [0.5547199845314026, 0.09834100306034088, 1.2877830266952515]
Dzassak [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]
Trung [0.08850499987602234, 0.9416580200195312, 2.876873016357422] [0.07777100056409836, 0.31118398904800415, 0.5838239789009094]

Theyā€™re linear rgb values (to make a hex value for ā€˜normal usageā€™ you need to convert to srgb)

4 Likes

I do not know much about color math and only a little bit about computer graphics, so I am not 100% sure what ā€œlinear RGBā€ is to be able to convert it properly.

According to these:

It looks like I would need to do something like this to convert them?

def convert(linear):
    if (linear <= 0.0031308):
        s = linear * 12.92
    s = 1.055 * pow(linear, 1.0/2.4) - 0.055

    # clamp it to 1 since we are dealing with only 0-255
    return min(s, 1.0)

EDIT: That still does not look right. Alcyon gives me [1.0, -0.055, 0.730182792525743] and [1.0, 0.11581592541838776, 0.3771297472538454]

Do I just need to clamp to 0.0 and 1.0?

Alcyon with clamping to 0.0 and 1.0 gives me #ff00ba and #ff1e60

Serp gives me #f3f3f3 and #919191

Both values look a lot more correct.

EDIT EDIT: Yep, it looks like I am definitely getting the correct values now. This is what I am getting for my local Creative world:

Atmo #53f8ff, Water #4e97c8

Full code:

def convert_linear_to_s(linear):
    if linear <= 0.0031308:
        s = linear * 12.92
    s = 1.055 * pow(linear, 1.0 / 2.4) - 0.055

    # clamp value to 8-bit space
    if s < 0.0:
        return 0.0
    elif s > 1.0:
        return 1.0
    return s


def convert_linear_rgb_to_hex(r, g, b):
    r, g, b = (
        convert_linear_to_s(r),
        convert_linear_to_s(g),
        convert_linear_to_s(b),
    )
    r, g, b = int(r * 255), int(g * 255), int(b * 255)

    return f"#{r:02x}{g:02x}{b:02x}"
2 Likes

I have seen another convertion formula that have less parameter you may want to try :

f(x) = x^(1/2.2)

this should convert from linear RGB to sRGB

I get nearly the same values with that. I saw that in one post somewhere, I think that is an simplified formula to give you a faster answer. So it is not quite as accurate. For my creative world above I get #54f8ff and #4f96c7 which are both slightly different colors.

1 Like

Do you know if this formula is still valid?

Iā€™m getting some much lighter results for the sovereign world atmosphere colours than what you get for the permanent world ones.

Iā€™m using my Sovereign world as a base reference which, within game, looks like thisā€¦

but when using that conversion, it looks like thisā€¦

The permanent world colours look perfectly correct when using the formula though, so it may well just be a difference in the way that the sovereign atmosphere colours are stored.

Yeah, I never really have a great answer for that. I am not actually using the atmosphere colors for anything at all. It was just something coming from the game API I wanted to try to represent in Boundlexx for anyone that wanted it. No one else has bugged me about them either.

You can look at the values I am calculating from Boundlexx though. They are getting exposed via the API for all worlds.

https://api.boundlexx.app/api/v2/worlds/320/

"atmosphere_color": "#f3f3f3",
"water_color": "#909090",

That is a T6 blast world and it has the same atmosphere/water color as Malurialakrib.

1 Like

Iā€™m getting the same values back as you, so it seems either the formula is slightly off, or the sovereign worlds are stored differently.

Do you have a code sample I can look at where it implements the formula that @Gorillastomp suggested?

f(x) = x^(1/2.2)

Never mind, I figured that bit out (was having a brain freeze). Thereā€™s actually very minimal difference between the 2 anyway.

Seems that itā€™s the clamping above 1.0 that is the culprit. Iā€™ll keep plugging away at it.

the atmosphere colour is stored in the lighting files (assets/archetypes/lighting/), they are not different for different standard/sovereign. The responses from discovery server also contain atmosphere colours for purposes of colouring the planets in the sky, but these are just replications of what is in the lighting files (legacy that it used to be controlled by the server and was later moved into the lighting files which is why the data from discovery does not just contain references to the lighting file itself but replicates the value).

if you look at the lighting file for lush world, you get an atmosphere colour of:

"atmosphereColor": {
  "b": 255,
  "g": 83.4666,
  "l": 0.8999999761581421,
  "r": 7.84487
},

the format for this colour is that the rgb are linear 0-255, and l is an intensity value. to get to an actual colour, you have to normalise the linear rgb value to an intensity of 1, and then multiply with the intensity value; this is an hdr format so wont necessarigly be representable as an srgb hex value.

details

this format is designed around authoring, so in game we have a colour picker like:

(noting this is actually the lush world atmosphere colour being shown)
where there is an HSL color picker on the left with L set to 100%, and this is just used for picking the saturation/chroma of the colour, with intensity being purely decided by the right-side hdr-intensity slider; the ā€œtrueā€ intensity of the colour from HSL is ignored; it is normalised in usage so that no matter what you pick on the left side, the final intensity of the colour is always ā€œ0.9ā€ in this case.

the value shown and distributed via the discovery server in the /gameserver/ responses is after normalisation and scaling is performed, so in this case:

normalisation = 1 / (r * 0.2126 + g * 0.7152 + b * 0.0722)

which is 3.1965249213428604 for our lush atmosphere colour, and multiplying this and the ā€œlā€ value gives the colour seen in the /gameserver/ response of [0.088504672050476074, 0.94165784120559692, 2.8768725395202637] noting the blue is way out of the the representable range of normal hex colours which only go as high as 1 and cant be directly converted to an srgb hex value.

ā€¦

if you want to get the ā€œcolourā€ of the atmosphere, youā€™d have to decide how you want to exposure adjust and tone map the hdr valueā€¦ clamping to 1 (what OP suggested) is one (not necessarigly great) way of forcing to the valid range.

with the assumption that the lush world is probably the most ā€œblueā€ atmosphere (maybe the freezing blue worlds is more blue?) you could just decided to divide everything by sayā€¦ 3 and get [0.0295, 0.313885, 0.958957] which is in the representable range, and converted from linear to standard sRGB would then give #3098FB; the ā€œactualā€ colour listed in the data is 3x brighter than that colour, but sRGB and our monitors cant display it (unless you have a fancy hdr monitor I guessā€¦)

5 Likes

Thatā€™s perfect, Thanks Luca! That makes a lot more sense to me now.

At least I also now know I was looking at the wrong colour profiles and can standardise them using the world profiles.

respect! :sunglasses: :joy:

Each day, I try to learn atleast one thing new. Today, this was it! An interesting read for sure. Thank you!

Just wanted to say thanks again. The normalisation and division by 3 did the trick and I am now getting decent uniform colours across all of the world images Iā€™m generating!

305 27 9 10 25 21 47 23

6 Likes