mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Smooth lighting: Fix light leaking through edge-connected corners
For solid nodes, the lighting at a corner becomes face-dependent, which means that only the four nodes in face-direction contribute to the lighting (getSmoothLightSolid). For special nodes, which use the lighting values at the eight corners of a node, the lighting is not face-dependent, but certain nodes of the eight surrounding nodes of a corner (here indices 4, 5, 6 and 7) can be obstructed. Ambient occlusion now also occurs for solid nodes, if two, three or four of the four nodes in face-direction are solid.
This commit is contained in:
parent
1ff5c20442
commit
2cf9014160
3 changed files with 109 additions and 41 deletions
|
@ -276,7 +276,7 @@ void MapblockMeshGenerator::drawCuboid(const aabb3f &box,
|
|||
void MapblockMeshGenerator::getSmoothLightFrame()
|
||||
{
|
||||
for (int k = 0; k < 8; ++k) {
|
||||
u16 light = getSmoothLight(blockpos_nodes + p, light_dirs[k], data);
|
||||
u16 light = getSmoothLightTransparent(blockpos_nodes + p, light_dirs[k], data);
|
||||
frame.lightsA[k] = light & 0xff;
|
||||
frame.lightsB[k] = light >> 8;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue