Escolar Documentos
Profissional Documentos
Cultura Documentos
Why 3D Graphics?
Phone screens may be flat but the world certainly isnt!
Objective
Gain an insight to the Mobile 3D Graphics API and take your games and applications to the next level
Fundamentals of 3D graphics
transformations, texturing, blending, OpenGL is the premier environment for developing interactive 2D and 3D graphics applications. Introduction in 1992, today industrys most widely used and supported 2D and 3D graphics application programming interface.
GameCanvas
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
Overview
Java M3G API (JSR-184) provides a scalable, small-footprint, interactive 3D graphics Java API for J2ME. For a wide range of applications, including games, animated messages, screen savers, custom user interfaces, product visualization Java M3G API is an optional package that can be adopted to existing J2ME profiles. The main target platform of the API is J2ME/CLDC, used with profiles such as MIDP 1.0 or MIDP 2.0. JSR-184 was selected by the Java Community Process (JCP) as The most innovative JSR in year 2003.
Also known as JSR-184 (Optional for J2ME) Designed for mobile devices
MIDlets
MIDP
Improve rendering speed by using native Libraries to leverage the underlying hardware Acceleration Mask hardware differences (3D HW, FPU, DSP,). Exploit any new hardware automatically Makes easier application development
OpenGL (ES) is too low-level, (OpenGL for Embedded Systems) is based on OpenGL)
Lots of Java code needed for simple things Bigger MIDlets, slower speed
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
Intro
M3G can be described as a unified immediate/retained mode API with a configurable rendering pipeline at the low level and an animated scene graph layered on top of it.
Flexibility is guaranteed by rich set of parameters for configuring the rendering pipeline. There are dozens of mutually independent parameters in the pixel pipeline alone, yielding billions of unique configurations and different visual effects that can be applied to polygons.
Key Classes
3D graphics context Performs all rendering
Graphics3D
Loader
Can load individual objects and entire scene graphs (M3G and PNG files) Scene graph root node
World
Graphics3D
Rendering Modes:
Immediate mode Low level, allows the user to define every detail of rendering process Render a branch or an individual node at a time Explicitly give the Camera and Lights to Graphics3D Retained mode Hides low level from the user allowing animated 3-D content to be loaded and displayed with few lines of code Render a scene graph, rooted by the World Take the Camera and Lights from the World
Graphics3D
Render individual scene graph nodes or groups of nodes, or individual submeshes Used lights, active camera, and background are provided separately Render an entire world represented as a scene graph Used lights, active camera, and background are members of the scene graph
Retained mode
Difference between immediate and retained mode is vague as they can be freely mixed and matched
Graphics3D: How-to-Use
public class Player extends MIDlet { public void pauseApp() {} public void destroyApp(boolean b) {} public void startApp() { PlayerCanvas canvas = new PlayerCanvas(true); Display.getDisplay(this).setCurrent(canvas); try { canvas.run(); } catch (Exception e) {} notifyDestroyed(); }
// A color for each corner as an (R,G,B) triplet static byte[] cubeColors = { (byte) 255, (byte) 0, (byte) 0, // red (byte) 0, (byte) 255, (byte) 0, // green }; // Define the cube as a single triangle strip static int[] indices = { 6,7,4,5,1,7,3,6,2,4,0,1,2,3 }; static int[] stripLen = { 14 };
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
MorphingMesh
Not allowed!
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
Renderable Objects
Mesh Made of triangle strips Base class for meshes (two subclasses: MorphingMesh and SkinnedMesh)
Sprite3D
Mesh
Composed of submeshes
Common buffer of vertex data Submesh has triangle strip indices to vertices One Appearance for each submesh Mesh VertexBuffer IndexBuffer Appearance coordinates normals colors texturecoords
Appearance Components
Material colors for lighting Can track per-vertex colors Blending, depth buffering Alpha testing, masking Winding, culling, shading Perspective correction hint Fades colors based on distance Linear and exponential mode Texture matrix, blending, filtering Multitexturing: One Texture2D for each unit
Material
CompositingMode
Sprite3D
2D image with a position in 3D space
Scaled mode for billboards, trees, etc. Unscaled mode for text labels, icons, etc.
Sprite3D
CompositingMode Fog
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
MorphingMesh
For vertex morphing animation
R = B + wi (Ti B )
i
A base mesh and several morph targets Result = weighted sum of morph deltas Can morph any vertex attribute
MorphingMesh
Example: Animating a rabbits face
Base
SkinnedMesh
Articulated characters without cracks at joints
v' = wiMiBiv
i
The skeleton consists of scene graph nodes Each node (bone) defines a transformation Each vertex is linked to one or more bones
SkinnedMesh
Weighted skinning
Neutral pose, bones at rest
Bone A Bone B shared vertex, weights = (0.5, 0.5) "skin" non-shared vertex
Bone B
SkinnedMesh Example
No skinning
Local skinning
Smooth skinning
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
AnimationController
AnimationTrack
Object3D
Demo
Creature in Wonderland
Document and example codes for this demo available at www.forum.nokia.com Remember also Nokia:
Nokia Reference Implementation, Binary For JSR-184 3D Graphics API For J2ME, Emulator Sun Wireless Toolkit (WTK) 2.2
40
Agenda
Overview? Getting started Scene graph Low level features Dynamic meshes Animation Demo New dimension of Java games
Downloadable Java games will be literally transformed into a new dimension when the Mobile 3D Graphics API hits the market. This new standard will bring Java on par with the Nokia N-Gage game deck in terms of visual quality. Java is the most widely deployed platform for third-party applications in mobile terminals. Nokia alone expects to ship approximately 100 million color-screen Java devices in 2004. 3D graphics makes games look more impressive, but it also enables new genres by giving more freedom to designers and artists. It even helps to bring down costs: being inherently scalable, it allows games to be easily targeted at different display sizes and color depths.
Developer Tools
Modeling tools for making *.m3g files = 3D scenes 3DS Max 7 includes a built-in M3G exporter. 3DS Max is the most popular 3D modeling and animation package in the game industry. Digital Element provides exporter that works also with 3DS Max version 6 HI Corporation has exporters for all versions of 3DS Max, as well as Lightwave 8. - utility for previewing and examining M3G files, useful for programmers and designers. Superscape: A basic version of their Swerve Exporter freely available. The exporter works with 3DS Max versions 5.1, 6, and 7. The professional version of Swerve Exporter is only available to game developers who sign a publishing deal with Superscape. Follow the open source projects: At least two independent developers (with no Web sites) are making exporters for Blender http://www.blender3d.com, an open-source 3D modeling package.
Summary
Will be supported in millions of devices Currently supported in Nokia 6630, (6255i CDMA device, US model)
M3G is flexible
Using the immediate mode gives you full control High-level features make your code faster and smaller
More Information
http://java.sun.com http://www.forum.nokia.com
Thank You