SlideShare a Scribd company logo
CS 354 Introduction Mark Kilgard University of Texas January 17, 2012
CS 354—Computer Graphics Instructor:  Mark Kilgard Principal Software Engineer, NVIDIA Previously at Silicon Graphics Teaching Assistant:  Randall Smith Ph.D. student with Dr. Fussell TA’ed the course last semester Burdine Hall (BUR) 116 Tuesday/Thursday, 9:30-11:00 a.m.
Expectations For us Teach practical graphics expertise Well-prepared lectures Grades fairly reflect your participation and performance Available to you Use my office hours Other times, use Randy If not satisfied, contact me [email_address] For you Attendance at every class Expect regular quizzes at the beginning of class Programming assignments You need to know C/C++ Use office hours if you need help No cheating
Grading Testing 60% Daily quizzes 10% 2-3 questions, easy Homework 10% Occasional, mostly math questions Exams 40% Mid-term 15% Final 25% Software projects 40% Simple Rendering Object loader Interaction Shading Performance analysis
Textbook Interactive Computer Graphics: A Top-Down Approach With Shader-Based OpenGL by Edward Angel and Dave Shreiner Addison-Wesley, 6th edition Regular readings assigned Match up with lecture topics
Helpful Resources Learning OpenGL OpenGL-oriented books Supplemental books OpenGL Programming Guide a.k.a. “the red book” OpenGL SuperBible OpenGL A Primer Eric Lengyel’s Mathematics for 3D Game Programming and Computer Graphics Real-Time Rendering  by Eric Haines,  Tomas Akenine-Moller, Eric Haines, Naty Hoffman
Computer Graphics Nexus of several disciplines Human Perception Artistic Expression Physics of Light Geometry and Mathematics of Surfaces Computer Science VLSI Hardware Design Display & Input Technology Animation & Simulation
Roles for Computer Graphics [Pixar 2010] Story telling Product design [CATIA] Roles for Computer Graphics
Roles for Computer Graphics Training [Commercial simulators] Gaming [Skyrim]
Roles for Computer Graphics User interfaces [Android 4.0] Navigation [Audi]
Roles for Computer Graphics Printing Digital imaging & video [HP Deskjet] [Canon]
What does computer graphics study? Computer-based simulation of Shape Appearance Motion [Litke et.al. 2001] [Chai & Hodgins, 2005] [Sloan et.al. 2005]
Not covered in the class Digital content creation No Photoshop, no Maya or 3D Studio Max Computer Science class, not an art class C/C++ programming I expect you know C or C++ under Linux Not just the language Need to know debugging and software practices Since course’s programming projects assume Linux software development Use the Computer Science labs (ESN or Painter)
Visual Thinking Human visual system = highest bandwidth input to your brain Very natural to want computers “feeding” this input to your brain Because people think visually Innate intuition for 3D imagery in particular Computer graphics Takes an abstract representation of a “scene” within a computer’s memory and converts it to a concrete signal (an image, or animating images) representing a view of that scene Computer graphics practitioners have a good practical and theoretical understanding of how to do this Amazing progress in the last 40 years Your brain Takes concrete signals (images, the visual world) and converts those signals (back!) into an abstract representation of a scene We have only the most rudimentary notions of how this process works Teaching a computer to do this is the field of “computer vision”
Reductionist Approach Can’t simply “take a picture” like a camera Instead images are “synthesized” from an abstract model of a scene and its view Must build graphics out of little bits of work and data Philosophers and scientists break down phenomenon to smallest observable units Examples Philosophical atoms (Leucippus, ancient) Triangles (Plato, ancient) Chemical atoms (Dalton, pre-modern) Physical atoms (Bohr, modern) Sub-atomic quantum particles, waves, strings Reductionism in graphics Pixels, vertexes, and triangles (Plato redux?) Discretization pervades, ideal for digital computers
Your Modern World View: Discrete Information, Particularly Images You  believe  in digital information Impossible to avoid this belief in a modern, computerized world Text is digital, video is digital, music is digital, communication is digital, even identity is becoming digital You believe exact copies are possible, even common Pervasive new belief that’s incognizant to world just 50 years ago Discrete images implies pixels Descartes’s Cartesian plane computerized Image ≈ grid of discrete color So images are simply numbers So can be processed as numbers!
Shape: Objects to Triangles Digital artists approximate solid object shape with meshes of triangles Was Plato right? More triangles makes the mesh an increasingly accurate approximation of the bunny shape
What will you learn Fundamentals of computer graphics Transformations and viewing Rasterization and ray tracing Lighting and shading Graphics hardware technology Mathematics for computer graphics Practical graphics programming OpenGL programming Shader programming Performance analysis
Expect programming projects using OpenGL Explicitly not just an “OpenGL” class But you will learn and use OpenGL When relevant Direct3D is discussed too You’ll use GLUT so programs can work on Windows, Mac, and Linux Plenty of resources to learn OpenGL www.opengl.org
What is OpenGL? Its specification is titled “The OpenGL  Graphics System ” Not just for 3D graphics; imaging too “ GL” standard for “Graphics Library” “ Open” means industry standard meant for broad adoption with liberal licensing Standardized in 1992 By Silicon Graphics And others: Compaq, DEC, Intel, IBM, Microsoft Originally meant for Unix and Windows workstations Now  de facto  graphics acceleration standard Now managed by the Khronos industry consortium Available everywhere, from supercomputers to cell phones Alternative:  Direct3D provides similar functionality with a very different API for Microsoft Windows platforms [Marathon Oil visionarium] [ES2 tablet] [MacBook]
OpenGL as an Evolving Standard EXT  SGI SGIS SGIX  ARB  NV  Others  Others  44% of extensions are “core” or multi-vendor Lots of vendors have initiated extensions Extending OpenGL is industry-wide collaboration  ATI  APPLE  MESA  Source:  http://www.opengl.org/registry  (Dec 2008)
Forces Driving Improvements in Computer Graphics Human desire for Visual Intuition and Entertainment Embarrassing Parallelism of Graphics Increasing Semiconductor Density Particularly the hardware-amenable, latency tolerant nature of rasterization Particularly interactive video games Computer Graphics Moore’s Law
Key Trend in OpenGL Evolution Fixed-function Programmable Simple Configurability Complex Configurability Shaders! High-level languages
Many Perspectives on OpenGL Programmer’s view: Application Programming Interface (API) Accelerated access to 3D graphics hardware Performance and functionality improves with time Graphics Architect’s view: Detailed functional graphics pipeline Well suited to VLSI hardware design Software or Hardware System Designer’s view: Stable standard component for building larger system Platform neutral so fits into other systems well Examples:   WebGL, Apple’s compositing desktop Student’s view: Real-world implementation of graphics concepts Good pedantic structure for learning graphics Practical skill you can really use
Programmer’s View: OpenGL API Example Let’s draw a triangle glShadeModel ( GL_SMOOTH );  // smooth color interpolation glEnable ( GL_DEPTH_TEST );  // enable hidden surface removal glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);  glBegin (GL_TRIANGLES); {  // every 3 vertexes makes a triangle glColor4ub (255, 0, 0, 255);  // RGBA=(1,0,0,100%) glVertex3f (-0.8,  0.8,  0.3);  // XYZ=(-8/10,8/10,3/10) glColor4ub (0, 255, 0, 255);  // RGBA=(0,1,0,100%) glVertex3f ( 0.8,  0.8, -0.2);  // XYZ=(8/10,8/10,-2/10) glColor4ub (0, 0, 255, 255);  // RGBA=(0,0,1,100%) glVertex3f ( 0.0, -0.8, -0.2);  // XYZ=(0,-8/10,-2/10) }  glEnd (); Pro Tip:  use curly braces to “bracket” nested OpenGL usage; no semantic meaning, just highlights grouping
Initial Logical Coordinate System Think of drawing into a [-1,+1] 3  cube (-0.8,  0.8) (-0.8,  0.8) (0, -0.8) origin at (0,0)
Visualizing Normalized Device Coordinates What does this simple triangle look like with the [-1,+1] 3  cube’s coordinate system? We call this coordinate system “Normalize Device Coordinate” or NDC space Wire frame cube shows boundaries of NDC space From NDC views, you can see triangle isn’t “ flat” in the Z direction Two vertices have Z of -0.2—third has Z of 0.3
Programmer’s View: GLUT API Example Windowing code #include <GL/glut.h>  // includes necessary OpenGL headers void display() { // <<  insert code on prior slide here  >> glutSwapBuffers (); } void main(int argc, char **argv) {   // request double-buffered color window with depth buffer glutInitDisplayMode ( GLUT_RGBA  |  GLUT_DOUBLE  |  GLUT_DEPTH ); glutInit (&argc, argv); glutCreateWindow (“simple triangle”); glutDisplayFunc (display);  // function to render window glutMainLoop (); } FYI:  GLUT = OpenGL Utility Toolkit
Reductionism for Rendering Objects and Scenes Programmers want to render “objects” Say a fire truck or molecule Arranged relative to other objects (a scene) & then viewed Graphics pipeline approach—used by OpenGL and GPUs Break objects into geometry batches Batches may be meshes or “patches” Batches reduce to polygonal primitives Typically triangles But also lines, points, bitmaps, or images Geometric primitives are specified by vertices So vertices are assembled into primitives Primitives are rasterized into fragments Fragments are shaded Raster operations take shaded fragments and update the framebuffer
Programmer’s View:  Also Programming Shaders  inside  GPU Multiple  programmable  domains within the GPU Can be programmed in high-level language OpenGL Shading Language (GLSL) Geometry Program 3D Application or Game OpenGL API GPU Front End Vertex Assembly Vertex Shader Clipping, Setup, and Rasterization Fragment Shader Texture Fetch Raster Operations Framebuffer Access Memory Interface CPU – GPU Boundary OpenGL 3.3 Attribute Fetch Primitive Assembly Parameter Buffer Read programmable fixed-function Legend
Example Simple GLSL Shaders Vertex Shader Operates on each vertex of geometric primitives Passes through per-vertex color Transforms the vertex to match fixed-function processing Fragment Shader Operates on each fragment (think pixel) Outputs the fragment’s interpolated color to the framebuffer void main(void) { gl_FrontColor  =  gl_Color ; gl_Position  =  ftransform (); } void main(void) { gl_FragColor  =  gl_Color ; } Shaders are way more  interesting than these minimal examples
Examples of Complex Shaders
Building Up Shaders   ) + ( ( ) = Diffuse Gloss Specular Decal Result
OpenGL’s Design Philosophy High-performance Assumes hardware acceleration Defined by a specification Rather than a de-facto implementation Rendering state machine Procedural Not a window system, not a scene graph No initial sub-setting Extensible Data type rich Cross-platform Window system-independent core X Window System, Microsoft Windows, OS/2, OS X, etc. Multi-language bindings C, FORTRAN, etc. Not merely an API, rather a system Later had OpenGL ES subset for embedded devices
OpenGL state machine Complicated from inception
Higher-level View of OpenGL From OpenGL 3.0 specification, unchanged since 1.0
Evolved OpenGL Data Flow vertex shading rasterization & fragment shading texture raster operations framebuffer pixel unpack pixel pack vertex puller client memory pixel transfer glReadPixels / glCopyPixels / glCopyTex{Sub}Image glDrawPixels glBitmap glCopyPixels glTex{Sub}Image glCopyTex{Sub}Image glDrawElements glDrawArrays selection / feedback / transform feedback glVertex* glColor* glTexCoord* etc.  blending depth testing stencil testing accumulation storage operations
Buffer-centric Evolution Data moves onto GPU, away from CPU Apps on CPUs just too slow at moving data otherwise Vertex Array Buffer Object (VaBO) Transform Feedback Buffer (XBO) Parameter Buffer Object (PaBO) Pixel Unpack Buffer (PuBO) Pixel Pack Buffer (PpBO) Uniform Buffer Object (UBO) Texture Buffer Object (TexBO) Vertex Puller Vertex Shading Geometry Shading Fragment Shading Texturing Array Element Buffer Object (VeBO) Pixel Pipeline vertex data texel data pixel data parameter data glBegin, glDrawElements, etc. glDrawPixels, glTexImage2D, etc. glReadPixels, etc. Framebuffer
Extensibility OpenGL is evolved via extensions Legalistic—expressed as “amending” OpenGL’s detailed specification Coordinated through Khronos But vendors don’t need any blessing or permission to make extensions Allows priorities to be shaped quickly Example :  Direct3Dism extensions have greatly reduced functional incompatibilities keeping Direct3D apps migrate to OpenGL All the latest GPU features available in OpenGL Example:   Tessellation shaders
Software and Hardware Architectures Incorporating 3D Pipelines X Window System GeForce 6 Architecture framebuffer updates vertex processing rasterization shading X server Graphics Kernel driver GPU Hardware OpenGL driver Application OpenGL library GLUT X client libraries Operating  system kernel  (Linux)
Hardware Platforms depending on the OpenGL Architecture Workstation PCs Consumer PCs High-end Visual Computing Solution (VCS) Embedded Applications Handheld Devices Game Consoles Conventional PC OpenGL Products  Unconventional non-PC OpenGL platforms
Student’s View of OpenGL You can learn OpenGL gradually Lots of its can be ignored for now The “classic” API is particularly nice “Deprecation” has ruined the pedagogical niceness of OpenGL; ignore deprecation Plenty of documentation and sample code Makes concrete the abstract graphics pipeline for rasterization
Next Lecture 3D Viewing How are 3D scenes processed so they can be turned into an image on the screen? Expect a short quiz on today’s lecture Easy questions Assignments Reading Chapter 1, pages 1-38 Makes sure your CS Unix account is active Homework next time will be compiling a simple OpenGL example

More Related Content

PPT
CS 354 More Graphics Pipeline
PDF
Computer graphics curves and surfaces (1)
PPTX
Cuda Architecture
DOCX
Uml Common Mechanism
PDF
Graphics a buffer
PPT
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
PDF
Final Exam OS fall 2012-2013 with answers
PPS
Overview of 2D and 3D Transformation
CS 354 More Graphics Pipeline
Computer graphics curves and surfaces (1)
Cuda Architecture
Uml Common Mechanism
Graphics a buffer
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
Final Exam OS fall 2012-2013 with answers
Overview of 2D and 3D Transformation

What's hot (20)

PPTX
Introduction to computer graphics
PPTX
Output primitives computer graphics c version
PDF
Getting started with RISC-V verification what's next after compliance testing
PPTX
Bezier Curve
PDF
Unite2019 HLOD를 활용한 대규모 씬 제작 방법
DOCX
Bezier Curve in Computer Graphics.docx
PPTX
Curve and text clipping
PPTX
Huffman coding
PDF
Basics of Image Processing using MATLAB
PDF
Daa notes 2
PPTX
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
PPTX
Raster scan systems with video controller and display processor
PPT
Introduction to computer graphics part 1
PPT
CS 354 Graphics Math
PPT
Two dimensional geometric transformations
PPT
Circle drawing algo.
PPTX
Developing a Map Reduce Application
PPTX
Superscalar Architecture_AIUB
PDF
3D Transformation
PDF
Unit 3
Introduction to computer graphics
Output primitives computer graphics c version
Getting started with RISC-V verification what's next after compliance testing
Bezier Curve
Unite2019 HLOD를 활용한 대규모 씬 제작 방법
Bezier Curve in Computer Graphics.docx
Curve and text clipping
Huffman coding
Basics of Image Processing using MATLAB
Daa notes 2
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Raster scan systems with video controller and display processor
Introduction to computer graphics part 1
CS 354 Graphics Math
Two dimensional geometric transformations
Circle drawing algo.
Developing a Map Reduce Application
Superscalar Architecture_AIUB
3D Transformation
Unit 3
Ad

Viewers also liked (20)

PPT
CS 354 GPU Architecture
PPT
CS 354 Project 1 Discussion
PPT
NVIDIA OpenGL in 2016
PDF
Programming with NV_path_rendering: An Annex to the SIGGRAPH Asia 2012 paper...
DOCX
Audit
PDF
Programming using opengl in visual c++
TXT
Robot by gulnaz
PDF
Creating a game using C++, OpenGL and Qt
PPT
CS 354 Final Exam Review
PPT
CS 354 Performance Analysis
PPT
CS 354 Procedural Methods
PPTX
Robot In OpenGL Using Line Function
PPTX
Robust Stenciled Shadow Volumes
PPT
CS 354 Acceleration Structures
PPT
CS 354 Shadows (cont'd) and Scene Graphs
PPT
CS 354 Global Illumination
PPT
CS 354 Shadows
PPT
CS 354 Surfaces, Programmable Tessellation, and NPR Graphics
PPT
CS 354 Viewing Stuff
PDF
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
CS 354 GPU Architecture
CS 354 Project 1 Discussion
NVIDIA OpenGL in 2016
Programming with NV_path_rendering: An Annex to the SIGGRAPH Asia 2012 paper...
Audit
Programming using opengl in visual c++
Robot by gulnaz
Creating a game using C++, OpenGL and Qt
CS 354 Final Exam Review
CS 354 Performance Analysis
CS 354 Procedural Methods
Robot In OpenGL Using Line Function
Robust Stenciled Shadow Volumes
CS 354 Acceleration Structures
CS 354 Shadows (cont'd) and Scene Graphs
CS 354 Global Illumination
CS 354 Shadows
CS 354 Surfaces, Programmable Tessellation, and NPR Graphics
CS 354 Viewing Stuff
OpenGL NVIDIA Command-List: Approaching Zero Driver Overhead
Ad

Similar to CS 354 Introduction (20)

PPT
01 first
PDF
Ball Collecting game report
PDF
TICTACTOE GAME MANAGEMENT SYSTEM PROJECT REPORT.
PPT
Introduction to 2D/3D Graphics
PDF
Module- I (CO-I) Fundamentals of Computer Graphics- Product cycle, sequential...
PDF
CG mini project
PDF
Bouncing ball content management system project report.pdf
PDF
Hacking the Kinect with GAFFTA Day 1
PPT
CS 354 Programmable Shading
PDF
AN INTERNSHIP REPORT ON AIRPLANE GAME MANAGEMENT SYSTEM PROJECT REPORT.
PPTX
Graphics Libraries
PDF
CGV Project Report.pdf
PDF
VisionizeBeforeVisulaize_IEVC_Final
PDF
1 introduction computer graphics
PPT
Introduction to OpenGL.ppt
DOCX
Ha4 displaying 3 d polygon animations
PPT
Topic 1 Introduction to Computer Graphics.ppt
PPT
openGL basics for sample program (1).ppt
PPT
openGL basics for sample program.ppt
01 first
Ball Collecting game report
TICTACTOE GAME MANAGEMENT SYSTEM PROJECT REPORT.
Introduction to 2D/3D Graphics
Module- I (CO-I) Fundamentals of Computer Graphics- Product cycle, sequential...
CG mini project
Bouncing ball content management system project report.pdf
Hacking the Kinect with GAFFTA Day 1
CS 354 Programmable Shading
AN INTERNSHIP REPORT ON AIRPLANE GAME MANAGEMENT SYSTEM PROJECT REPORT.
Graphics Libraries
CGV Project Report.pdf
VisionizeBeforeVisulaize_IEVC_Final
1 introduction computer graphics
Introduction to OpenGL.ppt
Ha4 displaying 3 d polygon animations
Topic 1 Introduction to Computer Graphics.ppt
openGL basics for sample program (1).ppt
openGL basics for sample program.ppt

More from Mark Kilgard (20)

PDF
D11: a high-performance, protocol-optional, transport-optional, window system...
PPT
Computers, Graphics, Engineering, Math, and Video Games for High School Students
PPT
NVIDIA OpenGL and Vulkan Support for 2017
PPT
NVIDIA OpenGL 4.6 in 2017
PPT
Virtual Reality Features of NVIDIA GPUs
PPTX
Migrating from OpenGL to Vulkan
PPT
EXT_window_rectangles
PPT
OpenGL for 2015
PPT
Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...
PDF
Accelerating Vector Graphics Rendering using the Graphics Hardware Pipeline
PPT
NV_path rendering Functional Improvements
PPTX
OpenGL 4.5 Update for NVIDIA GPUs
PPT
SIGGRAPH Asia 2012: GPU-accelerated Path Rendering
PPT
SIGGRAPH Asia 2012 Exhibitor Talk: OpenGL 4.3 and Beyond
PPT
GPU accelerated path rendering fastforward
PDF
GPU-accelerated Path Rendering
PPT
SIGGRAPH 2012: GPU-Accelerated 2D and Web Rendering
PPT
SIGGRAPH 2012: NVIDIA OpenGL for 2012
PPT
GTC 2012: GPU-Accelerated Path Rendering
PPT
GTC 2012: NVIDIA OpenGL in 2012
D11: a high-performance, protocol-optional, transport-optional, window system...
Computers, Graphics, Engineering, Math, and Video Games for High School Students
NVIDIA OpenGL and Vulkan Support for 2017
NVIDIA OpenGL 4.6 in 2017
Virtual Reality Features of NVIDIA GPUs
Migrating from OpenGL to Vulkan
EXT_window_rectangles
OpenGL for 2015
Slides: Accelerating Vector Graphics Rendering using the Graphics Hardware Pi...
Accelerating Vector Graphics Rendering using the Graphics Hardware Pipeline
NV_path rendering Functional Improvements
OpenGL 4.5 Update for NVIDIA GPUs
SIGGRAPH Asia 2012: GPU-accelerated Path Rendering
SIGGRAPH Asia 2012 Exhibitor Talk: OpenGL 4.3 and Beyond
GPU accelerated path rendering fastforward
GPU-accelerated Path Rendering
SIGGRAPH 2012: GPU-Accelerated 2D and Web Rendering
SIGGRAPH 2012: NVIDIA OpenGL for 2012
GTC 2012: GPU-Accelerated Path Rendering
GTC 2012: NVIDIA OpenGL in 2012

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Review of recent advances in non-invasive hemoglobin estimation
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Spectral efficient network and resource selection model in 5G networks
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
Network Security Unit 5.pdf for BCA BBA.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Dropbox Q2 2025 Financial Results & Investor Presentation
The AUB Centre for AI in Media Proposal.docx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
Unlocking AI with Model Context Protocol (MCP)
Per capita expenditure prediction using model stacking based on satellite ima...
Building Integrated photovoltaic BIPV_UPV.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

CS 354 Introduction

  • 1. CS 354 Introduction Mark Kilgard University of Texas January 17, 2012
  • 2. CS 354—Computer Graphics Instructor: Mark Kilgard Principal Software Engineer, NVIDIA Previously at Silicon Graphics Teaching Assistant: Randall Smith Ph.D. student with Dr. Fussell TA’ed the course last semester Burdine Hall (BUR) 116 Tuesday/Thursday, 9:30-11:00 a.m.
  • 3. Expectations For us Teach practical graphics expertise Well-prepared lectures Grades fairly reflect your participation and performance Available to you Use my office hours Other times, use Randy If not satisfied, contact me [email_address] For you Attendance at every class Expect regular quizzes at the beginning of class Programming assignments You need to know C/C++ Use office hours if you need help No cheating
  • 4. Grading Testing 60% Daily quizzes 10% 2-3 questions, easy Homework 10% Occasional, mostly math questions Exams 40% Mid-term 15% Final 25% Software projects 40% Simple Rendering Object loader Interaction Shading Performance analysis
  • 5. Textbook Interactive Computer Graphics: A Top-Down Approach With Shader-Based OpenGL by Edward Angel and Dave Shreiner Addison-Wesley, 6th edition Regular readings assigned Match up with lecture topics
  • 6. Helpful Resources Learning OpenGL OpenGL-oriented books Supplemental books OpenGL Programming Guide a.k.a. “the red book” OpenGL SuperBible OpenGL A Primer Eric Lengyel’s Mathematics for 3D Game Programming and Computer Graphics Real-Time Rendering by Eric Haines, Tomas Akenine-Moller, Eric Haines, Naty Hoffman
  • 7. Computer Graphics Nexus of several disciplines Human Perception Artistic Expression Physics of Light Geometry and Mathematics of Surfaces Computer Science VLSI Hardware Design Display & Input Technology Animation & Simulation
  • 8. Roles for Computer Graphics [Pixar 2010] Story telling Product design [CATIA] Roles for Computer Graphics
  • 9. Roles for Computer Graphics Training [Commercial simulators] Gaming [Skyrim]
  • 10. Roles for Computer Graphics User interfaces [Android 4.0] Navigation [Audi]
  • 11. Roles for Computer Graphics Printing Digital imaging & video [HP Deskjet] [Canon]
  • 12. What does computer graphics study? Computer-based simulation of Shape Appearance Motion [Litke et.al. 2001] [Chai & Hodgins, 2005] [Sloan et.al. 2005]
  • 13. Not covered in the class Digital content creation No Photoshop, no Maya or 3D Studio Max Computer Science class, not an art class C/C++ programming I expect you know C or C++ under Linux Not just the language Need to know debugging and software practices Since course’s programming projects assume Linux software development Use the Computer Science labs (ESN or Painter)
  • 14. Visual Thinking Human visual system = highest bandwidth input to your brain Very natural to want computers “feeding” this input to your brain Because people think visually Innate intuition for 3D imagery in particular Computer graphics Takes an abstract representation of a “scene” within a computer’s memory and converts it to a concrete signal (an image, or animating images) representing a view of that scene Computer graphics practitioners have a good practical and theoretical understanding of how to do this Amazing progress in the last 40 years Your brain Takes concrete signals (images, the visual world) and converts those signals (back!) into an abstract representation of a scene We have only the most rudimentary notions of how this process works Teaching a computer to do this is the field of “computer vision”
  • 15. Reductionist Approach Can’t simply “take a picture” like a camera Instead images are “synthesized” from an abstract model of a scene and its view Must build graphics out of little bits of work and data Philosophers and scientists break down phenomenon to smallest observable units Examples Philosophical atoms (Leucippus, ancient) Triangles (Plato, ancient) Chemical atoms (Dalton, pre-modern) Physical atoms (Bohr, modern) Sub-atomic quantum particles, waves, strings Reductionism in graphics Pixels, vertexes, and triangles (Plato redux?) Discretization pervades, ideal for digital computers
  • 16. Your Modern World View: Discrete Information, Particularly Images You believe in digital information Impossible to avoid this belief in a modern, computerized world Text is digital, video is digital, music is digital, communication is digital, even identity is becoming digital You believe exact copies are possible, even common Pervasive new belief that’s incognizant to world just 50 years ago Discrete images implies pixels Descartes’s Cartesian plane computerized Image ≈ grid of discrete color So images are simply numbers So can be processed as numbers!
  • 17. Shape: Objects to Triangles Digital artists approximate solid object shape with meshes of triangles Was Plato right? More triangles makes the mesh an increasingly accurate approximation of the bunny shape
  • 18. What will you learn Fundamentals of computer graphics Transformations and viewing Rasterization and ray tracing Lighting and shading Graphics hardware technology Mathematics for computer graphics Practical graphics programming OpenGL programming Shader programming Performance analysis
  • 19. Expect programming projects using OpenGL Explicitly not just an “OpenGL” class But you will learn and use OpenGL When relevant Direct3D is discussed too You’ll use GLUT so programs can work on Windows, Mac, and Linux Plenty of resources to learn OpenGL www.opengl.org
  • 20. What is OpenGL? Its specification is titled “The OpenGL Graphics System ” Not just for 3D graphics; imaging too “ GL” standard for “Graphics Library” “ Open” means industry standard meant for broad adoption with liberal licensing Standardized in 1992 By Silicon Graphics And others: Compaq, DEC, Intel, IBM, Microsoft Originally meant for Unix and Windows workstations Now de facto graphics acceleration standard Now managed by the Khronos industry consortium Available everywhere, from supercomputers to cell phones Alternative: Direct3D provides similar functionality with a very different API for Microsoft Windows platforms [Marathon Oil visionarium] [ES2 tablet] [MacBook]
  • 21. OpenGL as an Evolving Standard EXT SGI SGIS SGIX ARB NV Others Others 44% of extensions are “core” or multi-vendor Lots of vendors have initiated extensions Extending OpenGL is industry-wide collaboration ATI APPLE MESA Source: http://www.opengl.org/registry (Dec 2008)
  • 22. Forces Driving Improvements in Computer Graphics Human desire for Visual Intuition and Entertainment Embarrassing Parallelism of Graphics Increasing Semiconductor Density Particularly the hardware-amenable, latency tolerant nature of rasterization Particularly interactive video games Computer Graphics Moore’s Law
  • 23. Key Trend in OpenGL Evolution Fixed-function Programmable Simple Configurability Complex Configurability Shaders! High-level languages
  • 24. Many Perspectives on OpenGL Programmer’s view: Application Programming Interface (API) Accelerated access to 3D graphics hardware Performance and functionality improves with time Graphics Architect’s view: Detailed functional graphics pipeline Well suited to VLSI hardware design Software or Hardware System Designer’s view: Stable standard component for building larger system Platform neutral so fits into other systems well Examples: WebGL, Apple’s compositing desktop Student’s view: Real-world implementation of graphics concepts Good pedantic structure for learning graphics Practical skill you can really use
  • 25. Programmer’s View: OpenGL API Example Let’s draw a triangle glShadeModel ( GL_SMOOTH ); // smooth color interpolation glEnable ( GL_DEPTH_TEST ); // enable hidden surface removal glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glBegin (GL_TRIANGLES); { // every 3 vertexes makes a triangle glColor4ub (255, 0, 0, 255); // RGBA=(1,0,0,100%) glVertex3f (-0.8, 0.8, 0.3); // XYZ=(-8/10,8/10,3/10) glColor4ub (0, 255, 0, 255); // RGBA=(0,1,0,100%) glVertex3f ( 0.8, 0.8, -0.2); // XYZ=(8/10,8/10,-2/10) glColor4ub (0, 0, 255, 255); // RGBA=(0,0,1,100%) glVertex3f ( 0.0, -0.8, -0.2); // XYZ=(0,-8/10,-2/10) } glEnd (); Pro Tip: use curly braces to “bracket” nested OpenGL usage; no semantic meaning, just highlights grouping
  • 26. Initial Logical Coordinate System Think of drawing into a [-1,+1] 3 cube (-0.8, 0.8) (-0.8, 0.8) (0, -0.8) origin at (0,0)
  • 27. Visualizing Normalized Device Coordinates What does this simple triangle look like with the [-1,+1] 3 cube’s coordinate system? We call this coordinate system “Normalize Device Coordinate” or NDC space Wire frame cube shows boundaries of NDC space From NDC views, you can see triangle isn’t “ flat” in the Z direction Two vertices have Z of -0.2—third has Z of 0.3
  • 28. Programmer’s View: GLUT API Example Windowing code #include <GL/glut.h> // includes necessary OpenGL headers void display() { // << insert code on prior slide here >> glutSwapBuffers (); } void main(int argc, char **argv) { // request double-buffered color window with depth buffer glutInitDisplayMode ( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); glutInit (&argc, argv); glutCreateWindow (“simple triangle”); glutDisplayFunc (display); // function to render window glutMainLoop (); } FYI: GLUT = OpenGL Utility Toolkit
  • 29. Reductionism for Rendering Objects and Scenes Programmers want to render “objects” Say a fire truck or molecule Arranged relative to other objects (a scene) & then viewed Graphics pipeline approach—used by OpenGL and GPUs Break objects into geometry batches Batches may be meshes or “patches” Batches reduce to polygonal primitives Typically triangles But also lines, points, bitmaps, or images Geometric primitives are specified by vertices So vertices are assembled into primitives Primitives are rasterized into fragments Fragments are shaded Raster operations take shaded fragments and update the framebuffer
  • 30. Programmer’s View: Also Programming Shaders inside GPU Multiple programmable domains within the GPU Can be programmed in high-level language OpenGL Shading Language (GLSL) Geometry Program 3D Application or Game OpenGL API GPU Front End Vertex Assembly Vertex Shader Clipping, Setup, and Rasterization Fragment Shader Texture Fetch Raster Operations Framebuffer Access Memory Interface CPU – GPU Boundary OpenGL 3.3 Attribute Fetch Primitive Assembly Parameter Buffer Read programmable fixed-function Legend
  • 31. Example Simple GLSL Shaders Vertex Shader Operates on each vertex of geometric primitives Passes through per-vertex color Transforms the vertex to match fixed-function processing Fragment Shader Operates on each fragment (think pixel) Outputs the fragment’s interpolated color to the framebuffer void main(void) { gl_FrontColor = gl_Color ; gl_Position = ftransform (); } void main(void) { gl_FragColor = gl_Color ; } Shaders are way more interesting than these minimal examples
  • 33. Building Up Shaders   ) + ( ( ) = Diffuse Gloss Specular Decal Result
  • 34. OpenGL’s Design Philosophy High-performance Assumes hardware acceleration Defined by a specification Rather than a de-facto implementation Rendering state machine Procedural Not a window system, not a scene graph No initial sub-setting Extensible Data type rich Cross-platform Window system-independent core X Window System, Microsoft Windows, OS/2, OS X, etc. Multi-language bindings C, FORTRAN, etc. Not merely an API, rather a system Later had OpenGL ES subset for embedded devices
  • 35. OpenGL state machine Complicated from inception
  • 36. Higher-level View of OpenGL From OpenGL 3.0 specification, unchanged since 1.0
  • 37. Evolved OpenGL Data Flow vertex shading rasterization & fragment shading texture raster operations framebuffer pixel unpack pixel pack vertex puller client memory pixel transfer glReadPixels / glCopyPixels / glCopyTex{Sub}Image glDrawPixels glBitmap glCopyPixels glTex{Sub}Image glCopyTex{Sub}Image glDrawElements glDrawArrays selection / feedback / transform feedback glVertex* glColor* glTexCoord* etc. blending depth testing stencil testing accumulation storage operations
  • 38. Buffer-centric Evolution Data moves onto GPU, away from CPU Apps on CPUs just too slow at moving data otherwise Vertex Array Buffer Object (VaBO) Transform Feedback Buffer (XBO) Parameter Buffer Object (PaBO) Pixel Unpack Buffer (PuBO) Pixel Pack Buffer (PpBO) Uniform Buffer Object (UBO) Texture Buffer Object (TexBO) Vertex Puller Vertex Shading Geometry Shading Fragment Shading Texturing Array Element Buffer Object (VeBO) Pixel Pipeline vertex data texel data pixel data parameter data glBegin, glDrawElements, etc. glDrawPixels, glTexImage2D, etc. glReadPixels, etc. Framebuffer
  • 39. Extensibility OpenGL is evolved via extensions Legalistic—expressed as “amending” OpenGL’s detailed specification Coordinated through Khronos But vendors don’t need any blessing or permission to make extensions Allows priorities to be shaped quickly Example : Direct3Dism extensions have greatly reduced functional incompatibilities keeping Direct3D apps migrate to OpenGL All the latest GPU features available in OpenGL Example: Tessellation shaders
  • 40. Software and Hardware Architectures Incorporating 3D Pipelines X Window System GeForce 6 Architecture framebuffer updates vertex processing rasterization shading X server Graphics Kernel driver GPU Hardware OpenGL driver Application OpenGL library GLUT X client libraries Operating system kernel (Linux)
  • 41. Hardware Platforms depending on the OpenGL Architecture Workstation PCs Consumer PCs High-end Visual Computing Solution (VCS) Embedded Applications Handheld Devices Game Consoles Conventional PC OpenGL Products Unconventional non-PC OpenGL platforms
  • 42. Student’s View of OpenGL You can learn OpenGL gradually Lots of its can be ignored for now The “classic” API is particularly nice “Deprecation” has ruined the pedagogical niceness of OpenGL; ignore deprecation Plenty of documentation and sample code Makes concrete the abstract graphics pipeline for rasterization
  • 43. Next Lecture 3D Viewing How are 3D scenes processed so they can be turned into an image on the screen? Expect a short quiz on today’s lecture Easy questions Assignments Reading Chapter 1, pages 1-38 Makes sure your CS Unix account is active Homework next time will be compiling a simple OpenGL example