I have ceased work on the 2D finite element system using the grid-based optimized searching. My last work has been with generating springs between close elements so they “stick” to one another (and can also break apart). This required a pretty nifty spring management system (they are created and deleted on-the-fly cleaning themselves up). I again achieve real-time performance (although it drops below 60 fps if more points are added). The following images are from a simulation (thanks to ImageShack.us for the hosting) in order. Blue dots are elements, green lines springs.
At first a grid is generated which begins to fall. Because the grid is perfectly aligned, the points will not move along the x-axis unless nudged, so I sent a free element flying into the base of the “mass”.
It begins to settle, though the original top corners can still be made out as it deforms to fill the simulation area.
All signs of an original shape are gone, and the simulation has reached a low energy state where there is little to no movement.
To make sure to demonstrate the re-attachment ability, I add a some elements to the center of the “mass” with an initial positive y velocity, sending pieces everywhere.
Finally, the simulation reaches a low energy state again after being mixed up.
For any practical application, this would have to run with orders of magnitude more elements and in 3D. I began work on a 3D version, however it ran far too slow using the FPU to do anything reasonable in real-time and SSE optimizations were causing alignment errors. Given SSE and multi-threading, a theoretical 16x performance may be achieved, however I am ending this as this was only done to prove the grid-based method, which it has done with flying colors. The spacial sorting system remains an efficient way for distance-from-point lookups in n-dimensions with the grid size limitation. Other methods such as KD-tree and OCT-tree are most likely able to achieve greater performance and do so without the grid size limitation.






