SlideShare ist ein Scribd-Unternehmen logo
1 von 16
TEXTURING
2014DEFINITION
 Texture – A bitmap buffer in memory, usually containing color data
 Textures are used for showing better realism in scenes
GFX2014 Advanced Graphics Workshop, Bangalore
TEXTURES FOR REALISM
3
2014TEXTURING 3D OBJECTS
 Mapping from a bitmap to a 3D object involves matching the texture coordinates
to the object surface
 Texture coordinates are calculated along with the vertex coordinates
 3D tools output Texture coordinates along with vertex information, for the scene
Approach of data transfers
2014
CORRECT APPROACH OF DATA
TRANSFERS
1. Generate Object (ex, glGenBuffers, glGenTextures)
2. Bind Object to an ID “xyz” (glBindBuffer(xyz), ..)
3. Transfer data to Object (glBufferData, glTexImage2D)
4. Unbind (glBindBuffer(0))
  After this point, the data remains bound to “xyz” and is managed by GPU.
 Can be accessed later by referencing “xyz”
  Applies to VBOs, Textures, …
 Note the implicit “no atomicity” – needs locking
 Pixel Buffer Objects and performance
subTexImage2D
2014HOW TO UPDATE REGIONS ?
 It is possible to update selected regions of already uploaded textures
 Using glTexSubImage2D
 In embedded systems, not used widely
 Performance implications of read-back path
 Remember the client-server paradigm
6
Texture formats
2014TEXTURING BASICS
 Texture Formats available
 RGB* formats, Luminance only formats
 Relevance of YUV
 Texture Filtering
 Maps texture coordinates to object coordinates – think of wrapping cloth over object
 Mipmaps
 Local optimisation – use pre-determined “reduced” size images, if object is far away
from viewer – as compared to filtering full image
 Objective is to reduce bandwidth, not necessarily higher quality
 Application can generate and pass through TexImage2D() for multiple levels
 GPU can generate using GenerateMipMap()
 Occupies more memory
Uv mapping
2014TEXTURING 2D OBJECTS
 Mapping from a bitmap to a rectangle is
straightforward
 0:1 range maps to 0:1 of object size
 TexParameter determines filtering mode
 TexParameter determines REPEAT
 TexCoordinates determine if texture extends to
full size of object or not
S,T = {0:1}
Upscaled
Texcoords {0:10}
+ REPEAT
texture
object
Non-image textures
2014NON-IMAGE TEXTURES
 Textures need not be image data
 Textures can be used to pass per-pixel “attributes” to the fragment shaders
 Bump-maps and similar techniques for passing normal information
 light-maps for lighting information
 ….
9
compression
2014TEXTURE COMPRESSION TYPES
 GLES spec supports RGBA textures, Luminance …
 To reduce memory bandwidth, compression used
 Texture Compression major types
 PVRTC, ETC1, Others
 Android primarily supports ETC1
 iOS supports PVRTC (and no other)
 Extension support queryable using GL API queries
 How to store this information in an uniform manner ?
 Texture file formats
 PVRTC (using Textool converter from IMG) commonly used
 KTX file format
KTX
2014KHRONOS KTX FILE FORMAT
 To render a texture, steps to be used today:
 Application needs apriori knowledge of texture type, format, storage type, mipmap
levels, and filename or the buffer data itself
 Then load into server using TexImage2D()
 Proprietary formats exist to separate this application+texture dependency –
 ex, PVRT from IMG
 ETC from Ericsson
 KTX file format from Khronos is a standard way to store texture information, and
the texture itself
 See next slide for structure of the file
 http://www.khronos.org/opengles/sdk/tools/KTX/
2014KTX FORMAT …
Passing coords
2014TEXTURE COORDINATES TO GPU
 Texture coordinates are passed to GPU as “Attributes” along with the vertices
 Gen-bind-bufferdata, then bindAttrib
 Quiz:
 When does the binding actually come into effect ?
