Computer Graphics Lecture 2

Similar documents
Lecture 1. Computer Graphics and Systems. Tuesday, January 15, 13

Computer Graphics. Bing-Yu Chen National Taiwan University

Image Formation. Introduction to Computer Graphics. Machiraju/Zhang/Möller/Klaffenböck

Graphics Systems and Models

Image Formation. Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

3D graphics, raster and colors CS312 Fall 2010

INTRODUCTION. Slides modified from Angel book 6e

Graphics Hardware and Display Devices

National Chiao Tung Univ, Taiwan By: I-Chen Lin, Assistant Professor

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

Lecture 10: Input, Interaction & callbacks. CITS 3003 Graphics & Animation

Computer Graphics - Chapter 1 Graphics Systems and Models

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

CHAPTER 1 Graphics Systems and Models 3

Survey in Computer Graphics Computer Graphics and Visualization

Introduction to Computer Graphics with WebGL

Image Formation. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Computer Graphics 1 Instructor Information. Books. Graphics? Course Goals and Outcomes. Where are computer graphics? Where are computer graphics?

Game Programming. Bing-Yu Chen National Taiwan University

CS450/550. Pipeline Architecture. Adapted From: Angel and Shreiner: Interactive Computer Graphics6E Addison-Wesley 2012

Introduction to Computer Graphics with WebGL

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Homework Graphics Input Devices Graphics Output Devices. Computer Graphics. Spring CS4815

Some Resources. What won t I learn? What will I learn? Topics

Models and Architectures

CMP 477 Computer Graphics Module 2: Graphics Systems Output and Input Devices. Dr. S.A. Arekete Redeemer s University, Ede

Lecture 12 Color model and color image processing

CS 354R: Computer Game Technology

Models and Architectures. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Illumination and Shading

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

Computer Graphics and Visualization. Graphics Systems and Models

Rendering Objects. Need to transform all geometry then

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

MMGD0206 Computer Graphics. Chapter 1 Development of Computer Graphics : History

Homework Graphics Input Devices Graphics Output Devices. Computer Graphics. Spring CS4815

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

CS451Real-time Rendering Pipeline

Chapter 1 Introduction

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

Color and Shading. Color. Shapiro and Stockman, Chapter 6. Color and Machine Vision. Color and Perception

Development of Computer Graphics

Introduction to Computer Graphics with WebGL

CS 464 Review. Review of Computer Graphics for Final Exam

Introduction to Computer Graphics. Overview. What is Computer Graphics?

CS452/552; EE465/505. Image Formation

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

VTU QUESTION PAPER SOLUTION UNIT -1 INTRODUCTION

CS 160: Lecture 10. Professor John Canny Spring 2004 Feb 25 2/25/2004 1

Overview CS Plans for this semester. References. CS 4600 Fall Prerequisites

Introduce the basic input devices Input, Interaction and Animation

Reading. 2. Color. Emission spectra. The radiant energy spectrum. Watt, Chapter 15.

CS452/552; EE465/505. Clipping & Scan Conversion

SAZ4C COMPUTER GRAPHICS. Unit : 1-5. SAZ4C Computer Graphics

Physical Color. Color Theory - Center for Graphics and Geometric Computing, Technion 2

Computer Graphics. Lecture 1 Introduction to Computer Graphics. Somsak Walairacht - Computer Engineering KMITL

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

CSC Graphics Programming. Budditha Hettige Department of Statistics and Computer Science

Animation & Rendering

Introduction to Computer Graphics with WebGL

CSC 8470 Computer Graphics. What is Computer Graphics?

CS452/552; EE465/505. Color Display Issues

Ciril Bohak. - INTRODUCTION TO WEBGL

Computer Graphics Introduction. Taku Komura

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

INFOGR Computer Graphics

QUESTION BANK 10CS65 : COMPUTER GRAPHICS AND VISUALIZATION

