Explorium now has much better performance due to updates to the lighting engine. Lighting masks are only updated when needed. The game now does 60fps when fully zoomed out. The lighting is still wonderful color lighting with attenuation.
More in-depth explanation of lighting as it is now:
When a block is changed, its respective chunk’s lightmaps are added to a list to be updated.
A chunk lighting update essentially draws to two masks. One is the source mask, which is a black square with single pixels of light where light sources are. The other is a blocking mask, which is a black and white mask where black is empty and white is a block.
Every step the on-screen chunks’ lightmasks are drawn onto two final masks; again source and blocking. These final masks are fitted to the screen in block sizes, so every pixel is a single block.
The two final masks are used in a pixel shader that spreads the light, reading the blocking and source masks. The shader draws onto a final mask, and this spreading process is repeated 8 times to get maximum spread.
The final spread mask is stretched onto the screen on top of the unlit world.
3 comments