Game Technology. Lecture Physically Based Rendering. Dipl-Inform. Robert Konrad Polona Caserman, M.Sc.

Similar documents
Complex Shading Algorithms

Illumination. Illumination CMSC 435/634

Introduction to Visualization and Computer Graphics

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

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Rendering Algorithms: Real-time indirect illumination. Spring 2010 Matthias Zwicker

Deferred Rendering Due: Wednesday November 15 at 10pm

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

CMSC427 Shading Intro. Credit: slides from Dr. Zwicker

The Rasterization Pipeline

Reflection models and radiometry Advanced Graphics

Today. Global illumination. Shading. Interactive applications. Rendering pipeline. Computergrafik. Shading Introduction Local shading models

Computer Graphics (CS 543) Lecture 7b: Intro to lighting, Shading and Materials + Phong Lighting Model

Local Reflection Models

Radiance. Radiance properties. Radiance properties. Computer Graphics (Fall 2008)

Ambien Occlusion. Lighting: Ambient Light Sources. Lighting: Ambient Light Sources. Summary

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

CS 5625 Lec 2: Shading Models

Lighting and Materials

Computer Graphics (CS 4731) Lecture 16: Lighting, Shading and Materials (Part 1)

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Computer Vision Systems. Viewing Systems Projections Illuminations Rendering Culling and Clipping Implementations

Pipeline Operations. CS 4620 Lecture 14

Computer Graphics. Illumination and Shading

Path Tracing part 2. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

CSE 167: Lecture #7: Color and Shading. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Background: Physics and Math of Shading

CPSC / Illumination and Shading

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Shading Models. Welcome!

Recollection. Models Pixels. Model transformation Viewport transformation Clipping Rasterization Texturing + Lights & shadows

BRDF Computer Graphics (Spring 2008)

Radiometry & BRDFs CS295, Spring 2017 Shuang Zhao

CS5620 Intro to Computer Graphics

Pipeline Operations. CS 4620 Lecture 10

Shading, lighting, & BRDF Theory. Cliff Lindsay, PHD

Voxel Cone Tracing and Sparse Voxel Octree for Real-time Global Illumination. Cyril Crassin NVIDIA Research

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

Shading and Illumination

Lighting Killzone : Shadow Fall

Global Illumination CS334. Daniel G. Aliaga Department of Computer Science Purdue University

Rendering: Reality. Eye acts as pinhole camera. Photons from light hit objects

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

Rendering Light Reflection Models

Enhancing Traditional Rasterization Graphics with Ray Tracing. March 2015

INFOGR Computer Graphics. J. Bikker - April-July Lecture 10: Ground Truth. Welcome!

Shadows. COMP 575/770 Spring 2013

Ray Tracing: shading

Light Reflection Models

Overview. Radiometry and Photometry. Foundations of Computer Graphics (Spring 2012)

Lecture 15: Shading-I. CITS3003 Graphics & Animation

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

Lab 9 - Metal and Glass

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

CPSC 314 LIGHTING AND SHADING

CS452/552; EE465/505. Intro to Lighting

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

Shading. Shading = find color values at pixels of screen (when rendering a virtual 3D scene).

Computer Graphics MTAT Raimond Tunnel

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

Reading. Shading. An abundance of photons. Introduction. Required: Angel , 6.5, Optional: Angel 6.4 OpenGL red book, chapter 5.

Rendering Light Reflection Models

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

CENG 477 Introduction to Computer Graphics. Ray Tracing: Shading

Global Illumination. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Shading. Brian Curless CSE 557 Autumn 2017

CS354R: Computer Game Technology

Illumination & Shading

03 RENDERING PART TWO

Outline of Lecture. Real-Time High Quality Rendering. Geometry or Vertex Pipeline. Basic Hardware Pipeline. Pixel or Fragment Pipeline

Lights, Surfaces, and Cameras. Light sources emit photons Surfaces reflect & absorb photons Cameras measure photons

Shading / Light. Thanks to Srinivas Narasimhan, Langer-Zucker, Henrik Wann Jensen, Ravi Ramamoorthi, Hanrahan, Preetham

Final Project: Real-Time Global Illumination with Radiance Regression Functions

