We can edit or remove current blocks – adding new ones will be introduced after optimisation stage.
Current version supports 4 standard blocks (Blue, Green, Yellow, Brown) and 1 point light (Blue with circle in the middle).
In this iteration of “boxel engine” regenerateBuffers method updates nearest block that collides with ray fired from camera POV within worldGrid 3 dimensional table, after that, buffers that contain shadow and light powers are recalculated, at the end two openGL methods are called (for each buffer):
first, buffer is bind, and then values are updated, starting from index 0 and then updating whole buffer.
Optimisation, that I will be introducing soon, is updating only changed values that will reduce data size.
That has to be send to graphics card.
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.
Long Story short.
After hours spend on readings, coding and calculations I have got simple, bit slow but working Smoke effect.
FPS 25 – 30 on ATI Radeon HD 5700 Series which lets face it is a crap.
Next step – rewriting code, trying to make it bit more flexible and implement it to polygon based scene.
“Particle effects like smoke, fire and foam can be efficiently rendered without using hacks. Voxels are also being used by some big Hollywood special effects studio’s to render hair, fur and grass. ” – quote from Ray Tracey’s Blog
All important calculation will be proceed on GPU – I will do my best – using GLSL.
After couple hours spend on learning GLSL I have got that:
Loads of artefacts, however it is not so bad for just couple hours.
Next step will be to implement Perlin noise to get echo – base for my particles.