SlideShare ist ein Scribd-Unternehmen logo
1 von 25
TRANSFORMATIONS
2014
 in OpenGL ES, negative z-values go into the screen. This is because OpenGL
ES uses a right-handed coordinate system. GLKit, on the other hand (pun
intended), uses the more conventional left-handed coordinate system.
GFX2014 Advanced Graphics Workshop, Bangalore
http://www.learnopengles.com/understanding-opengls-matrices/
2014VERTICES AND PROJECTION
 Cartesian systems
 OpenGL
 +z  viewer
 DirectX is left handed (APIs to translate)
 Perspective, and Ortho
 Perspective matches natural viewing expectation
 Projection matrix (far/near, viewport size, Aspect ratio)
 Order of matrix multiplication – reversed
 projection*view*model Perspective projection
2014LAB L4 – COORDINATE AXES
 Click and move the mouse, to rotate the Z axis, around Y
4
x
y
2014ORTHOGRAPHIC PROJECTION - MATRIX
 Consists of a translation and scaling component
 An object looks the same whether it’s close or far away from the camera
5
2014PERSPECTIVE PROJECTION - MATRIX
 An object’s x and y are distorted, depending on the distance from the camera,
giving the “perspective” effect
6
2014PERSPECTIVE PROJECTION
 Viewing volume
 Clipping
*If near plane is very close to object, expect nasty clipping to happen
2014MATRIX ORDERING CONVENTIONS
 “Column-Major” notation  Read matrix notations in transposed manner
 M.V.P is to be treated P.V.M
 OpenGL / ES uses the Column-Order convention for depiction of operations
Transformation
2014TRANSFORMATIONS
 All vertices are in model-space, when input to the GL engine
 Where is the viewer ?
 Moving the object to the viewer-eye at origin [MV transformation]
 What is the bounding volume of the world ?
 Object needs to be clipped to the bounding box [Projection]
 Viewport normalisation
 Done by perspective division, to result in values of -1:1
Diagram
2014TRANSLATION OF A POINT - EXAMPLE
 [x y z 1] * [?] = [x-a y-b z-c 1]
 [?] = [1 0 0 0]
 = [0 1 0 0]
 = [0 0 1 0]
 = [-a -b -c 1]
 Revise this
 What happens if w is 0 ?
 Point vs Vector !
 From OpenGL FAQ - “…The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix
…” (note the column order reference)
Order of operation
Observation -
Last row – non unity
W - purpose
2014ORDER OF OPERATIONS
 Order - makes a difference for final position of object
 Do Model matrix operations carefully
- From “The redbook”
2014TRANSLATION
 matrix1.translate(X,0.0,0);
X = 0
X = 0.4
 Translation applied to all objects (effect is not dependent on depth of object)
2014ROTATION
x
y
z
Rotation  Observe effect of x offset!
Apply translation “after” rotation
Refresh M,V,P after every rotate
-0
Lookat
2014GETTING THE EYE TO SEE THE OBJECT
 “Model” Matrix made the object “look” right
 Now make the object visible to the “eye” – The “View”
 Eye is always at the origin {0,0,0}
 So using matrices, move the current object to the eye
 “LookAt” is implemented in many standard toolkits
 The LookAt transformation is defined by
 Viewpoint - from where the view ray starts (eye)
 A Reference point (where the view ray ends) – in middle of scene (center)
 A look-”up” direction (up)
 ex – gluLookAt Utility function
 Significant contributor of grey-hair
Viewport
2014PERSPECTIVE PROJECTION
 Needs the below four inputs
 aspect ratio – (WIDTH / HEIGHT) of target screen
 vertical field of view (called FOV): the vertical angle of the camera into which we look into
 location of the near Z plane – Objects in front of this are not drarwn
 location of the far Z plane – Beyond this, objects are not drawn
 The vertical field of view enables moving “in” and “out” – making the same object appear
small or big
15
2014VIEWPORT TRANSFORMATION
 Convert from the rendering to the final screen size
 ie physical screen
 Define the viewport using glViewport()
 Viewport can be an area anywhere within the physical screen
 Reminder – viewport(0,0,128,128)
 This takes care of aspect ratio
 After the transformation, successful triangles get to the rasterisation HW, and
then to the Fragment shader
HW optimisations
2014GLES3.0 - TRANSFORM FEEDBACK
 Refer quiz
