55
CSC 470 Introduction to Computer Graphics Course basics: Instructor – Dr. Natacha Gueorguieva Office 1N 205, Ext. 3288 Materials will be available at www.cs.csi.cuny.edu/~natacha 1 midterm, 2 projects, 1 presentation, homeworks, final Syllabus – read it as it is your contract

CSC 470 Introduction to Computer Graphicsnatacha/TeachSpring_12/CSC470/Notes/Lec1/lec1.pdf · CSC 470 Computer Graphics, Dr..Natacha Georgieva, College of Staten Island/CUNY 17 Where

  • Upload
    others

  • View
    22

  • Download
    0

Embed Size (px)

Citation preview

CSC 470 Introduction to Computer Graphics

Course basics:

Instructor – Dr. Natacha Gueorguieva

Office 1N 205, Ext. 3288

Materials will be available at

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

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

Syllabus – read it as it is your contract

Some Resources

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

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

• OpenGL Reference Manual, Second Edition, OpenGL Architecture Review Board Editors: Renate Kempf and Chris Frazier, Addison-Wesley Developers Press, 1997

• Angel, Edward, Interactive Computer Graphics, Addison-Wesley, Reading, MA, 1997

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

• Uses of Computer Graphics

• Programming for Computer Graphics

• Computer Graphics Algorithms

• Applied Linear Algebra

• Modelling

• Rendering

• Animation

The OpenGL Graphics APIs

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

CAD Packages (AutoCAD)

Animation Software (Maya)

Rendering Software (Renderman)

3D Modelling (3D Studio Max)

TopicsTopicsIntroduction to Computer GraphicsIntroduction to Computer GraphicsDrawing FiguresDrawing FiguresDrawing AlgorithmsDrawing AlgorithmsVectors for GraphicsVectors for GraphicsTransformationsTransformationsModelling with PolygonsModelling with Polygons3D Viewing3D ViewingRenderingRenderingFractalsFractalsRaster Display ToolsRaster Display ToolsCurves and Surface DesignCurves and Surface DesignColour TheoryColour Theory

What skills should I already have?What skills should I already have?

ProgrammingProgrammingProgrammingProgrammingProgrammingProgrammingC++C++

Outline and approach

Computer graphics is concerned with all aspects of producing pictures or images using a computer.

•Hardware•Software•Applications

Computer Graphics Tools

• Tools are both software and hardware.– Hardware tools include video monitors, graphics

cards, and printers that display graphics.– They also include input devices such as a mouse,

trackball that let users point to items and draw figures.

Computer Graphics Tools cont’d

• Software tools: the operating system, editor, compiler, and debugger you commonly use. – Graphics routines: e.g., functions to draw a simple

line or circle (or characters such as G).– Functions to manage windows with pull-down

menus, input, and dialog boxes. – Functions to allow the programmer to set up a

camera in 3D coordinate system and take snapshots of objects.

Device Independent Graphics

• Device independent graphics libraries that allow the programmer to use a common set of functions within an application, and to run the same application on a variety of systems and displays are available.

• OpenGL is such a library, and is the tool we shall use in this course. The OpenGL way of creating graphics is used widely in both academia and industry.

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

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

ModellingModellingThe 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 objects

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

Taking the real and turning Taking the real and turning it into the virtual.it into the virtual.Explaining real world or Explaining real world or fantastic objects using fantastic objects using mathematics.mathematics.If 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.A 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?

RenderingRenderingDrawing the ImageDrawing the ImageColourColourLightingLightingShadingShadingSurface TextureSurface TextureShadowsShadowsReflection and Reflection and TransparencyTransparencyIntersectionIntersection

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

AnimationAnimationControlling the Controlling the movement of objects.movement of objects.Laws of PhysicsLaws of PhysicsBiomechanics/ Biomechanics/ KinesiologyKinesiologyLip SinkLip SinkSpecial EffectsSpecial Effects

Presentation OptionsPresentation Options