WebGL/Textures
2014NOTE ON WEBGL AND TEXTURES
 Because of the way file loads work on browsers (asynchronous), texture loading
may not happen before the actual draw
 Expect black screen for a very short-while till the Texture image loads from the
website
 On native applications, due to the synchronous nature of loading the texture this
issue will not be present
Programming
PROGRAMMING WITH TEXTURES
 bindTexture
 pixelStorei (webGL only)
 UNPACK_FLIP_Y_WEBGL
 texImage2D
 texParameteri
 TEXTURE_MAG_FILTER
 TEXTURE_MIN_FILTER
 Note: WebGL “null” binding instead of
“0”
 Point Textures
 Rectangular Texture
2014LAB L2 - TEXTURING

Weitere ähnliche Inhalte

Was ist angesagt?

Oit And Indirect Illumination Using Dx11 Linked Lists
Oit And Indirect Illumination Using Dx11 Linked ListsOit And Indirect Illumination Using Dx11 Linked Lists
Oit And Indirect Illumination Using Dx11 Linked Lists
Holger Gruen
 

Was ist angesagt? (20)

OpenGL 4 for 2010
OpenGL 4 for 2010OpenGL 4 for 2010
OpenGL 4 for 2010
 
NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016NVIDIA OpenGL in 2016
NVIDIA OpenGL in 2016
 
Modern OpenGL Usage: Using Vertex Buffer Objects Well
Modern OpenGL Usage: Using Vertex Buffer Objects Well Modern OpenGL Usage: Using Vertex Buffer Objects Well
Modern OpenGL Usage: Using Vertex Buffer Objects Well
 
OpenGL for 2015
OpenGL for 2015OpenGL for 2015
OpenGL for 2015
 
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
 
OpenGL 4.5 Update for NVIDIA GPUs
OpenGL 4.5 Update for NVIDIA GPUsOpenGL 4.5 Update for NVIDIA GPUs
OpenGL 4.5 Update for NVIDIA GPUs
 
CS 354 Introduction
CS 354 IntroductionCS 354 Introduction
CS 354 Introduction
 
GFX part 8 - Three.js introduction and usage
GFX part 8 - Three.js introduction and usageGFX part 8 - Three.js introduction and usage
GFX part 8 - Three.js introduction and usage
 
CS 354 Viewing Stuff
CS 354 Viewing StuffCS 354 Viewing Stuff
CS 354 Viewing Stuff
 
Oit And Indirect Illumination Using Dx11 Linked Lists
Oit And Indirect Illumination Using Dx11 Linked ListsOit And Indirect Illumination Using Dx11 Linked Lists
Oit And Indirect Illumination Using Dx11 Linked Lists
 
vkFX: Effect(ive) approach for Vulkan API
vkFX: Effect(ive) approach for Vulkan APIvkFX: Effect(ive) approach for Vulkan API
vkFX: Effect(ive) approach for Vulkan API
 
OpenGL 3.2 and More
OpenGL 3.2 and MoreOpenGL 3.2 and More
OpenGL 3.2 and More
 
FlameWorks GTC 2014
FlameWorks GTC 2014FlameWorks GTC 2014
FlameWorks GTC 2014
 
SIGGRAPH 2012: NVIDIA OpenGL for 2012
SIGGRAPH 2012: NVIDIA OpenGL for 2012SIGGRAPH 2012: NVIDIA OpenGL for 2012
SIGGRAPH 2012: NVIDIA OpenGL for 2012
 
Shadow Volumes on Programmable Graphics Hardware
Shadow Volumes on Programmable Graphics HardwareShadow Volumes on Programmable Graphics Hardware
Shadow Volumes on Programmable Graphics Hardware
 
GTC 2012: GPU-Accelerated Path Rendering
GTC 2012: GPU-Accelerated Path RenderingGTC 2012: GPU-Accelerated Path Rendering
GTC 2012: GPU-Accelerated Path Rendering
 
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specificationsGFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
GFX Part 1 - Introduction to GPU HW and OpenGL ES specifications
 
