35
Bina Nusantara 1

T0074-01 ok

Embed Size (px)

DESCRIPTION

Computer Graphics and OpenGL introduction for college

Citation preview

Page 1: T0074-01 ok

Bina Nusantara 1

Page 2: T0074-01 ok

Lecture 01 Computer Graphics System

Subjects : T0074 / Computer Graphics Year : 2012

Bina Nusantara 2

Page 3: T0074-01 ok

Course Description• This course consists of computer graphics

concept and data manipulation based opengl in kernel of graphics. It gives students competency to apply and solve problems by using computer graphics algorithms or methods. It is related to some courses that are C++ computer language and opengl and associated with topics and related methods discussed in this class include: Introduction Computer Graphics and opengl, raster graphics algorithms, Clipping algorithms and graphics transformation, opengl instruction, lighting, texturing and 3D Object modeling.

Bina Nusantara 3

Page 4: T0074-01 ok

Bina Nusantara

Course OutlineComputer Graphics SystemComputer Graphics System (2 lectures) (2 lectures)

Graphics ArchitecturesGraphics Architectures (2 (2 lectures)lectures)

Graphics programming I (2D) (2 Lectures)Graphics programming I (2D) (2 Lectures)

Viewing in Graphics Programming(2 Lectures)Viewing in Graphics Programming(2 Lectures)

RasRaster algorithms for 2D ter algorithms for 2D graphicsgraphics(Clipping/Polygon)(Clipping/Polygon) ( (22

lectures)lectures)

2D and 3D graphics and geometrical 2D and 3D graphics and geometrical transformation (transformation (44

lectures)lectures)4

Page 5: T0074-01 ok

Bina Nusantara

Course Outline

