Tuesday, November 24, 2009

Implementing Bullet Collisions

I apologize for the lack of updates (again, I had to devote most of my time to another CIS564 project - http://www.youtube.com/watch?v=YQApmArwUSk). I am going to try my best to catch up on hair sim work this week/weekend over TG break. I do have some tiny things to show in the meantime, however. Using one of the Bullet demos as a starting point (and the power of the Bullet forums - I'm so glad that this library is well documented and supported...yes, I'm talking to you, OpenMesh!), I have put together a mini project that lets me shoot "particles" at an "animated" head collider! Check out the footage below.
The keen observer will note, however, that some of the cube "particles" pass right through the head mesh instead of bouncing off. I'm not exactly sure why this is - I've posted a question on the forums and will get back to you when I receive a reply. So, hopefully I have come close to solving the issue of "which collision detection method is most efficient" (again, by letting more experienced programmers take care of it for me). The next step will be to decide where to draw the line between Bullet and my own particle dynamics code (i.e. how to integrate the two). For example, I could let Bullet take care of the initial particle movements/collisions and then append my own special iterative constraints (including where / how far the particles are allowed to move). I think I will go with that plan of integration for now...

This brings me to another simultaneous task that I'd like to complete this week - developing a class hierarchy (including OpenGL representations) for different hair LODs. Here are the 3 major players:Strips, clusters, and strands. I already have a rough strand class working...it shouldn't be too difficult to use it as a starting point for the other 2 LODs. Also, now that I'm working with Bullet, I can start to think of how to structure these in terms of collision shapes that Bullet is familiar with (spheres, boxes, cylinders, and others). So, I could see I strand as being a collection of constrained (to each other) collision spheres, while a cluster would be a collection of constrained collision cylinders (or spheres with a radius equal to the cylinders that will be drawn around the base skeleton). The strip is a bit trickier - again, perhaps I could just use collision spheres held together in a kind of net. There's also the question of whether or not all 3 LODs are extremely necessary (as far as this project is concerned). I'd love to just use 2 of the 3. I found this video from a Pixar paper about hair simulation / rendering in the Incredibles:

They're just using strips here, and already (with some rendering tricks and interpolation) things are looking good.

So, to summarize, here are the things that I'd like to at least have started by next week:
  • Resolve the disappearing particles issue in Bullet
  • Construct a class hierarchy for the 3 LODs, including both OpenGL representations (how does OpenGL draw them?) and Bullet representations (how does Bullet see them?)
  • Bring everything back over to my OpenGL/FLTK testing ground (as opposed to Bullet's)
  • Populate the scalp with 1 of the 3 (or all 3) LODs
  • Begin looking into methods of interpolation across the scalp geometry (the Nalu demo comes to mind)
Ready, set, break!

Sunday, November 8, 2009

Which Pile of Bunnies is Better?

I spent some time today messing with the Bullet / ODE demos, specifically comparing and contrasting collision detection performance and mesh-mesh interactions between the two. This has left me with two very large piles of Stanford bunnies:
(Bullet Bunnies)

(ODE Bunnies)

I know, I know...you can't really tell which is the better engine by just looking at snapshots, but based on dropping these guys on top of each other (and shooting cubes around, among other things), I think I'll try to plug Bullet in first. Its collision performance looks a bit smoother (which also seems to be the consensus reached in various programming forums that I visited).

...Although, Pixar has been known to use ODE. No, no...Bullet for now. I'll let you know how it goes.

Wednesday, November 4, 2009

Sorry, I was making a game...

This past weekend was dedicated entirely to completing a CIS564 project (http://www.youtube.com/watch?v=o3x2L8oXaKY), so no progress was made on my hairs. However, the following statistics may give you a hint as to my plans for the rest of this week/weekend.
See, this way...I don't need to worry about whether or not my collision detection algorithm is efficient (though I'm still proud that I was able to implement it). Hmm, for some reason this decision to use a pre-made library for the sake of a higher quality output sounds familiar (Qt and OpenMesh *cough, cough*).