GFX2014 Advanced Graphics Workshop, Bangalore 17
2014
SUMMARY - THE TRANSFORMATION
SEQUENCE
Translation example
Just a mathematical step - w
2014HW OPTIMISATIONS
 Not all triangles are visible
 HW can reject based on depth
 coverage
 Front-facing or back-facing (Culling)
 Winding Rules used
 Culling is disabled by default per specification
 However, most HW do this optimisation by default to save on bandwidth/ later pixel
processing
Programming
2014PROGRAMMING !
2014LAB L6 – ROTATING MODEL
21
REAL LIFE 3D MODELS
2014REAL-LIFE MODELLING OF OBJECTS
 3D models are stored in a combination of
 Vertices
 Indices / Faces *
 Normals
 Texture coordinates
 Ex, .OBJ, 3DS, STL, FBX …
 f, v, v//norm, v/t, o
 Export of vertices => scaling to 1.0-1.0
 Vertex normals vs face normals
 Materials (mtl), animations
 Problem of multiple indices not allowed in openGL
 Tools and Models
 Blender, Maya, …
 http://assimp.sourceforge.net/ - tool for importing multiple types
 http://www.blendswap.com/ - Blender models
 Tessellation of meshes can be aided by HW in GPUs
2014EXPORTING MODELS FROM BLENDER
 .obj export
 Always triangulate for GLES2
 Model always from Top-View
 Ie, Y up (default setting)
 Always UV unwrap each object
 Normals if needed (lighting)
 Rest is rendering as usual 24
PROGRAMMING
 Loading 3D models is an
application functionality
 No new APIs from OpenGLES
are needed
 A parser is required to parse
the model files, and extract the
vertex, attribute, normal,
texture coordinate information

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction To Geometry Shaders
Introduction To Geometry ShadersIntroduction To Geometry Shaders
Introduction To Geometry Shaderspjcozzi
 
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileLook Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileUnity Technologies
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsPrabindh Sundareson
 
GFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ESGFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ESPrabindh Sundareson
 
Virtual Reality Features of NVIDIA GPUs
Virtual Reality Features of NVIDIA GPUsVirtual Reality Features of NVIDIA GPUs
Virtual Reality Features of NVIDIA GPUsMark Kilgard
 
NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016Mark Kilgard
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL TransformationSandip Jadhav
 
Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019
Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019
Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019Unity Technologies
 
Best Practices for Shader Graph
Best Practices for Shader GraphBest Practices for Shader Graph
Best Practices for Shader GraphUnity Technologies
 
OpenGL ES Presentation
OpenGL ES PresentationOpenGL ES Presentation
OpenGL ES PresentationEric Cheng
 
OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android Arvind Devaraj
 
Graphics programming in open gl
Graphics programming in open glGraphics programming in open gl
Graphics programming in open glArvind Devaraj
 
Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGLGary Yeh
 
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for ArtistsOwen Wu
 
Optimized Rendering Techniques for Mobile VR
Optimized Rendering Techniques  for Mobile VROptimized Rendering Techniques  for Mobile VR
Optimized Rendering Techniques for Mobile VRDevGAMM Conference
 
OpenGL ES on Android
OpenGL ES on AndroidOpenGL ES on Android
OpenGL ES on AndroidChris Farrell
 
Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...
Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...
Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...Unity Technologies
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programmingMohammed Romi
 

Was ist angesagt? (20)

Introduction To Geometry Shaders
Introduction To Geometry ShadersIntroduction To Geometry Shaders
Introduction To Geometry Shaders
 
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus MobileLook Ma, No Jutter! Optimizing Performance Across Oculus Mobile
Look Ma, No Jutter! Optimizing Performance Across Oculus Mobile
 
OpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI PlatformsOpenGL ES based UI Development on TI Platforms
OpenGL ES based UI Development on TI Platforms
 
GFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ESGFX Part 4 - Introduction to Texturing in OpenGL ES
GFX Part 4 - Introduction to Texturing in OpenGL ES
 
Virtual Reality Features of NVIDIA GPUs
Virtual Reality Features of NVIDIA GPUsVirtual Reality Features of NVIDIA GPUs
Virtual Reality Features of NVIDIA GPUs
 
NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016
 
OpenGL Transformation
OpenGL TransformationOpenGL Transformation
OpenGL Transformation
 
Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019
Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019
Learn how to do stylized shading with Shader Graph – Unite Copenhagen 2019
 
