11 June 2016 My first VR app.

Yesterday I put on-line my first Virtual Reality (VR) app - SphereVR. I am the first to admit that it's not a great app and the coding behind it is inelegant - containing code bits from the pathfinders out there who have been sorting out the many complexities of creating VR, and running it from a browser. And you can't actually "do" much in it - just teleport around the solvents inside and outside an HSP Sphere.

It even needs a special browser version to run it (the WebVR Chrome build) and so far it only works on one VR headset, the wonderful HTC Vive. [Ha! An email just popped up saying that my Oculus Rift will soon be shipped. I can soon start debugging on 2 headsets] So why have I put it on-line?

If you've put something of your own on-line then you know that it's rather different from something that only you can see. Before putting it on-line you have to think of the many ways it might go wrong and so you have to tidy things up to an acceptable level. Well, that's how I see things. Because I'd publically set myself the goal of writing VR science apps, I had to prove to myself that I could create an app that met at least a minimum of public criteria. Writing this app took me a week of painful work (building on weeks of pre-work on 3D stuff). Going from a "fully working" version on my PC to something that worked on-line was many hours of, mostly, house cleaning. The code and infrastructure behind it had gathered a lot of junk that was good enough for me, but not good enough for a public app. The clean-up necessary to put things on-line was actually necessary anyway, but without a specific goal ("get this stuff on-line by tonight") I'd never have done the clean-up, along with the disasters (removing a "junk" component only to find that it was vital) that inevitably follow.

Having made it clear that the app is limited, it's still something I'm proud I've done. It meets all my requirements for a first app.

  • It has to be some real science that benefits from being in 3D. The HSP Sphere meets those criteria.
  • When you step into the world it's a bit awesome. For no good reason, the app is hovering somewhere above Mars
  • It's visually attractive. The individual solvent spheres look to me rather pretty.
  • Information has to be clear. This was hard! Labelling axes in 2D graphs is trivial. It took me a long time to get the 3D axes to be legible - using a "lookAt" trick so that the numbers always face you. I tried many ways to give me the relevant solvent information and in the end used a simple Vive convention of putting information on the controller "hand".
  • I must be able to touch things in a real way. The Vive's controllers are amazing, but only if visible in the app. I found code from an app (Cute Cubes from the amazing Arturo Paracuellos) that provided a pair of hands that, within seconds, seem like your own hands, following exactly where your hands are pointing.
  • Navigation must be easy and intuitive - and fun. Thanks to a laser app I found on-line (one of the Threex tricks from www.threejsgames.com), I can point at a solvent, read which one it is and then teleport myself to that solvent, all using the controller hands. I especially love pointing to Water - which is far away and tricky to aim at - then looking back from Water to the rest of the solvents and the Sphere.
  • It has to do something that only VR can do. Teleporting to Water and looking back at the Sphere is all it takes to show that VR is the future for exploring complex science.

When I wrote my first (2D) app and put it on-line I was proud that I'd managed to do it even though I was aware of how clunky it was. I was also hoping that it would be the first of, perhaps, a dozen or so. That first app would look utterly awful now, but without it I would never have written 150+ apps that work well with the modern Responsive Design systems available to us (that hardly existed when I wrote the first one). I hope to look back at this blog in a year or two's time and chuckle at the bad code, limited infrastructure and lack of functionality with some affection that for all its limitations it was at least the first step towards stuff that really worked.

And that's the point. I continue to be surprised when I meet people who say "I'm delighted to meet you - your apps have been so useful to me". I'd merely hoped that they would be used, but hadn't really expected that they would be. So I hope that in a few years' time I will bump into someone who says "That VR app really helped me formulate a better product". That's why I'm torturing myself with the zillion problems of writing bleeding-edge VR. And that's why I now allow myself a maximum of 1hr in the evening enjoying myself in some of the fabulous VR worlds created by teams with vastly more skills than I'll ever have. Last night I accidentally hit the Start button when I was standing in front of a rather large Fantastic Contraption I'd been building. However much I knew that it was a virtual machine in a virtual world, the gut instinct to throw myself out of the way took over - much to my embarrassment when it passed harmlessly through me. If I can harness even a fraction of the potential of VR to help scientists do science, I will consider myself a lucky guy.

Of course, most of the above will be meaningless if you haven't been in VR and don't know what teleporting is and have no notion of an HSP Sphere. One of my many challenges is to work out how to make a video of my VR experience!