Lecture 4: Reflection Models

Raytracing. COSC 4328/5327 Scott A. King

Shaders. Oscar. 1/43 Apodaca and Gritz, Advanced RenderMan

Visualisatie BMT. Rendering. Arjan Kok

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

Practical Techniques for Ray Tracing in Games. Gareth Morgan (Imagination Technologies) Aras Pranckevičius (Unity Technologies) March, 2014

TDA361/DIT220 Computer Graphics, January 15 th 2016

Dynamic Ambient Occlusion and Indirect Lighting. Michael Bunnell NVIDIA Corporation

Local vs. Global Illumination & Radiosity

Enhancing Traditional Rasterization Graphics with Ray Tracing. October 2015

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

Introduction. Lighting model Light reflection model Local illumination model Reflectance model BRDF

Chapter 7 - Light, Materials, Appearance

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

So far, we have considered only local models of illumination; they only account for incident light coming directly from the light sources.

Shading. Brian Curless CSE 457 Spring 2017

Physically Based Shading in Unity. Aras Pranckevičius Rendering Dude

Enabling immersive gaming experiences Intro to Ray Tracing

Rendering Objects. Need to transform all geometry then

CS8803SC Software and Hardware Cooperative Computing GPGPU. Prof. Hyesoon Kim School of Computer Science Georgia Institute of Technology

NVIDIA Case Studies:

Wednesday, July 24, 13

ECS 175 COMPUTER GRAPHICS. Ken Joy.! Winter 2014

Simple Lighting/Illumination Models

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

Radiometry and reflectance

Shading & Material Appearance

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

Transcription:

Game Technology Lecture 7 4.12.2017 Physically Based Rendering Dipl-Inform. Robert Konrad Polona Caserman, M.Sc. Prof. Dr.-Ing. Ralf Steinmetz KOM - Multimedia Communications Lab PPT-for-all v.3.4_office2010 2012.09.10.pptx author(s) of these slides including research results from the KOM research network and TU Darmstadt; otherwise it is specified at the respective slide 5-Dec-17 Template all v.3.4

Intro https://www.youtube.com/watch?v=okmuxgfjkpy KOM Multimedia Communications Lab 2

Light Starts from light source Bounces around Looses intensity with each collision Eventually reaches the camera KOM Multimedia Communications Lab 3

Light Sources KOM Multimedia Communications Lab 4

Rendering Lots of Lights Forward Rendering Iterate over all lights in the pixel shader Optionally use a pre-depth pass Deferred Rendering Render buffers of depth, normals, materials, Render simple geometry, approximating light distributions Add light inside the geometry using a pixel shader Forward+ Create 3D grid, assign most important lights to each grid Pull light info from the grid in the pixel shader KOM Multimedia Communications Lab 5

Point Lights Defined by a position and light color/intensity KOM Multimedia Communications Lab 6

Spot Lights Point light plus an angle KOM Multimedia Communications Lab 7

Directional Light Just a direction and light intensity/color KOM Multimedia Communications Lab 8

Directional Light KOM Multimedia Communications Lab 9

Area Lights Simple solution: Approximate using multiple point/spot lights Analytical solution: https://labs.unity.com/article/real-time-polygonallight-shading-linearly-transformed-cosines KOM Multimedia Communications Lab 10

Bounces KOM Multimedia Communications Lab 11

BRDF Bidirectional reflectance distribution function incoming light direction outgoing direction (for example to the camera) returns the ratio of reflected radiance f r (ω i, ω r ) KOM Multimedia Communications Lab 12

Path Tracing Extended Raytracing foreach (pixel) bounce around a lot Use BRDF at each collision Very slow but useful to create reference images and for prerendered lighting information KOM Multimedia Communications Lab 13

Realtime Lighting Consider only light rays from direct light sources First bounce Use shadow maps Second bounce Ignore further light bouncing No reflections No ambient light KOM Multimedia Communications Lab 14

Image-Based Lighting Put surroundings in cube map Use for example path tracing to generate the cube map Ignore lights, instead sample cube map A cube map is only correct for one position Ignores dynamic objects KOM Multimedia Communications Lab 15

