So you want to display virtual reality (VR) panoramas on a cell phone. If your cellphone is Java-enabled, this tutorial may be for you.
I wanted to understand the buzz about VR on cellphone. To be honest, on such a tiny display it is not nearly as spectacular as on an average PC display. But it has its merits, if only to illustrate the concept of VR when discussing with a potential customer.
I used Helmut Dersch’s PTViewerME2. Don’t expect the quality of the legendary older brother PTViewer, another creation of professor Dersch, improved and currently maintained by Fulvio Senore.
PTviewerME2 can work in two way: stand alone or with separate media files.
In stand alone mode, the media and the applet are packaged in a single midlet. While it is possible to pack multiple VR with the midlet, it is not recommended because of memory issues. In this tutorial, we will make a single stand alone VR.
With separate media files, the VR is fetched from another archive or from the Internet. In both cases, the cellphone will keep asking if the midlet should be granted access to the filesystem or to the network, unless it is signed. Signing is beyond this tutorial.
Java on cellphones is a lottery – there are dozens of variations of the Java Virtual Machine (JVM) and little control over them. Compatibility is an issue. This can be frustrating. There are four entries for Java in the list of 101 great programming quotes. Read them and get over it – this is Java.
Still with me? OK, let’s go. In this first part we will look at the requirements and prepare the media. Later we will produce and deploy your VR to your cellphone and discuss advanced features.
Besides a color display and as much heap memory as possible, the cell phone will need the following Java technologies / profiles:
- MIDP 2.0
- CLDC 1.1
- JSR 75 FileConnection and PIM API
- JSR 184 Mobile 3D Graphics API
Don’t worry about the weird acronyms, just look at this table. Is your phone listed? If it has MIDP 2.0 or higher, CLDC 1.1 or higher and a Yes in the JSR 184 column, it is likely to work. The size of heap column gives you an idea of what resolution you can afford before Java crashes with an out of memory error. If your phone is not listed in the above table, check its tech specs at the manufacturer’s website.
Even if the phone’s specs are OK, the ultimate test is playing an actual VR. Do it now before embarking in a journey that may end in frustration if it does not work.
- Download this zipped VR
- Verify its MD5 sum
- Unzip it
- Connect the phone to the computer
- Transfer the pair of JAR/JAD files
- Play them. Use the phone’s cursors to pan left and right and tilt up and down. You can also zoom in and out.
Please comment back here with your phone model and what worked and what did not. Sometimes the boundaries of the cubefaces are visible. This may be due to the Java Virtual Machine’s (JVM) JPEG decoder or other factors that can’t be controlled by PTViewerME2.
Now that it is determined that the VRs will work on your phone, prepare your computer to author your own.
- If it is not yet on your computer, get and install Java.
- You will need software to produce QTVR out of your equirectangular images. Thomas Rauscher’s Pano2VR is a comfortable choice. Buy a license. Alternatively use Bruno Postle’s jpeg2qtvr, a free perl command line script.
- Get the PTViewerME2 archive and the Java Application Descriptor (JAD) from Professor Dersch‘s website and save them in a folder on your desktop.
- Last but not least, you will need an equirectangular image like the one below.
Prepare the media
Make a QTVR from your equirectangular image. Use a cubeface of 256px, and enough JPG compression to keep the QTVR smaller than 200Kb. A discussion of these parameters will follow in a future installment.