Venturing into the world of 3D

Over the last week or so, I’ve been spinning up some test code and infrastructure for supplementing my mobile apps with 3D viewing capabilities. This involves adventuring into the wild world of OpenGL ES, which is quite a maze of toolkits, meta-toolkits, versions, subsets, deprecated functions and optimisation gotchas. Nonetheless, I now have a widget capable of displaying 3D MOLfiles, and thus far allowing finger-dragging to rotate, as you can see if you click on the image to the right and watch the short screencast.

While it can’t be seen in the screencast version, the static rendering scene makes full use of the iPad3 retina screen and 4x multi-sampled anti-aliasing. This means that the spheres and cylinders are rendered in full 2048×1536 glory (3.1 mega-dots) not just once, but four times, in order to obtain a composite that has nicely alpha-blended edges, instead of ugly “jaggies”. Which is another way of saying that it looks really great, all the more so on a retina-class screen.

At the current state of optimisation, it takes about a half-second to draw this scene, for a 3D molecule with 60-something atoms. Under some circumstances this is an acceptable time lag for rendering a nice static picture, but not for interactive updates such as drag-to-rotate, and so the widget uses the time honoured trick of switching to wireframe mode in order to ensure real time updating.

3D visualisation capabilities will be added to some of the apps from Molecular Materials Informatics. But it’s not yet decided which ones, so that’ll have to count as a surprise.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s