Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.
NSDex edited this page Jun 6, 2015 · 12 revisions

Analysis is based on the decompiled source of the vanilla b1.7.3 client.

Concepts

Celestial Angle

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.

Sky Color

The Sky Color is the multiplicative product of the base sky color, a brightness multiplier, and other multipliers related to weather events.

Base Sky Color

The base sky color is derived from the biome and temperature of the voxel in which the player entity currently resides. The input temperature is divided by 3 and the result clamped to [-1, 1]. Notch uses this constrained temperature to compute the color in the HSL coordinate representation where the hue, saturation, and lightness are defined as shown below. The result is then converted to RGB.

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).

Brightness Multiplier

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].

Weather

TODO

Clone this wiki locally