computer graphics (cs 563) advanced graphicsemmanuel/courses/cs563/s12/slides/cs563...shaders:...

86
Computer Graphics (CS 563) Lecture 1: Advanced Computer Graphics Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI)

Upload: others

Post on 27-Jul-2021

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Computer Graphics (CS 563) Lecture 1: Advanced Computer Graphics

Prof Emmanuel Agu

Computer Science Dept.Worcester Polytechnic Institute (WPI)

Page 2: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Photorealistic Rendering Photorealistic? Indistinguishable from picture Main concern: Realism.  Slow: Does NOT care how long it takes (hours, days) Example photorealistic algorithm: Ray tracing images

Page 3: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Real Time Rendering Some applications re‐render moving objects many times per second = Real‐time rendering

Examples: Games Flight simulators Virtual reality Augmented reality, etc

• Real Time graphics: Milliseconds to render (30 FPS)But lower image quality 

Page 4: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

What is Real‐Time Rendering? How fast should real‐time rendering happen? Rendering speed measured in Frames Per Second (fps) About 72 fps guarantees that user: 

becomes immersed in graphics experience No distraction of waiting for rendering to complete Smooth interaction

So, we can say 30 fps upwards is real‐time Frank Cho, electronics arts, algorithms must run in at least  

30 fps (minimum) Images produced must have feel of 3D graphics

Page 5: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Photorealistic Vs Real‐Time GraphicsEach frame takes Less than 0.033 seconds

Hours to render

Ray tracing rendering time is over 10,000x that of real‐time render!!

But is the image quality 10,000x better?

Page 6: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Applications of Real‐Time Rendering

Computer Games

Courtesy: Super Mario Galaxy 2

Courtesy: Final Fantasy XIV

Page 7: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Applications of Real‐Time Rendering

Flight simulators, virtual worlds

Courtesy: Evans and Sutherland  Courtesy: PC Mag

Page 8: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

About This Course Focus this semester on Real time rendering Emphasis on real‐time global illumination techniques

Previous editions:  focussed on Photo‐realisticRendering Advances in ray tracing  Photon mapping

Appearance Modeling BRDFs /materials (representations, viewers, acquisition) Rendering humans (face, skin) Rendering nature (water, trees, seashells) Rendering animals (feathers, butterflies)

Basically, entire semester of ray tracing

Page 9: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Professor Background

Dr. Emmanuel Agu (professor, “Emmanuel”) Research areas Computer Graphics (real time/photorealistic rendering,  etc) Mobile computing (Healthcare apps on smartphone, etc) Mobile graphics (games on mobile devices,  mobile 3D, etc)

Research opportunities Independent Study Project MQP MS theses PhD theses

Page 10: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Student Background

Name Class (undergrad (seniors), masters, PhD …) Full and Part‐time student Programming experience (C, C++, java) Graphics background

At least one graphics class taken Solid math skills….  Other (Physics, computer vision, image science, ???)

Students intro themselves Fill in above info, say what you want from this class

Page 11: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Course Prerequisites No official prerequisite However, will assume you Have probably taken at least 1 graphics course (OpenGL?) Can quickly learn graphics  representations and techniques, 

(will briefly cover them in class as needed) have background in calculus, linear algebra Can read book(s), research articles, fill in gaps Can learn rendering package, shading language, use it

Still have questions?  See me

Page 12: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Syllabus

http://web.cs.wpi.edu/~emmanuel/courses/cs563/S12/ Office hours: Tuesdays:  4:00‐5:00pm Other times by appointment

Email me if you have specific questions Text Book: Real‐Time Rendering by Akenine‐Moller, Haines 

and Hoffman plus selected papers See online course paper schedule Text takes survey‐style approach:

Give overview,  When to use specific techniques Where to find more information

Page 13: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Grading No exams Presentations each (30%) Class participation (10%) Projects defined by me (30%) Final project, chosen by you (30%) Projects for this course  Small stand‐alone shader (OpenGL) programs Real time rendering platform (e.g. Ogre)

Page 14: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Why this course? Understand state‐of‐the‐art real‐time graphics techniques Become conversant with cutting edge graphics literature Hands‐on exploration of a selection of the techniques 

encountered Use cutting edge shading language(s), rendering package(s), 

