csc 706 computer graphics - city university of new yorknatacha/teachfall_2009/csc706/... · csc 706...

47
CSC 706 Computer Graphics Course basics: Instructor Dr Natacha Gueorguieva Instructor Dr. Natacha Gueorguieva Materials will be available at www cs csi cuny edu/~natacha www.cs.csi.cuny.edu/~natacha 1 midterm, 2 projects, 1 presentation, homeworks, final Syllabus – read it as it is your contract

Upload: others

Post on 11-May-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

CSC 706 Computer Graphics

Course basics:

Instructor – Dr Natacha GueorguievaInstructor – Dr. Natacha Gueorguieva

Materials will be available at

www cs csi cuny edu/~natachawww.cs.csi.cuny.edu/~natacha

1 midterm, 2 projects, 1 presentation, homeworks, final

Syllabus – read it as it is your contract

Page 2: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Some Resources

• Angel, Edward, Interactive Computer Graphics, g , , p p ,Addison-Wesley, Reading, MA, 2009

• Computer Graphics using OpenGL, Hill, Prentice Hall 2001Hall, 2001

• OpenGL Programming Guide, Second Edition, Mason Woo, Jackie Neider, and Tom Davis, Addi W l D l P 1997Addison-Wesley Developers Press, 1997

• OpenGL Reference Manual, Second Edition, OpenGL Architecture Review Board Editors: Renate Ope G c ec u e ev ew o d d o s: e eKempf and Chris Frazier, Addison-Wesley Developers Press, 1997

Page 3: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

What will I learn?What will I learn?What will I learn?What will I learn?Fundamentals of Computer Graphics

U f C t G hi• Uses of Computer Graphics

• Programming for Computer Graphics

• Computer Graphics Algorithmsp p g

• Applied Linear Algebra

• Modelling

• Rendering

• Animation

The OpenGL Graphics APIs

Page 4: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

WhatWhat won’twon’t I learn?I learn?What What won twon t I learn?I learn?Painting and Imaging Software (Paintshop Pro, Adobe Photoshop)

CAD P k (A t CAD)CAD Packages (AutoCAD)

Animation Software (Maya)

Rendering Software (Renderman)g ( )

3D Modelling (3D Studio Max)

Page 5: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

TopicsTopicsTopicsTopicsIntroduction to Computer GraphicsIntroduction to Computer GraphicsDrawing FiguresDrawing FiguresDrawing AlgorithmsDrawing AlgorithmsVectors for GraphicsVectors for GraphicsTransformationsTransformationsModelling with PolygonsModelling with Polygons3D Viewing3D ViewingggRenderingRenderingFractalsFractalsRaster Display ToolsRaster Display Toolsp yp yCurves and Surface DesignCurves and Surface DesignColour TheoryColour Theory

Page 6: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Outline and approach

Computer graphics is concerned with all aspects ofproducing pictures or images using a computerproducing pictures or images using a computer.

•HardwareHardware•Software•Applications

Page 7: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

So what is computer graphics?So what is computer graphics?So, what is computer graphics?So, what is computer graphics?

“Computer Graphics is concerned with“Computer Graphics is concerned withComputer Graphics is concerned with Computer Graphics is concerned with producing images using a computer.”producing images using a computer.”

ModellingModellingModellingModellingThe representation of the form of objectsThe representation of the form of objects

RenderingRenderingThe appearance of objectsThe appearance of objects

AnimationAnimationThe movement of objectsThe movement of objectsjj

Page 8: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

So what is computer graphics?So what is computer graphics?So, what is computer graphics?So, what is computer graphics?ModellingModellinggg

Taking the real and turning Taking the real and turning it into the virtual.it into the virtual.Explaining real world orExplaining real world orExplaining real world or Explaining real world or fantastic objects using fantastic objects using mathematics.mathematics.If the image does not existIf the image does not existIf the image does not exist If the image does not exist in real life, a blueprint is in real life, a blueprint is drawn by an artist.drawn by an artist.AA wire framewire frame is theis theA A wire framewire frame is the is the simplest form of model.simplest form of model.

