09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall...

28
09/07/04 © 2002-2004 University of Wisconsi n CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 http://www.cs.wisc.edu/~cs559-1

Transcript of 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall...

Page 1: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

CS 559: Computer Graphics

Prof Stephen Chenney

Fall 2004

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

Page 2: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Today

• Course overview and information

• Digital Images

• Homework 1 – due Sept 14 in class

Page 3: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 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, design, training, art, advertising, communication, …

Page 4: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

This Course: Building Blocks

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

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

• Drawing in 3D– Viewing, transformations, lighting, real-time graphics

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

• Miscellaneous topics– Raytracing, animation, …

Page 5: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

People

• Prof. Stephen Chenney– Room 6387

– Office Hours: TBD

[email protected]

• TA: Leo Chao– Room 1346

– Office Hour TBD

[email protected]

Send all class email to [email protected] gets the fastest response.

Page 6: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 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

• Email is sent out on the class mailing list– This list sends email to your official university email account

• Check it regularly or set up forwarding

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

– Only registered students get email• You read an archive at https://www-auth.cs.wisc.edu/lists/classes/

Page 7: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

CS Computer Account

• Everyone in the class needs a Computer Science department computer account– For completing and submitting projects

• If you don’t have one, go to the CSL on the 2nd floor

• CS559 provides you with a Windows account– You will only have a Unix account if you are taking some other

course

Page 8: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Textbooks and Readings

• Peter Shirley, “Fundamentals of Computer Graphics”, A.K. Peters, 2002

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

general real-time 3D graphics– It doesn’t really matter which edition – the differences are not

pertinent to this class

• Class readings– Online via the library’s reserve system – see class web page– A collection of papers, textbook chapters, and other documents– Some essential material not contained in the textbook

Page 9: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Projects

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

• Project 1: Image editing

• Project 2: Running a maze

• Project 3: Building a virtual theme park

• You must submit all three in order to pass the course– This rule has never been waived

Page 10: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 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 11: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Grading (approximate)

• 45% Midterm and Final

• 45% Projects

• 10% Homework

• Everyone must write up their own homework

• For projects 1 and 3, you have the option of working in pairs

Page 12: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Lab Facilities

• Room B240 contains machines for use in this class

• They have adequate hardware (circa 2001) and the software to make it work

• Students in CS 559 have priority in the lab

• There are benefits to working in a lab with your classmates– For instance, the blackboards frequently display useful hints that

someone else scrawled

– But they also sometimes have incorrect information!!

Page 13: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 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.1.0rc6, 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 and in most Unix distributions• Although getting hardware acceleration may take some doing

• Visual Studio.NET (Visual C++ 7.1) will be the programming environment for grading

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

Page 14: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

C++

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

• 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 students– Visual Studio also causes issues – we will provide a transition tutorial

Page 15: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Adding the Class

• Everyone should be able to add at this point

• If not, email [email protected] with your name, ID and major– If the system gave you a reason for denying registration, include it

in your email

• You have to wait a couple of days after adding before you can get a CS computer account

Page 16: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Admin Questions?

Page 17: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Images

• An image for our purposes is an abstract concept– It has no existence until it is displayed

• An image is intended to describe the light that arrives at your eyes when you view it– You can be even more abstract: image describes what you should

think when you see it

• Different display devices convey the image content in different ways– e.g. Print and computer monitors use two fundamentally different

approaches– The same image may look different on different monitors

• Who cares?

Page 18: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Image Formats

• We are familiar with many forms of image:– Photographs

– Paintings

– Sketches

– Television (NTSC, PAL-SECAM)

– Digital formats (JPEG, PNG, GIF, etc. etc. etc. etc.)

• Each form has its own way of obtaining and storing the information content

• We are primarily concerned with digital formats, but we will also discuss NTSC

Page 19: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Digital Images

• Many formats (100s) exist for storing images on a computer

• There are some conflicting goals:– The storage cost should be minimized

– The amount of information stored should be maximized• The size of something and the amount of information is contains are

not the same thing

– Original information versus perceptual equivalence

– Tracking ownership may be important

• Most formats you are familiar with are raster images

Page 20: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Raster Images

• A raster is a regular grid of pixels (picture elements)

• Raster image formats store the color at each pixel, and maybe some other information– Easiest is to use a simple array of pixel values

– Some formats store the pixel information in very different ways

– e.g. a 5x3, floating point, grayscale image

0.25

10.25 0

0.250.5

0.250.5

0.25

0.25

0.5

0.50.25

1

0.25

Page 21: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Vector Images

• Vector formats offer an alternative way to store images

• The most common use of vector formats are in fonts – images of characters (Postscript, TrueType)

• Store images as collections of geometric primitives– E.g. Lines, polygons, circles, curves, …

• It is possible to go from a vector image to a raster image– We’ll learn how

• It is very hard to go the other way

Page 22: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Trade-Offs

• Which format, raster or vector, is easier to:– Display?

– Resize (scale bigger or smaller)?

– Rotate?

– Crop (cut bits off at the edges)?

Page 23: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Obtaining Digital Images

• What are some methods for obtaining a digital image?– Digital camera

– Scanning another image

– Other forms of scanning (eg medical)

– Editing existing digital images

– Paint or drawing programs

– Created from abstract data (e.g. math function plot)

– Rendered from a scene description

– …

Page 24: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Ideal Images

• The information stored in images is often continuous in nature

• For example, consider the ideal photograph:– It captures the intensity of light at a particular set of points coming

from a particular set of directions (it’s called irradiance)

– The intensity of light arriving at the camera can be any positive real number, and it mostly varies smoothly over space

– Where do you see spatial discontinuities in a photograph?

FilmFocal point

Page 25: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 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 seeContinuous

Discrete

Pixels: Picture Elements

Page 26: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Discretization Issues

• Can only store a finite number of pixels– Choose your target physical image size, choose your resolution (pixels per

inch, or dots per inch, dpi), determine width/height necessary

– Storage space goes up with square of resolution• 600dpi has 4× more pixels than 300dpi

• Can only store a finite range of intensity values– Typically referred to as depth - number of bits per pixel

• Directly related to the number of colors available and typically little choice

• Most common depth is 8, but also sometimes see 16 for grey

– Also concerned with the minimum and maximum intensity – dynamic range

• What is enough resolution and enough depth?

Page 27: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Perceptual Issues

• Spatially, humans can discriminate about ½ a minute of arc– At fovea, so only in center of view, 20/20 vision

– At 0.5m, about 0.1mm (“Dot pitch” of monitors)

– Sometimes limits the required number of pixels

• Humans can discriminate about 8 bits of intensity– “Just Noticeable Difference” experiments

– Limits the required depth for typical dynamic ranges

– Actually, it’s 9-10 bits, but 8 is far more convenient

• BUT, when manipulating images much higher resolution may be required

129 128 125

Page 28: 09/07/04© 2002-2004 University of Wisconsin CS 559: Computer Graphics Prof Stephen Chenney Fall 2004 cs559-1.

09/07/04 © 2002-2004 University of Wisconsin

Next Time

• Color