3D computer graphic Basis for real-time rendering and GPU architecture 劉哲宇,Liou Jhe-Yu.

Slides:



Advertisements
Similar presentations
Real-Time Rendering 靜宜大學資工研究所 蔡奇偉副教授 2010©.
Advertisements

COMPUTER GRAPHICS SOFTWARE.
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.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
3D Graphics Rendering and Terrain Modeling
Rasterization and Ray Tracing in Real-Time Applications (Games) Andrew Graff.
HCI 530 : Seminar (HCI) Damian Schofield.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
(conventional Cartesian reference system)
IN4151 Introduction 3D graphics 1 Introduction to 3D computer graphics part 2 Viewing pipeline Multi-processor implementation GPU architecture GPU algorithms.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
The Graphics Pipeline CS2150 Anthony Jones. Introduction What is this lecture about? – The graphics pipeline as a whole – With examples from the video.
Game Engine Design ITCS 4010/5010 Spring 2006 Kalpathi Subramanian Department of Computer Science UNC Charlotte.
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.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
University of Illinois at Chicago Electronic Visualization Laboratory (EVL) CS 426 Intro to 3D Computer Graphics © 2003, 2004, 2005 Jason Leigh Electronic.
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.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
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.
Week 2 - Wednesday CS361.
Interactive Rendering of Meso-structure Surface Details using Semi-transparent 3D Textures Vision, Modeling, Visualization Erlangen, Germany November 16-18,
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
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.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Stream Processing Main References: “Comparing Reyes and OpenGL on a Stream Architecture”, 2002 “Polygon Rendering on a Stream Architecture”, 2000 Department.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Visual Appearance Chapter 4 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
Computing & Information Sciences Kansas State University Lecture 12 of 42CIS 636/736: (Introduction to) Computer Graphics CIS 636/736 Computer Graphics.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
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.
CS 445 / 645: Introductory Computer Graphics Review.
Shadows David Luebke University of Virginia. Shadows An important visual cue, traditionally hard to do in real-time rendering Outline: –Notation –Planar.
The Graphics Pipeline Revisited Real Time Rendering Instructor: David Luebke.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
- Introduction - Graphics Pipeline
Week 2 - Friday CS361.
Programmable Pipelines
Graphics Processing Unit
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Understanding Theory and application of 3D
Models and Architectures
Models and Architectures
Models and Architectures
Introduction to Computer Graphics with WebGL
Graphics Processing Unit
Models and Architectures
Models and Architectures
Presentation transcript:

3D computer graphic Basis for real-time rendering and GPU architecture 劉哲宇,Liou Jhe-Yu

Motivation for learning graphics fundamentals Q:I’m an architect. I do hardware, not algorithms. Can’t we just skip ahead to the case study? A: Not really. You can’t understand 3D graphics architectures without understanding 3D graphics algorithms. Q:Could I design my new Acme FlexiGPU architecture by optimizing for current graphics applications/ traces/benchmarks? A:No, not if you want your architecture to be relevant when it’s done. 3D Graphics Architecture Tutoral(2004), W.Mark and H. Moreton, NVIDIA.

3D Graphics Architecture Tutorial(2004), W. Mark and H. Moreton, NVIDIA.

Outline 3D computer graphic Real-time rendering – using OpenGL fixed function pipeline(1.5). – Geometry Stage – Rasterization stage From fixed to Programmable – OpenGL shading pipeline

3D computer graphic Use 3D geometric data that are stored in the computer and then perform some specific calculations to render them on a 2D image. OpenGL Super Bible 3rd edition

3D computer graphic Phases 3D modeling Layout and animation Rendering World of Warcraft, Blizzard entertainment

Polygon modeling Vertex – Basic unit with geometry data Triangle – 3 vertices – Basic polygon Curve surface – Triangles * N

Layout and animation Place 3D object or vertex group. Give them the relationship between time domain and movement vector. – May involve with physic simulation or motion capture on the human or animal movement.

Rendering problem Given – 3D world (objects and materials) – Light locations – A viewpoint Compute – 2D image scene from the viewpoint

Rendering Non real-time rendering – Cannot achieve 15 FPS (Frame per second) in modern GPU. – The most global illumination algorithm Ray-tracing, radiosity, etc. – EX: movie for realistic image. Created by Gilles TranToy Story 3, Pixar Disney

Rendering Real-time rendering – Can display over 15 FPS. – For those interactive applications. – EX. Video game. Simplified lighting model and use texture image. EX: OpenGL, DirectX Crysis, Electronic Arts

What is OpenGL Specify a series of abstract API. Define its own virtual graphic pipeline. Use APIs to control this pipeline and draw 3D image – Programmer doesn’t need to communicate directly with real hardware. Cross-platform, cross-language, royalty-free,… The OpenGL fixed-function pipeline (before OpenGL 2.0) is a really good entry point to know how the real-time rendering works.

Conventional OpenGL pipeline (OpenGL 1.5)

Processing sequence of OpenGL Transformation and lighting Texture mapping Triangle traversal and interpolation

Geometry Stage Model-view Transformation Lighting Projection Transformation Primitive assemble Clipping

Transformation Model-view – Transform an object from object coordinate into world coordinate. – Include translate, scale, and rotate matrix operation. y x z y x z Translate

Transformation Projection – Mapping 3D point onto 2D plane – Orthogonal vs. Perspective Perspective projection – Objects in the distance appear smaller than objects close by.

Lighting Created by Hugo Elias