Computer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGLComputer Graphics Project on Sinking Ship using OpenGL
Computer Graphics Project on Sinking Ship using OpenGL
 
GTC 2012: NVIDIA OpenGL in 2012
GTC 2012: NVIDIA OpenGL in 2012GTC 2012: NVIDIA OpenGL in 2012
GTC 2012: NVIDIA OpenGL in 2012
 
EXT_window_rectangles
EXT_window_rectanglesEXT_window_rectangles
EXT_window_rectangles
 

Andere mochten auch

Andere mochten auch (9)

Open Shading Language (OSL)
Open Shading Language (OSL)Open Shading Language (OSL)
Open Shading Language (OSL)
 
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
 
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ESGFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
GFX Part 6 - Introduction to Vertex and Fragment Shaders in OpenGL ES
 
GFX Part 3 - Vertices and interactions in OpenGL
GFX Part 3 - Vertices and interactions in OpenGLGFX Part 3 - Vertices and interactions in OpenGL
GFX Part 3 - Vertices and interactions in OpenGL
 
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ESGFX Part 5 - Introduction to Object Transformations in OpenGL ES
GFX Part 5 - Introduction to Object Transformations in OpenGL ES
 
Technology, Innovation - A Perspective
Technology, Innovation - A PerspectiveTechnology, Innovation - A Perspective
Technology, Innovation - A Perspective
 
GFX Part 7 - Introduction to Rendering Targets in OpenGL ES
GFX Part 7 - Introduction to Rendering Targets in OpenGL ESGFX Part 7 - Introduction to Rendering Targets in OpenGL ES
GFX Part 7 - Introduction to Rendering Targets in OpenGL ES
 
IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)IEEE - Consumer Electronics Trends Opportunities (2015)
IEEE - Consumer Electronics Trends Opportunities (2015)
 
OpenGL Shading Language
OpenGL Shading LanguageOpenGL Shading Language
OpenGL Shading Language
 

Ähnlich wie GFX Part 4 - Introduction to Texturing in OpenGL ES

View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)
Matthias Trapp
 
mago3D: Let's integrate BIM and 3D GIS on top of FOSS4G
mago3D: Let's integrate BIM and 3D GIS on top of FOSS4Gmago3D: Let's integrate BIM and 3D GIS on top of FOSS4G
mago3D: Let's integrate BIM and 3D GIS on top of FOSS4G
SANGHEE SHIN
 
Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)
Matthias Trapp
 
Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)
Matthias Trapp
 
Patchwork3 D Datasheet January 2009
Patchwork3 D Datasheet January 2009Patchwork3 D Datasheet January 2009
Patchwork3 D Datasheet January 2009
CAM3DRT
 
Algorithms and tools for point cloud generation
Algorithms and tools for point cloud generationAlgorithms and tools for point cloud generation
Algorithms and tools for point cloud generation
Radhe Syam
 

Ähnlich wie GFX Part 4 - Introduction to Texturing in OpenGL ES (20)

CS 354 Texture Mapping
CS 354 Texture MappingCS 354 Texture Mapping
CS 354 Texture Mapping
 
Texture mapping in_opengl
Texture mapping in_openglTexture mapping in_opengl
Texture mapping in_opengl
 
Texture Mapping
Texture Mapping Texture Mapping
Texture Mapping
 
View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)View-Dependent Texture Atlases (EG 2010)
View-Dependent Texture Atlases (EG 2010)
 
ShaderX³: Geometry Manipulation - Morphing between two different objects
ShaderX³: Geometry Manipulation - Morphing between two different objectsShaderX³: Geometry Manipulation - Morphing between two different objects
ShaderX³: Geometry Manipulation - Morphing between two different objects
 
mago3D: Let's integrate BIM and 3D GIS on top of FOSS4G
mago3D: Let's integrate BIM and 3D GIS on top of FOSS4Gmago3D: Let's integrate BIM and 3D GIS on top of FOSS4G
mago3D: Let's integrate BIM and 3D GIS on top of FOSS4G
 