graphics card(s) Possibly extend one of the algorithms/techniques

Page 15: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Class Time

Two halves with 15 minutes break Each half 45 minute presentation followed by 30 minute discussion of topic(s) and questions

Page 16: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Presentations My goal is to guide you how to present effectively  I will be strict with time (no breaks when presenting at

conferences!!) Get right to the point (core), offer motivation & insights Communicate basic ideas to fellow students Offer a ‘roadmap’ for studying the paper/readings Look over reading list & let me know which paper/readings you 

want to present Note: can use any resources (videos, Internet images) to build 

your talk. Must give credit. If not.. Cheating!!! Don’t just summarize! Find authors websites, videos, images, 

supplimentary cool stuff

Page 17: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Presentations Common mistakes: Avoid: putting too much on a slide (talk!!) Too many slides for alloted time (approx 2 mins/slide) 45 mins time? Estimate: 25 slides max!

Student presentations start in week 4

Page 18: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Final Project Implement one of the RT rendering techniques discussed in 

class, use shading language? Game engine? May also use high end package to create models Maya Renderman Blender PovRay, etc

Must submit your final project proposal by March 20, 2012 Can get ambitious: convert photorealistic technique to real time Ideas?? See Stanford rendering competition http://graphics.stanford.edu/courses/cs348b‐competition/

Page 19: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Where to do Projects? Most self‐respecting home PC’s have a graphics card Some PCs even have sweet Nvidia or ATI cards You can use your home computer or on‐campus labs Remember you will demo project at the end Six labs on campus support OpenGL 3.3 or 4.0 Gordon's Library  Salisbury Labs 123  Stratton Hall 003 (Math Lab)  Washburn 226  Higgins Lab 230  Kaven Hall 203 

Page 20: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Supplementary Books

Will place the supplementary books on reserve: On reserve in the library under CS 563 folder Randy Rost et al "OpenGL Shading Language", Addison 

Wesley publishers, 2009 More to come.. 

Page 21: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

About This Course Previous versions of class

Students chose any topics they liked Students tend to pick what’s easy Many random papers. Sometimes big picture lost

This version..  Suggested structure/papers based on hot trends in RT rendering In fact, using an advanced text for most of the literature  Creates better flow, students understand better Should still do additional literature survey, etc Will get nice points for finding sweet links, videos, supplementary 

material

Page 22: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Drivers of Real‐Time Graphics? A major driver of advances in real‐time graphics: Graphics Hardware acceleration Previously, SGI was king Today: 3D graphics cards from ATI, Nvidia on PCs 3Dfx Voodoo 1 was first card in 1996  beginning of real‐time graphics era?

Most advances in real time graphics are due to innovation in graphics cards Chip on card also called Graphics Processing Unit (GPU) 

Page 23: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Graphics Processing Unit (GPU) Entire graphics library (OpenGL, DirectX) in hardware => FAST!!

Speed: GPUs renders graphics faster CPUs Programmable: in last 8 years (Shaders)

Located either on PC motherboard (Intel) or Separate graphics card (Nvidia or ATI)

On PC motherboard On separate PCI express card

Page 24: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

GPU Evolution

High throughput computation GeForce GTX 280: 933 GFLOP/s

High bandwidth memory GeForce GTX 280: 140 GB/s 

High availability to all 180+ million CUDA‐capable GPUs in the wild

Numbers doubling every 6 months (Moore’s law cubed)

1995 2000 2005 2010

RIVA 1283M xtors

GeForce® 25623M xtors

GeForce FX125M xtors

GeForce 8800681M xtors

GeForce 3 60M xtors

“Fermi”3B xtors

Slide from Stanford course 193G 2010

Page 25: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

GPU Server?

Using Nvidia SLI, may install multiple cards

Page 26: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Why is GPU so Fast?

GPUs grew out of need for graphics to render quicker Observation: Graphics rendering involves: 

Many:  sequential calculations (linear algebra, matrix calculations)  sequential memory access (Orderly rendering of pixels/images)

Few: conditional (if/else,loops), branching statements Random memory access operations

Geometrytransforms Projection Lighting

and shading Rasterization

Graphics Rendering Pipeline

Page 27: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

GPU Design