Best Practices for Shader Graph
Best Practices for Shader GraphBest Practices for Shader Graph
Best Practices for Shader Graph
 
Gl efficiency
Gl efficiencyGl efficiency
Gl efficiency
 
OpenGL ES Presentation
OpenGL ES PresentationOpenGL ES Presentation
OpenGL ES Presentation
 
OpenGL Interaction
OpenGL InteractionOpenGL Interaction
OpenGL Interaction
 
OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android OpenGLES - Graphics Programming in Android
OpenGLES - Graphics Programming in Android
 
Graphics programming in open gl
Graphics programming in open glGraphics programming in open gl
Graphics programming in open gl
 
Introduction of openGL
Introduction  of openGLIntroduction  of openGL
Introduction of openGL
 
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
[Unite Seoul 2020] Mobile Graphics Best Practices for Artists
 
Optimized Rendering Techniques for Mobile VR
Optimized Rendering Techniques  for Mobile VROptimized Rendering Techniques  for Mobile VR
Optimized Rendering Techniques for Mobile VR
 
OpenGL ES on Android
OpenGL ES on AndroidOpenGL ES on Android
OpenGL ES on Android
 
Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...
Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...
Turning large CAD assemblies into real-time 3D visualizations- Unite Copenhag...
 
Chapter02 graphics-programming
Chapter02 graphics-programmingChapter02 graphics-programming
Chapter02 graphics-programming
 

Ähnlich wie OpenGL ES Transformations and Projection Matrix Guide

CS 354 Object Viewing and Representation
CS 354 Object Viewing and RepresentationCS 354 Object Viewing and Representation
CS 354 Object Viewing and RepresentationMark Kilgard
 
3 d graphics with opengl part 2
3 d graphics with opengl  part 23 d graphics with opengl  part 2
3 d graphics with opengl part 2Sardar Alam
 
Computer Graphics - Lecture 03 - Virtual Cameras and the Transformation Pipeline
Computer Graphics - Lecture 03 - Virtual Cameras and the Transformation PipelineComputer Graphics - Lecture 03 - Virtual Cameras and the Transformation Pipeline
Computer Graphics - Lecture 03 - Virtual Cameras and the Transformation Pipeline💻 Anton Gerdelan
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...ICS
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingMark Kilgard
 
Shadow Volumes on Programmable Graphics Hardware
Shadow Volumes on Programmable Graphics HardwareShadow Volumes on Programmable Graphics Hardware
Shadow Volumes on Programmable Graphics Hardwarestefan_b
 
Making High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis CataldiMaking High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis CataldiUnreal Engine
 
Making High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis CataldiMaking High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis CataldiLuis Cataldi
 
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2StanfordComputationalImaging
 
CG OpneGL 2D viewing & simple animation-course 6
CG OpneGL 2D viewing & simple animation-course 6CG OpneGL 2D viewing & simple animation-course 6
CG OpneGL 2D viewing & simple animation-course 6fungfung Chen
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsNaman Dwivedi
 
Non-Planar Projections (GRAPP 2008)
Non-Planar Projections (GRAPP 2008)Non-Planar Projections (GRAPP 2008)
Non-Planar Projections (GRAPP 2008)Matthias Trapp
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
 
Gef tutorial 2005
Gef tutorial 2005Gef tutorial 2005
Gef tutorial 2005Ryan Wang
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine OverviewSharad Mitra
 

Ähnlich wie OpenGL ES Transformations and Projection Matrix Guide (20)

CS 354 Object Viewing and Representation
CS 354 Object Viewing and RepresentationCS 354 Object Viewing and Representation
CS 354 Object Viewing and Representation
 
3 d graphics with opengl part 2
3 d graphics with opengl  part 23 d graphics with opengl  part 2
3 d graphics with opengl part 2
 
Computer Graphics - Lecture 03 - Virtual Cameras and the Transformation Pipeline
Computer Graphics - Lecture 03 - Virtual Cameras and the Transformation PipelineComputer Graphics - Lecture 03 - Virtual Cameras and the Transformation Pipeline
Computer Graphics - Lecture 03 - Virtual Cameras and the Transformation Pipeline
 
Lec4
Lec4Lec4
Lec4
 
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
OpenGL Fixed Function to Shaders - Porting a fixed function application to “m...
 
