Wednesday, 9 September 2009

iPhone - It's been one week

So I spent the last week working on modelling, lighting, cartoon rendering and animations...


Modelling has been the most interesting part, rather than using a 3D modelling tool, I decided to generate it all in code using helper primitive classes, which handle drawing cubes and pyramids of differenet skews.

Lighting comes free with OpenGL, so that was easy to set up, still need to provide better normals for the models, but will work on that later.

I decided to go for a cartoon styled look by drawing lines around the edges of the primitives, had some issues with z fighting depending on the thickness of the lines, but instead of battling with it, I went with a line thickness that just worked.

Animations was fun, I hooked in a model/primitive heichreichy and created a simple controller class to handle interpolating between frames. So when the character starts running, I just pass in the rotations that I want to occur and interpolate between them using the running speed, and the controller class handles the interpolation of all the rotations for all the frames. Next challenge will be prioiritising animations, so say when doing a shooting animation while running, the shooting animation will override the arm parts of the general running animation.

But for now, I have a basic character on the screen that can run around, so the next step is tying in basic collisions so he has a world he can interact with.