Opengl texturing
Opengl texturingOpengl texturing
Opengl texturing
 
Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)Dynamic Mapping of Raster Data (IV 2009)
Dynamic Mapping of Raster Data (IV 2009)
 
Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)Rendering of Complex 3D Treemaps (GRAPP 2013)
Rendering of Complex 3D Treemaps (GRAPP 2013)
 
A0280105
A0280105A0280105
A0280105
 
Advanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics APIAdvanced Game Development with the Mobile 3D Graphics API
Advanced Game Development with the Mobile 3D Graphics API
 
Patchwork3 D Datasheet January 2009
Patchwork3 D Datasheet January 2009Patchwork3 D Datasheet January 2009
Patchwork3 D Datasheet January 2009
 
Mirko Lucchese - Deep Image Processing
Mirko Lucchese - Deep Image ProcessingMirko Lucchese - Deep Image Processing
Mirko Lucchese - Deep Image Processing
 
OpenGL L05-Texturing
OpenGL L05-TexturingOpenGL L05-Texturing
OpenGL L05-Texturing
 
Deep 3D Visual Analysis - Javier Ruiz-Hidalgo - UPC Barcelona 2017
Deep 3D Visual Analysis - Javier Ruiz-Hidalgo - UPC Barcelona 2017Deep 3D Visual Analysis - Javier Ruiz-Hidalgo - UPC Barcelona 2017
Deep 3D Visual Analysis - Javier Ruiz-Hidalgo - UPC Barcelona 2017
 
Algorithms and tools for point cloud generation
Algorithms and tools for point cloud generationAlgorithms and tools for point cloud generation
Algorithms and tools for point cloud generation
 
Application of 3d max for 3d development and rendering and its merits
Application of 3d max for 3d development and rendering and its merits Application of 3d max for 3d development and rendering and its merits
Application of 3d max for 3d development and rendering and its merits
 
The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014The Technology behind Shadow Warrior, ZTG 2014
The Technology behind Shadow Warrior, ZTG 2014
 
Convolutional Neural Network (CNN)of Deep Learning
Convolutional Neural Network (CNN)of Deep LearningConvolutional Neural Network (CNN)of Deep Learning
Convolutional Neural Network (CNN)of Deep Learning
 
HANDWRITTEN DIGIT RECOGNITION SYSTEM BASED ON CNN AND SVM
HANDWRITTEN DIGIT RECOGNITION SYSTEM BASED ON CNN AND SVMHANDWRITTEN DIGIT RECOGNITION SYSTEM BASED ON CNN AND SVM
HANDWRITTEN DIGIT RECOGNITION SYSTEM BASED ON CNN AND SVM
 

Mehr von Prabindh 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
 
GFX Part 2 - Introduction to GPU Programming
GFX Part 2 - Introduction to GPU ProgrammingGFX Part 2 - Introduction to GPU Programming
GFX Part 2 - Introduction to GPU Programming
 
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
 
Cache profiling on ARM Linux
Cache profiling on ARM LinuxCache profiling on ARM Linux
Cache profiling on ARM Linux
 
Qt5 beta1 on ti platforms
Qt5 beta1 on ti platformsQt5 beta1 on ti platforms
Qt5 beta1 on ti platforms
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

