1. MOSC 2010
TM
Android
Applications in 3D
Yap Wen Jiun
@wenjiun
Multimedia University Lecturer
CodeAndroid Malaysia Member
2. Why Android?
An open, free development platform based on Linux
and open source
Growing very fast!
Provides the Android Market for distribution and
monetization of your applications and has no approval
process for application distribution
Supports OpenGL ES and many more ...
3. Why 3D?
3D is very popular!
3D is visually more realistics
3D is a must for 3D visualization such as flight
simulation
3D is fun especially for games
4. 3D Games
Winds of Steel
by DeckEleven Entertainment
Speedx 3D
by HyperBees Ltd.
6. Depth perception
Depth perception is the visual ability to perceive the
world in 3D, arises from a variety of depth cues such as:
Monocular cues
Perspective
Occlusion
Size comparison
● Depth from motion
Motion parallax
Binocular cues
● Stereopsis/Binocular disparity
- Wikipedia
7. 3D Rendering
3D rendering is the 3D computer graphics process of
automatically converting 3D models into 2D images with
3D photorealistic effects on a computer.
OpenGL (Open Graphics Library) is a standard
specification defining a cross-language, cross-platform
API for writing applications that renders 2D and 3D
computer graphics. The interface consists of over 250
different function calls which can be used to draw
complex 3D scenes from simple primitives.
- Wikipedia
8. OpenGL ES
OpenGL for Embedded Systems is a subset of the
OpenGL 3D graphics API designed for embedded
devices, managed by the not-for-profit technology
consortium, the Khronos Group, Inc.
1st Generation Android Devices
→ OpenGL ES 1.0 plus various 1.1 extensions
2nd Generation Android Devices (Android 2.0 & higher)
→ OpenGL ES 2.0, 1.1 + extensions
9. Learning Android OpenGL ES
API Demos
Books - Sample Codes
http://www.pragprog.com/titles/eband3/hello-android
Blogs with demo apps
http://nehe.gamedev.net/ &
http://code.google.com/p/nehe-android/
http://code.google.com/p/akjava-android-project/
http://blogs.sonyericsson.com/developerworld/category
/tutorials/3d-list/
11. Getting 3D Models
Create directly with OpenGL Codes
Import external 3D models (OBJ, DAE) with min3D
http://code.google.com/p/min3d/
Create in 3D modeling program
(Blender, SketchUp etc)
Download free 3D models from Internet
Scan in physical objects with 3D laser scanning
12. Android NDK
The Android NDK is a companion tool to the Android
SDK that lets Android application developers build
performance-critical portions of their apps in native
code (C, C++).
The NDK provides stable headers for libc (the C library),
libm (the Math library), OpenGL ES (3D graphics
library), the JNI interface.
Very convenient to developer that already has an
exisiting native C/C++ OpenGL renderer that has
thousands of lines of code.
14. 3D Head Tracking
By tracking the location of your head and rendering view
dependent images on the display, this effectively
transforms the display into a virtual environment which
has a realistic illusion of depth and space
http://johnnylee.net/projects/wii/
15. Sensor Tracking
Orientation sensor can try to fake the 3D head tracking
class HeadTracking extends Activity implements
SensorEventListener
SensorManager mgr
Sensor sensor
mgr=(SensorManager)getSystemService(SENSOR_SERVICE)
sensor=mgr.getDefaultSensor(Sensor.TYPE_ORIENTATION)
mgr.registerListener(this, sensor,
SensorManager.SENSOR_DELAY_FASTEST)
......
16. Face Tracking
Actual head tracking is possible with front-facing camera
FaceDetector arrayFaces = null
FaceDetector.Face getAllFaces[ ] = null
getAllFaces = new FaceDetector.Face[NUM_FACES]
arrayFaces = new FaceDetector (sourceImage.getWidth( ),
sourceImage.getHeight( ), NUM_FACES)
arrayFaces.findFaces(sourceImage, getAllFaces)
17. Augmented Reality
A live direct or indirect view of a physical real-world
environment whose elements are augmented by virtual
computer-generated imagery – Wikipedia
18. Camera Preview
class Preview extends SurfaceView implements
SaurfaceHolder.Callback
SurfaceHolder mHolder
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_
BUFFERS)
Camera mCamera
mCamera = Camera.open( )
mCamera.setPreviewDisplay(holder)
mCamera.startPreview( )
19. Stereoscopic View
Stereoscopy is the enhancement of the illusion of depth
in a photograph, movie or other 2D graphics by
presenting a slightly different image to each eye, and
thereby adding the dominant stereopsis cues.
Active LCD shutter
Circularly polarized projections
Lenticular autostereoscopic displays
Anaglyphs
20. Red-Cyan Anaglyph
Graphics are made up of two differently filtered coloured
graphics, one for each eye, superimposed to produce a
depth effect – Wikipedia
gl.glDisable(GL10.GL_DEPTH_TEST)
gl.glEnable(GL10.GL_BLEND)
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE)
gl.glColorMask(true, false, false, true)
gl.glColorMask(false, true, true, true)
21. Endless Possibilities ...
In the future … anything is possible
Check out CodeAndroid Malaysia at
http://www.codeandroid.my/
Thank you!
Small portions of this presentation are modifications based on work
created and shared by Google and used according to terms described
in the Creative Commons 3.0 Attribution License.