Linear Interpolation, Brief Introduction to OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, September.

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS SOFTWARE.
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
In the name of God Computer Graphics Bastanfard.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Further Programming for 3D applications CE Introduction to Further Programming for 3D application Bob Hobbs Faculty of Computing, Engineering and.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Introduction to Computer Graphics Ed Angel Professor of Computer Science, Electrical and.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
Ch 1 Intro to Graphics page 1CS 367 First Day Agenda Best course you have ever had (survey) Info Cards Name, , Nickname C / C++ experience, EOS experience.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
CS 480/680 Computer Graphics Course Overview Dr. Frederick C Harris, Jr. Fall 2012.
Basic OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, September 10, 2003.
Polygon Lists & 3-D File Formats Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, February 18, 2002.
CSC 461: Lecture 41 CSC461: Lecture 4 Introduction to OpenGL Objectives: Development of the OpenGL API OpenGL Architecture -- OpenGL as a state machine.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
Data Structures for Scenes, The Basics of Scene Graphs Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday,
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Graphics Systems and OpenGL. Business of Generating Images Images are made up of pixels.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Computer Graphics I, Fall 2008 Introduction to Computer Graphics.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 CS4610/7610: Introduction to Computer Graphics.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Computer Graphics Week2 –Creating a Picture. Steps for creating a picture Creating a model Perform necessary transformation Lighting and rendering the.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Bézier Curves & Surfaces Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, March 1, 2004.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
More on Ray Tracing Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, April 14, 2004.
Introduction to Input/Interaction Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 19, 2003.
Chapter 1 Graphics Systems and Models Models and Architectures.
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Graphics Programming. Graphics Functions We can think of the graphics system as a black box whose inputs are function calls from an application program;
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Computer Graphics (Fall 2003) COMS 4160, Lecture 5: OpenGL 1 Ravi Ramamoorthi Many slides courtesy Greg Humphreys.
Photorealistic Rendering vs. Interactive 3D Graphics
Week 2 - Friday CS361.
Computer Graphics Lecture 32
Introduction to OpenGL
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Understanding Theory and application of 3D
Models and Architectures
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Projection in 3-D Glenn G. Chappell
Display Lists & Text Glenn G. Chappell
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Lecture 13 Clipping & Scan Conversion
Introduction to Computer Graphics
Models and Architectures
Models and Architectures
CS297 Graphics with Java and OpenGL
Introduction to OpenGL
Presentation transcript:

Linear Interpolation, Brief Introduction to OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, September 8, 2003

8 Sep 2003CS 3812 Review: Course Overview — Goals Students will: Gain an overall understanding of 3-D graphics, based on the synthetic-camera model, implemented with a rendering pipeline. Learn to use a professional-quality graphics API (OpenGL) to do 3-D graphics. Learn simple event-driven programming. Learn to deal with issues and tools involved in 3-D graphics: transformations, viewing, hidden-surface removal, lighting. Understand and be able to use facilities for rendering complex scenes using simple primitives (hierarchical objects, texturing, etc.). Understand basic issues/algorithms involved in rasterization, clipping. Demonstrate proficiency by writing 10–11 short graphics programs in C/C++.

8 Sep 2003CS 3813 Review: Introduction to CG [1/4] In 2-D CG, we often think in terms of screen positions. Put this object in that spot in the image. So the scene “lives” on the screen. In 3-D CG, the user is (usually) inside the scene. The screen (or other image) is a (movable?) window through which the user looks at the scene. Therefore, we base our graphics on the synthetic camera model.

8 Sep 2003CS 3814 Review: Introduction to CG [2/4] We base our 3-D viewing on a model similar to a camera. A point is chosen (the center of projection). Given an object in the scene, draw a line from it, through the center of projection, to the image. The image lies in a plane, like film in a film camera, or the sensor array in a digital camera. Where this line hits the image is where the object appears in the image. This model is similar to the way the human visual system works. How is it different? What pitfalls might this model have?

8 Sep 2003CS 3815 Review: Introduction to CG [3/4] Images of 3-D scenes are generated in two steps: Modeling Rendering Modeling means producing a precise description of a scene, generally in terms of graphics primitives. Primitives may be points, lines, polygons, bitmapped images, various types of curves, etc. Rendering means producing an image based on the model. Images are produced in a frame buffer. A modern frame buffer is a raster: a 2-D array of pixels. This class focuses on rendering.

8 Sep 2003CS 3816 Review: Introduction to CG [4/4] In modern graphics architectures, rendering is accomplished via a pipeline. Why are pipeline-style designs good (in general)? Vertices enter. A vertex might be a corner of a polygon. Fragments leave. A fragment is a pixel-before-it-becomes-a-pixel. At the end of the pipeline, values are stored in the frame buffer. The above picture differs from that in the book. Both are over- simplifications; but they are over-simplified in different ways. Later in the class, we will be adding more detail to this picture. Vertices (window coordinates) Vertex Operations Rasterization Fragment Operations Vertices (object coordinates) Fragments Vertex enters here To framebuffer

