Вы находитесь на странице: 1из 57
COMPUTER GRAPHICS Institute of Information and Communication Technology University of Sindh, Jamshoro Dr. Zeeshan Bhatti
COMPUTER GRAPHICS Institute of Information and Communication Technology University of Sindh, Jamshoro Dr. Zeeshan Bhatti
COMPUTER GRAPHICS Institute of Information and Communication Technology University of Sindh, Jamshoro Dr. Zeeshan Bhatti

COMPUTER GRAPHICS

Institute of Information and Communication Technology

University of Sindh, Jamshoro

and Communication Technology University of Sindh, Jamshoro Dr. Zeeshan Bhatti BSIT-PIV Chapter 1 BY: DR. ZEESHAN

Dr. Zeeshan Bhatti

BSIT-PIV

Chapter 1

BY: DR. ZEESHAN BHATTI

1

Course Details

Course Details • Course Code: ITEC 612-613 • Course Title: Computer Graphics • Lecturer: Dr. Zeeshan

Course Code: ITEC 612-613

Course Title: Computer Graphics

Lecturer: Dr. Zeeshan Bhatti, zeeshan.bhatti@usindh.edu.pk

Schedule: Monday and Thursday 8:30-9:15

Refered Book

Computer Graphics: Principles and Practice in C,

by J. D. Foley, A. Van Dam, S. K. Feiner, J. F. Hughes.

Hardcover, 1200 pages, Addison-Wesley Pub Co; 2nd edition,

Course web page:

Blog:

Facebook

https://www.facebook.com/drzeeshanacademy

By: Dr. Zeeshan Bhatti

2

SENG-620 Artificial Intelligence and Computer Vision

SENG-620 Artificial Intelligence and Computer Vision • Course overview : Introduction to Computer Graphics; display

Course overview: Introduction to Computer Graphics; display

memory; generation of points, vectors, shapes, objects, etc.; raster and geometric graphics; interactive and passive graphics; graphics peripherals; analog and digital images and analog/digital conversion; mathematics of 2-D and 3-D transformations; applications in animation, computer aided design and instruction; hypertext and multimedia; dialog design; user-interface.

Prerequisites: Programming Fundamentals, Data Structures,

Mathematics, Linear Algebra.

Grading:

10 marks: Attendance

10 marks: Assignment

30

marks: Midterm

50

marks: Final Exam

Why Study 3D Computer Graphics?

