AMD have just announced there will be a free version of the DMM engine. It sounds like it will be closely integrated with Bullet Physics and provide OpenCL support.
I'm looking forward to this as DMM is the only realtime finite-element (FEM) based physics engine around. I'm interested to see how well it works.
Hopefully I can get a copy soon and some time to integrate it into the Physics Abstraction Layer.
Here is a video of DMM to refresh your memory:
Tuesday, March 09, 2010
Tuesday, March 02, 2010
Alpha Beta Filters
(EDIT: See also Kalman filters)
Alpha-Beta filters are fairly well explained on wikipedia, and are generally a very easy first-stop solution before heading to Kalman or particle-filter alternatives. (The next obvious step is to extend this to include acceleration (Alpha-Beta-Gamma), and to limit the error/estimates to a sensible range for your application).
Here is a small example program showing how they work, it generates output similar to this:
Alpha-Beta filters are fairly well explained on wikipedia, and are generally a very easy first-stop solution before heading to Kalman or particle-filter alternatives. (The next obvious step is to extend this to include acceleration (Alpha-Beta-Gamma), and to limit the error/estimates to a sensible range for your application).
Here is a small example program showing how they work, it generates output similar to this:
Ideal position: -0.897 -0.443 Mesaured position: -0.890 -0.421 [diff:0.029] AlphaBeta position: -0.898 -0.442 [diff:0.001] Total error if using raw measured: 1.522438 Total error if using a-b filter: 1.059981 Reduction in error: 69%C source code follows:
/** A simple alpha-beta filter example by Adrian Boeing www.adrianboeing.com */ #include <stdio.h> #include <stdlib.h> #include <math.h> typedef struct { float alpha; //alpha value (effects x, eg pos) float beta; //beta value (effects v, eg vel) float xk_1; //current x-estimate float vk_1; //current v-estimate } AlphaBeta; void InitializeAlphaBeta(float x_measured, float alpha, float beta, AlphaBeta* pab) { pab->xk_1 = x_measured; pab->vk_1 = 0; pab->alpha = alpha; pab->beta = beta; } void AlphaBetaFilter(float x_measured, float dt, AlphaBeta* pab) { float xk_1 = pab->xk_1; float vk_1 = pab->vk_1; float alpha = pab->alpha; float beta = pab->beta; float xk; //current system state (ie: position) float vk; //derivative of system state (ie: velocity) float rk; //residual error //update our (estimated) state 'x' from the system (ie pos = pos + vel (last).dt) xk = xk_1 + dt * vk_1; //update (estimated) velocity vk = vk_1; //what is our residual error (mesured - estimated) rk = x_measured - xk; //update our estimates given the residual error. xk = xk + alpha * rk; vk = vk + beta/dt * rk; //finished! //now all our "currents" become our "olds" for next time pab->vk_1 = vk; pab->xk_1 = xk; } double frand() { return 2*((rand()/(double)RAND_MAX) - 0.5); } int main(int argc, char *argv[]) { AlphaBeta ab_x; AlphaBeta ab_y; double t; //time double x,y; //ideal x-y coordinates double xm,ym; //measured x-y coordinates double xnoise = 0; //noise we are inserting into our system double ynoise = 0; double m_error = 0; //total error (measured vs ideal) double ab_error = 0; //total error (ab filter vs ideal) #define DT 0.1 //intialize the AB filters InitializeAlphaBeta(1,0.85,0.001,&ab_x); //x position InitializeAlphaBeta(0,1.27,0.009,&ab_y); //y position srand(0); for (t = 0; t < 4; t+=DT) { //our 'true' position (A circle) x = cos(t); y = sin(t); //update our simulated noise & drift xnoise += frand()*0.01; ynoise += frand()*0.01; //our 'measured' position (has some noise) xm = x + xnoise; ym = y + ynoise; //our 'filtered' position (removes some noise) AlphaBetaFilter(xm,DT, &ab_x); AlphaBetaFilter(ym,DT, &ab_y); //print printf("Ideal position: %6.3f %6.3f\n",x,y); printf("Mesaured position: %6.3f %6.3f [diff:%.3f]\n",xm,ym,fabs(x-xm) + fabs(y-ym)); printf("AlphaBeta position: %6.3f %6.3f [diff:%.3f]\n",ab_x.xk_1,ab_y.xk_1,fabs(x-ab_x.xk_1) + fabs(y-ab_y.xk_1)); //update error sum (for statistics only) m_error += fabs(x-xm) + fabs(y-ym); ab_error += fabs(x-ab_x.xk_1) + fabs(y-ab_y.xk_1); } printf("Total error if using raw measured: %f\n",m_error); printf("Total error if using a-b filter: %f\n",ab_error); printf("Reduction in error: %d%% \n",(int)((ab_error/m_error)*100)); return 0; }
Monday, March 01, 2010
Catchup: Graphics Links Post
Again, a set of interesting links from the last few weeks:
Cirkus Animation ABC: Stargate studios reel:
- Simple and Fast Multimedia Library, a SDL replacement with a few more modern concepts. (eg: shaders!)
- The OpenCL debugger, gDEBugger CL is in public beta for Windows, Mac OS X and Linux.
- ATI Stream Software Development Kit (SDK) v2.01 now supports DirectX / OpenCL interoperability, plus debugging with GDB! A giant leap forward for OpenCL by AMD!
- Sander Van Rossen has put together a set of interesting posts on implementing a constructive solid geometry (CSG) system.
- OpenRL (raytracing language) has gone beta. I've not had positive experiences with Caustic so far. Wait and see I guess.
- Apparently, someone managed a 20x speedup for SQL select queries with the GPU. I guess I need to eat my words. I'm still not convinced that this is really a CPU-intensive issue. (Maybe for scheduling and retrieving flight prices - a dijkstra-like issue)
- An interesting article on the history of photoshop, never realised how humble the beginnings were, and how much influence one mans decision to allow optional extras (ie: plug-ins) played on the future of the product.
- I never realised this, butAutodesk has a massive price reduction for students, this includes 3ds Max, Maya, and AutoCAD. Wow!
Cirkus Animation ABC: Stargate studios reel:
Subscribe to:
Posts (Atom)