Arithmetic Logic Unit (ALU) is part of chip for calculations ALU chip area: CPU (7%)   vs GPU ( > 50%) Transistors devoted to ALU, processing NOT

Data caching Flow control (if, else)

Result: GPU runs graphics (or math‐intensive apps) much faster than CPU

Geometrytransforms Projection Lighting

and shading Rasterization

Graphics Rendering Pipeline

Page 28: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Why is GPU so Fast?

More transistors for ALU, faster rendering calculations  GPUs will run applications with lots of branches, loops badly?

Page 29: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

GFLOP/sec growth

GPU!!

CPU!!

Page 30: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

GPU Memory Bandwidth

Graph from: http://developer.download.nvidia.com/compute/cuda/3_2_prod/toolkit/docs/CUDA_C_Programming_Guide.pdf

Page 31: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

How did GPU growth this happen?

Games demand advanced shading Fast GPUs = better shading Need for speed = continued innovation The gaming industry has overtaken the defense, finance, oil and healthcare industries as the main driving factor for high performance processors.

Page 32: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

146X

Medical Imaging

U of Utah

36X

Molecular Dynamics

U of Illinois, Urbana

18X

Video Transcoding

Elemental Tech

50X

Matlab Computing

AccelerEyes

100X

AstrophysicsRIKEN

149X

Financial simulation

Oxford

47X

Linear AlgebraUniversidad

Jaime

20X

3D UltrasoundTechniscan

130X

Quantum Chemistry

U of Illinois, Urbana

30X

Gene Sequencing

U of Maryland

Aside: GPGPU: GPUs to speedup  Non‐Graphics Applications

Page 33: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Graphics Pipeline Revisited

Conceptual graphics pipeline fits into 3 parts Application stage Geometry stage Rasterizer stage

OpenGL pipeline fits into geometry and rasterizer stages Application stage is “stuff” that main program may do before 

sending vertices down the pipeline

Application Geometry Rasterizer

CPU GPU

Page 34: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Graphics pipeline What about modelview, clipping, projection, etc? Functional stages fit into conceptual stages Application stage:

Stuff that you thought about as your OpenGL program Camera movement: slide, pitch, yaw, roll Collecting user interaction with models Animation calculations

Geometry stage (also called vertex pipeline): Model and view transforms Lighting Projection Clipping Screen mapping

Page 35: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Graphics Pipeline

Rasterizer stage (also called pixel pipeline): Fill algorithm (line drawing, polygon fill, etc) Z‐buffer Texturing: Look up/fill textures

Application stage => usually in software Geometry stage => may be in hardware of software For high performance graphics rasterizer stage has to be in 

hardware!!!

Page 36: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Programmable Pipeline

With OpenGL, programs focussed on generating and pumping primitives (actually vertices) down pipeline

Little control of vertices once in pipeline, fixed functions Recent hardware offers option of replacing portions of 

pipeline with user‐programmed stages Vertex shader: replaces fixed‐function transform and lighting Geometry shader: May add or remove vertices from geometric model Pixel shader: replaces texture stages

GPU typically programmed using shading languages Examples: Cg, HLSL, OpenGL shading language, RTSL, etc

Page 37: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Performance Bottlenecks

A pipeline’s fastest speed is defined by it’s slowest stage Depending on specific configuration, application, geometric 

or rasterizer stages could be the bottleneck We say:

Application stage bottleneck => application/CPU/bus‐bound Geometry stage bottleneck => vertex/geometry‐bound Rasterizer stage bottleneck => pixel‐bound

Question: Give an example scene that would cause each type of bottleneck above

Page 38: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Possible Bottlenecks

Framebuffer

Fragment Processor

Texture Storage + Filtering

RasterizerGeometry Processor

Geometry StorageCPU

CPU transfer transform raster texture fragment framebuffer

Vertex Bound Pixel Bound

CPU/BusBound

Page 39: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

GPU Programming Evolution

1st gen GPU: fixed graphics pipeline on chip 2nd gen GPU: 

Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Can update/re‐program graphics algorithms (new techniques for shading, materials, etc) as new ones are developed

3rd gen:  All graphics programs must write shaders (E.g. OpenGL  4.0) Most fixed function pipeline deprecated. 

Geometrytransforms Projection Lighting

