Graphics Hardware and OpenGL

Similar documents
Models and Architectures

Basic Graphics Programming

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

Graphics Programming

Computer Graphics. OpenGL

Programming with OpenGL Part 3: Three Dimensions

Programming with OpenGL Part 2: Complete Programs Computer Graphics I, Fall

Basic Graphics Programming

OpenGL refresher. Advanced Computer Graphics 2012

11/1/13. Basic Graphics Programming. Teaching Assistant. What is OpenGL. Course Producer. Where is OpenGL used. Graphics library (API)

Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using

OpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University

OpenGL/GLUT Intro. Week 1, Fri Jan 12

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

C++ is Fun Part 13 at Turbine/Warner Bros.! Russell Hanson

Introduction to OpenGL Week 1

Objectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1

Lecture 4 of 41. Lab 1a: OpenGL Basics

Introduction to Computer Graphics with WebGL

Lecture 3. Understanding of OPenGL programming

1/12/11. Basic Graphics Programming. What is OpenGL. OpenGL is cross-platform. How does OpenGL work. How does OpenGL work (continued) The result

Introduction to OpenGL

3D computer graphics: geometric modeling of objects in the computer and rendering them

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

3D Graphics and OpenGl. First Steps

Precept 2 Aleksey Boyko February 18, 2011

Introduction to Computer Graphics with OpenGL/GLUT

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008


1.2 Basic Graphics Programming

Lectures OpenGL Introduction

Graphics Programming. August 31, Programming of the Sierpinski gasket. Programming with OpenGL and C/C++

CS559: Computer Graphics. Lecture 12: OpenGL Transformation Li Zhang Spring 2008

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

Rendering Pipeline/ OpenGL

Programming using OpenGL: A first Introduction

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL

Programming with OpenGL Part 1: Background

Books, OpenGL, GLUT, GLUI, CUDA, OpenCL, OpenCV, PointClouds, and G3D

Assignment 1. Simple Graphics program using OpenGL

Announcements OpenGL. Computer Graphics. Autumn 2009 CS4815

Bob s Concise Introduction to Doxygen

Lecturer Athanasios Nikolaidis

Transformation Pipeline

to OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

Computer Graphics (Basic OpenGL)

RECITATION - 1. Ceng477 Fall

GL_COLOR_BUFFER_BIT, GL_PROJECTION, GL_MODELVIEW

Computer Graphics. Bing-Yu Chen National Taiwan University

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

Books, OpenGL, GLUT, CUDA, OpenCL, OpenCV, PointClouds, G3D, and Qt

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

Rasterization Overview

Intro to OpenGL III. Don Fussell Computer Science Department The University of Texas at Austin

Announcement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12

Computer graphic -- Programming with OpenGL I

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

Visualizing Molecular Dynamics

Exercise 1 Introduction to OpenGL

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

COMP 371/4 Computer Graphics Week 1

Announcements OpenGL. Computer Graphics. Spring CS4815

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

OpenGL JOGL. OpenGL & JOGL. Shaoting Zhang, or Tony. September 12, 2007

Computer Graphics I Lecture 11

// double buffering and RGB glutinitdisplaymode(glut_double GLUT_RGBA); // your own initializations

CS 464 Review. Review of Computer Graphics for Final Exam

Computer graphics MN1

UNIT 7 LIGHTING AND SHADING. 1. Explain phong lighting model. Indicate the advantages and disadvantages. (Jun2012) 10M

Using OpenGL with CUDA

Pipeline Operations. CS 4620 Lecture 14

Topics and things to know about them:

CSE4030 Introduction to Computer Graphics

CHAPTER 1 Graphics Systems and Models 3

Duc Nguyen CSE 420 Computer Graphics 10/10/2018 Homework 1

COMPUTER GRAPHICS LAB # 3

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

The Traditional Graphics Pipeline

CS 432 Interactive Computer Graphics

Graphics Hardware and Display Devices

Rendering Pipeline/ OpenGL

Intro to OpenGL II. Don Fussell Computer Science Department The University of Texas at Austin

Cameras (and eye) Ideal Pinhole. Real Pinhole. Real + lens. Depth of field

The Traditional Graphics Pipeline

VR-programming tools (procedural) More VRML later in this course! (declarative)

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

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

Computer Graphics, Chapt 08

Graphics Programming. 1. The Sierpinski Gasket. Chapter 2. Introduction:

Announcements. Submitting Programs Upload source and executable(s) (Windows or Mac) to digital dropbox on Blackboard

Graphics Pipeline & APIs

CSE4030 Introduction to Computer Graphics

Interaction Computer Graphics I Lecture 3

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

