• No results found

Computer Graphics. Anders Hast

N/A
N/A
Protected

Academic year: 2021

Share "Computer Graphics. Anders Hast"

Copied!
44
0
0

Loading.... (view fulltext now)

Full text

(1)

Computer Graphics

Anders Hast

(2)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Who am I?

! 5 years in Industry after graduation, 2 years as high school teacher.

! 1996 Teacher, University of Gävle

! 2004 PhD, Computerised Image Processing

" Computer Graphics

! 2007 Application Expert in Visualisation (UPPMAX)

! 2010 ”Docent”

! 2011 ERCIM Fellow, IIT, CNR, Pisa, Italy

! 2012 Associate Professor, Uppsala University

"

Department of Information Technology

"

MIC building 2, floor 1, room 2120

"

+46 18 - 471 2829

"

www.cb.uu.se/~aht

"

[email protected]

(3)

In fo rma tio nst ekn ol og i

The others in the Team

! Filip Malmberg

" Teacher

" All labs, assignments and project

" Located at Centre for Image Analysis, building 2, Room 2109

! Fredrik Nysjö

" Teacher

" All labs, assignments and project

" Located at Centre for Image Analysis, building 2 Room 2103

! Kristina & Tomas

" All labs

(4)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Formalities

! Did you register?

" www.antagning.se

! 3 Mandatory Assignments

! 1 Mandatory Project

! 1 Exam (5 hours)

! Course book

" Angel: Interactive Computer Graphics: A top-down

approach with OpenGL

(5)

In fo rma tio nst ekn ol og i

What CG?

! It is ”concerned with all aspects of producing pictures or images using a computer.”

- E. Angel

! “a branch of computer science”, which ”has

attracted some of the most creative people in the world to its fold. They come from all disciplines- art, science, music, dance, film making and many others”

- Foley et. al 


(6)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

What can it be used for?

! Display of information

" Visualisations etc...

! Interfaces

" Computers

" Cell Phones

" Hand held devices

! Entertainment

" Games

" Films

(7)

In fo rma tio nst ekn ol og i

(8)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

(9)

In fo rma tio nst ekn ol og i

(10)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

(11)

In fo rma tio nst ekn ol og i

Graphics in Movies

! TRON

" First 3D shaded graphics in a Hollywood film

(12)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Special Effects

! 1983 ILM computer graphics division develops

"Genesis effect" for Star Trek II - The Wrath of Khan

Text

http://www.youtube.com/watch?v=QXbWCrzWJo4

(13)

In fo rma tio nst ekn ol og i

Many Areas make use of it

! Visualisation

! Image Processing

! Computer Vision

! Scientific Visualisation

! Cartography

! GIS

! CAD

! Special Effects (Film)

(14)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Visualisation

! 2D

" Charts and Diagrams

! 3D

" Volumes

" Polygon Models

(15)

In fo rma tio nst ekn ol og i

Image Processing

! Extracts

information from

images or volumes

! Produces

" 2D Images

" 3D objects

! Haptics

(16)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Computer Vision

! Feature Matching

! Tracking

! 3D Reconstruction

(17)

In fo rma tio nst ekn ol og i

Cartography

! 2D

! 3D

(18)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

GIS

! Combining

" Maps

" Information

(19)

In fo rma tio nst ekn ol og i

CAD

! Computer Aided Design

(20)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Special Effects

! Special effects often needs special tools

" Because they are special effects!

" Therefore it was necessary to create this tool

from scratch

(21)

In fo rma tio nst ekn ol og i

What we will Learn

! How lines are drawn, surfaces painted, etc

! How to use graphic function libraries (OpenGL)

! How to give 3D impression on a 2D display

! Create 3D model worlds and display them

! What colour, resolution etc means in an Image

! In what order things are done (graphics pipeline)

! How to program graphics hardware shaders

! These things will be covered in 3 practicals (labbar) and

one Project

(22)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

What YOU are expected to know already:

! C or C++

! Data structures (arrays, linked lists)

! Geometry

! Linear algebra (matrices)

! You are responsible for your studies -

lecture notes is only a part of the whole

(23)

In fo rma tio nst ekn ol og i

Course Syllabus (outcomes)

! describe the data flow in a graphics rendering system;

! use matrix algebra in computer graphics applications;

! implement fundamental algorithms and transformations involved in viewing models, projection models, illumination models and the handling of hidden surfaces in polygon-based computer graphics;

! describe effects such as texture mapping, bump mapping and antialiasing;

! describe curves and surfaces that can be represented by splines;

! use the OpenGL API with C++ in 3D graphics programming;

(24)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Contents (Syllabus)

! The graphics pipeline. Colour systems.

Geometrical objects. Matrix algebra for

transformations, projections and coordinate systems in 2D and 3D. Clipping and hidden surface removal. Lighting models for polygon based graphics. Rasterization. Line drawing.

Polygon filling. Texture mapping and bump

mapping. Global rendering. Low level graphics

libraries for 3D programming (OpenGL). Shader

programming on GPU.

(25)

In fo rma tio nst ekn ol og i

Evaluation of last years course

! Students were very pleased with last years course, again! :)

" Interesting & inspiring!

! Nothing special changed for this year except that Fredrik has taken over from Stefan

! Ingrid will give her special lecture… for

