Skip to content
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.
NSDex edited this page Sep 23, 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.

World Sky Color

The World 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.5 + constrainedTemperature * 0.1
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 [0, 1].

Weather

TODO

World Fog Color

The World Fog Color is derived from the current celestial angle. The exact calculation varies by dimension.

Overworld

The celestial angle is transformed using the following function and the result clamped to [0, 1]:

Y = cos(celestialAngle * 2PI) * 2 + 0.5

The red, green, and blue components are then derived as follows:

let red := 0.7529412 * Y * 0.94 + 0.06
let green := 0.8470588 * Y * 0.94 + 0.06
let blue := 1.0 * Y * 0.91 + 0.09

Neather

The Neather ignores the current celestial angle and uses a constant (0.2, 0.03, 0.03) for the world fog color.

Clone this wiki locally