I've been quiet but not lazy :)

posted in I am a duck
Published April 04, 2011
Advertisement
It's been way too long since my last entry but it's not for lack of trying. Real life has been busy with a crazy couple of weeks at work along with a week long vacation in the sun so it's hasn't all been a bad kind of busy :). I've managed to fit in some project work during all of that but I just haven't had time to write up an entry on things until now.

Physics Integration

When I last wrote I was looking for a physics library to integrate. Everyone was nice enough to unanimously suggest Bullet which made my decision easy and it ends up that it also made integration easy too. The library does everything I need it to do and does it in a very clean fashion. Understanding how all the pieces work together was a breeze which made it easy to fit into my framework. One final work item that I still need to implement is passing along collision events to individual objects in my scene. Currently objects collide correctly based on collision masks but the objects don't currently perform any custom events on those collisions. I haven't done any heavy testing to see how performance holds up with a bunch of things going on in the world but unless there's a complete melt down I would definitely recommend this library to anyone else looking for a physics solution.

Of course everything can't go completely smooth all the time and the physics integration did identify a few bugs in my shaders with lighting not behaving correctly with objects in motion. I would never call myself a graphics dev, and neither would anyone else, so tracking down the bugs was a bit of work. I haven't really done much thinking of dot products, etc. since I was in school and I always let the fixed function pipeline worry about that stuff in the past so my debugging of things took longer than it probably should have. In the end though I did finally get things working enough that I'm ready to move on.

I've got a quick little video showing off the rubber ducky model getting some forces applied to it and bouncing off the walls. The physics world is using a sphere as a rigid body for the duck if you're wondering why the collisions don't look 100% accurate for an odd shaped object like the duck but I can easily get it to use the mesh instead. In this case I just want to test the basics of the physics integration.

[media]
[/media]
0 likes 4 comments

Comments

BooBoo
Was there any duck hurt during making of this video?!?!? I saw the duck hit the wall with its head, not nice!
April 04, 2011 06:30 PM
Jason Z
I'd be interested to hear what issues with the lighting were discovered only after physics were introduced - perhaps a mini-postmortem of what to take care about when building a lighting system...
April 05, 2011 04:15 PM
Mike Bossy
I wish there was a long involved story to go along with the lighting problems but it just boils down to me being dumb. :) I wasn't transforming my normals correctly based on the updated orientation of the objects. This didn't show up when I was just doing static screens because it appeared to be lighting things correctly. The problem is that I didn't have a definitive set of test cases that I ran against the static images. It was more like "Can I see one light? Can I see two lights?" What it came down to was that I was missing transforming the normals into world space using a normal matrix. This was further exacerbated by the fact that I don't want to use any of the built in variables like [color=#333333][font=monospace][size=2]gl_NormalMatrix [/size][/font][/color]that are being deprecated so that led me to actually learning how to build the normal matrix.

What would have helped would have been to have had a number of set scenes and reference images to go along with them to know that I was rendering things correctly. Obviously that means having everything from lights, camera and viewport setup to a known scene but it's nice to dream :)
April 05, 2011 08:53 PM
Jason Z
While I was working on my skinning code I thought the same thing - it would be great to have a sort of 'stanford bunny' to use as a test case for a scene. That might be worth investigating...
April 06, 2011 07:57 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement