Flight of the Navigator

Mozilla is showcasing our Flight of the Navigator (FOTN) demo, and I wanted to tell you a little bit about it.  FOTN takes advantage of many of the new and improved features of Firefox 4, and is an example of the kind of things you can do with HTML5, WebGL, web audio, and faster JavaScript.

The first thing to say is that this is a web page–HTML, CSS, and JavaScript.  Some people we’ve shown this to have assumed it was a movie until they saw the real-time Twitter and Flickr integration.  This is a regular web page, and uses the web to full effect.  However, it doesn’t look like a regular web page, and therein lies much of the power and potential of the web coming with Firefox 4.

We built the demo in order to integrate and showcase the various JavaScript libraries and browser features we were creating together.  As a result the demo exploits a number of features in HTML5, namely, <canvas>, WebGL, <audio>, and <video>.  It also uses some of our JavaScript libraries (CubicVR.js, processing.js, dsp.js, beatdetektor.js), as well as the various JavaScript speed and feature improvements in Firefox 4.  Finally, the demo is driven by the new Firefox Audio API to synchronize the audio and 2D/3D visuals.

Everything you see in the demo’s 3D world is done using <canvas> with a WebGL context.  The city and all other 3D structures, the models and animation, were created using Lightwave.  We used CubicVR.js to work with the resulting 3D XML data, to build and power the scenes.  We texture the buildings and other structures with a combination of images (regular jpg, png), videos (WebM), and 2D canvases.  For example, we create various effects (interlacing on billboards, ticker-tape displays, audio visualizations) using Processing.js on 2D canvases, and then texture those onto the 3D objects.

We wanted to build a hybrid of what people are used to seeing in the regular web with the 3D capabilities of WebGL.  We did this by pulling in live data from Twitter (see the ticker tape animations for #firefox4 tweets) and Flickr (see photo billboards).  This makes the demo different for every run–we’ve had some interesting moments at conferences running this live and pulling things from Twitter.

FOTN relies on many performance upgrades in Firefox 4 to make things run smoothly.  First Hardware Acceleration makes it possible for us to mix 3D an 2D graphics very quickly, and run at high frame rates, even when the browser is fullscreen.  Next, we use many of the new features in Firefox 4’s JavaScript engine, for example Tracing to give us a speed boost on our complex audio and graphics code, and Typed JavaScript Arrays to make our audio analysis work in real time.

As the music plays we use the audio’s signal data from the Audio Data API to calculate FFT and beat detection.  This data is used to trigger animations, transitions, and visualizations.  We’re doing this all in JavaScript–the same JavaScript that’s being used to simultaneously render our 2D and 3D canvases.  It’s amazing how far you can push JavaScript now.

Speaking of the music, we’re using an Ogg Theora version of Shpongle’s “Nothing is Something Worth Doing” (Copyright Twisted Records, UK, used with permission).  Grab headphones or turn up your speakers to enjoy this awesome track.  We listened to it hundreds of times building this, and it’s never gotten old.

We built this demo in our spare time over a 4 week period with nightly builds of what is now becoming Firefox 4.  We’ve been working with these technologies for a while now, and can tell you that the potential of Firefox 4, with all the new graphics and media features it’s shipping, is amazing.  The web platform is capable of an amazing amount, and it’s exciting to think about where people will take it next.  I know we’re working on a new, larger demo already :)

FOTN was built by the same people who have been working on the Audio Data API and demos with me, and I’ll end by naming them all.  They are an amazing group of developers to work with: Charles Cliffe, Corban Brook, Al MacDonald, Andor Salga, Maciej Adwent, Boaz Sender.

This entry was posted in CDOT, Digital Swag, Mozilla, Mozilla Education, Seneca, Teaching Open Source, Web Made Movies. Bookmark the permalink. Both comments and trackbacks are currently closed.

