Monday 9 February 2015

Unity Cardboard test #2

Following on from my initial test constructing a VR environment for Google Cardboard on the Unity game engine, I've been playing with capturing user input on the Cardboard system.

For this purpose, I've knocked-up a test room which I can populate with different objects.  Initially I've thrown a chair in there, to allow me to test whether an object has focus (i.e. dead centre of the viewport).

Test room design, using standard Unity shaders.  Approx. 1000 triangles (total) with four 512x512 textures.
Unity has a special library of low-cost mobile elements, optimised for smartphones & tablets, which have weak graphics & processing facilities (when compared with PCs).  Early iPhones are somewhere in the region of 20 draw calls per frame; to put that in context, a standard PC-style background skybox will eat up something like 6-10 drawcalls on its own.

The first thing I wanted to try to see how Unity's lightweight mobile shaders compared against standard shaders, because adding an extra camera (i.e. stereoscopic vision) is going to add some extra load (even if each camera's viewport is half the size).

The image above shows the version using standard shaders and a point light source, which pulled about 16-32 drawcalls on average.  On my battered old Galaxy Note, it ran OK but was a little sluggish to respond.

The image below uses mobile shaders, which pulled things down to 8-16 drawcalls.  The models & materials could be optimised further but I wanted to just get a ball-park feeling.  As you can see, there's a considerable difference in appearance, the chief one being that any lighting effects are going to need to be baked-in to the environment textures.

Same room model but using mobile shaders.
The other thing I wanted to test was the Cardboard SDK API.  Extracting info from Google's demonstration file, I wrote a script which kicked-in when the camera was looking at an object, changing the objects's shader to make it "light up".

Chair has been "lit" to indicate that it is currently selected.
Finally, I added some further script code to respond to the magnetic trigger on the side of the headset.  This would rotate the object by 45 degrees for each 'click', but only while the object is selected.

A rotated chair.  It's not exactly Halo 5 but it's a start.

All-in-all, this has been a very successful experiment.  I've gained a feel for how to interact with the API and now have the ability to interact with the user more.  Next up: movement and switching between objects.

Saturday 7 February 2015

VR with the View-Master

Yesterday saw an interesting tease from Google and Mattel: a product announcement at a forthcoming toy fair.


It's fairly evident from the teaser that this will be a new digital View-Master stereoscopic viewer.

A digital version of the View-Master isn't exactly a new idea, but Google's involvement means that the smart money betting on something compatible with the Cardboard project, which means there will be a big marketing machine behind a ready-built, sturdy VR system compatible with existing (and forthcoming) Cardboard games and apps.

If they're smart, they'll make it cheap compatible with with popular mobile phones; if they're greedy they'll build the display screen in -- a very bad idea in my opinion, since the appeal of this type of thing is likely to be linked to price.

Regular readers will recall that I'd referenced the View-Master in my 'Rewind' game concept trailer.  The circle comes, um... full circle!
Recent review for the Samsung Gear VR system suggest that it's an excellent product but, unlike Cardboard, is using its own movement sensors and controls (i.e. Oculus technology) -- rendering it incompatible with Cardboard.

So, if Google & Mattel are looking to make a big deal of cost-effective VR then we could be in for a format war which will present nightmares for game & app developers.  Let's hope they all see sense and work toward a common VR API.

However, in the meantime, a big announcement (and the related surge of interest) means problems for me.  I'm months away from turning 'Rewind' into a viable VR game, and had relied upon the marketplace staying relatively uncrowded as a way to get better visibility.  Still, such is life for a one-man development studio, so I'm just going to have to plod on and see how things develop,



Update


As hoped, Mattel went for the sensible option and are producing the new View-Master as a tough plastic version of the existing Google Cardboard headset.  The price is good, too: $30, which will translate as £20 -- comparable to high-end Cardboard kits.

Image pilfered from venturebeat.com

Photo shamelessly stolen from CNET.

The device has a comfortable, face-hugging viewport (although I wonder if it could get sweaty after prolonged use?) and a glossy black face on the rear.


I was intrigued that none of the launch photos showed the insides, i.e. the smartphone mounting system; indeed, the reports indicate that the object on display is a non-working prototype -- created to show the design aesthetics only -- just in case the toy-retailing market turns its nose up at the idea.  At the event Mattel used normal cardboard headsets to demonstrate the VR aspect.

Reports suggest that they intend to use this for Augmented Reality (AR) as well as VR.  For AR the phone's camera would need a clear view, so the back face would need a redesign.  If so, I suspect the final product will look rather different to the prototype.


The "reel" discs are a strange aspect to the package.  A CNET report suggests that the discs work on AR-style principles: you lay the disc on a table, point the headset at the disc, and it recognises (via the smartphone camera) the image at the centre of the disc and launches an appropriate 360-degree panorama.  Discs will be priced at around $15.

Presumably this requires an Internet connection to download the panorama, which makes the physical disc a bit of a useless gimmick -- given that you could just directly download the reel from the app store instead.  However, I'm guessing they wanted something to hook to the nostalgia of the old View-Master disc reels, which is understandable from a marketing perspective.

I must admit that I'm ready to part with my £20 to get a sturdy version of Google Cardboard, especially if it has that feel of using an old View-Master with the pull-down 'clicker'.  For me, the new View-Master can't arrive in toyshops quickly enough.

Hopefully I'll have a working VR version of the Rewind game ready in time for the launch!