HDR High dynamic range Use more than 32 bits of data for one pixel KOM Multimedia Communications Lab 16

BRDF Bidirectional reflectance distribution function incoming light direction outgoing direction (for example to the camera) returns the ratio of reflected radiance f r (ω i, ω r ) KOM Multimedia Communications Lab 17

BRDF Shortcomings Subsurface-Scattering Wavelength dependence KOM Multimedia Communications Lab 18

BRDF Only positive light f r ω i, ω r 0 KOM Multimedia Communications Lab 19

BRDF Inverted f r ω i, ω r = f r (ω r, ω i ) KOM Multimedia Communications Lab 20

BRDF Energy conserving ω i, න Ω f r ω i, ω r cos θ r dω r 1 KOM Multimedia Communications Lab 21

Phong Lighting color = ambient + diffuse + specular KOM Multimedia Communications Lab 22

Gamma Correction / srgb See Exercise 1 Transform textures to linear (pow 2.2) Or use srgb texture reading (also allows proper filtering) Lighting calculations in linear space (gamma 1) Then transform for srgb (pow 1 / 2.2) KOM Multimedia Communications Lab 23

Diffuse & Specular KOM Multimedia Communications Lab 24

Diffuse Lambertian reflectance / Phong diffuse I = L*N Good enough for modern engines Used for example in Unreal Engine 4 KOM Multimedia Communications Lab 25

Metals and Dielectrics http://www.manufato.com/wp-content/uploads/2010/10/imagem-35-english.jpg KOM Multimedia Communications Lab 26

Metals and Dielectrics Metals No diffuse High Specular Dielectrics Diffuse Lower but still surprisingly high Specular Note: Specular value is specified at low angles KOM Multimedia Communications Lab 27

Polarization of Reflected Light Specular Reflection Polarization does not change Diffuse Reflection Polarization is randomized KOM Multimedia Communications Lab 28

Cardboard KOM Multimedia Communications Lab 29

Cardboard Diffuse KOM Multimedia Communications Lab 30

Cardboard Specular KOM Multimedia Communications Lab 31

Metal KOM Multimedia Communications Lab 32

Metal Specular KOM Multimedia Communications Lab 33

Metal Diffuse KOM Multimedia Communications Lab 34

Specularity angle(normal, light) = angle(normal, camera) KOM Multimedia Communications Lab 35

Brick angle(normal, light) = angle(normal, camera) KOM Multimedia Communications Lab 36

Fresnel KOM Multimedia Communications Lab 37

Fresnel KOM Multimedia Communications Lab 38

Schlick Approximation Schlick(spec, light, normal) = spec + (1 - spec) (1 - (light*normal))^5 light*normal = 1 Schlick = spec light*normal = 0 Schlick = 1 spec characteristic specular reflectance specular color KOM Multimedia Communications Lab 39

Microfacet Model KOM Multimedia Communications Lab 40

Microfacet BRDF f l, v = F l, h G l, v, h D(h) 4(n l)(n v) KOM Multimedia Communications Lab 41

Microfacet BRDF Fresnel Reflectance f l, v = F l, h G l, v, h D(h) 4(n l)(n v) KOM Multimedia Communications Lab 42

Microfacet BRDF Active microfacets f l, v = F l, h G l, v, h D(h) 4(n l)(n v) KOM Multimedia Communications Lab 43

Microfacet BRDF Normal Distribution Function f l, v = F l, h G l, v, h D(h) 4(n l)(n v) KOM Multimedia Communications Lab 44

Normal Distribution Function D Evaluated for h The concentration of microfacets that have an orientation so they could reflect light to the camera Might still be occluded, KOM Multimedia Communications Lab 45

Normal Distribution D(h) Portion of microfacets pointing to h D tr m = π α2 tr n m 2 α 2 2 tr 1 + 1 Trowbridge-Reitz (GGX) α: Roughness KOM Multimedia Communications Lab 46

Microfacet BRDF Shadow Masking Function f l, v = F l, h G l, v, h D(h) 4(n l)(n v) KOM Multimedia Communications Lab 47