Visible Color. 700 (red) 580 (yellow) 520 (green)

CS4621/5621 Fall Computer Graphics Practicum Intro to OpenGL/GLSL

KRISTU JYOTI COLLEGE OF MANAGEMENT & TECHNOLOGY QUESTION BANK BCA SEMESTER III Computer graphics Part A (2 marks questions)

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Chapter Three. Hardware Basics: Peripherals

Output models Drawing Rasterization Color models

Computer Graphics Fundamentals. Jon Macey

CS 4620 Program 3: Pipeline

PowerVR Hardware. Architecture Overview for Developers

The Rasterization Pipeline

Computer Graphics Lecture 11

Three Main Themes of Computer Graphics

INTRODUCTION. Computer Graphics

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

Computer Graphics (CS 543) Lecture 1 (Part 1): Introduction to Computer Graphics

Shaders. Slide credit to Prof. Zwicker

MULTIMEDIA AND CODING

CS130 : Computer Graphics. Tamar Shinar Computer Science & Engineering UC Riverside

... Output System Layers. Application 2. Application 1. Application 3. Swing. UIKit SWT. Window System. Operating System

Development of Computer Graphics. mid 1950s SAGE air defense system command & control CRT, light pens

Lecture 2. Shaders, GLSL and GPGPU

Books: 1) Computer Graphics, Principles & Practice, Second Edition in C JamesD. Foley, Andriesvan Dam, StevenK. Feiner, John F.

Lecturer Athanasios Nikolaidis

CSE328 Fundamentals of Computer Graphics: Concepts, Theory, Algorithms, and Applications

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

The Graphics Pipeline

CS GPU and GPGPU Programming Lecture 2: Introduction; GPU Architecture 1. Markus Hadwiger, KAUST

COMP environment mapping Mar. 12, r = 2n(n v) v

Introduction. What s New in This Edition

Computer Graphics: Programming, Problem Solving, and Visual Communication

Form 3. Half Yearly Exam Revision

Transcription:

1 / 16 Computer Graphics Lecture 2 Dr. Marc Eduard Frîncu West University of Timisoara Feb 28th 2012

2 / 16 Outline 1 Graphics System Graphics Devices Frame Buffer 2 Rendering pipeline 3 Logical Devices 4 Recap

3 / 16 Graphics System Basic Graphic System set of equipment programs specialized in visual representation of the information Figure: Angel: Interactive Computer Graphics 4E c Addison-Wesley 2005

4 / 16 Graphics Devices Graphics Devices (GD) GD: equipment (hardware) required in order to interact with create graphics Sutherland (MIT 63) established the basic interactive human-computer paradigm: 1 user sees object on the display 2 user points to the object by using an input device 3 object reacts 4 repeat from 1

4 / 16 Graphics Devices Graphics Devices (GD) GD: equipment (hardware) required in order to interact with create graphics Sutherland (MIT 63) established the basic interactive human-computer paradigm: 1 user sees object on the display 2 user points to the object by using an input device 3 object reacts 4 repeat from 1 Types physical devices: Raster video display: CRT, LCD, Plasma, LED, video projector,...

4 / 16 Graphics Devices Graphics Devices (GD) GD: equipment (hardware) required in order to interact with create graphics Sutherland (MIT 63) established the basic interactive human-computer paradigm: 1 user sees object on the display 2 user points to the object by using an input device 3 object reacts 4 repeat from 1 Types physical devices: Raster video display: CRT, LCD, Plasma, LED, video projector,... Hard-copy devices: printers (Ink-ket, laser), film recorder, pen plotter,...

4 / 16 Graphics Devices Graphics Devices (GD) GD: equipment (hardware) required in order to interact with create graphics Sutherland (MIT 63) established the basic interactive human-computer paradigm: 1 user sees object on the display 2 user points to the object by using an input device 3 object reacts 4 repeat from 1 Types physical devices: Raster video display: CRT, LCD, Plasma, LED, video projector,... Hard-copy devices: printers (Ink-ket, laser), film recorder, pen plotter,... Input devices: light pen, keyboard, mouse, joystick, scanner, touch screen, tablet, eye-tracker, gloves, electro-magnetic, VR display,...

