
Here you see 1000 particles connecting each other if they travel close enough.

Combine 3D sphere into dimension two by connections.
Optimizing is everything. More you can optimize more powerful your tools become and you can do more. I never get tired of researching more ways to optimize.
First level of optimization is to get current code to run as efficient as possible by cutting off all unnecessary method calls and maths. Also strict typing and bitwise solutions need to be thought.
Second level is to think about the concept. Like in these demos if all objects check their distance with all objects the cpu will freeze. The solution is to split the scene into grid and push objects into those blocks according their coordinates. With that the distance check can be crop to affect only objects that are near.
Third level is something that I haven’t reached yet so don’t know anything about it yet.. :)



November 28th, 2009
5:07 pm
can you ellaborate on “split the scene into grid and push objects into those blocks according their coordinates” …?
November 28th, 2009
5:14 pm
Next level is called octree.
November 28th, 2009
6:40 pm
mrdoob: Very interesting area this gridding. There are much to achieve with the concept. I’m definitely going to read about octree too.
sq2: this is how it goes in 2D:
First you create the grid:
for(var _x:int = 0; _x < gridSize; _x++)
{
for(var _y:int = 0; _y < gridSize; _y++)
{
posGrid[loopsize] = new Vector.<Particle>();
loopsize++;
}
Then on loop after you have moved the particles you push them into the right Vector:
dy = int(particle.y / height * gridSize);
pos = int(dx + dy * gridSize);
posGrid[pos].push(particle);
You may also want to push them to the neighbor Vectors to have seamless effect when dealing with connect lines.
And after this make a new loop where you go trough all grid (posGrid) Vectors and check distances of particles found in individual Vector.
November 29th, 2009
6:35 pm
the “abstract connections” thing is just beautiful.
do you use your efla algo to draw ?
object pooling & space splitting are both very dense fields, can’t wait to see what you’ll come up with :)
November 29th, 2009
6:39 pm
[...] This post was mentioned on Twitter by nicoptere and Simo Santavirta, なんとかリーダーB. なんとかリーダーB said: すごく奇麗だな http://bit.ly/8kfZXM [...]
November 29th, 2009
6:57 pm
nicoptere: Yes it’s efla running there. I’m thinking what would be an efficient way to split the 3D space since it could be infinite large. I think it’s mandatory to set limits where objects can move if I want to benefit the power of gridding.