Mobile 3-D Graphics API overview

3D Graphics

The function of this API is to provide JavaTM application programmers with an efficient and flexible means to display animated 3D graphics in real time on embedded devices. To cater for the needs of different types of applications, both an easy-to-use scene graph structure and an immediate mode interface are provided. All animation and rendering features are available for scene graph objects and individually rendered objects alike. Therefore you do not need to choose between the immediate mode and the scene graph, but rather can mix and match both within the same application.

The API is targeted at devices that typically have very little processing power and memory, and no hardware support for 3D graphics. The API has been defined such that implementations on that kind of hardware are feasible. However, the API also scales up to higher-end devices featuring a color display, a DSP or even specialized 3D graphics hardware.

3D computer graphics are works of graphic art that were created with the aid of digital computers and specialized 3D software. In general, the term may also refer to the process of creating such graphics, or the field of study of 3D computer graphic techniques and its related technology.

3D computer graphics are different from 2D computer graphics in that a three-dimensional representation of geometric data is stored in the computer for the purposes of performing calculations and rendering 2D images. Sometimes these images are later displayed in a pre-rendered form, and sometimes they are rendered in real-time.

Technology

OpenGL and Direct3D are two popular APIs for the generation of real-time imagery. (Real-time means that image generation occurs in 'real time', or 'on the fly') Many modern graphics cards provide some degree of hardware acceleration based on these APIs, frequently enabling the display of complex 3D graphics in real-time. However, it's not necessary to employ any one of these to actually create 3D imagery.

Creation of 3D graphics

The process of creating 3D graphics can be divided into three basic phases:

  • Modeling

  • Scene layout setup

  • Rendering

Modeling

The modeling stage could be described as shaping individual objects that are later used in the scene.

Modeling processes may also include editing object surface or material properties (e.g., color, luminosity, diffuse and specular shading components — more commonly called roughness and shininess, reflection characteristics, transparency or opacity, or index of refraction), adding textures, bump-maps and other features.

In addition, modeling may also include various activities related to preparing a 3D model for animation (although in a complex character model this will become a stage of its own, known as rigging). Objects may be fitted with a skeleton, a central framework of an object with the capability of affecting the shape or movements of that object. This aids in the process of animation, in that the movement of the skeleton will automatically affect the corresponding portions of the model.

Scene layout setup

Scene setup involves arranging virtual objects, lights, cameras and other entities on a scene which will later be used to produce a still image or an animation. If used for animation, this phase usually makes use of a technique called "keyframing", which facilitates creation of complicated movement in the scene. With the aid of keyframing, instead of having to fix an object's position, rotation, or scaling for each frame in an animation, one needs only to set up some key frames between which states in every frame are interpolated.

Lighting is an important aspect of scene setup. As is the case in real-world scene arrangement, lighting is a significant contributing factor to the resulting aesthetic and visual quality of the finished work. As such, it can be a difficult art to master. Lighting effects can contribute greatly to the mood and emotional response effected by a scene, a fact which is well-known to photographers and theatrical lighting technicians.

Rendering

Rendering is the final process of creating the actual 3D image or animation from the prepared scene. This can be compared to taking a photo or filming the scene after the setup is finished in real life.

Several different, and often specialized, rendering methods have been developed. These range from the distinctly non-realistic wireframe rendering through polygon-based rendering, to more advanced techniques such as ray tracing or radiosity. In general, different methods are better suited for either photo-realistic rendering, or real-time rendering.

The Mobile 3D API (JSR 184)

The JSR 184: Mobile 3D Graphics API for J2METM specification (M3G) is an optional Java 2 Platform, Micro Edition (J2METM) package capable of 3-D rendering; it takes into account the limitations of the class of devices addressed by J2ME.

M3G was designed to allow small implementations of less than 150 KB that consider the limitations on processing power and memory. Even with these restrictions, M3G should be able to offer rendering that is fast enough for interactive applications like games and animations. M3G can also take advantage of hardware such as a floating-point unit or even 3-D accelerators, found in higher-end devices.

The specification covers many possible uses, from animations and 3-D visualization software to games. As such, it supports rendering in both immediate and retained mode. The immediate mode is similar in capabilities and design to OpenGL for Embedded Systems (OpenGL ES). The whole M3G API can be easily implemented on top of a native OpenGL ES implementation if available.

The API also contains a scene graph, which is used for retained mode rendering. The scene graph can be constructed in software or loaded from a file. There are no restrictions against using both immediate and retained mode in the same application, if needed.

An important component of M3G is the definition of a standard file format for storage of the scene graphs. The use of a standard file format supported directly in the API reduces the size and complexity and enhances the portability of applications. The m3g file format allows the importing of models and animations built using well-known 3-D graphics tools, thus easing the construction of complex applications. In fact, for applications without user interaction, rendering of a model and animation can be done with just a few lines of code.

Due to the nature of 3-D graphics calculation, M3G needs to perform floating-point calculations. Instead of defining its own floating-point type, M3G uses Connected Limited Device Configuration (CLDC) 1.1. Usage of CLDC 1.1 should be taken into account during the MIDlet preverification stage, since some preverificators may, by default, reject classes containing floating-point types.

The JSR-184: Mobile 3D Graphics API for J2METM specification can be found from the Sun Web site. It is supported in S60 and Series 40 with clarifications detailed in the M3G API for JavaTM 2 Micro Edition (JSR-184): Implementation Notes. The API was introduced in S60 2nd Edition, Feature Pack 2 and in Series 40 2nd Edition.