Tips for game development: Graphics, Audio, Sensor bada Developer Day in Seoul Dec 08, 2010

Similar documents
Contents. Canvas and Graphical shapes Drawing Font and Text Bitmaps and Buffer Example Animation 3D-Graphics Hardware Support

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

PowerVR Series5. Architecture Guide for Developers

Working with Metal Overview

OpenGL on Android. Lecture 7. Android and Low-level Optimizations Summer School. 27 July 2015

Optimizing and Profiling Unity Games for Mobile Platforms. Angelo Theodorou Senior Software Engineer, MPG Gamelab 2014, 25 th -27 th June

PowerVR Hardware. Architecture Overview for Developers

More frames per second. Alex Kan and Jean-François Roy GPU Software

PowerVR Performance Recommendations. The Golden Rules

Building scalable 3D applications. Ville Miettinen Hybrid Graphics

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

Module 13C: Using The 3D Graphics APIs OpenGL ES

Mali Developer Resources. Kevin Ho ARM Taiwan FAE

Graphics Processing Unit Architecture (GPU Arch)

PowerVR. Performance Recommendations

What was removed? (1) OpenGL ES vs. OpenGL

GPGPU on Mobile Devices

PowerVR Performance Recommendations. The Golden Rules

Completing the Multimedia Architecture

Course Recap + 3D Graphics on Mobile GPUs

Whiz-Bang Graphics and Media Performance for Java Platform, Micro Edition (JavaME)

Profiling and Debugging Games on Mobile Platforms

Mobile Performance Tools and GPU Performance Tuning. Lars M. Bishop, NVIDIA Handheld DevTech Jason Allen, NVIDIA Handheld DevTools

PowerVR. Performance Recommendations

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Rendering Objects. Need to transform all geometry then

Spring 2009 Prof. Hyesoon Kim

Optimizing Mobile Games with ARM. Solo Chang Staff Applications Engineer, ARM

The Application Stage. The Game Loop, Resource Management and Renderer Design

Chapter Answers. Appendix A. Chapter 1. This appendix provides answers to all of the book s chapter review questions.

Copyright Khronos Group, Page Graphic Remedy. All Rights Reserved

POWERVR MBX & SGX OpenVG Support and Resources

Dave Shreiner, ARM March 2009

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Module Introduction. Content 15 pages 2 questions. Learning Time 25 minutes

Lecture 9: Deferred Shading. Visual Computing Systems CMU , Fall 2013

Sign up for crits! Announcments

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

ARM. Mali GPU. OpenGL ES Application Optimization Guide. Version: 2.0. Copyright 2011, 2013 ARM. All rights reserved. ARM DUI 0555B (ID051413)

Hardware-driven Visibility Culling Jeong Hyun Kim

The Rasterization Pipeline

CS130 : Computer Graphics. Tamar Shinar Computer Science & Engineering UC Riverside

OpenMAX AL, OpenSL ES

Converts geometric primitives into images Is split into several independent stages Those are usually executed concurrently

Contents. Player Camera AudioIn, AudioOut Image & ImageUtil AudioRecorder VideoRecorder AudioDecoder/Encoder, VideoDecoder/Encoder

ARM. Mali GPU. OpenGL ES Application Optimization Guide. Version: 3.0. Copyright 2011, 2013 ARM. All rights reserved. ARM DUI 0555C (ID102813)

Android and OpenGL. Android Smartphone Programming. Matthias Keil. University of Freiburg

OpenGL with Qt 5. Qt Developer Days, Berlin Presented by Sean Harmer. Produced by Klarälvdalens Datakonsult AB

Spring 2011 Prof. Hyesoon Kim

Practical Texturing (WebGL) CS559 Fall 2016 Lecture 20 November 7th 2016

Mobile Application Programing: Android. OpenGL Operation

Introduction to OpenGL ES 3.0

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II)

Vulkan: Architecture positive How Vulkan maps to PowerVR GPUs Kevin sun Lead Developer Support Engineer, APAC PowerVR Graphics.

Understanding Shaders and WebGL. Chris Dalton & Olli Etuaho

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

Hardware-driven visibility culling

Optimization Tips 杜博, 美国高通公司资深工程师

Copyright Khronos Group Page 1

