From Minetest Developer Wiki
Jump to navigation Jump to search

In minetest, light is stored in the nodes.
Sunlight is propagated downwards ({x=0, y=-1, z=0}) and bright light makes the neighbour nodes brighter, it stops if there's a node which doesn't have sunlight_propagates = true in its nodedef or the value becomes 0.

daylight and nightlight

The param1 value (8 bit) of a node with paramtype "light" carries the information of the light amount.
The lower 4 bits of the param1 value store the so-called daylight.
The upper 4 bits of the param1 value store the so-called nightlight.


The sunlight value tells how much light comes from the sun (direct sun light / shadows / caves).
This value is independent of time of day. If daylight is smaller than nightlight or daylight is zero, the sunlight value is daylight, else the daylight may be light from torches because it's set to the maximum of artificial and sunlight, in this case neighbouring nodes need to be searched to find the correct sunlight value.

natural light

The natural light value is the sun light at a specific time.

artificial light

The artificial light, light emanating from e.g. torches, is the same as the nightlight. Calculate the emitted light using (math.floor(param1 / 16)).

node light

The function minetest.get_node_light returns the node light, it's the maximum of artificial and natural light. The bigger this value is, the less dark the node and neighbouring nodes look to the player.

Mbox important.png This article is incomplete.
Please help expand this article to include more useful information.