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

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

CS4620/5620: Lecture 14 Pipeline

Hidden surface removal. Computer Graphics

Overview. Pipeline implementation I. Overview. Required Tasks. Preliminaries Clipping. Hidden Surface removal

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

graphics pipeline computer graphics graphics pipeline 2009 fabio pellacini 1

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

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

Realtime 3D Computer Graphics Virtual Reality

VISIBILITY & CULLING. Don t draw what you can t see. Thomas Larsson, Afshin Ameri DVA338, Spring 2018, MDH

CHAPTER 1 Graphics Systems and Models 3

Pipeline Operations. CS 4620 Lecture 14

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

Topics. From vertices to fragments

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Visibility: Z Buffering

Pipeline Operations. CS 4620 Lecture 10

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

Clipping and Scan Conversion

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

From Vertices To Fragments-1

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

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Culling. Computer Graphics CSE 167 Lecture 12

Computer Graphics. Lecture 9 Hidden Surface Removal. Taku Komura

Sign up for crits! Announcments

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

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Visibility and Occlusion Culling

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

Graphics and Interaction Rendering pipeline & object modelling

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Rasterization Overview

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

Computer Graphics. Bing-Yu Chen National Taiwan University

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Class of Algorithms. Visible Surface Determination. Back Face Culling Test. Back Face Culling: Object Space v. Back Face Culling: Object Space.

E.Order of Operations

INFOGR Computer Graphics. J. Bikker - April-July Lecture 11: Visibility. Welcome!

Computer Graphics. Bing-Yu Chen National Taiwan University

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

Chapter 8: Implementation- Clipping and Rasterization

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Identifying those parts of a scene that are visible from a chosen viewing position, and only process (scan convert) those parts

Rasterization Computer Graphics I Lecture 14. Scan Conversion Antialiasing Compositing [Angel, Ch , ]

4: Polygons and pixels

Spatial Data Structures and Acceleration Algorithms

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Speeding up your game

The Rendering Pipeline (1)

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

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

CS 498 VR. Lecture 18-4/4/18. go.illinois.edu/vrlect18

Visible Surface Detection. (Chapt. 15 in FVD, Chapt. 13 in Hearn & Baker)

Today. CS-184: Computer Graphics. Lecture #10: Clipping and Hidden Surfaces. Clipping. Hidden Surface Removal

The Traditional Graphics Pipeline

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Computer Graphics (CS 543) Lecture 13b Ray Tracing (Part 1) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Clipping & Culling. Lecture 11 Spring Trivial Rejection Outcode Clipping Plane-at-a-time Clipping Backface Culling

Drawing Fast The Graphics Pipeline

Sung-Eui Yoon ( 윤성의 )

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Project Gotham Racing 2 (Xbox) Real-Time Rendering. Microsoft Flighsimulator. Halflife 2

Introduction to Visualization and Computer Graphics

The Traditional Graphics Pipeline

CS559: Computer Graphics. Lecture 12: Antialiasing & Visibility Li Zhang Spring 2008

Spatial Data Structures

Spatial Data Structures

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Einführung in Visual Computing

Drawing Fast The Graphics Pipeline

Hidden Surfaces II. Week 9, Mon Mar 15

Drawing Fast The Graphics Pipeline

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

The Application Stage. The Game Loop, Resource Management and Renderer Design

Adaptive Point Cloud Rendering

Rasterization and Graphics Hardware. Not just about fancy 3D! Rendering/Rasterization. The simplest case: Points. When do we care?

CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL

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

3D Rendering Pipeline (for direct illumination)

MODELING AND HIERARCHY

Performance OpenGL Programming (for whatever reason)

9. Visible-Surface Detection Methods

The Traditional Graphics Pipeline

Spatial Data Structures

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

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

Triangle Rasterization

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

VIII. Visibility algorithms (II)

Page 1. Area-Subdivision Algorithms z-buffer Algorithm List Priority Algorithms BSP (Binary Space Partitioning Tree) Scan-line Algorithms