Why Study 3D Computer Graphics? • Systems: Write complex 3D graphics programs (real-time scene in OpenGL,

Systems:

Write complex 3D graphics programs (real-time scene in

OpenGL, offline raytracer)

Theory: Mathematical aspects and algorithms underlying modern 3D

graphics systems

This course is not about the specifics of 3D graphics programs and APIs like Maya, Alias, DirectX but about the concepts underlying them.

Applications (discussed next)

Fundamental Intellectual Challenges

Some content inspired by Pat Hanrahan from Stanford’s CS148

Applications

Applications •CAD - Computer Aided Design (Mechanical, Architectural) •Simulators (Flight, Driving, Sports)

•CAD - Computer Aided Design (Mechanical, Architectural)

•Simulators (Flight, Driving, Sports) •Advertising •Virtual Reality

•Architectural Visualization

•Art and Entertainment •Games

•Special effects

•Education •Scientific visualization

Entertainment

Entertainment Movies: Brave, Pixar 2012
Entertainment Movies: Brave, Pixar 2012

Movies: Brave, Pixar 2012

Entertainment

Entertainment Games: Halo 3, Bungie 2007
Entertainment Games: Halo 3, Bungie 2007

Games: Halo 3, Bungie 2007

Lighting Simulation

Lighting Simulation Interior Design Automobile Visualization
Interior Design Automobile Visualization
Interior Design
Automobile Visualization

Computer Aided Design

Computer Aided Design Interiors Professional Google Sketchup Mechanical CAD Architectural CAD Electronics CAD Casual Users
Computer Aided Design Interiors Professional Google Sketchup Mechanical CAD Architectural CAD Electronics CAD Casual Users
Computer Aided Design Interiors Professional Google Sketchup Mechanical CAD Architectural CAD Electronics CAD Casual Users

Interiors Professional

Google Sketchup

Mechanical CAD

Architectural CAD Electronics CAD Casual Users

Computer Aided Design Interiors Professional Google Sketchup Mechanical CAD Architectural CAD Electronics CAD Casual Users

Visualization: Science and Medicine

Visualization: Science and Medicine Visible Human Project: University of Hamburg
Visualization: Science and Medicine Visible Human Project: University of Hamburg
Visualization: Science and Medicine Visible Human Project: University of Hamburg

Visible Human Project: University of Hamburg

Virtual Reality

Virtual Reality • VR for design and entertainment • Simulators: Surgical, Flight, Driving, Spacecraft

VR for design and entertainment

Simulators: Surgical, Flight, Driving, Spacecraft

Virtual Reality • VR for design and entertainment • Simulators: Surgical, Flight, Driving, Spacecraft

Digital Visual Media

Digital Visual Media • From text to images to video (to 3D?) • Image and video

From text to images to video (to 3D?)

Image and video processing and photography

Multimedia computers, tablets, phones

Flickr, YouTube, WebGL

Real, Virtual Worlds (Google Earth, Second Life)

Electronic publishing

Online gaming

3D printers and fabrication

Why Study 3D Computer Graphics?

Why Study 3D Computer Graphics? • Applications (discussed next) • Fundamental Intellectual Challenges • Create

Applications (discussed next)

Fundamental Intellectual Challenges

Create and interact with realistic virtual world

Requires understanding of all aspects of physical world

New computing methods, displays, technologies

Technical Challenges

Math of (perspective) projections, curves, surfaces

Physics of lighting and shading

3D graphics software programming and hardware

The Visual Sciences

The Visual Sciences By: Dr. Zeeshan Bhatti 14
The Visual Sciences By: Dr. Zeeshan Bhatti 14

The Visual Sciences

The Visual Sciences • Image Processing: From Images to Images • Computer Vision: From Images to

Image Processing:

From Images to Images

Computer Vision:

From Images to Models

Computer Graphics:

From Objects to Models (Geometric Modeling). From 2D/3D Models to Images (Rendering).

From 4D Models to Images (Animation).

3D Graphics Pipeline

3D Graphics Pipeline Modeling Animation Rendering

Modeling

Animation

Rendering

3D Graphics Pipeline Modeling Animation Rendering
3D Graphics Pipeline Modeling Animation Rendering
3D Graphics Pipeline Modeling Animation Rendering
3D Graphics Pipeline Modeling Animation Rendering
3D Graphics Pipeline Modeling Animation Rendering

Geometric Modeling

Geometric Modeling • From a concept (or a real object) to a geometric representation on a

From a concept (or a real object) to a geometric representation on

a computer

Example: a sphere can be described as (x,y,z,r)

Complex objects can be constructed from simpler ones

can be described as ( x,y,z,r ) • Complex objects can be constructed from simpler ones

Curves for Modeling

Curves for Modeling Rachel Shiner, Final Project Spring 2010
Curves for Modeling Rachel Shiner, Final Project Spring 2010
Curves for Modeling Rachel Shiner, Final Project Spring 2010
Curves for Modeling Rachel Shiner, Final Project Spring 2010
Curves for Modeling Rachel Shiner, Final Project Spring 2010

Rachel Shiner, Final Project Spring 2010

Animation

Animation • Definition of complex time-dependent behaviour of objects • Issues with rigid and elastic joints

Definition of complex time-dependent behaviour of objects

Issues with rigid and elastic joints

Realistic rendering of collective behaviours

Examples:

• –Automatic interpolation between key-frames

• –Physics based simulation

Rendering

Rendering • Given a scene and viewing parameters, produce an image • Images are a 2D

Given a scene and viewing parameters, produce an image

Images are a 2D array of pixels

Important sub problems:

Which pixels are covered by each object ? (Scan Conversion)

What is visible at each pixel ? (Visible Surface Algorithm)

What color should a pixel be ? (Illumination, Shading Algorithms).

Surface Algorithm) – What color should a pixel be ? (Illumination, Shading Algorithms). By: Dr. Zeeshan

Rendering and Image Synthesis Examples

Rendering and Image Synthesis Examples Collage from 2007
Rendering and Image Synthesis Examples Collage from 2007
Rendering and Image Synthesis Examples Collage from 2007
Rendering and Image Synthesis Examples Collage from 2007

Collage from 2007

Interactive 3D Graphics

Interactive 3D Graphics
Interactive 3D Graphics

Final Project

Final Project
Final Project

Rendered Image

By: Dr. Zeeshan Bhatti
By: Dr. Zeeshan Bhatti

24

Viewing Transformation Pipeline

Viewing Transformation Pipeline By: Dr. Zeeshan Bhatti 25

Viewing Factors

Viewing Factors • Objects: – Geometrical Properties of an Object (Solid Modeling) –Physical Properties of

Objects:

Geometrical Properties of an Object (Solid Modeling) –Physical Properties of Object’s Surfaces (Illumination Models, Color Models)

