Light

Light (or lighting) in Minecraft affects visibility, mob spawning, and plant growth. There are three aspects of Minecraft 's lighting system: light level, internal light level, and rendered brightness.

Light level
Light levels can be found on the debug screen $$. Light may come from two sources: the sky and certain blocks. There are 16 light levels, specified by an integer from 0 (the minimum) through 15 (the maximum).

Block light
A torch pattern which prevents most overworld hostile and neutral mobs from spawning. See 

Block light comes from light-emitting blocks, and spreads using a flood fill algorithm.

The block light level decreases by one for each meter (block) of taxicab distance from the light source. This applies to each of the 3 coordinate axes. In other words, the light level decreases diagonally by the sum of the distances along each axis. For example:
 * If a torch with light level 14 is placed on the floor, the light level of the adjacent floor blocks in all four directions is 13, while the diagonal blocks in all four directions have a light level of 12 (14 minus 1 south, minus 1 east).
 * If a torch with light level 14 is placed on a wall one block above the floor, then the block on the floor that is one block southeast of and below the torch has a light level of 11 (14 minus 1 south, minus 1 east, minus 1 down).

On a surface, this effect produces a diamond-shaped pattern of illumination around the light source. $$, light-filtering blocks can reduce more level of block light.

$$, when calculating lighting, the shapes of some blocks are detected, including and only including piston, daylight detector, enchanting table, farmland, lectern, stonecutter, grass path, snow, end portal frame, slab and stair, so that the light passing through them can only spread in specific directions. For example, the grass path prevents the light from propagating downward, but the light can propagate in other directions. Exceptions to this are composters, cauldrons, hoppers and carpets.

Sky light
The sky light level for blocks exposed to broad daylight is 15. Sky light cast onto blocks can spread to darker areas using a flood fill algorithm. Sky light is not reduced at night; rather, the spawning of mobs is determined by internal light values.

Opaque blocks can prevent the spread of sky light. By contrast, some transparent blocks such as glass and iron bars have no effect on the sky light level. All other transparent blocks, however, reduce the spread of sky light. Tinted glass, while visually transparent, blocks all sky light.

When sky light of a level of 15 spreads down through a transparent block, the level remains unchanged. When it spreads horizontally or upward, it reduces 1 light level. However, when it spreads through a light-filtering block, it does not follow the above two rules and attenuates specific light levels.

Sky light with a level less than 15 spreads as block light - when it propagates to adjacent (including top and bottom, six blocks in total) blocks, it is attenuated until it is 0.

$$, when calculating lighting, the shapes of some blocks are detected, including and only including piston, daylight detector, enchanting table, farmland, lectern, stonecutter, grass path, snow, end portal frame, slab, and stair. They have directional opacity, so that the light passing through them can only spread in specific directions. For example, the grass path prevents the light from propagating downward, but the light can propagate in other directions.

Light-filtering blocks
$$, all of the following light-filtering blocks decrease sky light by 1 level (but do not affect block light). $$, light-filtering blocks can reduce more levels of block or sky light. The following values are the amounts by which each block decreases the light level.

Light-emitting blocks


The following values are the brightness of the blocks themselves.

Internal light level
The internal light level is used for calculations within the game. The game uses the internal light level of one block to compute aspects of the game, which include mob spawning, plant growth, and daylight detector outputs.

The game uses sky light, time, and weather to calculate an internal sky light value (also known as darkening sky light), then uses the maximum level of the block light and the internal sky light to calculate the internal light (formula: ). This value is an integer with a maximum level of 15; it can also be negative.

Here are the levels of internal sky light at a sky light of level 15:

To obtain an internal sky light for a sky light level s less than 15, take the internal level at 15 l and subtract it with the difference between s and 15: l–(15–s).

Effects of internal light
Note: Keep in mind that the internal light level is only one of the considerations that apply to mob spawning and plant growth.

Mobs
Mobs may ignore the light level they are supposed to spawn in after using.

Other
$$, the light in predicate is internal light-level.

Rendered brightness


The game uses the light level (instead of internal light level), time, and weather to compute the rendered brightness of a given block or an entity. Light is completely monochromatic and cannot be truly colored.

As mentioned above, sky light is not reduced at night, instead, the brightness curve itself changes based on the time. Entities cast circular or tridecagonal shadows; however, these are unrelated to the rendering of blocks.

In general, lighting due to blocks results in a higher brightness, which is balanced by the fact that light due to blocks effectively starts at 14 (solid light source blocks emit a level of 15, but that applies to the light source block itself) while sky light brightness is 15 outdoors. Light due to blocks also tends toward orange in the middle ranges, while sky light in the Overworld daytime is white.

In the Overworld with the "Moody" brightness setting, full daylight reaches 98% brightness, while at night brightness is reduced to about 17% and is shaded blue. Full darkness is about 5% brightness.

In the Nether, sky lighting doesn't play a role since there is no source of sky light (although if there were, it would reach about 99% brightness. ) Full darkness with the "Moody" brightness setting is at about 25% brightness, slightly darker than a block light level of 7 and no sky light in the Overworld, and is shaded orange like block light.

In the End, sky lighting wouldn't play a role even if there were a source of sky light; this can also be seen if lightning is summoned in the End (there is no flash of brightness like there is in other dimensions). Full darkness in the End with the "Moody" brightness setting is about 28% brightness, and is shaded toward a bluish-green rather than the orange of the Nether and of block lighting.

Smooth lighting


Smooth lighting is a lighting engine that blends light levels across block faces and darkens corners using ambient occlusion to add semi-realistic shadows and glowing from light sources. It affects only rendered brightness, not the light level, so it has no effect on mob spawning or crop growth, and in fact can be detrimental for this very reason. It is set on by default. Paintings and water are unaffected.

$3/4$, smooth lighting can be turned on or off in the Video settings, accessed from the Settings menu. $1/2$, it has three settings: Maximum, Minimum (an older version of the engine), or Off, and can be changed by accessing Video Options from the Options menu.

Ambient occlusion in minecraft
In recent years, in many games, ambient occlusion is mainly generated dynamically by the GPU. But Minecraft calculates ambient occlusion in the code based on voxel placement and brightness levels.

Ambient occlusion is responsible for adding shading to an ordinary texture. It is a layer of translucent textures, on top of the normal textures. Overlaying these AO textures onto a texture is called AO mapping. There are about five AO texture patterns used in Minecraft's Smooth lighting, excluding flips and rotations, and only three patterns algorithmically. Strictly speaking, it's probably more than that. That's when the intensity changes with the brightness level. But they are solved by Tint.

AO texture pattern
If AO mapping is selected only to the northwest of the voxel, the following pattern is possible.

These classifications allow we can deduce a pattern from the placement of each voxel. We then use the following function to compute the opacity of the voxels' vertices, depending on the presence of the side and corner voxels.

function vertexAO(side1, side2, corner) { return 3 - (side1 + side2 + corner) }

This generates a 2x2 pixel image using the values of each vertex. The pixels are small, but don't worry. It's zoom in using anti-aliasing, it will gradat.



Trivia

 * In Minecraft's source code, the luminescences are defined using the floating point values in the third column. These floating point numbers are fractions of 16, but are multiplied by 15 to get the integer light value. This means that both 0/16 and 1/16 (0.0 and 0.0625) correspond to the integer light value 0.