본문 바로가기
연구/북마크

ajax3d whitepaper

by fermi 2006. 8. 31.
http://www.ajax3d.org/ajax3dwhitepaper.html



Ajax3D:
The Open Platform for Rich 3D Web Applications
Tony Parisi

Media Machines, Inc.

August, 2006



  




Introduction
Real-time 3D is emerging as a first-class media type for the web. Network bandwidth and graphics hardware processing power are now sufficiently advanced to enable compelling web-based 3D experiences, including games, online virtual worlds, simulations, education and training. Commercial developers are expressing increasing interest in exploiting real-time 3D in web applications to enhance production value, create engaging immersive experiences, and deliver information in a more meaningful way.

Much of the infrastructure has been put into place to enable professional Web 3D deployment in a cross-platform, open, royalty-free environment. Interoperability standards such as ISO standard Extensible 3D Graphics (X3D) are now mature, fully functional and robust, and supported by multiple open source implementations and affordable production pipelines. However, those technologies only go so far, in that they are focused on the transportability of embedded rich content, and not on the applications that embed it. The industry is in need of a rapid development environment for creating scalable, highly interactive client-server 3D applications on the web.

Ajax – Asynchronous Javascript and XML—has emerged as a preferred method for developing sophisticated web applications. Ajax makes client-server programming available to Javascript developers via Dynamic HTML, resulting in rich, responsive applications hosted in a web browser. While Ajax is being used to deploy some of the industry’s leading applications, such as Google Maps™ and Netflix™, current browsers are limited in their capabilities to render dynamic content, in particular high performance real-time 3D.

Ajax3D combines the power of X3D, the standard for real-time 3D on the web, with the ease of use and ubiquity of Ajax. Ajax3D employs the X3D Scene Access Interface (SAI)—the X3D equivalent of the DOM— to control 3D worlds via Javascript. With the simple addition of an X3D plugin to today’s web browsers, we can bring the awesome power of video game technology to the everyday web experience.

The initial development has begun. Media Machines has created the first showcase applications and tutorials, and has launched a web site, www.ajax3d.org, as an open industry forum to explore technologies, techniques and best practices. This white paper describes the key technical concepts behind Ajax3D and, via examples, introduces the beginning of a formal programming framework for general use.



Ajax3D Basics
Ajax3D is based on the integration of two programming models – the W3C Document Object Model (DOM) and the ISO Scene Access Interface (SAI). The DOM defines a model for programs interacting with a web document; the SAI allows programs to control X3D scenes. Javascript code running on a web page can interact with the DOM and the SAI simultaneously, enabling applications that integrate traditional 2D web page elements with the 3D world. Both the DOM and SAI are independent of any programming language; however our focus for Ajax3D is on Javascript.

One DOM object is of particular interest to Ajax programmers: the XMLHttpRequest object. XMLHttpRequest allows a web application to make server requests without requiring the contents of the page to be refreshed. This capability is fundamental for creating dynamic, responsive applications that meet the expectation of today’s consumers. The SAI has a similar capacity in createX3DFromURL, a method of the X3D “browser” object that loads 3D content on demand.

The combination of the DOM, SAI and XMLHttpRequest comprise the underpinnings of Ajax3D and in fact suggest the following precise definition of Ajax3D:

An Ajax3D application is a web browser-hosted program that

a.      uses the SAI to access a real-time 3D scene

b.      uses the DOM to manipulate web page content in response to changes in the 3D scene, and

c.       uses server-request methods (XMLHttpRequest, createX3DFromURL) to store and retrieve data in response to, and/or leading to, changes in a 3D scene.


Embedding X3D Scenes in a Web Browser
The first step in creating an Ajax3D application is to create an HTML page that embeds X3D content. This is done using EMBED or OBJECT tags (the former being well supported in all web browsers), e.g.

<embed WIDTH="640" HEIGHT="480" NAME="FLUX" SRC="helloajax3d.x3d" TYPE="model/x3d" DASHBOARD="0" BGCOLOR="0xFFFFFF">

Note: all examples in this document use Media Machines’ FLUX Player as the X3D plugin. However any SAI-compliant X3D plugin that supports Javascript should be able to support Ajax3D.

Accessing the X3D Scene from Javascript
Once the X3D plugin has been embedded, it can be accessed from Javascript like any other DOM object. The FLUX object is used to access the SAI “browser” object—not to be confused with the web browser, this is the main object defined by the SAI for connecting to the 3D scene. The browser is access as follows:

var browser = document.FLUX.getBrowser();

Once we have a handle to the X3D browser, we can access the ExecutionContext object, which allows us to get access to all of the live objects in the scene in order to retrieve and change properties, or send and receive events:

var context = browser.getExecutionContext();

Working with the X3D Scene Graph
The primary data structure in an X3D world is the scene graph: a collection of graphical objects organized in hierarchical relationships. The scene graph is akin to a DOM document, in that it is structured data representing the rendered content; however 3D scene graphics tend to be far more complex than even the richest DOM documents.

The SAI provides a few ways to access the scene graph. Once a valid execution context is obtained (see above), we can either ask it for an object by name, or a collection of all the top-level nodes in the scene as follows:

var theText = context.getNode("THETEXT");

or

var nodes = context.getRootNodes();

The scene graph is hierarchical, though it is not a strict tree as is a DOM document. Objects in the scene graph can have multiple parents, so long as no object is a descendant of itself either directly or indirectly. The technical term for this structure is a Directed Acyclic Graph, or DAG—hence the term scene graph. Many operations on the X3D scene graph require a knowledge of this structure, so it is important to understand this concept early on.