Lecture 13: Reyes Architecture and Implementation. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

University of British Columbia CPSC 314 Computer Graphics Jan-Apr Tamara Munzner. Hidden Surfaces.

Scan line algorithm. Jacobs University Visualization and Computer Graphics Lab : Graphics and Visualization 272

Spatial Data Structures

Spatial Data Structures and Speed-Up Techniques. Ulf Assarsson Department of Computer Science and Engineering Chalmers University of Technology

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Transcription:

EECE 478 Rasterization & Scenes Rasterization Learning Objectives Be able to describe the complete graphics pipeline. Describe the process of rasterization for triangles and lines. Compositing Manipulate alpha blending values for smoothing, compositing and antialisaing. 1 Learning Objectives Scenes and Optimization Be able to create data structures for entire scenes. Be able to evaluate the relative expense of basic rendering sequences. Be able to use basic techniques to optimize pipeline rendering. Describe and implement various scene culling techniques. 2 1

Vocabulary Rasterization Device coordinates Clipping Bounding box Axis-aligned bounding box Bounding volume Bounding sphere Culling Back-face culling Tesselation Antialiasing Compositing Alpha blending Scene graph 3 Rasterization Rasterization: Converting 2D objects to raster or coloured pixels End of pipeline frame buffer After clipping against canonical view volume p Model View Project CVV Clip q Render Z+FB GL_MODELVIEW GL_PROJECTION 4 Clipping Canonical view volume determines what will be drawn on screen Throw away everything outside of CVV Must draw partial objects at edges 5 2

Clipping Canonical view volume creates normalized device coordinates x,y,z from [-1,1] window coordinates viewport transform screen coordinates window transform convert from float integer 6 Liang-Barsky Clipping Clipping lines (2D): Parametric form Order of α 1, α 2, α 3, α 4 determines clip 7 Clipping Triangles Clipping triangle against CVV can produce nothing (culled) triangle, quadrilateral, or pentagon Optimize tests that can reduce total computation try to find nothing first 8 3

View Volume Culling Bounding box is a rectangle that minimally encloses the triangle parallel to x,y axes axis aligned simple to construct min and max of x,y coords of vertices if b-box doesn t intersect CVV, then triangle can t! 9 General Volume Culling A bounding volume completely contains some subset of scene no part of contents intersects region of interest if BV doesn t find bounding volumes such that we can quickly reject intersection of bounding volume with ROI Avoid need for complex intersection calculation! Useful for frustum culling, collision detection, 10 Line Rasterization Bresenham s Algorithm: (x 1,y 1 ) (x 2,y 2 ) 1. For Δx = x 2 -x 1 Δy = y 2 -y 1 where Δx > Δy 2. Set d = 0 y = y 1 x = x 1 3. Until x = x 2 1. Plot (x,y) 2. If Δx > 2(d+Δy) then d = d+δy 3. Else d = d+δy-δx, y = y+1 4. x = x+1 11 4

Polygon Rasterization Start with polygon in device coordinates Achieve four goals: Projection from 3D to 2D Hidden-surface removal Shading and colouring Rasterization of polygon End with polygon pixels in frame buffer 12 Rasterization Strategy Scan Conversion Given color and z for A, B, C Sort A,B,C by y Compute x l & x r for each y Interpolate color and z for left and right Interpolate along each scan line B x l C A x r y 13 Compositing Compositing: Combining a number of images into one Can be done at rasterization Need some way to control combination Easiest form is to control transparency Often dependent on order of drawing sequence Billboarding, Transparency, Antialiasing 14 5

Alpha Blending Alpha: Colors have fourth component α controls combination of colors with framebuffer contents (per pixel) α is opacity (α=1 is fully opaque) (1-α) is transparency 15 OpenGL: Alpha Blending Three component colors RGB α=1 Alpha blending must be enabled Options for blending styles /* Set up for standard Alpha blend */ glenable (GL_BLEND); glblendfunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 16 Transparent Objects Observations: Occluded by opaque objects Do not occlude opaque objects Implementation: Draw all transparent objects after opaque Turn off update of depth buffer Retain depth buffer test! /* Prepare to draw translucent object */ gldepthmask (GL_FALSE); 17 6

