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

Similar documents
Introduction to Computer Graphics with WebGL

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

Models and Architectures

CMSC427 OpenGL and JOGL

CMSC427 Fall 2017 OpenGL Notes A: Starting with JOGL and OpenGL Objectives of notes Readings Computer Graphics Programming in OpenGL with Java

INTRODUCTION. Computer Graphics

CSE4030 Introduction to Computer Graphics

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

INSTANCE VARIABLES (1/2) P. 1

Computer Graphics and Visualization. Graphics Systems and Models

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

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

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

CIS 441/541: Introduction to Computer Graphics Lecture 14: OpenGL Basics

INTRODUCTION. Slides modified from Angel book 6e

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

Pipeline Operations. CS 4620 Lecture 14

CS452/552; EE465/505. Image Formation

COMP3421 Computer Graphics

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Introduction to OpenGL Week 1

Objectives. Image Formation Revisited. Physical Approaches. The Programmer s Interface. Practical Approach. Introduction to OpenGL Week 1

CHAPTER 1 Graphics Systems and Models 3

SHADER PROGRAMMING. Based on Jian Huang s lecture on Shader Programming

OPENGL AND GLSL. Computer Graphics

Shaders. Slide credit to Prof. Zwicker

The Graphics Pipeline

The Graphics Pipeline

The Graphics Pipeline

Supplement to Lecture 22

Rasterization Overview

Rendering Objects. Need to transform all geometry then

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

Programming of Graphics

Pipeline Operations. CS 4620 Lecture 10

CS451Real-time Rendering Pipeline

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

Direct Rendering of Trimmed NURBS Surfaces

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

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

VTU QUESTION PAPER SOLUTION UNIT -1 INTRODUCTION

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

3D graphics, raster and colors CS312 Fall 2010

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

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

COMP371 COMPUTER GRAPHICS

Three Main Themes of Computer Graphics

CS 432 Interactive Computer Graphics

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

Computer Graphics 10 - Shadows

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

Graphics Hardware. Instructor Stephen J. Guy

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Computergrafik. Matthias Zwicker. Herbst 2010

BCA611 Video Oyunları için 3B Grafik

CS 4620 Program 3: Pipeline

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

WebGL and GLSL Basics. CS559 Fall 2015 Lecture 10 October 6, 2015

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

Computer Graphics. Shadows

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

CS452/552; EE465/505. Intro to Lighting

Shader Programs. Lecture 30 Subsections 2.8.2, Robb T. Koether. Hampden-Sydney College. Wed, Nov 16, 2011

CS 464 Review. Review of Computer Graphics for Final Exam

Computer Graphics: Programming, Problem Solving, and Visual Communication

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Programmable shader. Hanyang University

CS 354R: Computer Game Technology

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

Overview. By end of the week:

Lecture 2. Shaders, GLSL and GPGPU

An Introduction to 2D OpenGL

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

Blis: Better Language for Image Stuff Project Proposal Programming Languages and Translators, Spring 2017

Computer Graphics Lecture 2

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico


WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

Blue colour text questions Black colour text sample answers Red colour text further explanation or references for the sample answers

[175 points] The purpose of this assignment is to give you practice with shaders in OpenGL.

Lecturer Athanasios Nikolaidis

CS475/CS675 - Computer Graphics. OpenGL Drawing

Survey in Computer Graphics Computer Graphics and Visualization

CS 432 Interactive Computer Graphics

Graphics Pipeline. CS535 Fall Daniel G. Aliaga Department of Computer Science Purdue University

Graphics Systems and Models

Ulf Assarsson Department of Computer Engineering Chalmers University of Technology

CIS 581 Interactive Computer Graphics

Advanced Computer Graphics (CS & SE )

Computer Graphics. Lecture 9 Environment mapping, Mirroring

Introduction to Shaders.

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

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

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

Homework 3: Programmable Shaders

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

Recall: Indexing into Cube Map

TSBK03 Screen-Space Ambient Occlusion

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

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

Transcription:

GRAPHICS PIPELINE 1

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

IMAGE FORMATION REVISITED Can we mimic the synthetic camera model to design graphics hardware software? Application Programmer Interface (API) Need only specify Objects Materials Viewer Lights But how is the API implemented? 3

PHYSICAL APPROACHES Ray tracing: follow rays of light from center of projection until they either are absorbed by objects or go off to infinity Can handle global effects Slow Multiple reflections Translucent objects Must have whole data base available at all times 4

PRACTICAL APPROACH Process objects one at a time in the order they are generated by the application Can consider only local lighting Pipeline architecture All steps can be implemented in hardware on the graphics card 5

VERTEX PROCESSING Much of the work in the pipeline is in converting object representations from one coordinate system to another Object coordinates Camera (eye) coordinates Screen coordinates Every change of coordinates is equivalent to a matrix transformation Vertex processor also computes vertex colors 6

