CS770/870 Fall 2015 Advanced GLSL

Similar documents
HW-Tessellation Basics

CS770/870 Spring 2017 Open GL Shader Language GLSL

CS770/870 Spring 2017 Open GL Shader Language GLSL

Lecture 2. Shaders, GLSL and GPGPU

Rasterization Overview

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

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

CS4620/5620: Lecture 14 Pipeline

The Graphics Pipeline

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Ciril Bohak. - INTRODUCTION TO WEBGL

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

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

Dave Shreiner, ARM March 2009

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

CSE 4431/ M Advanced Topics in 3D Computer Graphics. TA: Margarita Vinnikov

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

Rendering Objects. Need to transform all geometry then

Introduction to Shaders.

GPU Memory Model. Adapted from:

CS195V Week 3. GLSL Programming

WebGL and GLSL Basics. CS559 Fall 2016 Lecture 14 October

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

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

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

Direct Rendering of Trimmed NURBS Surfaces

Programming shaders & GPUs Christian Miller CS Fall 2011

Pipeline Operations. CS 4620 Lecture 14

- Rasterization. Geometry. Scan Conversion. Rasterization

TSBK03 Screen-Space Ambient Occlusion

1.2.3 The Graphics Hardware Pipeline

Drawing Fast The Graphics Pipeline

Case 1:17-cv SLR Document 1-3 Filed 01/23/17 Page 1 of 33 PageID #: 60 EXHIBIT C

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

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

E.Order of Operations

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

The Graphics Pipeline

Shaders. Slide credit to Prof. Zwicker

CS427 Multicore Architecture and Parallel Computing

2.11 Particle Systems

Approximate Catmull-Clark Patches. Scott Schaefer Charles Loop

A Trip Down The (2011) Rasterization Pipeline

Drawing Fast The Graphics Pipeline

How to use tessellation to add geometric detail to your scenes. How to use geometry shaders to process whole primitives and create geometry on the fly

Graphics Hardware. Instructor Stephen J. Guy

Drawing Fast The Graphics Pipeline

The Graphics Pipeline

Graphics Processing Unit Architecture (GPU Arch)

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16

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

Beginning Direct3D Game Programming: 1. The History of Direct3D Graphics

Could you make the XNA functions yourself?

OPENGL RENDERING PIPELINE

Scheduling the Graphics Pipeline on a GPU

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

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

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

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

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

How to Work on Next Gen Effects Now: Bridging DX10 and DX9. Guennadi Riguer ATI Technologies

3D Rendering Pipeline

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.

Parallelizing Graphics Pipeline Execution (+ Basics of Characterizing a Rendering Workload)

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

OUTLINE. Tessellation in OpenGL Tessellation of Bezier Surfaces Tessellation for Terrain/Height Maps Level of Detail

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

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

Efficient GPU Rendering of Subdivision Surfaces. Tim Foley,

Spring 2009 Prof. Hyesoon Kim

The Rasterization Pipeline

Chapter IV Fragment Processing and Output Merging. 3D Graphics for Game Programming

Spring 2011 Prof. Hyesoon Kim

Shaders (some slides taken from David M. course)

Parallelizing Graphics Pipeline Execution (+ Basics of Characterizing a Rendering Workload)

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

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

CS179: GPU Programming

The Transition from RenderMan to the OpenGL Shading Language (GLSL)

Shader Programming. Daniel Wesslén, Stefan Seipel, Examples

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

Graphics Architectures and OpenCL. Michael Doggett Department of Computer Science Lund university

General Purpose Computation (CAD/CAM/CAE) on the GPU (a.k.a. Topics in Manufacturing)

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

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

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

COMP371 COMPUTER GRAPHICS

INF3320 Computer Graphics and Discrete Geometry

Real-Time Drainage Basin Modeling Using Concurrent Compute Shaders

Scanline Rendering 2 1/42

Comparing Reyes and OpenGL on a Stream Architecture

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

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

INF3320 Computer Graphics and Discrete Geometry

OpenGL Programmable Shaders

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

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

The GPGPU Programming Model

High-Quality Surface Splatting on Today s GPUs

Cg 2.0. Mark Kilgard

Transcription:

Expanded Graphics Pipeline CS770/870 Fall 2015 Advanced GLSL Geometry definition Shaders can actually be inserted in more places in pipeline Vertex and fragment shaders are most important Vertex shader Tessellation Control Shader Tessellation primitive assembly Tessellation Evaluation Shader Based on material from Bailey notes from Oregon State and web sources cited in slides and others to be documented later. Boxes are part of fixed pipeline; ovals are userdefined shaders Geometry shader Rasterizer 05/08/17 CS770/870 Spring 2017 Bergeron 1 Fragment shader 2 Fragment Processing Pipeline Topics of Interest pixel: rgbaz for a frame buffer location fragment: everything needed to compute pixel: rgbaz, texture coords, and more Screen coords Pixel parameters Texture Memory Vertex Processor Rasterizer Fragment Processor Frame Buffer Depth Buffer Vars to interpolate Interpolated vars RGBAZ pixels Pixel Processor Depth test, blending, scissors, stencil RGBAZ pixels Tessellation tessellation control shader tessellation evaluation shader Geometry shader Textures v. samplers Framebuffer objects WorkGroups Advanced vertex shader functionality drawarraysinstanced, drawarraysbaseinstanced, multidrawarrays, drawarraysindirect 3 4