Camera:

Projections

Light Source:

Color Theory

Spatial set-up:

3D Transformations, Coordinate Systems

2D Drawing

2D Drawing Goal: Getting Acquainted with Images • Displays (Raster vs. Vector) • Basic Definitions: Pixel,

Goal: Getting Acquainted with Images

Displays (Raster vs. Vector)

Basic Definitions: Pixel, Resolution, Dynamic Range…

Line Drawing (Incremental and Mid-Point Algorithms)

Techniques for Drawing Circles

Filling Polygons

2D Transformations

2D Transformations Goal: Introduction to 3D, Review Linear Algebra • Basic 2D Transformations: Translation, Scaling,

Goal: Introduction to 3D, Review Linear Algebra

Basic 2D Transformations: Translation, Scaling, Rotation, Shear.

Composition of Transformations and Transformation

Groups:

Shear. • Composition of Transformations and Transformation • Groups: By: Dr. Zeeshan Bhatti 28

2D Transformations

2D Transformations • Transformations in Matrix notation: • Composition of transformations in matrix notation •

Transformations in Matrix notation:

2D Transformations • Transformations in Matrix notation: • Composition of transformations in matrix notation •

Composition of transformations in matrix notation

The homogeneous coordinates in 2D:

in matrix notation • The homogeneous coordinates in 2D: • Change of coordinates: By: Dr. Zeeshan

Change of coordinates:

in matrix notation • The homogeneous coordinates in 2D: • Change of coordinates: By: Dr. Zeeshan

2D Viewing

2D Viewing Goal: Introduction to 3D and some Rendering Concepts Viewing Transformation pipe-line: Line and Polygon

Goal: Introduction to 3D and some Rendering Concepts

Viewing Transformation pipe-line:

to 3D and some Rendering Concepts Viewing Transformation pipe-line: Line and Polygon Clipping: By: Dr. Zeeshan

Line and Polygon Clipping:

to 3D and some Rendering Concepts Viewing Transformation pipe-line: Line and Polygon Clipping: By: Dr. Zeeshan

By: Dr. Zeeshan Bhatti

30

3D Viewing

3D Viewing Goal: Geometrical Transformations in Viewing Pipeline From Model Coordinates to Viewer Coordinates: By: Dr.

Goal: Geometrical Transformations in Viewing Pipeline

From Model Coordinates to Viewer Coordinates:

Geometrical Transformations in Viewing Pipeline From Model Coordinates to Viewer Coordinates: By: Dr. Zeeshan Bhatti 31

3D Viewing

3D Viewing Projections: • – Orthographic • – Oblique • – Perspective • The Viewing Volume:
3D Viewing Projections: • – Orthographic • – Oblique • – Perspective • The Viewing Volume:

Projections:

• –Orthographic

• –Oblique

• –Perspective

The Viewing Volume:

Projections: • – Orthographic • – Oblique • – Perspective • The Viewing Volume: By: Dr.

Solid Modeling

Goal: Learn how to Define Solid Objects

1D Curves in 3D

Primitive based: line segments. Free form:

Implicit, Explicit, Parametric (Polynomials, Splines)

2D Surfaces in 3D

Primitive Based: Polygon Mesh Free Form: As Above

3D volumes in 3D

Volume Rep.

Sweep Volumes

Spatial Occupancy (Voxels, Octree, …)

Constructive Solid Geometry

Boundary Rep.

Polyhedra

Free Form: As Above

By: Dr. Zeeshan Bhatti

33

Solid Modelling

Solid Modelling By: Dr. Zeeshan Bhatti 34
Solid Modelling By: Dr. Zeeshan Bhatti 34
Solid Modelling By: Dr. Zeeshan Bhatti 34

Parametric Surfaces

Parametric Surfaces • Bilinear Interpolation • Splines: – Cardinal Spline – Hermite Spline – Bezier

Bilinear Interpolation

Splines:

Cardinal Spline Hermite Spline

Bezier Spline

B Spline

• Splines: – Cardinal Spline – Hermite Spline – Bezier Spline – B Spline By: Dr.

Color Theory

Color Theory Goal: Understanding what a color is • The Trichromatic Color Theory • Linear Color

Goal: Understanding what a color is

The Trichromatic Color Theory

Linear Color Space and Color Representations: RGB,CMY,HSB

Perceptual Color Spaces: LAB,YIQ

The CIE Chromaticity Diagram

RGB,CMY,HSB • Perceptual Color Spaces: LAB,YIQ • The CIE Chromaticity Diagram By: Dr. Zeeshan Bhatti 36