PRIMITIVE ASSEMBLY Vertices must be collected into geometric objects before clipping and rasterization can take place Line segments Polygons Curves and surfaces 7

CLIPPING Just as a real camera cannot see the whole world, the virtual camera can only see part of the world or object space Objects that are not within this volume are said to be clipped out of the scene 8

RASTERIZATION If an object is not clipped out, the appropriate pixels in the frame buffer must be assigned colors Rasterizer produces a set of fragments for each object Fragments are potential pixels Have a location in frame buffer Color and depth attributes Vertex attributes are interpolated over objects by the rasterizer 9

FRAGMENT PROCESSING Fragments are processed to determine the color of the corresponding pixel in the frame buffer Colors can be determined by texture mapping or interpolation of vertex colors Fragments may be blocked by other fragments closer to the camera Hidden-surface removal 10

THE PROGRAMMER S INTERFACE Programmer sees the graphics system through a software interface: the Application Programmer Interface (API) 11

API CONTENTS Functions that specify what we need to form an image Objects Viewer Light Source(s) Materials Other information Input from devices such as mouse and keyboard Capabilities of system 12

OBJECT SPECIFICATION Most APIs support a limited set of primitives including Points (0D object) Line segments (1D objects) Polygons (2D objects) Triangles!! Some curves and surfaces Quadrics Parametric polynomials All are defined through locations in space or vertices 13

EXAMPLE Put geometric data in an array Send array to GPU Tell GPU to render as triangle vec3 points[3]; points[0] = vec3(0.0, 0.0, 0.0); points[1] = vec3(0.0, 1.0, 0.0); points[2] = vec3(0.0, 0.0, 1.0); 14

CAMERA SPECIFICATION Position of center of lens Orientation Film size Orientation of film plane 15

LIGHTS AND MATERIALS Types of lights Point sources vs distributed sources Spot lights Near and far sources Color properties Material properties Absorption: color properties Scattering Diffuse Specular 16

CODE EXPLANATION SHADERS: DRAWING A POINT Look at code in the order of execution Slides show code out of order Import libraries Definition of main() and other methods required by interface Constructor init() and display() Creating GLSL code for the GPU

IMPORT LIBRARIES import javax.swing.*; import static com.jogamp.opengl.gl4.*; import com.jogamp.opengl.*; import com.jogamp.opengl.awt.glcanvas; import com.jogamp.opengl.glcontext;

MAIN METHOD AND INTERFACE METHODS public static void main(string[] args) { new Code(); } public void reshape(glautodrawable drawable, int x, int y, int width, int height) {} public void dispose(glautodrawable drawable) {}

CLASS DECLARATION, CONSTRUCTOR public class Code extends JFrame implements GLEventListener { private GLCanvas mycanvas; private int rendering_program; private int vao[] = new int[1]; public Code() { settitle("chapter2 - program2"); setsize(600, 400); mycanvas = new GLCanvas(); mycanvas.addgleventlistener(this); getcontentpane().add(mycanvas); setvisible(true); }

INIT AND DISPLAY CALLED WHEN SETVISIBLE MADE TRUE public void display(glautodrawable drawable) { GL4 gl = (GL4) GLContext.getCurrentGL(); gl.gluseprogram(rendering_program); gl.glpointsize(30.0f); gl.gldrawarrays(gl_points,0,1); } public void init(glautodrawable drawable) { GL4 gl = (GL4) GLContext.getCurrentGL(); rendering_program = createshaderprogram(); gl.glgenvertexarrays(vao.length, vao, 0); gl.glbindvertexarray(vao[0]); }

GLSL CODE private int createshaderprogram() { GL4 gl = (GL4) GLContext.getCurrentGL(); String vshadersource[] = { "#version 430 \n", "void main(void) \n", "{ gl_position = vec4(0.0, 0.0, 0.0, 1.0); } \n" }; String fshadersource[] = { "#version 430 \n", "out vec4 color; \n", "void main(void) \n", "{ color = vec4(0.0, 0.0, 1.0, 1.0); } \n" };

COMPILING, ATTACHING, LINKING GLSL CODE } int vshader = gl.glcreateshader(gl_vertex_shader); gl.glshadersource(vshader, 3, vshadersource, null, 0); gl.glcompileshader(vshader); int fshader = gl.glcreateshader(gl_fragment_shader); gl.glshadersource(fshader, 4, fshadersource, null, 0); gl.glcompileshader(fshader); int vfprogram = gl.glcreateprogram(); gl.glattachshader(vfprogram, vshader); gl.glattachshader(vfprogram, fshader); gl.gllinkprogram(vfprogram); gl.gldeleteshader(vshader); gl.gldeleteshader(fshader); return vfprogram;

SUMMARY Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system 24