More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.

Slides:



Advertisements
Similar presentations
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
CS6500 Adv. Computer Graphics © Chun-Fa Chang, Spring 2003 Adv. Computer Graphics CS6500, Spring 2003.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Introduction to Computer Graphics Ed Angel Professor of Computer Science, Electrical and.
Computer Graphics Shadows
Computer Graphics Mirror and Shadows
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.
Mouse-Based Viewing & Navigation Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 3, 2003.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
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.
Linear Interpolation, Brief Introduction to OpenGL Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, September.
CS 481 Preview, Some Lighting Details Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 19, 2003.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
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.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
1 Angel and Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Introduction to Computer Graphics Ed Angel Professor Emeritus of Computer.
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
More on Environment Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, December 10, 2003.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Advanced Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 31, 2003.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Details of Texture Mapping Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, December 1, 2003.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
Chapter 1 Graphics Systems and Models Models and Architectures.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
Computer Graphics CC416 Lecture 02: Overview of Graphics Systems: Raster & Random Displays – Chapter 2 Dr. Manal Helal – Fall 2014.
Lecture 9 From Vertices to Fragments. Objectives Introduce basic implementation strategies Clipping Rasterization hidden-surface removal.
Chapter 5. Lighting Computer Graphics (spring, 2009) School of Computer Science University of Seoul.
Chapter 10: Computer Graphics
Spring 2006 G5BAGR – Advanced Computer Graphics
- Introduction - Graphics Pipeline
Stenciling Effects Glenn G. Chappell
Week 7 - Monday CS361.
Photorealistic Rendering vs. Interactive 3D Graphics
Week 2 - Friday CS361.
CS4610/7610: Introduction to Computer Graphics
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Models and Architectures
Advanced Menuing, Introduction to Picking
Introduction to Computer Graphics
Projection in 3-D Glenn G. Chappell
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Introduction to Computer Graphics
Introduction to Computer Graphics
Presentation transcript:

More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003

21 Nov 2003CS 3812 Review: CS 481; Lighting Details Last time we looked at: CS 481 Preview If you have questions about CS 481/681, feel free to ask! Some OpenGL Lighting Details Two-sided lighting. Front side of polygons: use front material. Back side: use back material and reverse the normals. Spotlights. Lights with a predominant direction. Exponents are better than cutoffs! Local-viewer mode. Compute viewing direction correctly in Phong Model specular computation. Often not worth doing. Not a bad idea when flying. Necessary in VR.

21 Nov 2003CS 3813 One Last OpenGL Lighting Detail: Light-Model Ambient In OpenGL ambient light comes either from a light source or the light-model ambient. Set the former with glLightfv(GL_LIGHT …, GL_AMBIENT, … ); Set the latter with something like this: GLfloat lmodel_ambient[] = { 0., 0., 0., 1. }; glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient); The light-model ambient defaults to (0.2, 0.2, 0.2, 1); If you have ambient in your light sources, you may want to turn the light-model ambient off (as above).

21 Nov 2003CS 3814 More on Advanced Interfaces: Introduction Recall our discussion of advanced interfaces (object manipulation, driving, flying, etc.). Often the hardest interfaces to write are those that involve arbitrary camera motions (e.g., flying). Oddly, the implementations we discussed did not keep a record of the camera location. It was hidden somewhere in the viewing matrix. This means that fancy interfaces can be written without knowledge of the camera location. But if a program needs to know the camera location for some other purpose, then you have a problem.  Shortly we will look at a partial solution.

21 Nov 2003CS 3815 More on Advanced Interfaces: Camera Location — When? When might a program need to know the camera location? When doing collision detection. Other uses are all variations on this theme: Am I in a room, am I near an object, have I walked through a wall, etc.

21 Nov 2003CS 3816 More on Advanced Interfaces: Finding the Camera How do we determine the camera location? Assume the model/view and projection transformations are being used “correctly”. Then the camera is at (0, 0, 0) in the world, after the viewing transformation is done. So we want to know what point we can multiply by the model/view matrix to get (0, 0, 0). Finding this is equivalent to solving a system of linear equations.  Fortunately, the hard work is done for us: gluUnProject.

21 Nov 2003CS 3817 More on Advanced Interfaces: Using gluUnProject Function gluUnProject takes a point in window coordinates backwards through the three transformations. But we only want to go back through model/view. Solution: create “dummy” projection and viewport transformations, then call gluUnProject. See whereami.cpp for sample code. This is on the web page. This program implements flying through a lit world. The code to determine the camera location is in function whereami.

21 Nov 2003CS 3818 More on Advanced Interfaces: Collision Detection Collision detection means determining when two objects, or an object and the camera, bump into each other. Collision detection is an active research field. There is no terribly nice solution to the problem. So we look at a very special case: How can we determine whether the camera location is inside a simple object? Simple: cube, sphere, etc.

21 Nov 2003CS 3819 Image Basics: Introduction Thus far, we have been looking at how to render a geometry-based 3-D scene. We have done little with pixels, despite the fact that these are the building blocks of all images. Next we cover Chapter 7 in the blue book (“Discrete Techniques”). This talks about pixel-level and image-level operations. Remember: “All graphics is 2-D graphics.” But first, a bit on images and the pipeline.

21 Nov 2003CS Image Basics: Terminology A raster image is a 2-D array of color values that represents a visible picture. So a raster image is what ends up in the frame buffer. Typically, we display a screen-aligned rectangle, with each image pixel corresponding to one screen pixel. Common graphic file formats (GIF, JPEG) hold raster images. We will use the following terms interchangeably. Raster image (or just image). Pixel rectangle. Pixmap. A bitmap is a special kind of image in which each pixel is represented by a single bit (off/on). Some people use “bitmap” to refer to general images. We will not. A texture is an image that can be painted on a polygon. Such a polygon is said to be textured. The process is known as texture mapping (or just texturing). Pixels in a texture image are often referred to as texels.

21 Nov 2003CS Image Basics: Primitives OpenGL (along with other graphics libraries) provides the following types of primitives: Points. Polylines. Filled polygons. Raster images. Bitmaps. So far, we have dealt mostly with the OpenGL geometry pipeline, which handles the first three above. Now we look at the image pipeline, which handles the last two.

21 Nov 2003CS Top: geometry pipeline. Bottom: image pipeline. This is a huge over-simplification, as usual. Algorithmically, the image pipeline is the simpler. Think: How do you rasterize a pixmap? The image pipeline has the same data type at start & end. So it can run backwards. Image Basics: More of the Pipeline FragmentsVertex Pixmap Fragment Pixmap Vertex Operations Rasterization Fragment Operations Frame Buffer Vertex Data Pixel Operations Pixel Data

21 Nov 2003CS Image Basics: Issues Geometry is better than images: It can be transformed (model/view, etc.). It can easily be edited. Can be faster when dealing with a small list of vertices. More compact representation when dealing with polygonal objects. Images are better than geometry: Can be more confident of correct appearance. Faster where appropriate. More appropriate for representing real-world images (photographs, etc.) Where have we seen issues like these before? Text fonts. Outline/stroke fonts are geometry. Bitmap fonts are images. The same advantages and disadvantages that these have, extend to more general contexts.

21 Nov 2003CS Discrete Techniques: Overview In the next few class meetings, we will cover: How images are stored, used, and operated on. Tossing around pixmaps and pixels in OpenGL. Texture mapping: painting an image on a polygon. Generating interesting textures.