You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Skylights are calculated from height-maps and are stored separately from the block lights.
They are calculated by the world's height-map that is generated by the chunk generator since it is the only one that knows the real height of the world, since it's infinite on the y-axis and it's impossible to calculate otherwise.
Height-maps are stored in the chunk pillars, sets that are identified by the X and Z coordinate and have unlimited chunks on the y-axis.
Calculation
On player move (chunk change):
Server-side (transmission)
When a server-side player changes chunk the new chunks entering it's view distance are sent to the client.
If the chunk has not been generated, generates first the height-map of its chunk pillar and secondly the blocks of the chunk. Finally diffuses skylights.
If the player hasn't received the height-map of the chunk pillar yet, sends it.
Now we can send the blocks.
Client-side (reception)
Client-side, when height-map is received, we simply store it in the relative chunk pillar. We create it if doesn't exist (based on the X and Z stored in the packet).
When the chunk is received, we can diffuse the skylight based on the height-map of the chunk pillar container of the chunk received.