Nodes, Fields and Events
The fundamental object type in X3D is the node. Nodes are scene graph elements; they can represent geometric shapes, their visual properties, animations, scripts that contain program code, clickable behaviors, and so on. The properties of nodes are called fields; fields store basic data type information such as floating point values, integers, strings, 2D and 3D vectors, bitmapped images, and arrays of those types.

Dynamic behaviors in the scene graph are accomplished via events – fields that allow their values to be changed, or that tell the application when their values have changed. An Ajax3D application can send events via the SAI using a straightforward Javascript property-setting syntax, such as in the following example:

theText.string[0] = "Hello";

theText.string[1] = "AJAX3D!";

The SAI also defines field listeners: objects with callback methods that are invoked when an event is generated. Here is an example of adding a field listener to a TouchSensor – an object that tells the programmer when some geometry in the world has been clicked on (by generating a touchTime event):

var observer = new Object;

observer.readableFieldChanged = clickCallback;

sensor1.touchTime.addFieldEventListener(observer);

Dynamically Generating Scene Graph Content
The SAI supports the dynamic generation of X3D content from strings, URLs, or using factories that create nodes by type. Here is an example of creating X3D with a string:

var str = "<Shape><Box size='.5 .5 .1'/></Shape>";

var newscene = Browser.createX3DFromString(str);

By combining this capability with Ajax techniques (i.e. using XMLHttpRequest), an Ajax3D application can build an entire 3D world programmatically, for example based on queries to a MySQL database.

Taken together, the ability to control rich X3D worlds from Javascript running in web pages, to update web pages based on events that occur in the world, and to dynamically build worlds from program code make Ajax3D a complete system for delivering 3D applications on the web. The possibilities for this approach are endless, and this presents a challenge: how to best harness the vast power of Ajax3D into a useable set of tools and framework code for developing a broad range of applications. We will explore this issue below; but first: an example.



Example : The Strikefighter
Larry Rosenthal of Cube Productions has been designing real-time 3D content for over fifteen years, and has been running a science fiction virtual world/online community called StarbaseC3 for nearly that long. In 2001 he developed the first version of a 3D web game called “Strikefighter,” based on StarbaseC3 models. Over the years Larry has updated the game from time to time, and ported it across various 3D engines, both open and proprietary.

Larry teamed up with programmer Dave Arendash to once again port Strikefighter. Using Ajax3D, Dave connected the game to a live web server (running PHP and MySQL) that implements a scoreboard. When the game is over, it checks the current score against a database of high scores residing on the server. If the player’s score is in the top 10 he is invited to post his name to the public scoreboard. Strikefighter is similar to the Flash-based mini-games that have proliferated on the web over the last several years. Until Ajax3D, Larry was not able to deploy a 3D game like this based on a royalty-free, open platform that fully integrates with a web server and runs in a page.



The Strikefighter Game in Ajax3D




The Ajax3D Initiative
In a sense, the technical underpinnings for Ajax3D, like those of Ajax itself, are almost trivially simple (that is, if one considers web browsers, XML, and real-time 3D web plugins “simple” things). There are a small number of basic constructs involved: Javascript, XMLHttpRequest, the DOM and the SAI. However, the myriad combinations that these enable combined with the ability to deliver code and content world wide at nearly the speed of thought, have profound implications.

Ajax3D promises a royalty-free, open, global platform for creating a next-generation web experience. The key to realizing that promise lies in establishing techniques and best practices that can be used throughout the industry, supported by tools and frameworks and developed in an open setting. In other words, Ajax3D is as much about community process and collaboration as it is about technology.

In August of 2006, Media Machines launched www.ajax3d.org as an open industry body to foster Ajax3D development. The site has a large mailing list, active discussion forums and several examples. Media Machines intends to hand the maintenance and governance of the site, and the project as a whole, over to an all-volunteer group in the near future.

With the initial launch of Ajax3D, we have just scratched the surface of what is possible. The group has identified important next steps to be taken over the next several months:

Develop a programming framework (“ajax3dlib”). The first tutorials hint at a general-purpose programming framework, but there is still a lot of work to be done in this area.
Create domain-specific modules. It would be beneficial to develop reusable modules for game play, data visualization, and e-commerce and other domains.
Build out the showcases and examples. The site is continually soliciting showcases and examples.
Identify areas for ongoing research and development. While most of the effort within the Ajax3D project will be focused on deployment, there are some areas that require further research. For example, is it possible to deliver real-time messages for multi-user game play using Ajax, or are other technologies required?
Engage with industry. Develop relationships and begin conversations with other groups involved in Ajax and Web 3D development, both official and ad-hoc.
Summary
Royalty-free standards such as X3D have made it possible for anyone to deliver rich 3D content in real time over the Internet. At the same time, Ajax has emerged as a worldwide phenomenon and unleashed a flurry of new application development. By bringing these two technologies together, Ajax3D promises a complete open platform for creating a next-generation 3D web experience.

With Ajax3D, immersive virtual worlds can be deployed within a web browser, integrated with pages and other media. Ajax3D worlds can communicate with standard web servers using XML and Ajax technologies, enabling professional, scalable, industrial strength applications with high production value and visual impact.

Ajax3D is in its infancy. In the coming months, it will need to be nurtured and actively developed. Media Machines hopes that the initiative began at www.ajax3d.org will take on a life of its own and become a world wide forum for research and development of this exciting new technology.



Privacy | Contact

Copyright © 2006 Ajax.org All Rights Reserved.