Normalized Device Coordinate System (NDC) World Coordinate System. Example Coordinate Systems. Device Coordinate System

Similar documents
World Coordinate System

CHAPTER 1 Graphics Systems and Models 3

OpenGL. Jimmy Johansson Norrköping Visualization and Interaction Studio Linköping University

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

E.Order of Operations

Discrete Techniques. 11 th Week, Define a buffer by its spatial resolution (n m) and its depth (or precision) k, the number of

Pixels and Buffers. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

INF3320 Computer Graphics and Discrete Geometry

OpenGL. Toolkits.

Computer Graphics, Chapt 08

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

HE COMPLETE OPENGL PROGI FOR WINDOW WIND

Module 13C: Using The 3D Graphics APIs OpenGL ES

Models and Architectures

Exercise 1 Introduction to OpenGL

Graphics Pipeline & APIs

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Computer Graphics. Chapter 3 Computer Graphics Software

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

Pipeline Operations. CS 4620 Lecture 10

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL

Pipeline Operations. CS 4620 Lecture 14

Graphics Programming

Graphics Pipeline & APIs

CSE4030 Introduction to Computer Graphics

Introduction to Computer Graphics with WebGL

Rasterization Overview

Rendering Objects. Need to transform all geometry then

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

The Rendering Pipeline (1)

Computer Graphics with OpenGL ES (J. Han) Chapter VII Rasterizer

INF3320 Computer Graphics and Discrete Geometry

Lecture 2. Determinants. Ax = 0. a 11 x 1 + a 12 x a 1n x n = 0 a 21 x 1 + a 22 x a 2n x n = 0

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

Buffers, Textures, Compositing, and Blending. Overview. Buffers. David Carr Virtual Environments, Fundamentals Spring 2005 Based on Slides by E.

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

PROFESSIONAL. WebGL Programming DEVELOPING 3D GRAPHICS FOR THE WEB. Andreas Anyuru WILEY. John Wiley & Sons, Ltd.

The Traditional Graphics Pipeline

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

Computer Graphics: Programming, Problem Solving, and Visual Communication

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

CS 130 Final. Fall 2015

1.2.3 The Graphics Hardware Pipeline

Computer Graphics Fundamentals. Jon Macey

Graphics Hardware and OpenGL

Rendering. Part 1 An introduction to OpenGL

Buffers. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Computer Graphics Course 2005

Graphics Hardware. Instructor Stephen J. Guy

to OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL

Early History of APIs. PHIGS and X. SGI and GL. Programming with OpenGL Part 1: Background. Objectives

Grafica Computazionale: Lezione 30. Grafica Computazionale. Hiding complexity... ;) Introduction to OpenGL. lezione30 Introduction to OpenGL

The Traditional Graphics Pipeline

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

Computer Graphics I Lecture 11

CS 464 Review. Review of Computer Graphics for Final Exam

The Traditional Graphics Pipeline

CMSC 425: Lecture 4 More about OpenGL and GLUT Tuesday, Feb 5, 2013

- Rasterization. Geometry. Scan Conversion. Rasterization

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

VR-programming tools (procedural) More VRML later in this course! (declarative)

Computer Graphics (Basic OpenGL)

OpenGl Pipeline. triangles, lines, points, images. Per-vertex ops. Primitive assembly. Texturing. Rasterization. Per-fragment ops.

Graphics Hardware and Display Devices

Ciril Bohak. - INTRODUCTION TO WEBGL

Programming with OpenGL Part 1: Background

Course Title: Computer Graphics Course no: CSC209

Introduction to Computer Graphics

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

Texture. Texture Mapping. Texture Mapping. CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

CS 475 / CS 675 Computer Graphics. Lecture 11 : Texture

Drawing Fast The Graphics Pipeline

Lecture 4 of 41. Lab 1a: OpenGL Basics

Computer Graphics. Bing-Yu Chen National Taiwan University

