Optimizations include:
- Meshbuffers with dynamic vbos.
- Colour calculations are now done in vertex shader.
- Normal calculations are now done in vertex shader.
- Proximity checks for only calculating values near the metaballs.
- Other optimizations, preallocations, set_used, etc. (Thanks to hybrid for tips.)
- I even went to the lengths of implementing the algorithm using SSE intrinsics, but I ditched it because it ended up slower than just normal C++.
Shader features include:
- Background refraction based on the spheres normals.
- Reflection mapping.
- Fresnal to alternate between refraction and reflection based on view angle.
- Specular with shine-through.
Press Z/X to increase/decrease the quality at runtime (Lower sample width = higher quality).
Press Space to pause the metaballs animation and benefit from VBOs. You can still change the quality while they're paused.
Screenshots:
Download:
http://irrlichtirc.g0dsoft.com/BlindSide/Metaballs.zip
Cheers