Baback Elmieh, Software Lead James Ritts, Profiler Lead Qualcomm Incorporated Advanced Content Group

GeForce4. John Montrym Henry Moreton

CS4620/5620: Lecture 14 Pipeline

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation

PROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd.

Programming Graphics Hardware

Achieving Console Quality Games on Mobile

Best practices for effective OpenGL programming. Dan Omachi OpenGL Development Engineer

OUTLINE. Implementing Texturing What Can Go Wrong and How to Fix It Mipmapping Filtering Perspective Correction

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

LPGPU Workshop on Power-Efficient GPU and Many-core Computing (PEGPUM 2014)

Understanding M3G 2.0 and its Effect on Producing Exceptional 3D Java-Based Graphics. Sean Ellis Consultant Graphics Engineer ARM, Maidenhead

PowerVR: Getting Great Graphics Performance with the PowerVR Insider SDK. PowerVR Developer Technology

CPSC 436D Video Game Programming

WebGL: Hands On. DevCon5 NYC Kenneth Russell Software Engineer, Google, Inc. Chair, WebGL Working Group

Render-To-Texture Caching. D. Sim Dietrich Jr.

ARM Multimedia IP: working together to drive down system power and bandwidth

Bringing AAA graphics to mobile platforms. Niklas Smedberg Senior Engine Programmer, Epic Games

OpenGL ES 2.0 : Start Developing Now. Dan Ginsburg Advanced Micro Devices, Inc.

GeForce3 OpenGL Performance. John Spitzer

Bringing it all together: The challenge in delivering a complete graphics system architecture. Chris Porthouse

Optimizing Mobile Games with Gameloft and ARM

Advanced Deferred Rendering Techniques. NCCA, Thesis Portfolio Peter Smith

Shaders. Slide credit to Prof. Zwicker

PERFORMANCE OPTIMIZATIONS FOR AUTOMOTIVE SOFTWARE

Engine Development & Support Team Lead for Korea UE4 Mobile Team Lead

Parallelizing Graphics Pipeline Execution (+ Basics of Characterizing a Rendering Workload)

Rendering Grass with Instancing in DirectX* 10

Introduction to OpenGL ES 3.0

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

Mobile graphics API Overview

3.01C Multimedia Elements and Guidelines Explore multimedia systems, elements and presentations.

Bringing Large Scale Console Games to ios:

Mobile Application Programing: Android. OpenGL Operation

We assume that you are familiar with the following:

the gamedesigninitiative at cornell university Lecture 15 Game Audio

VR Rendering Improvements Featuring Autodesk VRED

Shader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures

Transcription:

Tips for game development: Graphics, Audio, Sensor bada Developer Day in Seoul Dec 08, 2010 Copyright 2010 Samsung Electronics, Co., Ltd. All rights reserved

Contents Games in bada Audio tips Sensor tips 3D rendering tips Summary *This material is based on bada SDK 1.2.0 2

Games in bada Many games in Appstore Videos or live demos 3

bada features for games Input Output Sensors Weather Graphics Sound Face detection Service-centric Vibration Audio $2 $3 In-App purchasing Remote contents SNS Gateway 4

1 Audio tips

Two ways to play sound General-purpose audio/video playback Player AudioOut Multiple audio playback (max.: 10) Supports streaming* MP3, WMA, MIDI,.. Plays only PCM data *Streaming protocol: RTSP (API 1.0), HTTP (API 1.1) Multiple audio playback (max.: 64) Double buffering is possible 6

Player Step 1: Create a Player instance pplayer = new Player; pplayer->construct(*plistener); // IPlayerEventListener Step 2: Load a file and play it result r = pplayer->openfile(path); pplayer->play(); Step 3: Stop playing and close it pplayer->stop(); pplayer->close(); 7

AudioOut Step 1: Create an AudioOut instance pao = new AudioOut(); pao->construct(*plistener);// IAudioOutEventListener //Prepares the audio output device pao->prepare(audio_type_pcm_s16_le, AUDIO_CHANNEL_TYPE_MONO, SAMPLERATE); Step 2: Write PCM data // Fill buffer with PCM data pao->writebuffer(*poutbuffer); Step 3: Play the sound pao->start(); 8