Image Processing. Geometry Processing. Reading: (Not really covered in our text. See Sects 18.1, 18.2.) Overview: Display

Computer Graphics. Bing-Yu Chen National Taiwan University

Lecture 07: Buffers and Textures

CS4620/5620: Lecture 14 Pipeline

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

COMP3421 Computer Graphics

CS559: Computer Graphics. Lecture 12: OpenGL Li Zhang Spring 2008

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

OpenGL SUPERBIBLE. Fifth Edition. Comprehensive Tutorial and Reference. Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak

Lectures OpenGL Introduction

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

OpenGL refresher. Advanced Computer Graphics 2012

Computer Graphics. Bing-Yu Chen National Taiwan University

Deferred Rendering Due: Wednesday November 15 at 10pm

Drawing Fast The Graphics Pipeline

Spring 2009 Prof. Hyesoon Kim

The Viewing Pipeline Coordinate Systems

cs123 Lab 3 OpenGL Part One 1 Introduction 2 OpenGL Basics 2.2 The Rendering Pipeline 2.1 The CPU and the GPU 2.3 Basic Syntax of OpenGL commands

Computer Graphics. Making Pictures. Computer Graphics CSC470 1

Line Drawing. Foundations of Computer Graphics Torsten Möller

GUERRILLA DEVELOP CONFERENCE JULY 07 BRIGHTON

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

Introduction to Shaders.

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

Game Architecture. 2/19/16: Rasterization

Transcription:

World Coordinate System Normalized Device Coordinate System (NDC) Model Program Graphics System Workstation Model Program Graphics System Workstation Normally, the User or Object Coordinate System. World Coordinate Window: A subset of the world coordinate system, defined by the application. For instance, this could be the coordinate system of reals. The standardized coordinate system for all devices. Ranges from (0.0 1.0) in each dimension. Convenient for all device drivers. A convenient space for performain Pick operations. 1 2 Example Coordinate Systems Device Coordinate System ( 10, 2) ( 2.5, 4.5) (1000, 500) Model Program Graphics System Workstation ( 20, 1) (1.5, 3.3) ( 1000, 500) Coordinate system of Device. Could be different for each device. Must specify device square for mapping from NDC. World Coordinate Windows (1.0, 1.0) (0,0) (0.0, 0.0) Normalized Device Coordinates (1280,1024) Device Coordinates (example) 3 4

Graphics Primitives A Simple Graphics Package Graphics Primitives Point Line, Polyline, Polygon, Rectangle Circle, Ellipse Marker, Polymarker Text Polyline Polygon Start Angle PolyMarker End Angle Ellipse 5 6 Text Graphics Attributes Lines: style (continuous, dashed, dotted), width Markers: style, size Color (color index or true color - RGB) Filled Primitives: style (opaque, transparent), pattern (bitmap/pixmap) Text: style (font), size, orientation Foreground/Background colors Inquiry 7 Attributes baseline Text Origin Text center quit Width Font (Times, Helvetica, Roman) Appearance (Bold, italic, underlined) Size (points), Orientation Inter-character, Inter-line spacing Implementation As Pixmaps Height As geometric descriptions (splines, for instance) 8

Input Interaction: Sampling vs. Event-Driven Processing Interaction Human Factors Simple, consistent interaction sequences. Not too many options, features. Appropriate feedback. Error recovery. Polling: Continuous monitoring of all enabled input devices - CPU intensive, wasteful. Interrupt-driven: interrupted when device state changes - a little tricky. Event-driven: chooses to service the event at its convenience (GKS, PHIGS, X). Device Handler Mouse Keyboard 9 Event Queues 10 Event Based Processing Initialize and generate initial display do { wait for user selection switch (on selection) { selection 1 : process selection 1 selection 2 : process selection 1...... selection n : process selection n } } while (!quit) Transformations/Viewing Affine (modeling) transforms (scale,rotate, translate) Camera specification Projection transformations (parallel(orthographic), perspective) Clipping and View volume specification 11 12