Viewing in 3D (viewing transformation and projection Viewing in 3D (viewing transformation and projection transformation (2 lectures)transformation (2 lectures)

Interactive CG Interactive CG Programming Programming II (II (3D3D)) using openGL (2 using openGL (2 lectures)lectures)

Achromatic and Chromatic (Achromatic and Chromatic (2 lectures) 2 lectures)

Illumination (lighting) and shading (2 lectures)Illumination (lighting) and shading (2 lectures)

Texture mapping (2 lectures)Texture mapping (2 lectures)

3D object modeling : quadric surface and NURBS (2 3D object modeling : quadric surface and NURBS (2 lectures)lectures)

Modeling with Hermite, Bezier, B-Spline.Modeling with Hermite, Bezier, B-Spline.5

Page 6: T0074-01 ok

composition assessment

• Assessment Activity Weight • Assignment 20% • Mid Exam 30% • Final Exam 50%

Bina Nusantara 6

Page 7: T0074-01 ok

Bina Nusantara

Overview : Overview : • what computer graphics is and its differences with what computer graphics is and its differences with image image processing, and image analysisprocessing, and image analysis

Course outline, philosophy, course composition Course outline, philosophy, course composition and assessmentsand assessments

Why study computer graphics and various uses of Why study computer graphics and various uses of computer graphicscomputer graphics

Processes in 3D graphic pipeline Processes in 3D graphic pipeline

Lecture Outlines

7

Page 8: T0074-01 ok

Bina Nusantara

What is Computer Graphics ?

8

Page 9: T0074-01 ok

What is Computer Graphics? Computer graphics deals with all aspects of

creating images with a computer– Hardware– Software– Applications

Bina Nusantara

Input devices

Output device

9

Page 10: T0074-01 ok

Computer Graphics: 1990-2000

• OpenGL API• Completely computer-generated feature-length

movies (Toy Story) are successful• New hardware capabilities

– Texture mapping– Blending– Accumulation, stencil buffers

Bina Nusantara

10

Page 11: T0074-01 ok

Computer Graphics: 2000-

• Photorealism• Graphics cards for PCs dominate market

– Nvidia, ATI

• Game boxes and game players determine direction of market

• Computer graphics routine in movie industry: Maya, Lightwave

• Programmable pipelines

Bina Nusantara

11

Page 12: T0074-01 ok

Bina Nusantara

IMAGE DESCRIPTION

IMAGEIMAGE PROCESSING PATTERN

RECOGNITION

DESCRIPTIONCOMPUTER

GRAPHICS

DATA PROCESSING

OUTPUOUTPUTT

IINNPPUUTT

Course Philosophy

• Teaches theory and practice using Teaches theory and practice using openGL openGL and and C/C++C/C++

• Provides solid foundation in academic materials, andProvides solid foundation in academic materials, and

• Practical experiences in programming graphicsPractical experiences in programming graphics12

Page 13: T0074-01 ok

Bina Nusantara

Uses of Computer Graphics

13

Page 14: T0074-01 ok

Bina Nusantara

Uses of Computer Graphics

14

Page 15: T0074-01 ok

Bina Nusantara

Uses of Computer Graphics

15

Page 16: T0074-01 ok

Bina Nusantara

Uses of Computer Graphics

16

Page 17: T0074-01 ok

Bina Nusantara

Uses of Computer Graphics

17

Page 18: T0074-01 ok

Bina Nusantara

Nature of Computer Graphics

Many computer graphics applications involve:Many computer graphics applications involve:• ModelingModeling

– Choice of representationChoice of representation• RenderingRendering

– geometry, visibilitygeometry, visibility– mapping from ‘real world’ to ‘image space’mapping from ‘real world’ to ‘image space’– simulation of interaction of light with objectssimulation of interaction of light with objects

• reflection, absorption, and transmissionreflection, absorption, and transmission• emission, and refractionemission, and refraction• diffraction, and interference.diffraction, and interference.

• AnimationAnimation• InteractionInteraction

18

Page 19: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline ArchitecturesINPUT :INPUT :

• Geometrical Model :Geometrical Model :Description of all object, surface, light Description of all object, surface, light source geometry and transformationssource geometry and transformations

• Lighting ModelLighting ModelComputational description of object and Computational description of object and light properties, interactionlight properties, interaction

• Synthetic Viewpoint (or Camera)Synthetic Viewpoint (or Camera)Eye position and frustum (viewing Eye position and frustum (viewing volume)volume)

• Raster Raster ViewportViewportPixel grid onto which image plane is Pixel grid onto which image plane is mappedmapped

OUTPUT :OUTPUT :

Colors/Intensities suitable for frame Colors/Intensities suitable for frame buffer display (ex. 24 bit RGB value at buffer display (ex. 24 bit RGB value at each pixel)each pixel)

19

Page 20: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline Architectures

• 3D models defined in their own 3D models defined in their own coordinate coordinate system (object space)system (object space)

• Modeling transforms orient the Modeling transforms orient the models models within a common coordinate frame within a common coordinate frame (world (world space)space)

20

Page 21: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline Architectures

• Vertices lit (shaded) according to Vertices lit (shaded) according to material material properties, surface properties, and properties, surface properties, and light light sources.sources.

• Local lighting model (diffuse, Local lighting model (diffuse, ambient, ambient, specularspecular, etc), etc)

21

Page 22: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline Architectures• Maps world space to eye spaceMaps world space to eye space

• Viewing positions is transformed to Viewing positions is transformed to original original and direction is oriented along some and direction is oriented along some axis axis (usually z-axis)(usually z-axis)

22

Page 23: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline Architectures• Transform to normalized device Transform to normalized device coordinates coordinates (NDC)(NDC)

• Portions of the object Portions of the object outside the view outside the view volume are removedvolume are removed

23

Page 24: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline Architectures• The objects are projected to the 2D The objects are projected to the 2D image image space (screen space)space (screen space)

24

Page 25: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline Architectures

• Rasterizes Rasterizes objects into pixelsobjects into pixels

• Interpolate values as we go (color, Interpolate values as we go (color, depth, etc)depth, etc)

25

Page 26: T0074-01 ok

Bina Nusantara

3D Graphics Pipeline Architectures• Each pixel remembers the closest Each pixel remembers the closest object object (depth buffer)(depth buffer)

• Almost every step in the graphic Almost every step in the graphic pipeline pipeline involves a change in coordinate involves a change in coordinate system. system. Transformations are central to Transformations are central to understanding understanding 3D computer graphics3D computer graphics

26

Page 27: T0074-01 ok

Bina Nusantara

Example thro’ the pipeline Architectures…

Images courtesy of Picture Inc.Images courtesy of Picture Inc.

ModelModel

Constant Shading-Constant Shading-AmbientAmbient

Depth CueDepth Cue Hidden Line RemovalHidden Line Removal

Perspective ViewPerspective ViewOrthographic ViewOrthographic View

27

Page 28: T0074-01 ok

Bina Nusantara

Graphics Definitions

• Point– a location in space, 2D or 3D– sometimes denotes one pixel

• Line– straight path connecting two points– infinitesimal width, consistent density– beginning and end on defining points

28

Page 29: T0074-01 ok

Bina Nusantara

Graphics Definitions• Vertex

– point in 3D• Edge

– line in 3D connecting two vertices• Polygon/Face/Facet

– arbitrary shape formed by connected vertices– fundamental unit of 3D computer graphics

29

Page 30: T0074-01 ok

Bina Nusantara

Graphics Definitions

• Raster– derived from TV systems for a row of pixels– commonly referred to as a scanline– does influence algorithms – reducing memory

requirements, parallelism, etc.– is the derivation of rasterization, scan-line algorithms

30

Page 31: T0074-01 ok

Display Processor• Rather than have the host computer try to refresh display

use a special purpose computer called a display processor (DPU)

• Graphics stored in display list (display file) on display processor

• Host compiles display list and sends to DPU

Bina Nusantara

31

Page 32: T0074-01 ok

Frame Buffer

•Define a buffer by its spatial resolution (n x m) and its depth (or precision) k, the number of bits/pixel

pixel

Bina Nusantara

32

Page 33: T0074-01 ok

OpenGL Frame Buffer

Bina Nusantara 33

Page 34: T0074-01 ok

OpenGL Buffers(Frame Buffers)

• Color buffers can be displayed– Front– Back– Auxiliary– Overlay

• Depth• Accumulation

– High resolution buffer• Stencil

– Holds masks

Bina Nusantara

34

Page 35: T0074-01 ok

Writing in Buffers•Conceptually, we can consider all of memory as a large two-dimensional array of pixels

• We read and write rectangular block of pixels– Bit block transfer (bitblt) operations

• The frame buffer is part of this memory

frame buffer(destination)

sourcememory

Bina Nusantara

35