Object Models Object Model: Data structure to enable storage, manipulation and rendering Divided into objects Any part of model that moves as a unit Articulation allows whole or parts to be moved together maintaining relationships Organized for rendering and culling 18 Hierarchical Models Hierarchy = tree Root node Every node has 0 children Geometry, materials at nodes Transforms on links All objects below node are affected by state at node Common models can be repeated Directed acyclic graph (DAG) 19 Example Hierarchy Consider a person Each node has geometry Each link has instance transform bl fl hl ll sl ftl H T lr br fr hr sr ftr T H bl br ll lr fl hl fr sl sr hr ftl ftr 20 7

Shared Geometry Whenever same shape used Point to same geometry (DAG) Instance transform allows different sizes T H bl b br ll l lr fl hl f h fr sl s sr hr ftl ft ftr 21 Render A Node Depth-first graph traversal 1. At node: a. Bind material b. Render geometry 2. For each child link a. Push link transform b. Recursively render node at link c. Pop link transform 22 Tree Data Structure: C typedef struct { Material *material; Geometry *geometry; Child *child; } Node; typedef struct { Child *next; GLfloat *mat; Node *node; } Child; void rendernode (Node *n, State *s) { if (n->material) { rendermat (n->material, s); } if (n->geometry) { rendergeom (n->geometry, s); } for (Child *ch = n->child; ch; ch = ch->next) { if (ch->mat) { glpushmatrix(); glmultmatrix (ch->mat); } rendernode (ch->n, s); if (ch->mat) { glpopmatrix (); } 23 } 8

Tree Data Structure: C++ class Node { void push (Path *p); void pop (Path *p); Child *child; }; void Node::render (Path *p) { push (p); class Child { Child *next; Node *node; }; for (Child *ch = n->child; ch; ch = ch->next) { ch->n->render (p->extend (ch->n)); } pop (p); } 24 Hierarchical Culling(1) Each node has bounding volume Encloses objects at and below it in hierarchy Computed bottom-up from hierarchy Derive geometric bounding volume directly Transform children by inverse of link transform Bounding volume is union of transformed children Change in transform or geometry must be propagated up hierarchy! Best to keep shallow hierarchies 25 Hierarchical Culling(2) Descend through tree Before rendering a node: 1. Check bounding volume vs. frustum 2. If outside frustum, don t render it or children 3. If entirely inside frustum, turn off checking for children 26 9

Occlusion Culling Occlusion culling: Don t draw primitives that will be occluded by others Binary Space Partition (BSP) Trees Recursively partition subspaces by planes Portals Indoors with walls and windows, doorways Horizon Culling Height fields 27 Display Lists Display List: Fixed, optimized sequence of OpenGL calls. glgenlists(n): Creates n display lists glnewlist(i,t): Compiles and optionally displays (depending on t) list i glendlist(): Finishes list started by glnewlist glcalllist(i): Execute list i 28 Representing Geometry Surface representation: Set of vertices, colors, normals Mesh of primitives using vertices Many vertices shared between primitives Can store primitives using indices of vertices 1 2 3 4 5 0 6 7 8 9 10 11 12 13 14 15 29 10

Vertex Arrays 1. Define and activate particular arrays Vertex, color, normal, texture coordinate glenableclientstate glvertexpointer, glcolorpointer, 2. Call drawing primitives that take arrays of indices as arguments gldrawarrays: Fixed index order gldrawelements: Arbitray index order 30 Geometric Modeling Winged Edge: Array of Edges Edge Data Structure: a Vertices: Start: X End: Y Faces: Left: 1 Right: 2 Traversals: Left: b, d Right: e, c 31 11