-
Notifications
You must be signed in to change notification settings - Fork 312
Sky
Analysis is based on the decompiled source of the vanilla b1.7.3 client.
The celestial angle is defined by the following function, where X is a value between [0, 1].
Y = X + ( (1 - (cos(X * PI) + 1) / 2) - X ) / 3
Notch derives X from the current time-of-day (in ticks) divided by 24,000 (the number of ticks in a day-night cycle), minus 0.25. If X is less than 0, he adds one in order to keep the domain between [0, 1] as required by the equation. The reason Notch shifts the domain by 1/4 is not clear.
The following graph shows the result of Notch's celestial angle calculation function for inputs between [0, 24000] in increments of 240.
The Sky Color is a product of the base sky color, a brightness multiplier, and other multipliers related to ongoing weather events.
The base sky color is derived from the biome and temperature of the voxel in which the player entity currently resides. Notch computes it using the HSL coordinate representation and then converts it to RGB. The input temperature is divided by 3 and the result clamped to [-1, 1]. The hue, saturation, and lightness are then computed as follows:
let hue = 0.6222222 - constrainedTemperature * 0.05
let saturation = 0.5F + constrainedTemperature * 0.1F
let lightness = 1.0
Only the Sky biome overrides this computation to instead return a constant (0.75R, 0.75G, 1.0B).
The brightness multiplier is derived from the current celestial angle using the following function:
Y = cos(celestialAngle * 2PI) * 2 + 0.5
The result is clamped to to [0, 1].
TODO - Weather