Shadow Masking Function G Also referred to as the Geometry Function Probability that microfacets with normal h are visible from both the light and the view direction KOM Multimedia Communications Lab 48

Geometry Factor G(l, v, h) Cook-Torrance: G ct l, v, h = min 1, 2 n h n v v h, 2 n h n l v h KOM Multimedia Communications Lab 49

Microfacet BRDF f l, v = F l, h G l, v, h D(h) 4(n l)(n v) KOM Multimedia Communications Lab 50

Physically Based Rendering In practice: Gamma correction Microfacet BRDF Lots of Cube Maps KOM Multimedia Communications Lab 51

Textures Typical Setup Diffuse texture Specular texture Roughness texture Normal Map KOM Multimedia Communications Lab 52

Diffuse Texture KOM Multimedia Communications Lab 53

Specular Texture KOM Multimedia Communications Lab 54

Smoothness Texture KOM Multimedia Communications Lab 55

Incorporating Image Based Lighting Precalculate Cube Maps Lots of Cube Maps Manually placed in level editor KOM Multimedia Communications Lab 56

Cube Maps KOM Multimedia Communications Lab 57

Cube Maps Can be interpolated Which is a rough approximation Can not capture dynamic objects KOM Multimedia Communications Lab 58

Reflection Rendering As done in Unreal Engine 4, Killzone Shadow Fall, Deferred Rendering Pass Raytrace depth buffer If no hit Interpolate local cube maps If no hit Use global cube map KOM Multimedia Communications Lab 59

Ambient Occlusion Small notches are normally shadowed Unless lit directly Calculations need very exact light bounces KOM Multimedia Communications Lab 60

Screen Space Ambient Occlusion Filter after rendering Darken at sharp normal changes KOM Multimedia Communications Lab 61

Global Illumination Ambient light Spherical Harmonic Lighting Voxel Cone Tracing KOM Multimedia Communications Lab 62

Summary Stay closer to nature Energy conservation Metals vs. Dielectrics Textures, parameters can be capured from nature More reusable assets No specific lighting information baked/painted into textures Physically Based Shading in Theory and Practice Course @SIGGRAPH http://blog.selfshadow.com/publications/ KOM Multimedia Communications Lab 63

GPU Internals NVidia GeForce GT 6600, 2004 KOM Multimedia Communications Lab 64

Memory Memory bandwidth is extremely important Textures Framebuffer Depth Buffer Memory access times not very important Most data is streamed Access times can be hidden by switching tasks KOM Multimedia Communications Lab 65

Memory Gigantic discrepancy from low-end to high-end High End CPU: 60 GB/s GeForce 1030: 48 GB/s PS4: 176 GB/s GeForce 1080 Ti: 484 GB/s KOM Multimedia Communications Lab 66

Vertex and Fragments Shaders Run on the same hardware Dynamically scheduled KOM Multimedia Communications Lab 67

CPU - GPU https://developer.nvidia.com/content/life-triangle-nvidiaslogical-pipeline KOM Multimedia Communications Lab 68

GPU KOM Multimedia Communications Lab 69

Rasterization, Pixel Shader KOM Multimedia Communications Lab 71

Work distribution KOM Multimedia Communications Lab 72

SMT (Symmetric Multithreading) Also used in CPUs (Hyperthreading) Switch to different thread when stalled (for example waiting for memory) KOM Multimedia Communications Lab 73

SIMD Compiler can put calculations on multiple vertices/pixels in one instruction Problem: Flow control Wrong paths pseudo-executed Can be efficient when all vertices/pixel in one pack take the same paths Shader variants Typically when you create a simple surface shader, it internally expands into 50 or so internal shader variants (Shader Compilation in Unity 4.5) KOM Multimedia Communications Lab 74

Parallelization Small work packages can prevent parallelization Performance dip for tiny triangles KOM Multimedia Communications Lab 75

CPU GPU Biggest performance trap Minimize state changes Minimize draw calls Send little data to the GPU If possible never read data from the GPU KOM Multimedia Communications Lab 76

Summary Broad overview of GPU internals CPU GPU interaction Work distribution Massively parallel execution (vertex, pixel shaders) Multithreading and SIMD KOM Multimedia Communications Lab 77