Background image by chromosphere.deviantart.com Fella in following slides by devart.deviantart.com DM2336 Programming hardware shaders Dioselin Gonzalez.

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS SOFTWARE.
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Graphics Pipeline.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
RealityEngine Graphics Kurt Akeley Silicon Graphics Computer Systems.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
CGDD 4003 THE MASSIVE FIELD OF COMPUTER GRAPHICS.
IN4151 Introduction 3D graphics 1 Introduction 3D Computer Graphics part 1 Projective display Viewing pipeline Graphics hardware Image-based rendering.
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
Status – Week 277 Victor Moya.
GPU Simulator Victor Moya. Summary Rendering pipeline for 3D graphics. Rendering pipeline for 3D graphics. Graphic Processors. Graphic Processors. GPU.
Status – Week 283 Victor Moya. 3D Graphics Pipeline Akeley & Hanrahan course. Akeley & Hanrahan course. Fixed vs Programmable. Fixed vs Programmable.
The Graphics Pipeline CS2150 Anthony Jones. Introduction What is this lecture about? – The graphics pipeline as a whole – With examples from the video.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Texture Mapping A way of adding surface details Two ways can achieve the goal:  Surface detail polygons: create extra polygons to model object details.
Under the Hood: 3D Pipeline. Motherboard & Chipset PCI Express x16.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
Basic Graphics Concepts Day One CSCI 440. Terminology object - the thing being modeled image - view of object(s) on the screen frame buffer - memory that.
What is ? Open Graphics Library A cross-language, multi-platform API for rendering 2D and 3D computer graphics. The API is used to interact with a Graphics.
Under the Hood: 3D Pipeline. Motherboard & Chipset PCI Express x16.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
3D API By Clayton Azzopardi (Group 10). Introduction Android uses the OpenGL ES 1.0 API Android uses the OpenGL ES 1.0 API Open Graphics Library for Embedded.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Week 2 - Friday.  What did we talk about last time?  Graphics rendering pipeline  Geometry Stage.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
OpenGL Conclusions OpenGL Programming and Reference Guides, other sources CSCI 6360/4360.
CSE Real Time Rendering Week 2. Graphics Processing 2.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
Shader Basics Chap. 2 of Orange Book. 2 Contents Why write shaders OpenGL programmable processors Language overview System overview.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
1 3D API OPENGL ES v1.0 Owned by Silicon Graphics (SGL) Control was then transferred to Khronos Group Introduction.
Texture Mapping CAP4730: Computational Structures in Computer Graphics.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
OpenGL-ES 3.0 And Beyond Boston Photo credit :Johnson Cameraface OpenGL Basics.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
© David Kirk/NVIDIA and Wen-mei W. Hwu, ECE408, University of Illinois, Urbana-Champaign 1 Programming Massively Parallel Processors Lecture.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Lecture 7 Midterm Review. OpenGL Libraries gl: Basic OpenGL library, e.g. primitives. glu: OpenGL Utility library, a set of functions to create texture.
The Graphics Pipeline Revisited Real Time Rendering Instructor: David Luebke.
© David Kirk/NVIDIA and Wen-mei W. Hwu, ECE408, University of Illinois, Urbana-Champaign 1 GPU.
2 3D Viewing Process  3D viewing process MC Model Space Model Transformation Model Transformation WC World Space Viewing Transformation Viewing Transformation.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Shaders, part 2 alexandri zavodny.
Week 2 - Friday CS361.
Programmable Pipelines
Graphics Processing Unit
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
Models and Architectures
Models and Architectures
Day 05 Shader Basics.
Graphics Processing Unit
Introduction to Computer Graphics with WebGL
The Graphics Pipeline Lecture 5 Mon, Sep 3, 2007.
Models and Architectures
Models and Architectures
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
OpenGL-Rendering Pipeline
Presentation transcript:

Background image by chromosphere.deviantart.com Fella in following slides by devart.deviantart.com DM2336 Programming hardware shaders Dioselin Gonzalez S2 DM2336 Programming hardware shaders Dioselin Gonzalez S2 Week 2: Review of graphics API Programmable pipeline

DM2336 PHS – Dioselin Gonzalez – 2007 S2 2 OpenGL block diagram Application generation Application traversal Display list Evaluator Per-vertex operations & Primitive assembly Rasterization Per- fragment operations Texture memory Frame buffer Video display GenerationTraversalXformationRasteriz. & tex.Display Pixel operations Application & higher level graphics libraries OpenGL implementation

DM2336 PHS – Dioselin Gonzalez – 2007 S2 3 Per-vertex operations Transform vertex coords. (modelview m.)Transform vertex coords. (modelview m.) Transform and renormalize normalsTransform and renormalize normals Generate and transform texture coords.Generate and transform texture coords. Lighting calculationsLighting calculations Application generation Application traversal Display list Evaluator Per-vertex operations & Primitive assembly Rasterization Per- fragment operations Texture memory Frame buffer Video display Pixel operations

DM2336 PHS – Dioselin Gonzalez – 2007 S2 4 Primitive assembly Flat shadingFlat shading ClippingClipping Projection transformationsProjection transformations Viewport and depth-range operationsViewport and depth-range operations CullingCulling Application generation Application traversal Display list Evaluator Per-vertex operations & Primitive assembly Rasterization Per- fragment operations Texture memory Frame buffer Video display Pixel operations

