© university of wisconsin cs 559: computer graphics prof stephen chenney spring 2002 cs559-1

26
© University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 http://www. cs . wisc . edu /~cs559-1

Upload: neil-fleming

Post on 03-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

CS 559: Computer Graphics

Prof Stephen Chenney

Spring 2002

http://www.cs.wisc.edu/~cs559-1

Page 2: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Today

• Course overview and information

• Getting started on images

• Programming assignment 1

Page 3: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

What is Computer Graphics?

• Technically, it’s about the production, manipulation and display of images using computers

• Practically, it’s about movies, games, art, training, advertising, communication, design, …

Page 4: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Is 2D Graphics Important?

Compositing in movies: images arecreated in layers, and then combined

Sprites in games: Images are built by overlaying characters and objects on a background

Page 5: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Virtual Reality, the Iowa Driving Simulator

Augmented Reality, from Eric Grimson’s research group at MIT

3D is Sometimes Essential

Page 6: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Computer Graphics?

The Wooden Mirror, by Daniel Rozin

It consists of many small wooden blocks with a camera in the center. The camera takes an image, it is converted to intensities, and each block is rotated to reflect an appropriate amount of light.

Page 7: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

This Course: Building Blocks

• Images and computers– Sampling, Color, Filters, …

• Drawing in 2D– Drawing lines and polygons, clipping, transformations

• Drawing in 3D– Viewing, transformations, lighting, the standard pipeline

• Modeling in 3D– Describing volumes and surfaces, drawing them effectively

• Miscellaneous interesting stuff– Raytracing, animation, …

Page 8: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

People

• Professor Stephen Chenney– Room 6387

– Office Hours Tues 2-3, Thurs 10-11

[email protected]

• TA: Matt Anderson– Office Hour TBD

[email protected]

• TA: Eric McDaniel– Office Hour TBD

[email protected]

Page 9: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Web and Email

• The class web site is http://www.cs.wisc.edu/~cs559-1– It is updated very frequently

– Lecture notes are put online before class, and updated after class

– Additional resources and links are provided

– Reading for future classes is listed

• The class mailing list is [email protected]– I assume that you check this email regularly

– All notices are sent out on the mailing list, including things not mentioned in class

– The mail goes to your cs class account, so make sure you check that or set up forwarding

Page 10: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Textbook and Reader

• Woo et. al., "OpenGL Programming Guide", Third Edition, Adison-Wesley, 1999– The definitive guide to OpenGL, and a reasonable description of

general real-time 3D graphics

• Class reader: Available at DOIT real soon now– A collection of papers, textbook chapters, and other documents

– Essential reading

Page 11: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Projects

• There will be three projects for the course, spread evenly through the semester

• Project 1: Image manipulation

• Project 2: Running a maze (probably)

• Project 3: Building a virtual theme park

• You must submit all three in order to pass the course

Page 12: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Homeworks

• There will be a homework every two weeks or so

• They are intended primarily to explore topics further and to prepare you for the exams

• They will be graded, but only the best five will count

• Some essential techniques will be presented only in homework– For example, an review of linear algebra

Page 13: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Grading (approximate)

• 45% Midterm and Final

• 45% Projects

• 10% Homework

• Everyone must write up their own homework, and write their own software, unless explicitly told otherwise

Page 14: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Lab Facilities

• Room B240 contains machines for use in this class

• They have high performance hardware and the software to make it work

• Students in 559 and 838 (animation) have priority in the lab, but it shouldn’t be a problem

• Don’t underestimate the benefits of working in a lab with your classmates

Page 15: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Software Infrastructure

• FLTK will be the user interface toolkit– Provides windows, buttons, menus, etc

– C++ class library, completely portable

– We are currently at version 1.11, available for free: www.fltk.org

• OpenGL will be the 3D rendering toolkit– Provides an API for drawing objects specified in 3D

– Included as part of Windows, available for Linux either as Mesa or hardware drivers (nvidia)

• Visual C++ 6.0 will be the programming environment for grading

• To be graded, your projects must compile under Visual C++ on the machines in room B240

Page 16: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

C++

• This is probably the first, and only, class in which you must complete large software projects in C++

• There is a great deal of freedom in the projects, which requires that you do your own software design

• If you are not comfortable in C++, you will have to take action

• There are tutorials intended to teach you C++ assuming you know Java:– http://www.cs.wisc.edu/~hasti/cs368/CppTutorial/index.html

– These are intended for the course CS 368, but just do the tutorials

• The transition to C++ was one of the biggest issues for past CS559 studetns

Page 17: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Adding the Class

• To go on the waiting list, email [email protected] with your name, ID and major

• Do it again even if you have already send me email

• People who add in this manner will have to wait a couple of days for accounts

Page 18: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Programming Assignment 1

• Do the Visual C++ and FLTK demo off the class web page

• Will get you started with C++ and FLTK

• Do it NOW, don’t wait until the project comes up

• There will be another assignment in a week or so continuing your preparation for the first project

• Not graded. Questions during office hours or on the class mailing list

Page 19: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

The Imaging Pipeline

• Consider taking a photo and viewing the result– Assume black and white, and a traditional film camera

• The film stores the image

• The camera is a device for imprinting the image on the film

• The image is viewed by a human

• We’ll look at these processes as an introduction to digital images

Page 20: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Photographs

• First photograph due to Niepce,

• First on record shown - 1822

Page 21: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Film

• Film samples (records) the intensity of light that strikes each point

• What is intensity?– The scientific term for that roughly corresponds to brightness

– It can be physically measured and there are many different units, such as lumens

• Real film is not perfect:– It has a finite dynamic range: it cannot simultaneously record very

dark and very bright regions - this is a big issue in photography

– It has finite resolution: if you blow it up large enough, you can see grains - this is rarely an issue in photography

Page 22: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Cameras

• A camera is a device for mediating the way light strikes film

• Lens lets light in while maintaining focus

• Aperture controls proportion of the light that gets to the film

• Shutter controls how long light is allowed to get to the film

Light in

Lens

Aperture

Shutter

Film

Page 23: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

The Human Eye

• How do we see?– Light from the outside world excites

nerves in our retina

– The brain does the rest (not of concern in this class)

• To view a piece of film, we print it and look at the light that it reflects into our eye– Or, we shine light through a slide and see

what is transmitted

Page 24: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Images as Samples

• A photograph is a sample of the light that fell onto the film– Actually, it’s a very large set of samples, one for each point on the

film

• The camera controls precisely what is sampled– Which period of time is sampled

– Which region of space is sampled (which part of the light field)

– Which region of the electromagnetic spectrum is sampled

– Which range of intensity is sampled most accurately

• The idea of image as sample is central to many aspects of computer graphics

Page 25: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

More on Film

• Film stores the samples of the light that fell onto it• Spatial continuity:

– In the real world, light tends to change smoothly over space– Film captures this smoothness quite well, with its high resolution

• Intensity continuity:– The real world contains a continuous range of intensities, from

bright to dark– Film can capture a sub-range very well, but not outside the range

• Temporal continuity:– In the real world, light tends to vary smoothly over time– Movie film captures a discrete set of images over time

Page 26: © University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Spring 2002 cs559-1

© University of Wisconsin

Digital Images

• Computers work with discrete pieces of information• How do we digitize a continuous image?

– Break the continuous space into small areas, pixels– Use a single value for each pixel - the pixel value (no color, yet)– No longer continuous in space or intensity

• This process is fraught with danger, as we shall see

Continuous

Discrete

Pixels: Picture Elements