Shadow value for each cube is stored in separate grid, values are sent to shader and then output is altered. It all depends on value.
The value is calculated based on number of obstacles on the way between light and current cube.
Below you can find some metrics:
Earlier I have introduced point light to engine, there is example of one point light – shown below.
Below 510 point lights on 64x64x64 cubes grid.
And its metrics..
Metrics for grid of 32x32x32 cubes, below:
Why the results for point lights are almost the same?
All the calculations are precomputed on CPU so we are dealing with fixed buffer of light values – which is fair enough, however I need to optimise loading process so it will allow to add lights in real time.
Next step, editable terrain..