and shading Rasterization

Graphics Rendering Pipeline

Page 40: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

NVIDIA G80 Architecture

Slide from David Luebke: http://s08.idav.ucdavis.edu/luebke-nvidia-gpu-architecture.pdf

Page 41: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Some New GPU Hardware features Geometry shader Texture access from Fragment Shader Unified shader model Unlimited program lines in shaders

Page 42: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Today: Real‐Time LoD Management Geometry shader unit: can generate new vertices, primitives  Tesselation and simplification algorithms on GPU Real‐time change LoD in game

Page 43: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Why Unify Shader Processors?

Slide from David Luebke: http://s08.idav.ucdavis.edu/luebke-nvidia-gpu-architecture.pdf

Page 44: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Why Unify Shader Processors?

Slide from David Luebke: http://s08.idav.ucdavis.edu/luebke-nvidia-gpu-architecture.pdf

Page 45: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Unified Shader Processors

Slide from David Luebke: http://s08.idav.ucdavis.edu/luebke-nvidia-gpu-architecture.pdf

Page 46: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Terminology

ShaderModel

Direct3D OpenGL Video cardExample

2 9 2.x NVIDIA GeForce 6800ATI Radeon X800

3 10.x 3.x NVIDIA GeForce 8800ATI Radeon HD 2900

4 11.x 4.x NVIDIA GeForce GTX 480ATI Radeon HD 5870

Page 47: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Shader Capabilities

Table courtesy of A K Peters, Ltd. http://www.realtimerendering.com/

Page 48: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Real‐Time Rendering Techniques Polygonal techniques: OpenGL, DirectX Shading: Pixel/vertex/geometry shading Level of detail management (simplification, tesselation) Texturing to improve RT performance Point‐based rendering BRDF factorization, SH lighting Image‐based rendering: Spectrum of IBR techniques Real time global illumination

Page 49: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Billboard Example in Games

Billboard forbackground

Page 50: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Billboards IBR: pre‐render geometry onto images/textures Rendering at runtime involves simple lookups, fast Similar technique used for crowds in NFL madden football

Real time cloud rendering, Mark J. Harris

Page 51: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Billboard Clouds Billboard Clouds, Decoret, Durand et al [SIGGRAPH‘03] Render complex mesh onto cloud of billboards Billboard inclined at different viewpoints

Page 52: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Imposters

Similar to billboards

Impostors Made Easy – William Damon, Intel

No Impostors

With Impostors

Page 53: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Depth Sprite aka Nailboard

Give depth to image ! RGBΔ ‐ Δ (transparency) is depth parameter Set Δ based on depth of actual geometry Accuracy varies with no. of bits to represent Δ

2 bits 4 bits 8 bits

http://zeus.gup.uni-linz.ac.at/~gs/research/nailbord/

Page 54: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

IBR: Pros and Cons

Billboards, imposters, sprites: Image‐based Rendering (IBR)

Pros Speesd up rendering complex scenes Rendering cost independent of scene complexity

Cons Static scene geometry Fixed look‐from or look‐at point Fixed lighting

Page 55: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Advanced Shading: Shadow mapping

Courtesy Hellgate:London, flagship studios incVariance shadow mapping

Courtesy Nvidia SDK 10

Page 56: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Global Illumination Global illumination: model interaction of light from all surfaces in scene (track multiple bounces)

translucent surface

shadow

multiple reflection

Page 57: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Real Time Global Illumination

Ray tracing is classic global illumination algorithm Instead of billboards, imposters, images use physically‐based 

appearance models Very cool effects possible:

Shadows Ambient Occlusion Reflections Transmittance Refractions Caustics Global subsurface scattering What does it look like?

Page 58: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Game Engine without Real Time GI

Example: Torque 3D Images look somewhat fake

Page 59: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Game Engine with GI: Crytek Crisis 

Page 60: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Better Sky and Atmosphere

[BrunetonNeyret2008] Single and multiple scattering Pre‐computation on the GPU Viewable from space Light shafts

Page 61: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Different Atmospheres

Page 62: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Time Of Day

Page 63: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Caustics and Refraction

Courtesy Chris Wyman, Univ Iowa

Page 64: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Sub‐Surface Scattering

Marble

Human Skin