Page 9: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

So what is computer graphics?So what is computer graphics?So, what is computer graphics?So, what is computer graphics?

RenderingRenderingRenderingRenderingDrawing the ImageDrawing the ImageColourColourLightingLightingShadingShadingSurface TextureSurface TextureShadowsShadowsR fl ti dR fl ti dReflection and Reflection and TransparencyTransparencyIntersectionIntersectionIntersectionIntersection

Page 10: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

So what is computer graphics?So what is computer graphics?So, what is computer graphics?So, what is computer graphics?

AnimationAnimationAnimationAnimationControlling the Controlling the movement of objects.movement of objects.Laws of PhysicsLaws of PhysicsBiomechanics/ Biomechanics/ KinesiologyKinesiologyKinesiologyKinesiologyLip SinkLip SinkSpecial EffectsSpecial EffectsSpecial EffectsSpecial Effects

Page 11: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Progression of a CG CharacterProgression of a CG CharacterProgression of a CG CharacterProgression of a CG Character

Muscle ModelWireframe Model Skeletal Model Muscle ModelSkeletal Model

Skin Hair Final Render

Page 12: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Example

• Where did this imageWhere did this image come from?

• What software and/orWhat software and/or hardware was necessary?

Page 13: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Preliminary answery

• Application: The object is an artist’s renditionApplication: The object is an artist s rendition of the sun for an animation to be shown in a domed environment (planetarium)domed environment (planetarium)

• Software: Maya for modeling and rendering but Maya is built on top of OpenGLbut Maya is built on top of OpenGL

• Hardware: PC with graphics card for d li d d imodeling and rendering

Page 14: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Main tasks in CG

• Main tasks:Main tasks:– modeling: creating and representing the geometry

of objects in the 3D worldof objects in the 3D world– rendering: generating 2D images of the objects

animation: describing how objects change in time– animation: describing how objects change in time

Page 15: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Why study CG?y y

• Graphics is coolGraphics is cool– I like to see what I’m doing

I like to show people what I’m doing– I like to show people what I m doing• Graphics is interesting

– Involves simulation, algorithms, architecture…• I’ll never get an Oscar for my acting

– But maybe I’ll get one for my CG special effects• Graphics is funp

Page 16: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Graphics applications

• Art, publicityArt, publicity

• Scientific visualization• Scientific visualization

Page 17: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

• Education and trainingEducation and training

• User interfaces

Page 18: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

• CADCAD

• Geographical info• Geographical info

Page 19: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

• Terrain modelingTerrain modeling

• Medical• Medical

Page 20: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

E t t i t Ci• Entertainment: Cinema

Square: Final Fantasy

Pixar: Monster’s Inc.

Page 21: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

E t t i t G• Entertainment: Games

GT Racer 3

Polyphony Digital: Gran Turismo 3, A Spec

Page 22: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

• Video GamesVideo Games

Page 23: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

M di l Vi li ti• Medical Visualization

The Visible Hum

an Projec

MIT: Image-Guided Surgery Project

ct

Page 24: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

C t Aid d D i (CAD)• Computer Aided Design (CAD)

Page 25: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

S i tifi Vi li ti• Scientific Visualization

Page 26: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

More Cool Pictures

Video!

Page 27: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Graphics Programming OpenGL API Graphic functions:p

primitive (points, lines, polygons, pixels, text, curves, surfaces)

attribute (colors, fills, type face for titles of graphs)

viewing (types of views)

transformation (rotation, translation, scaling)

input

control (communicate with window system, initialize programs, deal with errors)

Page 28: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Introduction to OpenGLIntroduction to OpenGL

• What is an application programmer’s interface?– Software library– Layer between programmer and graphics

h d d fhardware and software• Where does OpenGL fit in?

– Between application and graphics system– Between high level API and system software

Page 29: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha
Page 30: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Why OpenGL?

• Fast• SimpleSimple• Well-defined architecture

Wi d t i d d t• Window system independent• Supports high-end features• Both geometric and pixel processing

Standard, available on many platforms