DM2336 PHS – Dioselin Gonzalez – 2007 S2 5 Rasterization Convert each primitive into fragmentsConvert each primitive into fragments Fragment: “transient data structures”Fragment: “transient data structures” –position (x,y); depth; color; texture coordinates; coverage; … Application generation Application traversal Display list Evaluator Per-vertex operations & Primitive assembly Rasterization Per- fragment operations Texture memory Frame buffer Video display Pixel operations

Background image by katosu.deviantart.com DM2336 PHS – Dioselin Gonzalez – 2007 S2 Interpolation issues

DM2336 PHS – Dioselin Gonzalez – 2007 S2 7 Linear Interpolation Issues Linear interpolation takes place in screen spaceLinear interpolation takes place in screen space Problems can happen when projectingProblems can happen when projecting –Texture coordinates –Colors –Positions are okay. Cannot recover p’s color and texture coordinates from linear Interpolation Lerp(C p1’,C p2’ ) along L != C p perspective correct interpolation Need perspective correct interpolation for unprojected values p2 p1 p P1’ P2’ p L

DM2336 PHS – Dioselin Gonzalez – 2007 S2 8 More explanations Equal spacing in screen (pixel) space is not the same as in texture space in perspective projectionEqual spacing in screen (pixel) space is not the same as in texture space in perspective projection –Perspective foreshortening from Hill courtesy of H. Pfister

DM2336 PHS – Dioselin Gonzalez – 2007 S2 9 Perspective-Correct Texture Coordinate Interpolation Interpolate (tex_coord/w) over the polygon, then do perspective divide after interpolationInterpolate (tex_coord/w) over the polygon, then do perspective divide after interpolation Compute at each vertex after perspective transformationCompute at each vertex after perspective transformation –“Numerators” s/w, t/w –“Denominator” 1/w

DM2336 PHS – Dioselin Gonzalez – 2007 S2 10 Perspective-Correct Texture Coordinate Interpolation Linearly interpolate 1/w, s/w, and t/w across the polygonLinearly interpolate 1/w, s/w, and t/w across the polygon At each pixelAt each pixel  Perform perspective division of interpolated texture coordinates (s/w, t/w) by interpolated 1/w (i.e., numerator over denominator) to get (s, t)

DM2336 PHS – Dioselin Gonzalez – 2007 S2 11 Perspective-Correct Interpolation That fixed it!That fixed it!

Background image by katosu.deviantart.com DM2336 PHS – Dioselin Gonzalez – 2007 S2 Back to the pipeline

DM2336 PHS – Dioselin Gonzalez – 2007 S2 13 Rasterization Convert each primitive into fragmentsConvert each primitive into fragments Fragment: “transient data structures”Fragment: “transient data structures” –position (x,y); depth; color; texture coordinates; coverage; … Application generation Application traversal Display list Evaluator Per-vertex operations & Primitive assembly Rasterization Per- fragment operations Texture memory Frame buffer Video display Pixel operations

DM2336 PHS – Dioselin Gonzalez – 2007 S2 14 Per fragment operations (I) Generate texel for every fragmentGenerate texel for every fragment Fog calculationsFog calculations Coverage (antialiasing) values applicationCoverage (antialiasing) values application Application generation Application traversal Display list Evaluator Per-vertex operations & Primitive assembly Rasterization Per- fragment operations Texture memory Frame buffer Video display Pixel operations

DM2336 PHS – Dioselin Gonzalez – 2007 S2 15 Per fragment operations (II) ScissoringScissoring Alpha testAlpha test Stencil testStencil test Depth-buffer testDepth-buffer test Application generation Application traversal Display list Evaluator Per-vertex operations & Primitive assembly Rasterization Per- fragment operations Texture memory Frame buffer Video display Pixel operations BlendingBlending Dithering and logical operationDithering and logical operation MaskingMasking

DM2336 PHS – Dioselin Gonzalez – 2007 S2 16 Hello world Per- fragment Operations (I) Per- vertex Operations

DM2336 PHS – Dioselin Gonzalez – 2007 S2 17

DM2336 PHS – Dioselin Gonzalez – 2007 S2 18 Vertex shader Is run once every time a vertex position is specifiedIs run once every time a vertex position is specified –glVertex, glDrawArrays, … Must compute gl_PositionMust compute gl_Position May compute gl_ClipVertex or gl_PointSizeMay compute gl_ClipVertex or gl_PointSize

DM2336 PHS – Dioselin Gonzalez – 2007 S2 19 Hello world

DM2336 PHS – Dioselin Gonzalez – 2007 S2 20

DM2336 PHS – Dioselin Gonzalez – 2007 S2 21 Fragment shader Is run once for every fragment producedIs run once for every fragment produced Has access to the interpolated value for each varying variableHas access to the interpolated value for each varying variable –Color, normal, texture coordinates, arbitrary values Output goes to the fixed pipelineOutput goes to the fixed pipeline –gl_FragColor – computed R, G, B, A for the fragment –gl_FragDepth – computed depth value for the fragment –gl_FragData[n] – arbitrary data per fragment, stored in multiple render targets

Background image by katosu.deviantart.com DM2336 PHS – Dioselin Gonzalez – 2007 S2 Playing with GLSL Demo