Crysis skin demo

Page 65: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Sub‐Surface Scattering

Page 66: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Participating Media

Consider other volumes that light must pass through. E.g. smoke, clouds

CloudsSmoke

Page 67: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Real‐Time Global Illumination

For real‐time GI on the fly, need real time GI algorithm  One option: Make classic GI techniques real time Real‐time ray tracing Real‐time photon mapping

Page 68: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Ray tracing algorithm

Page 69: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Ray Casting (Appel, 1968)

direct illuminationOpenGL does this too

Page 70: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Real Time Ray Tracing

Multi‐pass rendering: Ray tracer using 4 shaders

Courtesy Purcell et alSIGGRAPH, 2002

Page 71: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Photon mapping: Caustics examples

Images: courtesy of Stanford rendering contest

Caustics

Page 72: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Photon Mapping Pass 1: Photon Tracing Photon mapping: Simulates the transport of individual photons 

(Jensen ’95‐’96): Two pass algorithm  Pass 1: Emitted photons are probabilistically scattered through 

the scene, bounce around and eventually absorbed. Photon hits surface: can be reflected, refracted, or absorbed Photon hits volume: can be scattered or absorbed.

Illustration is based on figures from Jensen[1].

Store final positionOf photon in data structureCalled photon map (kd-tree)

Page 73: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Photon mapping: Pass 2 ‐ Rendering

Indirect diffuse lighting: Use ray tracing Indirect light, volumes, caustics: estimate illumination using photon map (kd‐tree)

Page 74: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Photon Tracing Pass 2: Rendering

Pass 2 ‐ Rendering Imagine ray tracing a hitpoint x Information from photon maps used to estimate radiance from x Radius of circle required to encountering N photons gives radiance 

estimate at x

x

Page 75: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Real Time Photon mapping

Similar idea to real‐time ray tracing. Photon mapping as multi‐pass shading

Page 76: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Real‐Time GI

Real‐time RT/photon mapping still not 30 FPS One solution: pre‐compute parts of rendering Faster run‐time Hence, pre‐computed global illumination

Page 77: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Pre‐computed Global Illumination

Pre‐compute Global Illumination rationale Lights objects mostly static Use GPU to pre‐compute approximate lighting solutions Speeds up run‐time

Pre‐computed Occlusion Pre‐computed Radiance Transfer (reflections) Use spherical harmonics

object 1

object 2object 3

object 4

Page 78: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Pre‐Compute Occlusion

Ambient occlusion Estimate fraction of hemisphere above point that is blocked Render ambient term proportional to fraction of hemisphere 

occluded

Courtesy NvidiaSDK 10

Page 79: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Precomputed Radiance Transfer Factorize and precompute light & material as Spherical 

Harmonics Run‐time: Light reflection is dot product at run time (Fast)

Sponza Atrium: Courtesy Marko Dabrovic 

Page 80: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

New Real‐Time GI Algorithms

Third option: Create brand new real time GI approaches Designed to run fast on graphics hardware/shaders Two examples: Light Propagation Volumes (LPV) Screen Space Directional Occlusion (SSDO)

Page 81: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

CryEngine 3:GI with Light Propagation Volumes State‐of‐the‐art game engine Real‐time simulation of massive,indirect physically‐based lighting

Page 82: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Demo

Light Propagation Volumes Demo

Page 83: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

LPV Idea

Main idea: represent light propagation as Virtual Point Lights (VPL)Re‐project VPL into adjacent cells

Page 84: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Game Engine For some projects/final projects, we may use Ogre, 3D open source game engine 

Free! Easy to learn and work with Will also look at Ogre source code and learn from it Ogre website: http://www.ogre3d.com

Page 85: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

Assignment

Go home, review schedule, decide on which topics you can/want to present

Sign up for topics next week

Page 86: Computer Graphics (CS 563) Advanced Graphicsemmanuel/courses/cs563/S12/slides/cs563...Shaders: Limited re‐programming of graphics functions using assembler, graphics shader languages

References Kutulakos K, CSC 2530H: Visual Modeling, course slides UIUC CS 319, Advanced Computer Graphics Course David Luebke, CS 446, U. of Virginia, slides Chapter 1‐4 of RT Rendering CS 543/4731 course slides