CS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and CullingCS 354 Transformation, Clipping, and Culling
CS 354 Transformation, Clipping, and Culling
 
Shadow Volumes on Programmable Graphics Hardware
Shadow Volumes on Programmable Graphics HardwareShadow Volumes on Programmable Graphics Hardware
Shadow Volumes on Programmable Graphics Hardware
 
Bai 1
Bai 1Bai 1
Bai 1
 
Making High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis CataldiMaking High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis Cataldi
 
Making High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis CataldiMaking High Quality Interactive VR with Unreal Engine Luis Cataldi
Making High Quality Interactive VR with Unreal Engine Luis Cataldi
 
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
Build Your Own VR Display Course - SIGGRAPH 2017: Part 2
 
CG OpneGL 2D viewing & simple animation-course 6
CG OpneGL 2D viewing & simple animation-course 6CG OpneGL 2D viewing & simple animation-course 6
CG OpneGL 2D viewing & simple animation-course 6
 
Opengl basics
Opengl basicsOpengl basics
Opengl basics
 
Enhancing UI/UX using Java animations
Enhancing UI/UX using Java animationsEnhancing UI/UX using Java animations
Enhancing UI/UX using Java animations
 
Non-Planar Projections (GRAPP 2008)
Non-Planar Projections (GRAPP 2008)Non-Planar Projections (GRAPP 2008)
Non-Planar Projections (GRAPP 2008)
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
Gef tutorial 2005
Gef tutorial 2005Gef tutorial 2005
Gef tutorial 2005
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine Overview
 
IOS 8 Indoor Location
IOS 8 Indoor LocationIOS 8 Indoor Location
IOS 8 Indoor Location
 
Windows and viewport
Windows and viewportWindows and viewport
Windows and viewport
 

Mehr von Prabindh Sundareson

Synthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in RoboticsSynthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in RoboticsPrabindh Sundareson
 
Machine learning in the Indian Context - IEEE talk at SRM Institute
Machine learning in the Indian Context - IEEE talk at SRM InstituteMachine learning in the Indian Context - IEEE talk at SRM Institute
Machine learning in the Indian Context - IEEE talk at SRM InstitutePrabindh Sundareson
 
ICCE Asia 2017 - Program Outline
ICCE Asia 2017 - Program OutlineICCE Asia 2017 - Program Outline
ICCE Asia 2017 - Program OutlinePrabindh Sundareson
 
Call for Papers - ICCE Asia 2017
Call for Papers - ICCE Asia 2017Call for Papers - ICCE Asia 2017
Call for Papers - ICCE Asia 2017Prabindh Sundareson
 
Technology, Innovation - A Perspective
Technology, Innovation - A PerspectiveTechnology, Innovation - A Perspective
Technology, Innovation - A PerspectivePrabindh Sundareson
 
IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)Prabindh Sundareson
 
John Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual RealityJohn Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual RealityPrabindh Sundareson
 
Gfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manualGfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manualPrabindh Sundareson
 
ANGLE on Windows for OpenGLES2.0
ANGLE on Windows for OpenGLES2.0ANGLE on Windows for OpenGLES2.0
ANGLE on Windows for OpenGLES2.0Prabindh Sundareson
 
Yocto usage for Graphics SDK on AM335x
Yocto usage for Graphics SDK on AM335xYocto usage for Graphics SDK on AM335x
Yocto usage for Graphics SDK on AM335xPrabindh Sundareson
 
ARM Linux Embedded memory protection techniques
ARM Linux Embedded memory protection techniquesARM Linux Embedded memory protection techniques
ARM Linux Embedded memory protection techniquesPrabindh Sundareson
 
Qt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with YoctoQt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with YoctoPrabindh Sundareson
 
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335xMoksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335xPrabindh Sundareson
 

Mehr von Prabindh Sundareson (20)

Synthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in RoboticsSynthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in Robotics
 
Work and Life
Work and Life Work and Life
Work and Life
 
GPU Algorithms and trends 2018
GPU Algorithms and trends 2018GPU Algorithms and trends 2018
GPU Algorithms and trends 2018
 
Machine learning in the Indian Context - IEEE talk at SRM Institute
Machine learning in the Indian Context - IEEE talk at SRM InstituteMachine learning in the Indian Context - IEEE talk at SRM Institute
Machine learning in the Indian Context - IEEE talk at SRM Institute
 