4 / 16 Graphics Devices Graphics Devices (GD) GD: equipment (hardware) required in order to interact with create graphics Sutherland (MIT 63) established the basic interactive human-computer paradigm: 1 user sees object on the display 2 user points to the object by using an input device 3 object reacts 4 repeat from 1 Types physical devices: Raster video display: CRT, LCD, Plasma, LED, video projector,... Hard-copy devices: printers (Ink-ket, laser), film recorder, pen plotter,... Input devices: light pen, keyboard, mouse, joystick, scanner, touch screen, tablet, eye-tracker, gloves, electro-magnetic, VR display,... logical devices: Graphics APIs, e.g., OpenGL, WebGL, DirectX/XNA, JavaScript based (Three.js, Box2D), X3D,...

4 / 16 Graphics Devices Graphics Devices (GD) GD: equipment (hardware) required in order to interact with create graphics Sutherland (MIT 63) established the basic interactive human-computer paradigm: 1 user sees object on the display 2 user points to the object by using an input device 3 object reacts 4 repeat from 1 Types physical devices: Raster video display: CRT, LCD, Plasma, LED, video projector,... Hard-copy devices: printers (Ink-ket, laser), film recorder, pen plotter,... Input devices: light pen, keyboard, mouse, joystick, scanner, touch screen, tablet, eye-tracker, gloves, electro-magnetic, VR display,... logical devices: Graphics APIs, e.g., OpenGL, WebGL, DirectX/XNA, JavaScript based (Three.js, Box2D), X3D,... The separation of physical & logical devices allows for more flexible programs, independent from the actual physical device

Graphics Devices Raster Device General notions a raster (bitmap) display consists of a two-dimensional array of pixels (i.e., picture elelements) discretized image shape and size of a pixel: square with a diagonal of 0.5mm the size of the array gives the display resolution (i.e., no. vertical pixels no. horizontal pixels) images are stored inside RAM in an area called a frame buffer a hardware device called video controller reads the frame buffer line by line and produces images on the display Figure: Raster graphics with Display Processor, www.cs.umd.edu/~mount/427/lects/427lects.pdf 5 / 16

6 / 16 Frame Buffer Frame Buffer Refresh rate or vertical scan rate usually at 30-75Hz (i.e., 30-75 Frames Per Second FPS) includes repeated drawing of identical frames Frame rate refresh rate does NOT include the repeated drawing of identical frames usually lower than the refresh rate

Frame Buffer Frame Buffer Refresh rate or vertical scan rate usually at 30-75Hz (i.e., 30-75 Frames Per Second FPS) includes repeated drawing of identical frames Frame rate refresh rate does NOT include the repeated drawing of identical frames usually lower than the refresh rate Interlaced vs. progressive display interlace: technique in which the apparent flickering is diminished by doubling the frame rate (e.g., 50Hz monitor PAL & SECAM set): paint first the odd lines then the even ones only ALiS plasma panels and traditional Cathode Ray Tube (CRT) TV sets use it modern CRT TV: flicker free by using the 100Hz technology progressive: technique in which all lines are drawn in sequence most CRT computer monitors, LCD monitors, HDTV displays LCDs: as much as 120 (i.e., lcm between 24FPS, cinema, and 30FPS, NTSC TV) or 240 Hz advantages over interlace: no visual artifacts (e.g., interline twitter) & no need for blurring to reduce interline twitter clearer and faster results for scaling to higher resolutions frames can be captured as still photos 6 / 16