17 Comments

  1. Tamale
    Posted December 22, 2010 at 2:06 pm | Permalink

    amazing work, guys. I love the demo, and I’ve long been a believer that HTML5 is the platform of the future. Glad to see it finally coming to light.

    Also, amazing choice on shpongle. I thought hardly anyone knew about this group, so you can imagine my excitement when I heard a tune I’ve been listening to non-stop since it came out on such a prestigious place! I’d like to know who on the team found the band/track in the first place.. kudos!

  2. schrep
    Posted December 22, 2010 at 9:26 pm | Permalink

    This is awesome. I’m seeking a stutter ever 30s or so – is that a js gc or something else?

  3. Posted December 22, 2010 at 9:29 pm | Permalink

    @schrep, yeah gc pauses. Compartments should help with this.

  4. Posted December 23, 2010 at 2:23 am | Permalink

    Yes, really amazing demo. Too bad that the 3D graphics are badly broken on my computer, I guess on-board graphics just won’t do it.

  5. Yariv
    Posted December 23, 2010 at 5:28 am | Permalink

    Great demo! HTML5 is the new Amiga…

    Mozilla should implement a concurrent garbage collector, as Google did in Android 2.3. It will go a long way toward making the web a viable gaming platform.

  6. Danny Moules
    Posted December 23, 2010 at 10:05 am | Permalink

    Not working for me. I’m running the latest nightly… GeForce 210. Shame, looks impressive.

  7. Posted December 23, 2010 at 10:13 am | Permalink

    Danny, sorry to hear it. There are some hardware/OS combos where WebGL is still being fixed. Soon…

  8. Dizza
    Posted December 23, 2010 at 3:11 pm | Permalink

    As much as the potential of WebGL is, it is ‘mostly’ gaming and I see no major purpose of it contributing to the web as an information driven element. Firefox 4 Beta 8 is still performing horrible in term of responsiveness and and UI. It’s seem like it’s not even a major focus for Mozilla to improve the responsiveness of FF4. Since when did people need a graphic card to run their browser. Other browsers are performing and showing the web much faster and better right now. H.A should have been a low priority.

    Mozilla should have released FF3.7 with JM to at least keep up with other browser first instead of focusing on the including H.A. It has apparently extended the dev cycle longer than needed and thus the reason for driving the core users to better browsers. And unfortunately for Moz, those core users are the ones that used to install Firefox on their moms and dads’ computers. Mozilla had committed a bad judgment and now you guys will see your users base decline with so many players on the field.

  9. Posted December 23, 2010 at 5:17 pm | Permalink

    the demo works flawlessy with latest firefox nightly on Ubuntu Linux 64 bits but at 2 seconds per frame (not a mistake : i’m counting in spf and not fps) with my Intel GMA950

  10. Cathy
    Posted December 23, 2010 at 11:07 pm | Permalink

    Excellent work all! Grats on getting it completed and wrapped up! :D

  11. Posted December 25, 2010 at 5:43 pm | Permalink

    Dizza, seeing as JM work to release is still ongoing, I’d say hardware acceleration and related projects have not especially slowed the 4.0 release. There are a lot of people working on a lot of projects in parallel. To a large extent talent in one area isn’t always easily transferred to another, at least not with the speed which I think you believe this is possible.

  12. Alan
    Posted January 4, 2011 at 2:10 pm | Permalink

    I have a modern Dell Laptops (both E4300 and E6410), Windows 7, and Firefox 4.0 Beta 8 and I can not play the video on either machine. The video drivers look to be current.

    All I get is the following error message

    “Could not initialise WebGL, sorry :-(

    I can play the video find on my 3 year old desktop.

    any thoughts or suggestions?

    thanks

    Alan

  13. Dragos
    Posted January 8, 2011 at 12:41 pm | Permalink

    @Alan to see the great vid : http://hacks.mozilla.org/2010/12/firefox4b8

  14. springer
    Posted January 11, 2011 at 7:06 am | Permalink

    Great, wonderful demo…bringing the web at the gate of Neuromancer’s world of data.

    For a better experience of real time 3D you should have given the ’spectator’ at least one degree of freedom, like the camera orbiting while locked on the spaceship or some picking ability.

  15. Dwight Stegall
    Posted January 14, 2011 at 8:26 pm | Permalink

    After taking approx. 90 seconds to load on Mobile Broadband it started. The only thing that appeared on the screen was the progress meter at the top. I gave up and left after the meter showed half of the video had played. Good song though.

    I’m using Asus G73GX with Window 7 Home Premium 64-bit and Firefox 4.0 Beta 10pre.

  16. Ted
    Posted January 30, 2011 at 6:39 am | Permalink

    Mozilla Firefox 4.0 Beta 10
    Intel Graphics Media Accelerator 3150

    Could not initialise WebGL, sorry :-(

  17. Chuck
    Posted February 4, 2011 at 3:14 pm | Permalink

    Awesome Job! The future is now!

    Great use of all the technology.
    Looking forward to Firefox 4 going Live…

11 Trackbacks

  1. By WebGL in Firefox 4 Beta 8 at Vladimir Vukićević on December 21, 2010 at 9:16 pm

    [...] out Dave’s post for more details about the Flight of the Navigator demo.  You can find many more projects and demos using WebGL on the web and linked from webgl.org [...]

  2. [...] demo is rendered in your browser as you watch. As Professor and Mozilla Developer Dave Humphrey describes, this is not a video – it’s built using open technologies, pulls in data from Twitter and [...]

  3. [...] information about this demo on David Humphrey’s blog (one of the developer of this demo) and more about WebGL in Firefox Beta8 on Vlad’s [...]

  4. [...] The Flight of the Navigator WebGL and Mozilla Audio API demo is now properly live. [...]

  5. By WebGL on December 27, 2010 at 12:22 pm

    [...] more demo’s pop up, I found the following (7 days old movie and demo) quite interesting: Flight of the Navigator (Firefox 4 needed for [...]

  6. [...] Flight of the Navigator [Bread and Circuits] [...]

  7. [...] demo is rendered in your browser as you watch. As Professor and Mozilla Developer Dave Humphrey describes, this is not a video – it’s built using open technologies, pulls in data from Twitter and [...]

  8. [...] a demo? Try the amazing Flight of the Navigator where we combine WebGL with a number of other technologies in Firefox 4 — HTML5 video, the [...]

  9. By Firefox4.0对WebGL的支持 | 二牛 – ERNIU on January 14, 2011 at 11:28 pm

    [...] information about this demo on David Humphrey’s blog (one of the developer of this demo) and more about WebGL in Firefox Beta8 on Vlad’s [...]

  10. [...] a demo? Try the amazing Flight of the Navigator where we combine WebGL with a number of other technologies in Firefox 4 — HTML5 video, the Audio [...]

  11. [...] http://videos.mozilla.org/serv/mozhacks/flight-of-the-navigator/ is really interesting because of what it actually is and does – more of that here http://vocamus.net/dave/?p=1233 [...]