8 Sep 2003CS 3817 Linear Interpolation: The Problem In CG we often need to determine the value of some quantity in between two places where its value is known. For example, We are rendering a line. One endpoint is white; the other is blue. What color should the rest of the line be? We are animating a spinning wheel. We know its angular position at two key frames; what is the angle between the two frames? We are rendering a partially transparent polygon. We know the transparency at two of its vertices; what is the transparency between these vertices? We are drawing a smooth curve. We know its slope at two different points; what is the slope between the two points? We are texturing a polygon (painting an image on it). What color is the polygon between two pixels in the image (“texels”)? We are doing lighting calculations for a surface. We know the effect of lighting at two points; what is the effect between the two points?

8 Sep 2003CS 3818 Linear Interpolation: Lirping Approximating a quantity between places where the quantity is known, is called interpolation. Approximating the quantity in other places is called extrapolation. The simplest interpolation method is linear interpolation. Linear interpolation assumes that the graph of the quantity between the two known values is a straight line. Of course, this assumption is often false, but remember that we are only trying to approximate. We abbreviate “linearly interpolate” as lirp [some people spell it “lerp”].

8 Sep 2003CS 3819 Linear Interpolation: Simple Case When we lirp, we are given two values of a quantity; we determine its value somewhere between these. To do this, we assume that the graph of the quantity is a line segment (between the two given values). Here is a simple case: When t = 0, the quantity is equal to a. When t = 1, the quantity is equal to b. Given a value of t between 0 and 1, the interpolated value of the quantity is Check that this satisfies all the requirements. Note: We only do this for t between 0 and 1, inclusive.

8 Sep 2003CS Linear Interpolation: Example 1 An object lies at position y = 2 at time t = 0 and position y = 3.1 at time t = 1. Using linear interpolation, approximate the position of the object at time t = 0.6. Answer is on the last slide.

8 Sep 2003CS Linear Interpolation: General Case What if we are not given values of the quantity at 0 and 1? Say the value at s 1 is a and the value at s 2 is b, and we want to find the interpolated value at s. We set and proceed as before:

8 Sep 2003CS Linear Interpolation: Example 2 The brightness of a moving light source is 1.0 when it lies at position x = 1.1 and 0.5 when it lies at position x = 1.5. Using linear interpolation, approximate the brightness when it lies at position x = 1.4. Answer is on the last slide.

8 Sep 2003CS Linear Interpolation: Lirping Colors & Points Much of the interpolation done in CG involves several numbers at once. An important example is colors, which are typically specified as three numbers: R, G, and B. To lirp between two colors, we actually lirp three times: between the two R values, between the two G values, and between the two B values. The three lirping calculations are carried out independently of each other. This method actually ignores some important characteristics of human vision; however, when the two colors are very similar, it is a fine method to use. Lirping between 2-D and 3-D points is done similarly.

8 Sep 2003CS Linear Interpolation: Example 3 The position of an object is (0, 1) at time t = 0 and (2, 10) at time t = 1. Using linear interpolation, approximate the position of the object at time t = 0.1. Answer is on the last slide.

8 Sep 2003CS Introduction to OpenGL: API API = Application Programmer’s Interface. An API specifies how a program uses a library. What calls/variables/types are available. What these do. A well-specified API allows implementation details of a library to be changed without affecting programs that use the library. The graphics API we will be using is called OpenGL.

8 Sep 2003CS Introduction to OpenGL: What is OpenGL? Professional-quality 2-D & 3-D graphics API Developed by Silicon Graphics Inc. in Based on Iris GL, the SGI graphics library. Available in a number of languages. We will use the C-language API. There is no C++-specific OpenGL API. System-Independent API Same API under Windows, MacOS, various Unix flavors. Programmer does not need to know hardware details. Can get good performance from varying hardware. An Open Standard A consortium of companies sets the standard. Anyone can implement the OpenGL API. Review board handles certification of implementations.

8 Sep 2003CS Introduction to OpenGL: What does OpenGL Do? OpenGL provides a system-independent API for 2-D and 3-D graphics. It is primarily aimed at: Graphics involving free-form 3-D objects made up (at the lowest level) of polygons, lines, and points. Simple hidden-surface removal and transparency- handling algorithms are built-in. Scenes may be lit with various types of lights. Polygons may have images painted on them (texturing). OpenGL does not excel at: Text generation (although it does include support for text). Page description or high-precision specification of images.

8 Sep 2003CS Introduction to OpenGL: Parts of OpenGL OpenGL Itself The interface with the graphics hardware. Designed for efficient implementation in hardware. Particular OpenGL implementations may be partially or totally software. C/C++ header:. The OpenGL Utilities (GLU) Additional functions & types for various graphics operations. Designed to be implemented in software; calls GL. C/C++ header:. OpenGL Extensions Functionality that anyone can add to OpenGL. OpenGL specifies rules that extensions are to follow. May be system-dependent. We will not use any extensions.

8 Sep 2003CS Answers Example 1 a = 2, b = 3.1, and the relevant value of t is 0.6. Approximation: (1 – 0.6)   3.1 = Example 2 We start at 1.1 and end at 1.5. We want to approximate at 1.4. So t = (1.4 – 1.1)/(1.5 – 1.1) = Now, a = 1.0, b = 0.5, and t = Approximation: (1 – 0.75)   0.5 = Example 3 We lirp the two coordinates separately. 1 st coord.: a = 0, b = 2, t = 0.1. (1 – 0.1)   2 = nd coord.: a = 1, b = 10, t = 0.1. (1 – 0.1)   10 = 1.9. We finish by putting the two coordinates together: (0.2, 1.9).