2/3/16. Interaction. Triangles (Clarification) Choice of Programming Language. Buffer Objects. The CPU-GPU bus. CSCI 420 Computer Graphics Lecture 3

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

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Transcription:

Graphics Hardware and OpenGL Ubi Soft, Prince of Persia: The Sands of Time What does graphics hardware have to do fast? Camera Views Different views of an object in the world 1

Camera Views Lines from each point on the image are drawn through the center of the camera lens (the center of projection (COP)). Camera Views Many camera parameters For a physical camera: position (3) orientation (3) lens (field of view) 2

Camera Projections Orthographic projection long telephoto lens. Flat but preserving distances and shapes. All the projectors are now parallel. Camera Projections Perspective projection Example: pin hole camera Objects farther away are smaller in size 3

Camera Transformations Camera positioning just results in more transformations on the objects: Transformations that position the object relative to the camera up eye COP Clipping Not everything is visible on the screen 4

Rasterizer Transforms pixel values in world coordinates to pixel values in screen coordinates Shading: Material Properties Ambient: same at every point on the surface Diffuse: scattered light independent of angle (rough) Specular: dependent on angle (shiny) 5

Light Sources Point light sources are common: Special Tricks Gouraud Shading: Compute an appropriate color for each vertex, then smooth-shade between the different vertex colors. Shadows on ground plane: Render from the position of the light source and create a shadow map 6

So... How does the graphics hardware make these operations fast? OpenGL C programming language OpenGL libraries for defining a 3D scene convert scene description to pixels use state variables (current color, current transform...) platform independent GLUT libraries handle windows, menus, keyboard input 7

OpenGL Hello World example int main (int argc, char *argv[]) { glutinit(&argc, argv); glutinitdisplaymode(glut_rgb); glutinitwindowsize(640, 480); glutcreatewindow( Hello World ); glutdisplayfunc(display); } glutmainloop( ); return(0); OpenGL Hello World example void display( ) { glortho(-1, 1, -1, 1, -1, 1); glclearcolor(0.5, 0.5, 0.5, 1); glclear(gl_color_buffer_bit); } glcolor3f(1, 0, 0); glbegin(gl_triangles); glvertex2f(-0.5, -0.5); glvertex2f( 0.5, -0.5); glvertex2f( 0, 0.5); glend( ); glflush( ); 8

OpenGL Hello World example You also need headers: #include <stdlib.h> #include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h>..and a Makefile that links in the proper libraries See the starter code! OpenGL functionality --- Primitives 9

Primitives Why triangles, quads, and strips? Specifying Primitives shapes.exe Code for all of today s examples available from http://www.xmission.com/~nate/tutors.html 10

Primitives: Material Properties glcolor3f(r,g,b); All subsequent primitives will be this color. Colors are not attached to objects. glcolor3f(r,g,b) changes the system state. Everyone who learns GL gets bitten by this! Red, green & blue color model. Components are from 0-1. Primitives: Material Properties Many other material properties available: glenable(gl_polygon_stipple); glpolygonstipple(mask); /* 32x32 pattern of bits */ gldisable (GL_POLYGON_STIPPLE); 11

Light Sources lightposition.exe Transforms transformation.exe 12

Camera Transformations Alternative to glortho void glulookat (eyex,eyey,eyez, centerx,centery,centerz, upx,upy,upz ) up eye COP Graphics Hardware What alternatives are there to the triangles-through-the-pipeline approach? 13

Pixel Planes and Pixel Flow (UNC) http://www.cs.unc.edu/~pxfl/ Pixel Planes: programmable processor per pixel fast rasterization of single triangle hey pixels, figure out if you are in this triangle what happens when triangles get very small? Pixel Planes and Pixel Flow (UNC) Pixel-Flow: processors each take a subset of the geometry and render a full-size image images are then combined using depth information 14

Talisman (Microsoft) http://research.microsoft.com/msrsiggraph/96/talisman/ Observation: an image is usually much like the one that preceded it in an animation. Goal: a $200-300 board image-based rendering cache images of rendered geometry re-use with affine image warping (sophisticated sprites) re-render only when necessary to reduce bandwidth and computational cost Current & Future Issues Geometry compression (far beyond triangle strips) Progressive transmission (fill in detail) Alternative modeling schemes (not polygon soup) Parametric surfaces, implicit surfaces, subdivision surfaces Generalized texture mapping: displacement mapping, light mapping Programmable shaders Beyond just geometry: dynamics, collision detection, AI, 15

Admin Assignment goes out Tuesday You should have Wean Hall 5336 access My office hours are Tuesday 1-2pm (or send email to set up an appointment) The OpenGL book (linked off the web page) is quite good --- make use of it as a resource! 16