Raster Operations Lighting Local models (Ambient, Diffuse, Specular) Light sources (color, position, attenuation), types (spotlights) Material colors/properties Local vs. Infinite Viewpoint Exploits display hardware features, especially saving and restoring bitmaps. BITBLT operations. Canvases Any bitmap or pixmap (2D array of pixels) is a canvas. Canvases have size, extent, mask and other attributes. Can be created, deleted, changed, copied. Offscreen or onscreen. Operations affect current canvas. 13 14 Raster Operations(contd) Source Destination Op Other Package Features Write Masks: Replace OR XOR AND Write masks control bit planes that are to be modified Logical operations between source and destination canvases. Pull down menus. Rubber Banding. 15 Pixels, Bitmaps, Images (BitBlt) Blending, Anti-aliasing, Fog Texture mapping (2D and 3D) and filtering Framebuffer Operations Modeling and representation (Polygons, Cubics (Bezier, B-Spline, NURBS) 16

Graphics APIs OpenGL: An Introduction A graphics language that is a current industry standard Widely deployed across multiple application domains, platforms, vendors GKS (Graphics Kernal System) PHIGS (Programmer Hierarchical Interactive Graphics Standard) PHIGS+ Outgrowth of SGI GL GL (Graphics Library) by SGI Device independent Supports interfaces to modern graphics hardware/systems Generally these APIs support both 2D and 3D graphics: 17 OpenGL DirectDraw, Direct3D by Microsoft 18 GL Output Examples What is OpenGL A software interface to graphics hardware Consists of about 250 different commands (200 core, 50 utility functions) Implemented on all major platforms/operating systems All windowing tasks, user input/output must be supported by underlying windowing system (X, Direct X, etc) Limited modeling support - support for low level primitives only GLU - higher level utility library with support for modeling features like NURBS. OpenGL Utility Toolkit (GLUT) primitive window setup and event handling Wireframe Rendering 19 20

Anti-aliasing Depth Cueing 21 Flat Shaded Rendering 23 22 Smooth (Gouraud) Shaded Renering 24

Texture Mapping and Shadows 25 Atmospheric (Fog) Effects 27 Environment Mapping Rendering Different Material Types 26 28

What does GL do? OpenGL Basic Syntax (C Language Binding) Construct shapes from geometric primitives (points, lines, polygons, pixels, images) Arrange objects in 3D space and select location to view the composed scene. Calculate colors of objects, from specification or lighting conditions, pasting texture onto objects. Convert mathematical description of objects and colors into screen pixels, termed rasterization 29 Functions: glxxxx glbegin, glend, glpolygonmode Constants: GL XXXX GL 2D, GL RGB, GL CCW Types: GLxxx GLbyte, GLshort, GLint, GLfloat, GLdouble, GLboolean 30 OpenGL: A State Machine OpenGL Geometric Output Primitives Types: GL POINTS, GL LINES, GL LINE LOOP, GL LINE STRIP, GL POLYGON, GL QUADS, GL QUAD STRIP, GL TRIANGLE, GL TRIANGLE STRIP, GL TRIANGLE FAN Basic Syntax: glbegin (PrimitiveConstant); glvertex3f (x1,y1,z1) glvertex3f (x2,y2,z2) glend(); 31 OpenGL operates as a state machine - state remains in effect until it is changed. Example states: current color, viewing/projection transformations, line/polygon patterns, light position/characteristics. Each state variable has a default value and can be queried, (glget- Intv(), glgetfloatv(), etc). enabled/disabled (glenable(), gldisable()). Can also save collections of attributes (glpushattrib(), glpopattrib()). 32

OpenGL Rendering Pipeline Display Lists OpenGL has 2 modes of operation: immediate, or retained. Display lists allow collections of geometry and attributes to be stored for later use; allows optimization Display lists are write-only; no other structure within objects (in contrast to OpenInventor, Java3D, VRML) 33 34 Evaluators Per-Vertex Operations A set of functions that allows evaluation of curved surfaces (Bezier, B-Spline, NURBS), for conversion to points, lines, polygons A polynomial mapping, producing surface normals, texture coords, colors, surface coordinates from control points. 35 Typically, vertices are transformed (modeling, projection) by 4 4 matrices, in preparation for primitive assembly. Texture coordinates can be generated and transformed, Lighting calculations are also performed with transformed vertex, normal and lighting attributes. 36

Primitive Assembly Points and Lines Involves clipping, perspective division Viewport and depth(z coord) operations are applied Results are complete geometric primitives, in preparation for rasterization. 37 glbegin (PrimitiveConstant); glvertex3f (x1,y1,z1) glvertex3f (x2,y2,z2) glend(); 38 Polygons Polygons glbegin (PrimitiveConstant); glvertex3f (x1,y1,z1) glvertex3f (x2,y2,z2) glend(); 39 glbegin (PrimitiveConstant); glvertex3f (x1,y1,z1) glvertex3f (x2,y2,z2) glend(); 40

Why glbegin/glend? Trying to define a separate function for each possible combination of vertex data too cumbersome: Last specified color, normal, texcoord used by vertex call. versions of calls based on type, eg., vertex3f(), vertex2i(). glbegin (PrimitiveConstant); glcolor3f (c1,c1,c1) gltexcoord2f(t1,t2) glvertex3f (x1,y1,z1) glcolor3i (c1,c2,c3) glnormal3f (n1,n2,n3) glvertex3f (x2,y2,z2) glend() Why glbegin/glend? Allow maximum possible parallelism in host CPU and Graphics Processor glbegin (PrimitiveConstant); compute x1,y1,z1 coordinate glvertex3f (x1,y1,z1) compute x2,y2,z2 coordinate glvertex3f (x2,y2,z2) glend() GPU can compute during CPU calls. 41 42 Vertex Arrays Pixel Operations downside of glbegin/glend is lots of function calls OpenGL Vertex Arrays drastically reduce function call overhead support most common combinations of vertex data allow sharing of vertex coordinates for adjacent primitives glenableclientstate (GL VERTEX ARRAY); glvertexpointer ( 3, GL FLOAT, 0, vertex coords); gldrawelements (GL QUADS, 24, GL UNSIGNED BYTE, vertex indices ); 43 Pixels are unpacked into components, followed by scaling, bias calculations Results are clamped and written into texture memory or sent to rasterization step. Pixel data from framebuffer - apply pixel transfer ops (scale, bias, clamping), then packed for storage in system memory. 44

Pixel Array Primitives glbitmap (width, height, x0, y0, xoffset, yoffset, bit array) width, height - size of bit map to draw (in last specified color) x0, y0 defines window coordinate of lower-left corner of bit array xoffset, yoffset added to current raster position (see glraster- Pos2i); useful for text output bit array bits encode in unsigned byte array Figure 3.61, Hearn/Baker. OpenGL Raster Operations Raster operations, bitblts (bit-block transfers), pixblts gldrawpixels (width, height, dataformat, datatype, pixel array) glreadpixels (xmin, ymin, width, height, dataformat, datatype, pixel array) glcopypixels from glreadbuffer to gldrawbuffer 45 46 Texture Assembly Rasterization Textures (images + lots of texture rendering options) can be bound to texture objects; then you can switch between texture objects Multiple textures may be assembled into texture objects, for efficient switching. Scan conversion of geometry and pixel data into fragments. Line, polygon attributes, shading model and coverage calculations are accounted for rastering lines, polygons into pixels. fragment is pixel color + depth value + stencil + accumulation 47 48

Fragment Operations Series of operations that might result in discarding fragment. Texturing, fog calculatons, scissor test, alpha test, stencil test, depth buffer (Z) test, are performed (if enabled) Followed by blending, dithering, logical ops, masking performed. Processed and fragments that survive are drawn into the appropriate buffer, becoming a rendered pixel. 49 50