26
CSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures can be generated using a computer. But it also includes: – software tools used to make pictures – hardware for efficient graphics processing – input devices for interacting with these pictures – output devices for displaying the pictures

CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

  • Upload
    others

  • View
    20

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

CSC 8470Computer Graphics

What is Computer Graphics?

For us, it is primarily the study of how pictures can be generated using a computer.

But it also includes: – software tools used to make pictures

– hardware for efficient graphics processing

– input devices for interacting with these pictures

– output devices for displaying the pictures

Page 2: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Graphics Application: Information Visualization

GOAL:– Visualization of complex multidimensional data

for analysis and presentation.

Examples:– Clinical trial data

– Business consultancy data

Graphics application: Direct Volume Rendering

GOAL:– Visualization of highly complex data

Texture adds a high visual dimension

Page 3: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Graphics Application: Biomedical Visualization

GOAL:– Improve the perception, analysis, understanding

of interactions between complex data

Graphics Application:Virtual Reality

GOAL:– Design effective simulation and education

applications by combining real and virtual elements

– Reduce cost & improve safety of applications

Page 4: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Graphics Application: Computer Aided Design

GOAL:– Develop novel interfaces for the efficient design of

products, scenes and characters. In general focus is on real-time performance and rapid prototyping, and/or visual realism.

Graphics Application: Advertisements

Page 5: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Graphics Application: Arts and Publishing

Graphics Application: Everyday Use

Page 6: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Course Goals

Learn the Process of Creating an Image

Page 7: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Learn Animation Basics

Animation Example

Page 8: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Data Crunching behind Avatar

Tools we Will Use

www.blender.org

www.opengl.org

www.povray.org

Page 9: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Main Topics

Basic Graphics Concepts

Graphics System and Architecture

Algorithms for simple graphics

Geometric Objects and Transformations

Viewing and Projection

Shading and Rendering

Texture Mapping

Lighting and Ray Tracing

Resources

Recommended:

Online material– References on the

class website

Page 10: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Grading

Assignments (60%)– Pencil and paper– Clean, readable, working code– On time (no late submission)– First assignment is available now

Exam (30%)Class Participation (10%)No makeup assignments or examsLecture attendance is mandatory

Any questions before we start?

Page 11: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Graphics Systems Basics

What is a digital image?Pixel:

Raster image:

Page 12: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Pixel Depth

Pixel depth:

Effect of Pixel Depth

Banding:

____ bits____ bits____ bits

Page 13: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Effect of Pixel Depth

Source: Wikipedia, http://en.wikipedia.org/wiki/Pixel_depth

2 bits (4 colors) 4 bits (16 colors)

Raster Displays

Path of electron beam

Display surface: Dotted with material that emits light when stimulated by electron beam. Beam must repeatedly stimulate dots row by row, b/c intensity fades when not stimulated.

Refresh rate:

Resolution:

Page 14: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Light

White light:

Raster Displays Revisited

Page 15: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

LCD displaysLCD:

Color Models

Additive Color Model:

Subtractive Color Model:

Page 16: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Color Raster Images

Pixel color is encoded as ordered triple.

Color value (R,G,B)

Displayed

(0, 0, 0) Black

(0, 0, 1) Blue

(0, 1, 0) Green

(1, 0, 0) Red

(1, 0, 1) Magenta

(1, 1, 0) Yellow

(0, 1, 1) Cyan

(1, 1, 1) White

Frame Buffer

CPU Main Memory Graphics Card

-- Graphics Processing Unit(GPU)

-- Frame Buffer

System Bus

Special memory where pixel colors are stored.

Page 17: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Modeling-Rendering Paradigm

Modeling Rendering

The Concept of Pipeline

* +

b

c

a

Page 18: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Graphics Pipeline

VertexProcessor Clipper Rasterizer

FragmentProcessor

3D VerticesRasterImage

ALL done by the GPU on the graphics card!

Hands-On Session

Page 19: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

A cross-platform Application Programming Interface (API) for producing 2D and 3D computer graphics

Developed by Silicon Graphics Inc. (1992)

See: http://www.opengl.org

OpenGL Graphics Programming

OpenGL– Industry standard API for 3D graphics

– Cross-platform – Windows, MAC, Unix

– Supported on all hardware platforms

OpenGL API (gl)– core of OpenGL API

OpenGL Utility API (glu)– additional functionality built on top of GL

OpenGL Utility Toolkit (glut)– Handles the windowing system, menus, events, etc.

Page 20: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Hands-on Activities

In the future you will write your own OpenGL program, but this time you’ll copy an existing program (squares.cpp) from the course website.

Get the activities handout from your instructor.

OpenGL Introduction

OpenGL Geometric Primitives

OpenGL Attributes

Sierpinski’s Triangle

Page 21: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Points, Lines, Polygons

Vertices

A vertex is a location in the plane – Specified by its x and y coordinates

– Used to define geometric primitives

– The simplest geometric primitive is a point

General form: glVertex*– Examples:

• glVertex2i(int x, int y);

• glVertex3f(float x, float y, float z);

• glVertex3fv(float vcoord);

Page 22: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

glVertex*

OpenGL Primitives

glBegin( GL_POINTS );glVertex2i(100, 100);glVertex2i(400, 100);glVertex2i(250, 400);

glEnd(); x

y

500

500

x

y

500

500glBegin( GL_LINE_LOOP );glVertex2i(100, 100);glVertex2i(400, 100);glVertex2i(250, 400);

glEnd(); 

Page 23: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Many Questions

How to interpret the values of x, y?

In what units are they? Feet, meters or pixels?

Where is the origin?

Where on the screen does our image appear?

How large will the image be?

In what color are we drawing?

Screen (Graphics) vs. Viewing (Clipping) Window

glutInitWindowSize(600, 500);

glutInitPosition(200, 150);

glOrtho2D(0, 600, 0, 500);

x

y

screen win

viewing windowx

y

Page 24: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

OpenGL Attributes

Examples:

glColor3f( 1.0, 0.0, 0.0 );

glClearColor( 1.0, 1.0, 1.0, 1.0 );

glPointSize( 4.0 );

glLineWidth( 2.0 );

Once an attribute is set, it stays that value until you later change it.

Hands-On SessionThe primitives.cpp ProgramCompile, Run & Play, eg:– Change point size to 8

– Change `GL_POINTS’ to:• GL_LINES

• GL_LINE_STRIP

• GL_LINE_LOOP

• GL_POLYGON

• GL_QUADS

• GL_TRIANGLES

• GL_QUAD_STRIP

• GL_TRIANGLE_STRIP

• GL_TRIANGLE_FAN

Page 25: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

The Sierpinski Gasket

Algorithm:

Start with 3 corner vertices v1, v2, v3 and one interior point p

Repeat the following

Hands-on Session

The gasket.cpp Program

Compile, Run & Play

Change ‘GL_POINTS’ to GL_LINES

Comment out certain lines, e.g.– glClear(GL_COLOR_BUFFER_BIT);

(and resize your window)

What happens when you resize your window?

Page 26: CSC 8470 Computer Graphicsmdamian/Past/graphicsfa10/notes/01-Introduction.pdfCSC 8470 Computer Graphics What is Computer Graphics? For us, it is primarily the study of how pictures

Sierpinski Gasket -- Triangle Bisection

Algorithm:

Start with 3 corner vertices v1, v2, v3 Repeat the following

Hands-on Session

Save a copy of your gasket.cpp code

Alter the code for the gasket to generate the Sierpinski gasket using triangle bisection