FrameFrame--byby--frame:frame: A single frame can be A single frame can be drawn while the user waits. drawn while the user waits. (very boring)(very boring)FrameFrame--byby--frame under control of the frame under control of the user:user: A sequence of frames can be A sequence of frames can be drawn, as in a PowerPoint® presentation; drawn, as in a PowerPoint® presentation; the user presses a key to move onto the the user presses a key to move onto the next slide, but otherwise has no way of next slide, but otherwise has no way of interacting with the slides. interacting with the slides. (much less (much less boring)boring)

Presentation OptionsPresentation OptionsAnimation:Animation: A sequence of frames A sequence of frames proceeds at a particular rate while the user proceeds at a particular rate while the user watches.watches.Interactive Program:Interactive Program: In an interactive In an interactive graphics experience, the user controls the graphics experience, the user controls the flow from one frame to another using an flow from one frame to another using an input device such as a mouse or keyboard input device such as a mouse or keyboard in a manner that was unpredictable at the in a manner that was unpredictable at the time the program was written. A computer time the program was written. A computer game is a familiar case of an interactive game is a familiar case of an interactive graphics presentation. graphics presentation.

CSC 470 Computer Graphics, Dr..Natacha Georgieva, College of Staten Island/CUNY 17

Where Computer Graphics is Used?

• Computer graphics are widely used in the production of movies, television programs, books, games, and magazines.

Progression of a CG CharacterProgression of a CG Character

Muscle ModelWireframe Model Skeletal Model

Skin Hair Final Render

Example

• Where did this image come from?

• What software and/or hardware was necessary?

Preliminary answer

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

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

• Hardware: PC with graphics card for modeling and rendering

Main tasks in CG

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

of objects in the 3D world– rendering: generating 2D images of the objects– animation: describing how objects change in time

Why study CG?

• Graphics is cool– I like to see 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 fun

Graphics applications

• Art, publicity

• Scientific visualization

• Education and training

• User interfaces

• CAD

• Geographical info

• Terrain modeling

• Medical

• Entertainment: Cinema

Pixar: Monster’s Inc.

Square: Final Fantasy

• Entertainment: Games

GT Racer 3

Polyphony Digital: Gran Turismo 3, A Spec

• Video Games

• Medical Visualization

MIT: Image-Guided Surgery Project

The Visible Hum

an Project

• Computer Aided Design (CAD)

• Scientific Visualization

More Cool Pictures

Video!

Computer Graphics is Everywhere

• Pictures generated by a computer– Example: a ray-traced picture with shadows.

Graphics Programming OpenGL API Graphic functions:

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 OpenGL

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

hardware and software• Where does OpenGL fit in?

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

Why OpenGL?

• Fast• Simple• Well-defined architecture• Window system independent• Supports high-end features• Both geometric and pixel processing

Standard, available on many platforms

Why OpenGL

• industry standard• stable• reliable and portable• evolving• scalable• easy to use• well-documented AP• provides a full set of 3D graphics routines

The Graphics Rendering Pipeline

Rendering: The conversion of a scene into an image:

Scene: Composed of models placed in 3D space.

Models: Composed of collections of primitives.

Primitives: 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 ... ...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 own 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

Computer Graphics• Input: objects’ model

• Output: realistic image

Image Processing• Input: a real image

• Output: objects’ model

Computer Animation

Video Processing

Pictures that move

A sequence of images (frames)

The Graphics Rendering Pipeline

Coordinate Systems in the Graphics Pipeline

OCS - object coordinate system WCS - world coordinate system VCS - viewing coordinate system CCS - clipping coordinate system NDCS - normalized device coordinate system DCS - device coordinate system

Event driven programming• Almost all window based programs follow

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 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 provide for this

• GLUT (OpenGL Utility Toolkit) does

Registering Events• The function call:

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

events• button press/release

• When a mouse button is pressed or released in the graphics application window, the user defined function mouse is called

• Application ignores all mouse events without this function call

OpenGL 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 be handled outside of OpenGL

OpenGL Related Libraries

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

– C++– high level three-dimensional applications

Clearing

• Clearing color has to be set– glClearColor(r,g,b,alpha)

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

• Color buffer• Depth buffer• Accumulation buffer• Stencil buffer

OpenGL Interface