Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

Archive for March, 2013

[Final] Now it’s finished!

It’s been a good few weeks, and time has passed with a flash. The project has had a lot of ups and downs, but it has finally arrived at a conclusion, to my delight. It was a fun process and I believe I’ve learned a lot, and have got good grounds to learn even more. I don’t intend on stopping my work on this project as it is, not now. There are just a lot of more things I can do to it.. but anyway, here’s my wrap-up. My report. In short.


The positives:

  • A lot of tasks were simpler than I had estimated, so I ended up winning a lot of time.
  • OpenCL was easier to get into than imagined.
  • I was more capable than I first imagined, too. It helps to get confident. =D
  • Managed work so quickly, even with timelosses..

The negatives:

  • Timeloss on sickness: 2 weeks approx.
  • Timeloss on driver issues: 1 week approx.
  • Could have had better initial planning!
  • There’s a lot of place for more sophisticated solutions, like maybe using a heightmap for particle collision. Or something else.

Overall I’m happy with my results, and I feel there is a lot of room for improvement. Improvements that I am going to try out from home and at my own leisure.


The final delivery ended up being not quite a .lib. I wasn’t happy enough with the result, so instead I send out my entire source, which is full of test-code and unoptimized parts; but it’s something for anyone to improve upon.

This is Klas, over and out.

[Week 7] Ray-Triangle intersection, friction and I’m starting to get done.

This seems to be it. Even if most of the mechanics are currently locked down in a conveiently named test kernel, they are there and they seem to work. Now I can start working with making the code more readable, isolate parts into their own kernels, and of course optimize the code after doing this. Then I can set up example scenes for the upcoming milestone. For demonstrating them at the gradshow, I may or may not add functionality to alter the system on the fly, adding several force fields and several particle systems at a time; all with activated and/or deactivated kernels.

So, today  I wish to go through the particle-triangle collisions. For the collision detection, I’m using Möller & Trumbore’s fast triangle intersection test, modified as to return ray values of (float)INFINITY if there are no intersecting rays. (or if the ray is behind a triangle). For detecting the actual collision, I make a ray with an origin on the particle, with it’s velocity as its reach, and if I get a proper collision, the distance to the collision point is returned. When a collision happens, I split the current velocity vector in two components; one component that is aligned with the surface normal, and another that is aligned with the surface tangent. This is so that I can apply particle restitution and plane friction using:

V=(1-F )*vT – R*vN.
Where V = velocity,
F = friction,
vT = Tangent Force,
R = restitution,
vN = Normal Force

[Week 6] Just a few example videos

Now, I know the system behaves mostly the same. But the purpose of these tests were just to try out functionality.

[Week 6]Simple local forces somewhat finished, trying plane/triangle collision

I didn’t think trying local forces would go as fast as it did, after settling the sorting and putting extra time in some overdue courses I did it in less than a day. The local forces are not complex by any means.. I had hoped to put in some sort of field texture, but with my time I think I’d rather focus on a simple spherical ’emitter’. That can either drag in or push away particles. I may, when I create the kernel for this functionality also add functionality for bounding boxes with a “wind” vector..

I am currently looking into plane/triangle collision with my particles.. if I could get it done swiftly, I could get to cleaning up my code and actually make a demo of sorts. I’ve already planned what the demo should contain by itself. I may also, since it’s an extremely logical thing to do, add support for several particle systems in one particle manager. However, focus lies on making the particles behave pleasantly first! It doesn’t matter if I can demonstrate several systems at once if they don’t behave as I want. I’d rather have a demo with a single particle emitter, than several that don’t work.

[Week 6] Well… that was embarassing

So.. I spent most of the week trying to implement a sorting algorithm. I never did that well to begin with, nothing seemed to work quite as I imagined, and I trawled through several papers trying to write my own sorting algorithms.

Nothing of this had any success, so before the weekend, I decided to use some existing projects for sorting. None of which seemed to work properly.


In short. NOTHING.  WHATSOEVER. Worked. Apart from my particle kernel. But that one was really simple, nothing much to screw up there. But.. in my desperation, I, today decided to install new drivers. And… it suddently works. Thanks a bunch Nvidia. I had broken drivers all along.


So now I have working depth sorting. I’ll post a simple run-through of the “algorithm” later.  And a video. Even if the particle kernel and test emitter still looks the same, this means I can start doing other things. For this evening, I will be clearing up my code however. A video will come at a later time.