7 / 16 Frame Buffer Color Frame Buffer About colors the method to represent colors depends on pixel depth and on the output device: additive: video displays subtractive: printers pixel depth: the number of bits to represent the color of a pixel (e.g., 24bit Red-Green-Blue model for most video and color LCDs) 8 bits for each color component in the 24 bit model (true-color): 0 for black and 255 for white usually a forth component called alpha (denoted A) is used to achieve various effects such as opacity and transparency color map (or color Look-Up-Table): used for web GIF images each pixel stores an 8bit index (i.e., 256 possible colors) the index points to a LUP containing 24bit colors halftoning: technique to trick the eye into seeing many shades of a color where in reality only a small number of distinct colors exist (e.g., web images)

8 / 16 Frame Buffer Color Frame Buffers Figure: Halftoning, www.cs.umd.edu/~mount/427/lects/427lects.pdf

Frame Buffer Visible Light Light visible light frequencies (electromagnetic spectrum): from red (700nm) to violet (400nm) light color characterized by: hue: dominant frequency (i.e., highest peak or primary wavelength) of a color saturation: excitation purity (i.e., ratio of highest to rest) of a color lightness: perceived luminance of a color Figure: A diagram of the electromagnetic spectrum, www.wikipedia.org 9 / 16

10 / 16 Frame Buffer Color Models Red-Green-Blue Cyan-Magenta-Yellow Hue-Saturation-Lightness... Images on the right from: http://viz.aset.psu.edu/ Figure: RGB color gho/sem_notes/color_2d/ cube html/primary_systems.html Figure: CMY cube Figure: HSV Perceptual Color Spaces

11 / 16 Rendering pipeline The rendering (graphics) pipeline typically accepts some representation of a three-dimensional primitives as an input and results in a 2D raster image as output (source: www.wikipedia.org) Figure: Rendering pipeline http://goanna.cs.rmit.edu.au/~gl/teaching/interactive3d/2011/lecture2.html

12 / 16 Rendering pipeline points vertices fragments pixels in mathematics a point is a zero-dimensional primitive in CG a vertex is a data structure that describes a point in 2D/3D space: position color normal textures reflectance in CG a fragment is a pre-pixel, i.e., data necessary to generate a single pixel (shade test): raster position depth color, texture coordinates,... stencil alpha...

13 / 16 Rendering pipeline Shaders programs used primarily to calculate rendering effects on graphics hardware vertex shader: run once for each vertex transform each vertex s 3D position in virtual space to the 2D coordinate in screen space fragment (pixel) shader: executed after the vertex shader compute the color and other attributes of each pixel alone they cannot produce complex effects as they operate on a per pixel basis used for: bump mapping, shadows, specular highlights, translucency,... geometry shader: relatively new can generate new graphics primitives from primitives sent at the beginning of the graphics pipeline operate between the vertex and a fragment shaders used for: point sprite generation, geometry tessellation, shadow volume extrusion, single pass cube map rendering,...

13 / 16 Rendering pipeline Shaders programs used primarily to calculate rendering effects on graphics hardware vertex shader: run once for each vertex transform each vertex s 3D position in virtual space to the 2D coordinate in screen space fragment (pixel) shader: executed after the vertex shader compute the color and other attributes of each pixel alone they cannot produce complex effects as they operate on a per pixel basis used for: bump mapping, shadows, specular highlights, translucency,... geometry shader: relatively new can generate new graphics primitives from primitives sent at the beginning of the graphics pipeline operate between the vertex and a fragment shaders used for: point sprite generation, geometry tessellation, shadow volume extrusion, single pass cube map rendering,... Example: GLSL (OpenGL Shading Language) high level shading language based on C syntax. No need to use assembly language or hardware specific languages!

14 / 16 Logical Devices Logical input Consider the C code: 1: int x; 2: scanf( %d, &x);

14 / 16 Logical Devices Logical input Consider the C code: 1: int x; 2: scanf( %d, &x); What is the input device?

