csc 706 computer graphics - city university of new yorknatacha/teachfall_2009/csc706/... · csc 706...
TRANSCRIPT
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
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
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
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)
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
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
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
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.
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
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
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
Example
• Where did this imageWhere did this image come from?
• What software and/orWhat software and/or hardware was necessary?
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
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
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
Graphics applications
• Art, publicityArt, publicity
• Scientific visualization• Scientific visualization
• Education and trainingEducation and training
• User interfaces
• CADCAD
• Geographical info• Geographical info
• Terrain modelingTerrain modeling
• Medical• Medical
E t t i t Ci• Entertainment: Cinema
Square: Final Fantasy
Pixar: Monster’s Inc.
E t t i t G• Entertainment: Games
GT Racer 3
Polyphony Digital: Gran Turismo 3, A Spec
• Video GamesVideo Games
M di l Vi li ti• Medical Visualization
The Visible Hum
an Projec
MIT: Image-Guided Surgery Project
ct
C t Aid d D i (CAD)• Computer Aided Design (CAD)
S i tifi Vi li ti• Scientific Visualization
More Cool Pictures
Video!
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)
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
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
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
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.
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.
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
The Graphics Rendering Pipeline
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
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.
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
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
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
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
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
OpenGL Interface