I think I have forgotton to post this experiment to JActionScripters.
Here is a playable demo & source code that I showed on the FITC2009 session. Storm simulation with 10000 particle.
Basically all physic and mouse interaction is calculated with bitmap force map. Precalculating mouse interaction with bitmap is much faster than doing mouse distance with 10000 particles every frame.
In the Spark meeting #09, I presented an ARMessageCard for Geoff. At first, a card on the marker seems to be white, but a message will be rose by particles moves if you tilt the card. It works like a sand painting.
First, invert the transform matrix calculated by the FLARToolKit to get a transform matrix of gravity about the marker. Next, apply only rotations from the transform matrix to a normalized vector for gravity. Finally, get x value and y value from it. If you move particles based on these values, it will work fine
In one of them, there is “100,000 particles” posted by bkzen. I think it’s pretty cool! but I need more speed. :p So I posted a quick optmized one. It brings 33% faster (21fps -> 28fps) in my Mac.
You can see what did I changed by clicking “diff” link in above page. In short, I changed an iteration method from Array to LinkedList. Because array index access and calculating and checking an index (variable i) are pretty slow.
// Slow
while (i > num) {
p = particles[i];
// do something
i++;
}
But accessing an member variable is fast because it's optimized by AVM2. So it causes fast iteration.
// Fast
while ((p = p.next) != null) {
// do something
}
Please use this optimization if you need fast iteration especially in case you have a large data.
One of my professions is a professional photographer. Of many techniques,
I love to take long exposure photos and often like to light-paint within them.
This is a real photo taken with a Nikon DSLR, 30secs, drawn with two LED penlights (blue/white) for a new year's card in 2006. Click here to read more »
My name is Tomohiko Koyama aka Saqoosha. I think everyone knows me as a developer of FLARToolKit. I joined JActionScripters.com too, and I hope that Japanese Flashers are exposed to the world more and more. My English is not so good. If you find a mistake, please correct me.
Recently, I researched about Thresholding algorithms. Thresholding algorithms are used to binarize and preprocess the input to find some objects within the image. FLARToolKit uses a thresholding algorithm to detect the marker.
The algorithm currently using in FLARToolKit is Global Thresholding.
Its implementation is simple and faster, but no flexibility about illumination variation. I looked for a thresholding algorithm to improve this weak point. Then found Adaptive Thresholding.