the last time? Take the chance to come!!

(26)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Images

! Spatial Resolution

" A modern computer display (1980x1080)

pixels

" Pixel = Picture Element

! Colour Depth

" The number of bits used to represent the

colour of a single pixel

" True Colour 24 bit (8 bit per colour channel)

" 3 Colour Channels: R,G,B

(27)

In fo rma tio nst ekn ol og i

Raster Graphics

! Image produced as an array (the raster) of

picture elements (pixels) in the frame buffer

(28)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

History

! 70’s

" University of Utah

# Sutherland, Blinn, Phong, Guoraud, Catmull, Newell (the teapoat) and others….

" The fundamentals of CG

! 80’s

" Graphical User Interfaces

# Macintosh,Amiga

" Graphics in Movies

(29)

In fo rma tio nst ekn ol og i

History

! 90’s

" Image Based Rendering

" Toy Story

" Special Effects

! 00’s

" GPU’s

! 10’s

" Fusion with Image Processing and Computer

Vision

http://www.youtube.com/watch?v=RPV1Dqo_RWE

(30)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Some things you will learn

! Transformations

! Shading

! Illumination

! Mapping

! Graphics Pipeline

(31)

In fo rma tio nst ekn ol og i

Transformations

! Affine

(32)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Shading

! Gouraud

! Phong

(33)

In fo rma tio nst ekn ol og i

Illumination

! The Phong Illumination Equation

(34)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Mapping Techniques

! Texture mapping

! Bump mapping

! Environment mapping

! Geometry mapping

! Normal mapping

(35)

In fo rma tio nst ekn ol og i

Graphics Pipeline

! The input is the objects and its vertices

! The output are pixels on the screen

! Performs

" Transformations

" Clipping

" Shading and illumination

" texturing, etc

(36)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Splines

! The Utah Teapot is made by Bezier

Splines

(37)

In fo rma tio nst ekn ol og i

OpenGL

! stands for Open Graphics Library.

! It is a specification of an API for rendering graphics, usually in 3D.

! OpenGL implementations are libraries that implement the API defined by the specification.

! Graphics cards usually have an OpenGL implementation.

! Because the OpenGL specification is not platform-specific, it is possible to write an application that will be possible to use against many different types of graphics cards.

! It also increases the chance that the application will

continue to work when new hardware will become

(38)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

What is it?

! OpenGL is an open specification.

! Latest version 4.3 (2012)

! describes the interface the programmer uses and expected behavior.

! There is an implementation of GL that is Open Source and it is called Mesa3D http://www.mesa3d.org

! Its announcing itself as OpenGL 2.1 compliant.

(39)

In fo rma tio nst ekn ol og i

Coordinate System

! The negative Z-axis is in front of you

(40)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

Code Example

! A Triangle

" 3 coordinates (float)

! Note the API-calls!

glBegin(GL_TRIANGLES);

glVertex3f(-1.0f, -0.5f, -4.0f);

glVertex3f( 1.0f, -0.5f, -4.0f);

glVertex3f( 0.0f, 0.5f, -4.0f);

glEnd();

(41)

In fo rma tio nst ekn ol og i

More Pimitives

! GL_POINTS

! GL_LINES

! GL_LINE_STRIP

! GL_LINE_LOOP

! GL_TRIANGLES

! GL_TRIANGLE_STRIP

! GL_TRIANGLE_FAN

! GL_QUADS

! GL_QUAD_STRIP

! GL_POLYGON

(42)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

OpenGL

! 2D Graphics

! 3D Graphics

! Shading & Illumination

! Projections

! Clipping

! Texture Mapping

! And a lot more!

(43)

In fo rma tio nst ekn ol og i

Programmable Shaders

! OpenGL in software is relatively slow

" Phong shading is not supported (was

invented in the mid 70’s!!

! Phong Shading is easy to implement using shaders

! Shaders are FAST!

(44)

In fo rma tio nst ekn ol og i

Institutionen för informationsteknologi | www.it.uu.se

The End

! Remember to Study the chapters in the textbook

! Prepare for practicals

! Play around with OpenGL!

" Make your own Game!?

References

Related documents

2017 UH-Manoa, Shidler College of Business; Rice University, Jones School of Business; HEC Paris; Northwestern University, Kellogg School of Management; NYU, Stern School of

A study to determine the effect of maternal anaemia on anthropometric profile of neonates and it was found mean birth weight, head circumference and the crown heel

The Bills proposing An Integrated Climate and Energy Policy also called for a broad analysis to be made of future removals and emissions of greenhouse gases from for- estry

Evans and Linsley (1960) classified aggregations into dense (ball-like) or loose (males sharing the same site but not maintaining physical contact), depending on the fidelity

According to the results of data analysis questionnaire, obtained the conclusions; cost-effectiveness, security and reliability of the system will affect to the decision

This whole process build up a Multi-resolution Editing system for the hair model ( Kim and Neumann, 2003) Which allow user can easily pick any level of control

GROUP OF THIRTY, FINANCIAL REFORM: A FRAMEWORK FOR STABILITY 29 (2009), available at http://www.group30.org/images/PDF/Financial Reform-A

Our results show that the effects of school starting age fade away in adulthood for math competencies and for text comprehension but remain significant for receptive vocabulary.. This