Hi, I have my own meshing algorithm, where each “voxel” can take any shape, which means my mesh is not necessarily uniform - for example, a user can change any voxel to any of the available shapes.

I have my procedural light created per block, and each “air” block or “partial block” can propagate light. If I use this directly, it works well, but it does not look smooth.

Next, I am smoothing the light by averaging 8 neighboring non-zero-lights for each vertex. This doesn’t work so well, because light can “bleed” through the partial voxels.

2d example of per-block light - works good

2d example with 1 partial block, per block light - works okay

In this one, if I average the lights, the light at vertex between the block with 5 and the one with 1 will become 3 for both blocks, so one side will be too bright, and one too dark.

The following would be the most challenging case

Averaging at the vertex in the middle would bleed in the voxels with “0”. however, if “per block” light is used, it would work okay.

In the case here, I would somehow need 4 value for that vertex, and each value used based on which block containing the vertex is rendered. I cannot think of a solution which is simple (I’d like to avoid complicated ones - I usually over-complicate )

ps. These are all 2d schematics, my world is 3d - but for the ease of discussion.

pps. The per block light propagates in x,y,z directions by losing 1 level for each block it travels. The vertex ones are just averages (but only of the non-zero light). Full blocks have 0 light. So averaging 8 blocks, and only 3 have non-zero value, the sum of the 3 blocks, divided by 3 - goes to vertex light.

Kind regards,