Lighting Realistic render equation

Lighting in OpenGL OpenGL refines rendering equation – Break optical phenomena into three lighting models. – Break visible spectrum into red, green, and blue component. Component – Lighting source position – Object position – Observation position – Object surface normal – Color material of light and object Lighting must be done in world coordinate – After model-view but before projection

Lighting in OpenGL 3 lighting models in OpenGL Ambient – Environment lighting Diffuse – Object receives light effect and reflect its own color. Specular – In particular angle, object will completely reflect light color.

Lighting in OpenGL OpenGL’s lighting equation – approximated equation to solve rendering problem. – No integrity and recursion. Ambient Diffuse Specular

Lighting in OpenGL Ambient Diffuse Specular Amb + Diff Diff + Spec All

Surface shading model Per-Vertex lighting – Flat shading One polygon, one surface normal. – Gouraud shading One polygon, three normals on three vertices. Per-Pixel lighting – Phong shading One polygon has lots of normal value for every pixel.

Surface shading model Flat shadingGouraud shading Phong shading

Primitive Assembly and Clipping Primitive = basic 3D polygon (triangle) Primitive Assembly – Gather three vertices into one triangle. Clipping – Clip the triangle which is partially outside the view volume into new triangle set.

Rasterization Stage Triangle Setup, traverse and interpolation Anti-aliasing Texture mapping & filter Per-fragment operation

Triangle traverse and interpolation Purpose: decompose a triangle into pixels. Triangle traverse – Finding whether pixels are inside a triangle or not Interpolation – Give those pixels property from the original triangle. – Color, texture coordinate, and so on.

Anti-aliasing Sample more sub-pixels then combine them into one final pixel.

Texture mapping Texture is not necessary if… – Use lots, lots, lots, of tiny polygons to present a 3D object. Why do we need texture? – Give the object surface more details. – Decrease polygon complexity, and increase performance.

Texture mapping Downgrade polygon complexity and represent the detail Path of exile, Grinding Gear Games

Texture mapping Basic texture mapping – Give the fragment color Procedure texture mapping – Give the fragment physic property and adjust the color. – Ex. Normal mapping

Texture mapping normal mapping Supported by OpenGL 1.5 An approach to per-pixel lighting. Have a normal map which restores the original surface normal at each texel. – (R,G,B) -> (x,y,z) Re-do simplified lighting operation in texture mapping.

Texture mapping normal mapping example

Texture filter Pixel texel – seldom one by one mapping. The filter method decides whose texels will map to the specific pixel.

Per-fragment operation The pixel flying in the OpenGL pipeline is considered as a fragment.

Painter algorithm Visible problem. Sorting polygons by depth and paint them in this sorting result. Unable to solve cyclic overlap or piercing polygons

Z-buffer algorithm (Depth Test) Prosise, How Computer Graphics Work Prosise

Alpha blending Blend color from fragments and relative pixels in frame buffer. – For transparent object However, alpha blending has image defect with depth test in some case.

Alpha blending’s race condition (Order-dependent transparent) Use painter algorithm to fix it (depth sorting) – Draw all opaque objects with depth test on. – Get drawing order by sorting transparent objects. – Draw transparent object in order with depth test on but depth write off. Take care by programmer, not OpenGL……

OpenGL Conclusion Programmer: – Prepare raw data. – Place Object and lighting source. – Optional operation. Sort object if alpha blending is needed. OpenGL (Hardware) – Calculating the effect between light and object. – Transforming 3D object into 2D image. – Executing texture operation

Outline 3D computer graphic Real-time rendering – using OpenGL fixed function pipeline(1.5). – Geometry Stage – Rasterization stage From fixed to Programmable – programmable shading pipeline

Texture operation wants more flexibility In OpenGL 1.5, normal mapping can be “partially” achieved by calling and setting parameter in glTexEnv API. – API does know what is dot operation. If I want to execute vecA Ω vecB in texture operation. – OpenGL : Ω ????

Lots of per-pixel lighting application under texture mapping Color map, normal map, height map, light map, XXX map, ……, a lots of procedure map. – And their combination. EX: parallax occlusion mapping. – Combine normal and height map Normal mapping Parallax occlusion mapping

OpenGL 1.5 fixed function pipeline

OpenGL 2.0 programmable pipeline

DirectX 10 pipeline (OpenGL 4.0) Input primitive Vertex Shader Geometry Shader Rasterizer Fragment Shader Per-fragment operation Video memory (Texture, Buffer,) Video memory (Texture, Buffer,)

Geometry shader and tessellation Dynamic Generate/delete polygon. Parallax occlusion mapping Tessellation

Programming pipeline with programmer Advantage: – Freedom More procedure texture applications, better image quality. Special post production effect. A solution for blending’s ordering problem can be made in advanced shader architecture without CPU pre-sorting. Step forward to ray-tracing. Disadvantage – No built-in light model and transformation function.

Fixed pipeline’s game example (OpenGL 1.5) Doom 3 (2003), id Software

Programmable pipeline’s game ex. Crysis 2 (2011), Crytek, Electronic Arts

Trend of application Maintain the final image quality but decrease polygon complexity. Simplify per-vertex lighting algorithm. Use multi layer texture to reconstruct per- pixel lighting and shadow effect. – Make lighting equation closer to the rendering equation.

Not everything is programmable Primitive assembly, clipping, and culling. Triangle traverse and interpolation. Texture filter Some per-fragment operation

GPU Architecture? See you next week Thank you