iPhone Development #3 – ‘Zio’
June 29, 2009
Well here I am about 6 weeks into developing my first iPhone app based on my generative animation system.
It’s been an enormously steep learning curve, even though coming from a background in Java/Processing, of which I would be fairly proficient. This has been tough.
I would say I’m at the half way stage now, and after doubting almost daily the project and my ability to realise it, for the first time I feel confident that I can actually pull this off and come up with something half decent on the iPhone.
The direction I’m taking for my first app will be based on the ‘Music is Math’ animation style, semi-abstract, in black and white – roots and vines growing endlessly in real-time. It will be interactive, respond to touch,orientation etc, have randomising features and maybe a few other tricks.
The last few weeks have been spent mostly focused on creating an optimised real time graphic engine which is perfect for my style of algorithmic animation. My main concern was trying to reduce the amount of math computation required. The amount of polygons hasn’t been an issue, which I thought it would be, but the algorithms were killing the CPU and FPS. My main solution so far was to replace the smallest most stems with bitmaps, which doesn’t affect things visually, and gave me an enormous speed increase.
But then having too many bitmaps became an issue, so I’ve implemented the fasted texturing routines I can muster, which uses PVRTC copmressed images – streamlined image formats best for iPhone, and also mipmapping these, which reduces the efforts needed for the graphic chip to rescale texures at different distances.
I’ve also been using glDrawelements calls to draw all the quads with their bitmaps. The main body of the ‘snake’ and the first ‘shoots’ that come out are mathematically generated polygon strips created with glDrawarrays. Other little coding hacks I’ve been using which differ from my original Processing/Java implementation, are things such as disabling depth testing all together, and just drawing my layers in order from back to front. I’ve also culled backface rendering, disabled all gl lighting, and a few other things.
The demo runs smoothly at 24 fps, it can run a lot faster, but I need headroom to implement the rest of the visuals to be added – to be included next will be the shading/shadow algoritms (more bitmaps), the sprites/particles flying around through a perlin noise field, and also I can hopefully have a duplicate layer of the growing vines in the background, as is common in all my videos to date using this system.
So on we go, I feel inspired again after a tough few weeks. I want to create something enigmatic, sublime. Like my mum said when I showed it to her, it’s peaceful to watch, like an aquarium… which is a very good comparison.
But it also has to work, and run smoothly using the technology. This has been the challenge, not a creative challenge, but technical.