Page 31: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Why OpenGLWhy OpenGL

• industry standardindustry standard• stable• reliable and portable• reliable and portable• evolving

l bl• scalable• easy to use• well-documented AP• provides a full set of 3D graphics routines

Page 32: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha
Page 33: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

The Graphics Rendering Pipelineg

Rendering: The conversion of a scene into an image:

Scene: Composed of models placed in 3D spaceScene: Composed of models placed in 3D space.

Models: Composed of collections of primitives.

Primitives: Graphic components supported by a RenderPrimitives: Graphic components supported by a Render.

Output Image: May be drawn on a monitor or printed on a laser printer or written to a raster in memory or to a file or ... p y...Must consider device independence.

The Graphics Pipeline: The “model” to “image” conversion broken into stages. Some version of the pipeline is implemented in graphics hardware to get interactive speeds.

Page 34: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

The Graphics Rendering Pipeline

The viewing pipeline is a group of processes common from wireframe display through to near photo-realistic image generation, and is basically concerned with transforming objects to be displayed from specific viewpoint and removing surfaces that cannot be seen from this viewpoint.

The input to the viewing pipeline is a list of objects with their points defined in their p g p p j pown local coordinate system, and the position and orientation of the viewpoint. The output is the same list of objects with their points defined in a two dimensional screen coordinate system.

Page 35: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Computer Graphics and Image Processing

C t G hi Image ProcessingComputer Graphics• Input: objects’ model

Image Processing• Input: a real image

• Output: realistic image • Output: objects’ model

A sequencePictures that move

A sequence of images (frames)

Computer Video Animation Processing

Page 36: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

The Graphics Rendering Pipeline

Page 37: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Coordinate Systems in the Graphics Pipeline

OCS - object coordinate system WCS ld di t tWCS - world coordinate system VCS - viewing coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device coordinate system

Page 38: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Event driven programmingEvent driven programming• Almost all window based programs follow p g

the event driven paradigm– program waits for events to occur– takes appropriate action

• Events are typically stored in an event queue

• Application programs specify the types of events that are of interest

• The window system passes events to apps.

Page 39: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Event driven programmingEvent driven programming• Appropriate action is implemented by the

application calling a unique, user defined function for each event of interest

• these functions are referred to as callback functions

• Associating callback functions with events is not a rendering issue, OpenGL does not

id f thiprovide for this• GLUT (OpenGL Utility Toolkit) does

Page 40: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha
Page 41: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

Registering EventsRegistering Events• The function call:

glutMouseFunc(mouse)– associates the callback function mouse with all mouse

events• button press/release

When a mo se b tton is pressed or released in the• When a mouse button is pressed or released in the graphics application window, the user defined function mouse is calledfunction mouse is called

• Application ignores all mouse events without this function callu c o ca

Page 42: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

OpenGL BuffersOpenGL Buffers• OpenGL supports a variety of buffers that

can be used for advanced rendering– Color buffers (front, back, right, left)– Depth (z) buffer– Accumulation– Stencil

• Window system interactions must beWindow system interactions must be handled outside of OpenGL

Page 43: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

OpenGL Related LibrariesOpenGL Related Libraries

• OpenGL Utility Library (GLU)• OpenGL Utility Library (GLU)• GLX (X Window extension), glX...• WGL (MS Windows extension), wgl…• GLUT (OpenGL Utility Toolkit), glut…( p y ), g• OpenInventor

C++– C++– high level three-dimensional applications

Page 44: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha
Page 45: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha
Page 46: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

ClearingClearing

Cl i l h t b t• Clearing color has to be set– glClearColor(r,g,b,alpha)

• Buffers can be cleared all at once– glClear(bitfield)

• Color buffer• Depth buffer

A l i b ff• Accumulation buffer• Stencil buffer

Page 47: CSC 706 Computer Graphics - City University of New Yorknatacha/TeachFall_2009/CSC706/... · CSC 706 Computer Graphics Course basics: ·Instructor –Dr Natacha GueorguievaDr. Natacha

OpenGL Interface