Tessellation Optional Vertex Processing vertex patch data is subdivided generates new vertices need to specify new vertex attributes: position, color, normal, texture coords, etc. Tessellation Example Tessellation Control Shader Tessellation primitive generator Tessellation Evaluation Shader 5 Example From OpenGL SuperBible 6 Patches OpenGL patch primitive is a block of vertices in which each successive n vertices constitutes 1 patch glpatchparameteri( patchid, 6 ); // 6 verts per patch vertices in patch often thought of as control points max patch size is impl-dependent, but is >= 32 No particular order is required in a patch; it depends on how the patch is used Can have all the attribute information associated with any vertex block: position, color, normals, texture coords, etc. From OpenGL SuperBible 7 8

Tessellation Levels Patches have inner and outer edges Tessellation level independently set for inner/outer edge types A level n means that the edge will be partitioned into n segments by the tessellation. outer edges usually have higher n than inner edges Allows for better stitching between patches. Fractional Tessellation Levels Level specification is float 3 options for fractional component equal_spacing : all segments same length fractional_odd_spacing : let n = next-lower odd integer (for 4.6, that is 7); make segment size segments and split the remaining space in 2. fractional_even_spacing : same as odd, but n is next-lower even integer get smoother transitions between levels http://www.geeks3d.com/20130128/know-your-opengl-tessellation-spacing-modes/ http://www.geeks3d.com/20100730/test-first-contact-with-opengl-4-0-gpu-tessellation/ 9 10 Tessellation Coordinates Triangle Barycentric Coordinates Similar to texture coordinates Depend on data type: line, triangle, quad triangles use barycentric coordinates represent any point inside by linear combination of vertex coordinates subdivision points inside triangle can be defined on an abstract triangle with these coordinates and later transformed by actual Cartesian coordinates. (0,0) (1,0) (0,1,0) (0,0,1) (1,0,0) (1,0) (1,1) (0,0) (1,0) 11 Given triangle defined by v0, v1, v2 where vi=(xi, yi) Can represent every point in triangle with x = λ0x0 + λ1x1 + λ2x2 y = λ0y0 + λ1y1 + λ2y2 where λ0 + λ1 + λ2 = 1 Given Cartesian coordinates, can get barycentric: λ0 = ((y1-y2)(x-x2)+(x2-x1)(y-y2))/det(t) λ1 = ((y2-y0)(x-x2)+(x0-x2)(y-y2))/det(t) λ2 = 1 - λ0 - λ1 where T = x0-x2 x1-x2 y0-y2 y1-y2 12

Tessellation Level Specifications Tessellation Primitive Generator Inner level[2] = [ 2.0, 4.0 ] quad: u direction edges split into 2 parts, v into 4 triangle: all edges split into 2; 2nd element not used Outer level[4] = [ 2.0, 3.0, 4.0, 5.0 ] quad: left edge split in 2 parts, bottom into 3, right into 4, and top into 5. triangle: edge between (0,0,1) and (0,1,0) split into 2 edge between (0,0,1) and (1,0,0) split into 3 edge between (1,0,0) and (0,1,0) split into 4 (last value not used). http://www.informit.com/articles/article.aspx?p=2120983 13 Fixed-function stage: not programmable by user, User provides parameters (directly or via a shader) tessellation levels spacing parameters for tessellated vertices data type: triangles, quads, isolines, points Determines only # vertices to generate, their order, primitive type It does not use the actual input vertex information all output is relative to an abstract normalized (0,1) primitive object 14 Tessellation Control Shader (TCS) Processes exactly one vertex of a patch Can communicate with other TCS instances for same patch can share information must synchronize share output information Outputs (mostly) go directly to the Tessellation Evaluation Shader (TES) patch output inner and outer tessellation levels goes to the tessellation primitive generator Tessellation Evaluation Shader (TES) Input abstract patch from tessellation primitive generator actual vertex data for entire patch (from TCS or VS) Output A single vertex from the tessellation Assumption: not verified if a patch has 6 vertexes, 16 TES instances are created and all patch data and each knows which it is supposed to produce as output. 15 16

Geometry Shader Geometry shader takes input after vertex processing (including tessellation) and prior to vertex postprocessing Geometry shader input: OpenGL Primitive stream points lines, lines_adjacency triangles, triangle_adjacency Note that geometry shader has the entire triangle, not just 1 vertex at a time. Each geometry shader only processes 1 kind of Primitive Stencil Buffer Like a depth buffer where values act like a cardboard stencil, that can either allow colors through, prevent them. OpenGL s stencils have more options than cardboard! https://open.gl/depthstencils http://web.engr.oregonstate.edu/~mjb/cs519/handouts/geometry_shaders.1pp.pdf 17 18