Students Hackathon - 2017
Students Hackathon - 2017Students Hackathon - 2017
Students Hackathon - 2017
 
ICCE Asia 2017 - Program Outline
ICCE Asia 2017 - Program OutlineICCE Asia 2017 - Program Outline
ICCE Asia 2017 - Program Outline
 
Call for Papers - ICCE Asia 2017
Call for Papers - ICCE Asia 2017Call for Papers - ICCE Asia 2017
Call for Papers - ICCE Asia 2017
 
Technology, Innovation - A Perspective
Technology, Innovation - A PerspectiveTechnology, Innovation - A Perspective
Technology, Innovation - A Perspective
 
IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)
 
John Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual RealityJohn Carmack talk at SMU, April 2014 - Virtual Reality
John Carmack talk at SMU, April 2014 - Virtual Reality
 
GFX2014 OpenGL ES Quiz
GFX2014 OpenGL ES QuizGFX2014 OpenGL ES Quiz
GFX2014 OpenGL ES Quiz
 
Gfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manualGfx2014 Graphics Workshop - Lab manual
Gfx2014 Graphics Workshop - Lab manual
 
Render to Texture with Three.js
Render to Texture with Three.jsRender to Texture with Three.js
Render to Texture with Three.js
 
ANGLE on Windows for OpenGLES2.0
ANGLE on Windows for OpenGLES2.0ANGLE on Windows for OpenGLES2.0
ANGLE on Windows for OpenGLES2.0
 
Yocto usage for Graphics SDK on AM335x
Yocto usage for Graphics SDK on AM335xYocto usage for Graphics SDK on AM335x
Yocto usage for Graphics SDK on AM335x
 
Gfx2013 lab manual
Gfx2013 lab manualGfx2013 lab manual
Gfx2013 lab manual
 
ARM Linux Embedded memory protection techniques
ARM Linux Embedded memory protection techniquesARM Linux Embedded memory protection techniques
ARM Linux Embedded memory protection techniques
 
Qt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with YoctoQt5 (minimal) on beaglebone, with Yocto
Qt5 (minimal) on beaglebone, with Yocto
 
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335xMoksha - HTML5/CSS with Qt5+Snowshoe on AM335x
Moksha - HTML5/CSS with Qt5+Snowshoe on AM335x
 
Qt5.0.0 eglfs abort issue
Qt5.0.0 eglfs abort issueQt5.0.0 eglfs abort issue
Qt5.0.0 eglfs abort issue
 

Kürzlich hochgeladen

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 