AudioOut Step 4: Process events void EventListener::OnAudioOutBufferEndReached (Osp::Media::AudioOut &src) { //Write Next PCM data } Step 5: Stop the sound pao->stop(); //or Reset() 9

Audio tips Preferred PCM format Double buffering Sound mixing Handled by platform Handled by application Use the preferred PCM format to reduce the internal operations Field Values Channels Stereo Sample rate 44.1Khz Bit per sample 16-bit 10

Audio tips Preferred PCM format Double buffering Sound mixing Handled by platform Handled by application Reduce latency AudioOut Device Event: Buffer End Reached Application Buffer1 Buffer2 Buffer3 Step 1. Initialize AudioOut Step 2. Write a buffer two times Step 3. Start playback Step 4. Playback is ended Step 5. Event is fired Buffer2 is used by AudioOut Step 6. Write a new buffer 11

Audio tips Preferred PCM format Double buffering Sound mixing Handled by platform Handled by application Sound mixing Combine multiple sounds into one Sound mixing by application reduces the internal resource and event processing 12

Audio tips Preferred PCM format Double buffering Sound mixing Handled by platform Handled by application Headset Platform will change the sound path automatically* Incoming call Player and AudioOut are stopped by the platform** The application should resume them*** * Osp::System::DeviceManager ** IAudioOutEventListener::OnAudioOutInterrupted *** IAudioOutEventListener::OnAudioOutRelased 13

Audio tips Preferred PCM format Double buffering Sound mixing Handled by platform Handled by application Silent mode No event is fired Check the silent mode* Side volume key** Foreground/Background Stop the audio on background *Osp::System::SettingInfo **Osp::Ui::IKeyEventListener 14

2 Sensor tips

Sensor Sensors Type Acceleration sensor Magnetic sensor (compass) Proximity sensor Tilt sensor Properties x, y, z x, y, z 1 (on) or 0 (off) Azimuth, Pitch, Roll SensorManager Manages built-in sensors Polls sensors for data and delivers it to applications at specified intervals. 16

Getting sensor data Step 1: Create a SensorManager Osp::Uix::SensorManager sensormgr; sensormgr.construct(); Step 2: Add a listener sensormgr.getmaxinterval( SENSOR_TYPE_MAGNETIC, interval); sensormgr.addsensorlistener( *this, SENSOR_TYPE_MAGNETIC, interval, false); Step 3: Get sensor data from event-listener* Void OnDataReceived(SensorType sensortype, SensorData& sensordata, result r) { } * Event hander should return immediately, else event delay or event handling problem will occur 17

Multi-touch The number of points depends on the hardware 18

Multi-touch Step 1: Enable multi-touch Touch touch; touch.setmultipointenabled(*this, true); Step 2: Get multi-touch information Touch touch; IList* plist = null; plist = touch.gettouchinfolistn(source); if (plist) { for(int i = 0; i < plist->getcount(); i++ ) TouchInfo *ptouchinfo = static_cast<touchinfo *>(plist->getat(i)); plist->removeall(true); delete plist; } 19

3 3D rendering tips

3D rendering in bada bada supports OpenGL ES 1.1/2.0 1.1 Fixed function hardware 2.0 Fully programmable 3D graphics EGL Manages contexts and drawing surfaces Timer-based rendering loop Rendering on every kind of controls 21

3D rendering in bada Timer-based rendering loop Step 1: Create a timer ptimer= new Timer; ptimer->construct(*this); ptimer->start(time_out); Step 2: Implement event listener class GlesCube11 : public Osp::Base::Runtime::ITimerEventListener void OnTimerExpired(Osp::Base::Runtime::Timer& timer); Step 3: Handle timer event void GlesCube11::OnTimerExpired(Timer& timer){ ptimer->start(time_out); Draw(); // draw something.. } 22

3D rendering in bada Initialize EGL bool GlesCube11::InitEGL() { EGLint numconfigs = 1; EGLint eglconfiglist[] = {/* */}; EGLint eglcontextlist[] = {/* */}; eglbindapi(egl_opengl_es_api); egldisplay = eglgetdisplay( (EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); eglinitialize(egldisplay, null, null); eglchooseconfig(egldisplay, eglconfiglist, &eglconfig, 1, &numconfigs); eglsurface = eglcreatewindowsurface(egldisplay, eglconfig, (EGLNativeWindowType)pForm, null);... } 23

3D rendering in bada Checks OpenGLES version of device void Test1::CheckGLES(void) { String key(l"openglesversion"); String GLESVersion; } SystemInfo::GetValue(key,GLESVersion); AppLog("%ls", GLESVersion.GetPointer()); Result string Device Result Wave/Wave II 1.1/2.0 Wave525 24

3D accelerator of Wave/Wave II POWERVR SGX Unified Shader Architecture Load balancing Mostly identical capabilities of shaders Tile-based Deferred Rendering (TBDR) 25

3D accelerator of Wave/Wave II Related resources Visit http://www.imgtec.com 26

Tips for 3D rendering Texture Bitmaps are added to the surface of geometry Geometry Represents 3D object using geometric entities such as triangles, lines, and so on Shader Program to add special effects to 3D rendering 27

Texture tips Use texture atlas Use mipmap Load all textures on loading time Texture atlas Contains many sub images Use FBO instead of pbuffer Reduces the CPU overhead to load texture 28

Texture tips Use texture atlas Use mipmap Load all textures on loading time Mipmap Image set of different scales Use FBO instead of pbuffer Improves speed and quality Removes cache miss Removes aliasing 29

Texture tips Use texture atlas Use mipmap Load all textures on loading time Use FBO instead of pbuffer Reduces the frame-drops during run-time Loading texture has overhead 30

Texture tips Use texture atlas Use mipmap Load all textures on loading time Frame Buffer Object (FBO) For off-screen rendering Use FBO instead of pbuffer FBO is more efficient than pbuffer 31

Geometry tips Simplify geometry Order 3D geometry optimally Use VBO if possible You do not need a very complex model for mobile devices Use object culling 4M triangles 500 triangles 500 triangles + normal map 32

Geometry tips Simplify geometry Order 3D geometry optimally Traversal order of vertex data V1 V3 V5 Use VBO if possible Use object culling V0 V2 V4 V6 Interleaved attributes are better than separate arrays Interleaved attr.: Separate array: Position Normal Color 33

Geometry tips Simplify geometry Order 3D geometry optimally Use VBO if possible Vertex Buffer Object (VBO) Uploads data(vertex, normal..) to video device Use object culling Get more performance from driver and hardware optimization 34

Geometry tips Simplify geometry Order 3D geometry optimally Object culling Do not render invisible object Use VBO if possible Use object culling Viewpoint View Frustum Improve speed 35

Geometry tips Simplify geometry Order 3D geometry optimally Object culling Do not render invisible object Use VBO if possible Use object culling Viewpoint View Frustum Improve speed 36

Shader tips Prefer vertex shader to fragment shader Rendering pipeline Choose the appropriate precision Evaluator Vertex shader Rasterizati on Fragment shader Frame Buffer Vector and scalar operation Texture Memory Avoid discard operation Pixel Operations The number of vertex is much smaller than the number of fragment 37

Shader tips Prefer vertex shader to fragment shader Choose the appropriate precision Vector and scalar operation Avoid discard operation Consider the tradeoff between speed and quality highp: 32-bit Midiump: 16-bit Reduce the storage space Texture coordinate Lowp : 10-bit Color, normal.. 38

Shader tips Prefer vertex shader to fragment shader Choose the appropriate precision Vector and scalar operation Avoid discard operation Be careful with the order of vector and scalar operations highp vec4 v1, v2; highp float x, y; //Bad operation: 8 v2 = (v1 * x) * y; //Good operation: 5 v2 = v1 * (x * y); 39

Shader tips Prefer vertex shader to fragment shader Choose the appropriate precision discard operation is expensive Use alpha blend instead of discard Vector and scalar operation Avoid discard operation 40

4 Summary

Games in bada 42

We ve learned.. Audio tips Sensor tips 3D rendering tips Texture Geometry Shader bada games 43

Find out more.. Tutorial bada Tutorial.UI and Graphics.pdf bada Tutorial.UI Extension.pdf bada Tutorial.Media.pdf POWERVR SDK SGX 3D Application Recommendations 44

Thank you.