GFX Part 4 - Introduction to Texturing in OpenGL ES

  • 2. 2014DEFINITION  Texture – A bitmap buffer in memory, usually containing color data  Textures are used for showing better realism in scenes GFX2014 Advanced Graphics Workshop, Bangalore
  • 4. 2014TEXTURING 3D OBJECTS  Mapping from a bitmap to a 3D object involves matching the texture coordinates to the object surface  Texture coordinates are calculated along with the vertex coordinates  3D tools output Texture coordinates along with vertex information, for the scene Approach of data transfers
  • 5. 2014 CORRECT APPROACH OF DATA TRANSFERS 1. Generate Object (ex, glGenBuffers, glGenTextures) 2. Bind Object to an ID “xyz” (glBindBuffer(xyz), ..) 3. Transfer data to Object (glBufferData, glTexImage2D) 4. Unbind (glBindBuffer(0))   After this point, the data remains bound to “xyz” and is managed by GPU.  Can be accessed later by referencing “xyz”   Applies to VBOs, Textures, …  Note the implicit “no atomicity” – needs locking  Pixel Buffer Objects and performance subTexImage2D
  • 6. 2014HOW TO UPDATE REGIONS ?  It is possible to update selected regions of already uploaded textures  Using glTexSubImage2D  In embedded systems, not used widely  Performance implications of read-back path  Remember the client-server paradigm 6 Texture formats
  • 7. 2014TEXTURING BASICS  Texture Formats available  RGB* formats, Luminance only formats  Relevance of YUV  Texture Filtering  Maps texture coordinates to object coordinates – think of wrapping cloth over object  Mipmaps  Local optimisation – use pre-determined “reduced” size images, if object is far away from viewer – as compared to filtering full image  Objective is to reduce bandwidth, not necessarily higher quality  Application can generate and pass through TexImage2D() for multiple levels  GPU can generate using GenerateMipMap()  Occupies more memory Uv mapping
  • 8. 2014TEXTURING 2D OBJECTS  Mapping from a bitmap to a rectangle is straightforward  0:1 range maps to 0:1 of object size  TexParameter determines filtering mode  TexParameter determines REPEAT  TexCoordinates determine if texture extends to full size of object or not S,T = {0:1} Upscaled Texcoords {0:10} + REPEAT texture object Non-image textures
  • 9. 2014NON-IMAGE TEXTURES  Textures need not be image data  Textures can be used to pass per-pixel “attributes” to the fragment shaders  Bump-maps and similar techniques for passing normal information  light-maps for lighting information  …. 9 compression
  • 10. 2014TEXTURE COMPRESSION TYPES  GLES spec supports RGBA textures, Luminance …  To reduce memory bandwidth, compression used  Texture Compression major types  PVRTC, ETC1, Others  Android primarily supports ETC1  iOS supports PVRTC (and no other)  Extension support queryable using GL API queries  How to store this information in an uniform manner ?  Texture file formats  PVRTC (using Textool converter from IMG) commonly used  KTX file format KTX
  • 11. 2014KHRONOS KTX FILE FORMAT  To render a texture, steps to be used today:  Application needs apriori knowledge of texture type, format, storage type, mipmap levels, and filename or the buffer data itself  Then load into server using TexImage2D()  Proprietary formats exist to separate this application+texture dependency –  ex, PVRT from IMG  ETC from Ericsson  KTX file format from Khronos is a standard way to store texture information, and the texture itself  See next slide for structure of the file  http://www.khronos.org/opengles/sdk/tools/KTX/
  • 13. 2014TEXTURE COORDINATES TO GPU  Texture coordinates are passed to GPU as “Attributes” along with the vertices  Gen-bind-bufferdata, then bindAttrib  Quiz:  When does the binding actually come into effect ? WebGL/Textures
  • 14. 2014NOTE ON WEBGL AND TEXTURES  Because of the way file loads work on browsers (asynchronous), texture loading may not happen before the actual draw  Expect black screen for a very short-while till the Texture image loads from the website  On native applications, due to the synchronous nature of loading the texture this issue will not be present Programming
  • 15. PROGRAMMING WITH TEXTURES  bindTexture  pixelStorei (webGL only)  UNPACK_FLIP_Y_WEBGL  texImage2D  texParameteri  TEXTURE_MAG_FILTER  TEXTURE_MIN_FILTER  Note: WebGL “null” binding instead of “0”  Point Textures  Rectangular Texture
  • 16. 2014LAB L2 - TEXTURING