Rendering Objects. Need to transform all geometry then

Similar documents
The Graphics Pipeline

Rasterization Overview

Lecture 2. Shaders, GLSL and GPGPU

CS475/CS675 - Computer Graphics. OpenGL Drawing

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

CS451Real-time Rendering Pipeline

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

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

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

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

COMP371 COMPUTER GRAPHICS

Spring 2009 Prof. Hyesoon Kim

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

Ciril Bohak. - INTRODUCTION TO WEBGL

3D Graphics and OpenGl. First Steps

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

Spring 2011 Prof. Hyesoon Kim

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

E.Order of Operations

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

PowerVR Hardware. Architecture Overview for Developers

Computer graphics 2: Graduate seminar in computational aesthetics

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

CS4620/5620: Lecture 14 Pipeline

Chapter 1 Introduction

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

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

WebGL (Web Graphics Library) is the new standard for 3D graphics on the Web, designed for rendering 2D graphics and interactive 3D graphics.

The Graphics Pipeline and OpenGL I: Transformations!

Graphics Processing Unit Architecture (GPU Arch)

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

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

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

CS452/552; EE465/505. Image Processing Frame Buffer Objects

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

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

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

We assume that you are familiar with the following:

Models and Architectures

Pipeline Operations. CS 4620 Lecture 14

Computer Graphics Seminar

CENG 477 Introduction to Computer Graphics. Graphics Hardware and OpenGL

Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

The Rasterization Pipeline

Graphics Hardware. Instructor Stephen J. Guy

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

Scanline Rendering 2 1/42

Introduction to Computer Graphics with WebGL

Game Architecture. 2/19/16: Rasterization

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

Computergrafik. Matthias Zwicker. Herbst 2010

The Graphics Pipeline and OpenGL I: Transformations!

OpenGL. Toolkits.

Introduction to OpenGL

VTU QUESTION PAPER SOLUTION UNIT -1 INTRODUCTION

TSBK03 Screen-Space Ambient Occlusion

The Rendering Pipeline (1)

Coding OpenGL ES 3.0 for Better Graphics Quality

Getting fancy with texture mapping (Part 2) CS559 Spring Apr 2017

Graphics Programming

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

We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell

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

A SIMD-efficient 14 Instruction Shader Program for High-Throughput Microtriangle Rasterization

Lecture 4: Geometry Processing. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

Shaders. Slide credit to Prof. Zwicker

3D Rendering Pipeline

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

Computer Graphics and Visualization. Graphics Systems and Models

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

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker

Hardware-driven Visibility Culling Jeong Hyun Kim

Shaders (some slides taken from David M. course)

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

CS 4620 Program 3: Pipeline

1.2.3 The Graphics Hardware Pipeline

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

Today. Rendering - III. Outline. Texturing: The 10,000m View. Texture Coordinates. Specifying Texture Coordinates in GL

Overview. By end of the week:

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

Evolution of GPUs Chris Seitz

Programming Graphics Hardware

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

Computer Graphics. Lecture 02 Graphics Pipeline. Edirlei Soares de Lima.

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

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

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

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

Programming shaders & GPUs Christian Miller CS Fall 2011

Optimizing and Profiling Unity Games for Mobile Platforms. Angelo Theodorou Senior Software Engineer, MPG Gamelab 2014, 25 th -27 th June

Copyright Khronos Group, Page Graphic Remedy. All Rights Reserved

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

Rendering approaches. 1.image-oriented. 2.object-oriented. foreach pixel... 3D rendering pipeline. foreach object...

Could you make the XNA functions yourself?

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

Advanced Rendering Techniques

CS 130 Final. Fall 2015

The Graphics Pipeline

Transcription:

Intro to OpenGL

Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform all geometry then draw

The Graphics Pipeline Designed to optimize rendering process Raytracing is too slow Focus on high throughput and parallelization

Rasterization Objects composed of vertex data Vertex data tessellated into primitives

Rasterization Primitives have color and position Draw pixels to screen Embarrassingly parallel with great hardware support!

OpenGL Open Graphics Library Standardized in 1992 by Silicon Graphics Currently managed by Kronos Group Microsoft equivalent is DirectX

Simplified Graphics Pipeline Application Vertex batching & assembly OpenGL API Clipping NDC to window space NDC = Normalized Device Coordinates, this is a [-1,+1] 3 cube Rasterization Fragment shading Depth testing Color update Depth buffer Framebuffer

A Little Expanded Application Vertex batching & assembly Vertex transformation Lighting Texture coordinate generation Triangle assembly User defined clipping Back face culling View frustum clipping NDC to window space Triangle rasterization Fragment shading Perspective divide Depth testing Color update Depth buffer Framebuffer

Old vs Modern OpenGL Originally OpenGL was a Fixed Function Pipeline Exposed graphics hardware through user configurations Built-in math operations manipulate data accordingly

Old vs Modern OpenGL OpenGL 3.0 is programmable allowing for greater flexibility and control Also changes hardware pipeline and how a programmer interacts with the GPU

The modern rendering pipeline (blue stages are fully programmable)

Vertex Specification Specify vertices for GPU to process One vertex/triangle at a time is slow Specify how to process Attributes inform vertex shader what data represents

Vertex Buffer Objects (VBOs) Source of data for vertex arrays glbindbuffer binds given buffer to global target GL_ARRAY_BUFFER specifies Buffer Object is vertex attribute data glvertexattribpointer specifies attribute data for vertices What are the data components and how are they arranged?

VBO Data Contain data for: Vertex position Vertex colors Texture info Normal info etc

Vertex Array Objects (VAOs) OpenGL Objects associated with an OpenGL context (state of the instance) Stores attribute data and Buffer Objects for bussing to GPU Can contain multiple VBOs VAOs allow switches between vertex attribute configurations without performance hit glgenvertexarrays creates VAO glbindvertexarray binds that VAO to target

Using VAOs 1. Create VAO with necessary information: 1. Create VAO 2. Bind VAO 3. Generate and bind VBO 4. Disable/unbind VAO and VBO 2. Rendering using VAO: 1. Bind VAO 2. Draw data in VBO 3. Unbind VAO

Vertex Shader Vertex List Geometry Shader Triangle List Primitive Assembly Fragment Shader Textures Rasterization CPU GPU Framebuffer Screen

Coordinate Systems model matrix world object view matrix camera perspective matrix normalized device

Camera Coordinates Note: Look down negative z direction

Normalized Device Coordinates Note: X and Y map to screen width and height Z used for depth (deeper points are higher)

Except Screen coordinates use different system!

Also glviewport(x, y, width, height) transforms NDC to window coordinates Allows for an aspect ratio in final display to screen after being normalized Incidentally (x, y) specifies the lower left corner of the viewport

Framebuffer Memory region containing pixel data Controlled by GPU Layers: Color buffer (RGB) Depth buffer (Z axis position) Stencil buffer (extension of depth buffer)

Displaying a Framebuffer CRTs: beam sweeps across screen to draw pixels (one pass every 1/60 secs) LCDs: grab framebuffer (every 1/60 secs)

Flickering and Tearing Framebuffer changes while monitor draws How to solve?

Double-Buffering Use two framebuffers Render to back buffer while showing front buffer Then swap

When to Draw On CRTs: wait for vertical retrace to swap vsync Occurs 1/60 sec Introduces lag On LCDs: swap when not reading

OpenGL Tutorial Work through: http://www.opengl-tutorial.org/beginnerstutorials/tutorial-2-the-first-triangle/