android3d

Upload: mosc2010

Post on 30-May-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 android3D

    1/19

    MOSC 2010

    AndroidTM

    Applications in 3DYap Wen Jiun

    @wenjiunMultimedia UniversityCode Android Malaysia

  • 8/9/2019 android3D

    2/19

    Why Android?

    An open, free development platform based on Linuxand open source

    Growing very fast! Provides the Android Market for distribution and

    monetizationof your applications and has no approvalprocess for application distribution

    Supports OpenGL ES and many more ...

  • 8/9/2019 android3D

    3/19

    Why 3D?

    3D is very popular!

    3D is visually more realistics

    3D is a must for 3D visualization such as flightsimulation

    3D is fun especially for games

  • 8/9/2019 android3D

    4/19

    3D Games

    Winds of Steel

    by DeckEleven Entertainment

    Speedx 3D

    by HyperBees Ltd.

  • 8/9/2019 android3D

    5/19

    3D User Interface

    Stock 3D Gallery

    Earth Live Wallpaper

    by unixseb

  • 8/9/2019 android3D

    6/19

    Depth perception

    Depth perception is the visual ability to perceive theworld 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

  • 8/9/2019 android3D

    7/19

    3D Rendering

    3D rendering is the 3D computer graphics process ofautomatically converting 3D models into 2D images with3D photorealistic effects on a computer.

    OpenGL (Open Graphics Library) is a standardspecification defining a cross-language, cross-platformAPI for writing applications that renders 2D and 3Dcomputer graphics. The interface consists of over 250

    different function calls which can be used to drawcomplex 3D scenes from simple primitives.

    - Wikipedia

  • 8/9/2019 android3D

    8/19

    OpenGL ES

    OpenGL for Embedded Systems is a subset of theOpenGL 3D graphics API designed for embeddeddevices, managed by the not-for-profit technologyconsortium, 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

  • 8/9/2019 android3D

    9/19

    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/

    http://www.pragprog.com/titles/eband3/hello-androidhttp://nehe.gamedev.net/http://code.google.com/p/akjava-android-project/http://code.google.com/p/akjava-android-project/http://nehe.gamedev.net/http://www.pragprog.com/titles/eband3/hello-android
  • 8/9/2019 android3D

    10/19

    Android NDK

    The Android NDK is a companion tool to the AndroidSDK that lets Android application developers buildperformance-critical portions of their apps in nativecode (C, C++).

    The NDK provides stable headers for libc (the C library),libm (the Math library), OpenGL ES (3D graphicslibrary), the JNI interface.

    Very convenient to developer that already has anexisiting native C/C++ OpenGL renderer that hasthousands of lines of code.

  • 8/9/2019 android3D

    11/19

    Android NDK

    http://code.google.com/p/doom-for-android/

    http://code.google.com/p/kwaak3/

  • 8/9/2019 android3D

    12/19

    3D Head Tracking

    By tracking the location of your head and rendering viewdependent images on the display, this effectivelytransforms the display into a virtual environment whichhas a realistic illusion of depth and space

    http://johnnylee.net/projects/wii/

  • 8/9/2019 android3D

    13/19

    Sensor Tracking

    Orientation sensor can try to fake the 3D head tracking

    class HeadTracking extends Activity implements

    SensorEventListenerSensorManagermgr

    Sensorsensor

    mgr=(SensorManager)getSystemService(SENSOR_SERVICE)

    sensor=mgr.getDefaultSensor(Sensor.TYPE_ORIENTATION)

    mgr.registerListener(this, sensor,SensorManager.SENSOR_DELAY_FASTEST)

    ......

  • 8/9/2019 android3D

    14/19

    Face Tracking

    Actual head tracking is possible with front-facing camera

    FaceDetectorarrayFaces = null

    FaceDetector.Face getAllFaces[ ] = null

    getAllFaces = new FaceDetector.Face[NUM_FACES]

    arrayFaces = new FaceDetector (sourceImage.getWidth( ),sourceImage.getHeight( ), NUM_FACES)

    arrayFaces.findFaces(sourceImage, getAllFaces)

  • 8/9/2019 android3D

    15/19

    Augmented Reality

    A live direct or indirect view of a physical real-worldenvironment whose elements are augmented by virtualcomputer-generated imagery Wikipedia

  • 8/9/2019 android3D

    16/19

    Camera Preview

    class Preview extends SurfaceView implementsSaurfaceHolder.Callback

    SurfaceHoldermHolder

    mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS)

    Camera mCamera

    mCamera=Camera.open( )

    mCamera.setPreviewDisplay(holder)

    mCamera.startPreview( )

  • 8/9/2019 android3D

    17/19

    Stereoscopic View

    Stereoscopy is the enhancement of the illusion of depthin a photograph, movie or other 2D graphics bypresenting a slightly different image to each eye, andthereby adding the dominant stereopsis cues.

    Active LCD shutter

    Circularly polarized projections

    Lenticular autostereoscopic displays

    Anaglyphs

  • 8/9/2019 android3D

    18/19

    Red-Cyan Anaglyph

    Graphics are made up of two differently filtered colouredgraphics, one for each eye, superimposed to produce adepth 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)

  • 8/9/2019 android3D

    19/19

    Endless Possibilities ...

    In the future anything is possible

    Thank you!

    Small portions of this presentation are modifications based on workcreated and shared by Google and used according to terms describedin the Creative Commons 3.0 Attribution License.