Kürzlich hochgeladen (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 

OpenGL ES Transformations and Projection Matrix Guide

  • 2. 2014  in OpenGL ES, negative z-values go into the screen. This is because OpenGL ES uses a right-handed coordinate system. GLKit, on the other hand (pun intended), uses the more conventional left-handed coordinate system. GFX2014 Advanced Graphics Workshop, Bangalore http://www.learnopengles.com/understanding-opengls-matrices/
  • 3. 2014VERTICES AND PROJECTION  Cartesian systems  OpenGL  +z  viewer  DirectX is left handed (APIs to translate)  Perspective, and Ortho  Perspective matches natural viewing expectation  Projection matrix (far/near, viewport size, Aspect ratio)  Order of matrix multiplication – reversed  projection*view*model Perspective projection
  • 4. 2014LAB L4 – COORDINATE AXES  Click and move the mouse, to rotate the Z axis, around Y 4 x y
  • 5. 2014ORTHOGRAPHIC PROJECTION - MATRIX  Consists of a translation and scaling component  An object looks the same whether it’s close or far away from the camera 5
  • 6. 2014PERSPECTIVE PROJECTION - MATRIX  An object’s x and y are distorted, depending on the distance from the camera, giving the “perspective” effect 6
  • 7. 2014PERSPECTIVE PROJECTION  Viewing volume  Clipping *If near plane is very close to object, expect nasty clipping to happen
  • 8. 2014MATRIX ORDERING CONVENTIONS  “Column-Major” notation  Read matrix notations in transposed manner  M.V.P is to be treated P.V.M  OpenGL / ES uses the Column-Order convention for depiction of operations Transformation
  • 9. 2014TRANSFORMATIONS  All vertices are in model-space, when input to the GL engine  Where is the viewer ?  Moving the object to the viewer-eye at origin [MV transformation]  What is the bounding volume of the world ?  Object needs to be clipped to the bounding box [Projection]  Viewport normalisation  Done by perspective division, to result in values of -1:1 Diagram
  • 10. 2014TRANSLATION OF A POINT - EXAMPLE  [x y z 1] * [?] = [x-a y-b z-c 1]  [?] = [1 0 0 0]  = [0 1 0 0]  = [0 0 1 0]  = [-a -b -c 1]  Revise this  What happens if w is 0 ?  Point vs Vector !  From OpenGL FAQ - “…The translation components occupy the 13th, 14th, and 15th elements of the 16-element matrix …” (note the column order reference) Order of operation Observation - Last row – non unity W - purpose
  • 11. 2014ORDER OF OPERATIONS  Order - makes a difference for final position of object  Do Model matrix operations carefully - From “The redbook”
  • 12. 2014TRANSLATION  matrix1.translate(X,0.0,0); X = 0 X = 0.4  Translation applied to all objects (effect is not dependent on depth of object)
  • 13. 2014ROTATION x y z Rotation  Observe effect of x offset! Apply translation “after” rotation Refresh M,V,P after every rotate -0 Lookat
  • 14. 2014GETTING THE EYE TO SEE THE OBJECT  “Model” Matrix made the object “look” right  Now make the object visible to the “eye” – The “View”  Eye is always at the origin {0,0,0}  So using matrices, move the current object to the eye  “LookAt” is implemented in many standard toolkits  The LookAt transformation is defined by  Viewpoint - from where the view ray starts (eye)  A Reference point (where the view ray ends) – in middle of scene (center)  A look-”up” direction (up)  ex – gluLookAt Utility function  Significant contributor of grey-hair Viewport
  • 15. 2014PERSPECTIVE PROJECTION  Needs the below four inputs  aspect ratio – (WIDTH / HEIGHT) of target screen  vertical field of view (called FOV): the vertical angle of the camera into which we look into  location of the near Z plane – Objects in front of this are not drarwn  location of the far Z plane – Beyond this, objects are not drawn  The vertical field of view enables moving “in” and “out” – making the same object appear small or big 15
  • 16. 2014VIEWPORT TRANSFORMATION  Convert from the rendering to the final screen size  ie physical screen  Define the viewport using glViewport()  Viewport can be an area anywhere within the physical screen  Reminder – viewport(0,0,128,128)  This takes care of aspect ratio  After the transformation, successful triangles get to the rasterisation HW, and then to the Fragment shader HW optimisations
  • 17. 2014GLES3.0 - TRANSFORM FEEDBACK  Refer quiz GFX2014 Advanced Graphics Workshop, Bangalore 17
  • 18. 2014 SUMMARY - THE TRANSFORMATION SEQUENCE Translation example Just a mathematical step - w
  • 19. 2014HW OPTIMISATIONS  Not all triangles are visible  HW can reject based on depth  coverage  Front-facing or back-facing (Culling)  Winding Rules used  Culling is disabled by default per specification  However, most HW do this optimisation by default to save on bandwidth/ later pixel processing Programming
  • 21. 2014LAB L6 – ROTATING MODEL 21
  • 22. REAL LIFE 3D MODELS
  • 23. 2014REAL-LIFE MODELLING OF OBJECTS  3D models are stored in a combination of  Vertices  Indices / Faces *  Normals  Texture coordinates  Ex, .OBJ, 3DS, STL, FBX …  f, v, v//norm, v/t, o  Export of vertices => scaling to 1.0-1.0  Vertex normals vs face normals  Materials (mtl), animations  Problem of multiple indices not allowed in openGL  Tools and Models  Blender, Maya, …  http://assimp.sourceforge.net/ - tool for importing multiple types  http://www.blendswap.com/ - Blender models  Tessellation of meshes can be aided by HW in GPUs
  • 24. 2014EXPORTING MODELS FROM BLENDER  .obj export  Always triangulate for GLES2  Model always from Top-View  Ie, Y up (default setting)  Always UV unwrap each object  Normals if needed (lighting)  Rest is rendering as usual 24
  • 25. PROGRAMMING  Loading 3D models is an application functionality  No new APIs from OpenGLES are needed  A parser is required to parse the model files, and extract the vertex, attribute, normal, texture coordinate information