Illumination Models and Shading

Illumination Models and Shading Goal: Understanding the physical properties of an object • Light Source Parameters

Goal: Understanding the physical properties of an object

Light Source Parameters (Shape, Position, Color, Intensity)

Surface Parameters: Ambient, Diffuse, Specular

Polygon Rendering Methods

Shadow

Ambient, Diffuse, Specular • Polygon Rendering Methods • • Shadow Transparency By: Dr. Zeeshan Bhatti 37

Transparency

Illumination Models and Shading

Illumination Models and Shading By: Dr. Zeeshan Bhatti 38
Illumination Models and Shading By: Dr. Zeeshan Bhatti 38
Illumination Models and Shading By: Dr. Zeeshan Bhatti 38

By: Dr. Zeeshan Bhatti

38

Example: Creating an Image from a Model

Example: Creating an Image from a Model Polygonal Model Generated from Spline Patches. Orthographic Projection By:

Polygonal Model Generated from Spline Patches.

Orthographic Projection

By: Dr. Zeeshan Bhatti

39

Example: Creating an Image from a Model

Example: Creating an Image from a Model Polygonal Model Generated from Spline Patches. Orthographic Projection By:

Polygonal Model Generated from Spline Patches.

Orthographic Projection

By: Dr. Zeeshan Bhatti

40

Example: Creating an Image from a Model

Example: Creating an Image from a Model Depth Cueing By: Dr. Zeeshan Bhatti 41

Depth Cueing

Depth Clipping By: Dr. Zeeshan Bhatti 42
Depth Clipping By: Dr. Zeeshan Bhatti 42

Depth Clipping

Colored Vectors By: Dr. Zeeshan Bhatti 43

Colored Vectors

Visible Line Determination By: Dr. Zeeshan Bhatti 44

Visible Line Determination

Visible Surface Détermination with Ambient Illumination By: Dr. Zeeshan Bhatti 45

Visible Surface Détermination with Ambient

Illumination

By: Dr. Zeeshan Bhatti

45

Individually Shaded Polygon with Diffuse Reflection By: Dr. Zeeshan Bhatti 46

Individually Shaded Polygon with Diffuse Reflection

By: Dr. Zeeshan Bhatti

46

Gouraud Shaded Polygon with Diffuse Reflection By: Dr. Zeeshan Bhatti 47

Gouraud Shaded Polygon with Diffuse

Reflection

By: Dr. Zeeshan Bhatti

47

Gouraud Shaded Polygon with Specular Reflection By: Dr. Zeeshan Bhatti 48

Gouraud Shaded Polygon with Specular Reflection

Phong Shaded Polygon with Specular Reflection By: Dr. Zeeshan Bhatti 49

Phong Shaded Polygon with

Specular Reflection

By: Dr. Zeeshan Bhatti

49

Curved Surfaces with Specular Reflection By: Dr. Zeeshan Bhatti 50

Curved Surfaces with Specular Reflection

Multiple Lights By: Dr. Zeeshan Bhatti 51

Multiple Lights

Texture Mapping By: Dr. Zeeshan Bhatti 52

Texture Mapping

Shadows By: Dr. Zeeshan Bhatti 53

Shadows

Reflection Mapping By: Dr. Zeeshan Bhatti 54
Reflection Mapping By: Dr. Zeeshan Bhatti 54

Reflection Mapping

Example: Polynomial Texture Maps

Example: Polynomial Texture Maps • From: • http://www.hpl.hp.com/research/ptm/ By: Dr. Zeeshan Bhatti 55

From:

http://www.hpl.hp.com/research/ptm/

Example: Polynomial Texture Maps • From: • http://www.hpl.hp.com/research/ptm/ By: Dr. Zeeshan Bhatti 55

Example: Polynomial Texture Maps

Example: Polynomial Texture Maps • From: • http://www.hpl.hp.com/research/ptm/ By: Dr. Zeeshan Bhatti 5 6

From:

http://www.hpl.hp.com/research/ptm/

Example: Polynomial Texture Maps • From: • http://www.hpl.hp.com/research/ptm/ By: Dr. Zeeshan Bhatti 5 6

By: Dr. Zeeshan Bhatti

56

Thankyou

Q & A

Referred Book

Computer Graphics: Principles and Practice in C, by J. D. Foley, A. Van Dam, S. K. Feiner, J. F. Hughes. Hardcover, 1200 pages, Addison-Wesley Pub Co; 2nd edition,

For Course Slides and Handouts web page:

Blog:

Facebook:

https://www.facebook.com/drzeeshanacademy

By: Dr. Zeeshan Bhatti

57