14 / 16 Logical Devices Logical input Consider the C code: 1: int x; 2: scanf( %d, &x); What is the input device? cannot tell from the code can be anything: keyboard, file, another file,...

14 / 16 Logical Devices Logical input Consider the C code: 1: int x; 2: scanf( %d, &x); What is the input device? cannot tell from the code can be anything: keyboard, file, another file,... The code provides logical input, i.e., an int is returned regardless of the physical device

14 / 16 Logical Devices Logical input Consider the C code: 1: int x; 2: scanf( %d, &x); What is the input device? cannot tell from the code can be anything: keyboard, file, another file,... The code provides logical input, i.e., an int is returned regardless of the physical device Graphical logical devices graphical input is more varied than input to standard programs Six types of logical input (for older APIs: GKS, PHIGS): 1 keyboard: returns ASCII characters 2 locator: position in world coordinates through mouse, trackball,... 3 pick: identifies an object 4 choice: selection of a discrete number of objects 5 dial: provides analog input to the program 6 stroke: device returns an array of locations through mouse clicks (button down start transfer, release button end transfer)

Logical Devices Logical input Consider the C code: 1: int x; 2: scanf( %d, &x); What is the input device? cannot tell from the code can be anything: keyboard, file, another file,... The code provides logical input, i.e., an int is returned regardless of the physical device Graphical logical devices graphical input is more varied than input to standard programs Six types of logical input (for older APIs: GKS, PHIGS): 1 keyboard: returns ASCII characters 2 locator: position in world coordinates through mouse, trackball,... 3 pick: identifies an object 4 choice: selection of a discrete number of objects 5 dial: provides analog input to the program 6 stroke: device returns an array of locations through mouse clicks (button down start transfer, release button end transfer) Newer APIs (e.g., OpenGL) do not take this approach 14 / 16

15 / 16 Input Modes Input devices contain triggers (e.g., mouse button, keys) which can be used to send signals (e.g., information: position mouse, ASCII code keyboard) to the OS Input modes request mode: input provided only when user triggers the device (e.g., keyboard input) event mode: input stored in an event queue for later examination each time the device is triggered (e.g., window: resize; mouse: click, move; keyboard: key press/release)

15 / 16 Input Modes Input devices contain triggers (e.g., mouse button, keys) which can be used to send signals (e.g., information: position mouse, ASCII code keyboard) to the OS Input modes request mode: input provided only when user triggers the device (e.g., keyboard input) not sufficient for Human-Computer-Interface event mode: input stored in an event queue for later examination each time the device is triggered (e.g., window: resize; mouse: click, move; keyboard: key press/release) ideal for environments with multiple input devices

Input Modes Input devices contain triggers (e.g., mouse button, keys) which can be used to send signals (e.g., information: position mouse, ASCII code keyboard) to the OS Input modes request mode: input provided only when user triggers the device (e.g., keyboard input) not sufficient for Human-Computer-Interface event mode: input stored in an event queue for later examination each time the device is triggered (e.g., window: resize; mouse: click, move; keyboard: key press/release) ideal for environments with multiple input devices Callbacks programming interface for event-driven input one callback function for each type of event the graphics system recognizes the user defined callback function is executed when the corresponding event occurs: 1: public void display(glautodrawable canvas) { 2: GL2 gl = canvas.getgl().getgl2(); 3: gl.glclear(gl.gl COLOR BUFFER BIT); 4: //Add here the code for generating the scene 5: //... 6: gl.glflush(); 7: } Figure: Java for OpenGL: display callback, called each time the scene is rendered 15 / 16

16 / 16 Lecture Recap graphics system = equipment (graphics devices) specialized programs/graphics APIs physical logical devices images stored inside a memory zone called frame buffer before being rendered on the display real light (wave particle), simulated light (various models: RGB, CMY, HSL) rendering pipeline: converts a 3D model to a 2D raster image points vertices fragments pixels input modes: request vs. event based event based wins in graphics contest