41
Physically Based Rendering An advanced practicum by Michael Pronkin

Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Physically Based Rendering

An advanced practicum by Michael Pronkin

Page 2: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Overview

● PBR○ intro○ BRDF (bidirectional reflectance distribution function)○ materials○ IBL (image based lighting)

● implementation○ Deferred Rendering○ GBuffer for PBR○ material data structure

● outlook○ gltf○ PBR in the industry

2

Page 3: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Intro to PBR(Physically Based Rendering)

3

Page 4: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake" Wilson 4

Page 5: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake" Wilson 5

Page 6: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

6

Page 7: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

7

Page 8: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

8

Page 9: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

9

Page 10: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

BRDF (bidirectional reflectance distribution function)

Describes reflection of light from a point on a surface

From https://github.com/moneimne/glTF-Tutorials/tree/master/PBR/figures 10

Page 11: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

From https://github.com/moneimne/glTF-Tutorials/tree/master/PBR/figures 11

shadowing

Geometric Occlusion

interreflection masking

Page 12: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

f(l, v, n) = Diffuse(l, n) +

BRDF: Lighting Function

F(l, h) G(l, v, h) D(h)4(n · l)(n · v)

● l := light direction● v := view direction● h := light view halfway vector● n := normal vector

12

Diffuse Term(Lambert)

Specular Term(Cook-Torrance)

Page 13: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Diffuse(l, n) = l · n

BRDF Diffuse Term (Lambert)

● l := light direction● n := normal vector

13

Page 14: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

14

Page 15: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

BRDF Specular Term (Cook-Torrance)

● l := light direction● v := view direction● h := light view halfway vector● n := normal vector

15

F(l, h) G(l, v, h) D(h)4(n · l)(n · v)

● Fresnel Term● Geometric Occlusion Term● Distribution Term

Page 16: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

BRDF Specular Term (Fresnel)

● F0 := specular reflectance at normal incidence● l := light direction● h := light view halfway vector

16

F(l, h) G(l, v, h) D(h)4(n · l)(n · v)

Fschlick_gauss(l, h) = F0 + (1 − F0) × (1 − v · h)5

Page 17: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

17

Page 18: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

BRDF Specular Term (Geometric Occlusion)

● r := roughness● l := light direction● v := view direction● h := light view halfway vector

18

F(l, h) G(l, v, h) D(h)4(n · l)(n · v)

Gschlick(l, v, h) = G1(n, l) × G1(n, v)

G1(n, v) = 2 × (n · v)

(n · v) + √r2 + (1 - r2)(n · v)2

Page 19: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

BRDF Specular Term (Distribution)

● r := roughness● h := is actually n · h for this term

19

F(l, h) G(l, v, h) D(h)4(n · l)(n · v)

Dggx(h) = r4

π((n · h)2 × (r4 - 1) + 1)2

Page 20: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

IBL (image based lighting)

● cubemap (or similar)● multiple resolutions● for both diffuse and specular● point/area lights optional● HDR (high dynamic range)

20

Page 21: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

from https://3dcoat.com/pbr/ 21

Page 22: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

from https://3dcoat.com/pbr/ 22

Page 23: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

implementation

● BRDF code● Deferred Rendering● GBuffer for PBR● irradiance/reflection maps● material data structure

○ glTF format

23

Page 24: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

BRDF code

24

Page 25: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Deferred Rendering vs. Forward Rendering● Lights per fragment

(less complexity)● Only calculates visible pixels

(screen space deferral)● Requires buffers

(multi render target)● Anti-aliasing more difficult

● Lights per vertex● Requires additional calculations

for invisible geometry avoidance(or naively calculate all invisible)

● Much lower overhead in memory

25

Page 26: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Gbuffer for PBR

● albedo● normal/roughness● specular/IOR● position/depth

26

Page 27: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Gbuffer code

27

Page 28: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

Gbuffer code continued

28

Page 29: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

materials

components:

● albedo (“color”)● metalness (“metal or dielectric”)● roughness (“rough to smooth”)

29

Page 30: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

from https://3dcoat.com/pbr/ 30

Page 31: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

31

Page 32: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

from https://3dcoat.com/pbr/ 32

Page 33: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

33

Page 34: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

34

Page 35: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

from https://3dcoat.com/pbr/ 35

Page 36: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

from https://3dcoat.com/pbr/ 36

Page 37: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

PBR vs. traditional shading

● higher memory overhead● much higher visual

impact● closer approximation of

photorealism

● Simple to understand and implement

● useful for prototyping● easy to run on very old

hardware

37

Page 38: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

● New format for PBR based scenes● Application independent● compact size● fast loading● open and extensible● you can follow all development at

https://github.com/KhronosGroup/glTF

glTF

38

Page 39: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

PBR in the industry

39

Page 40: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

demo time!

Page 41: Physically Based Rendering - Welcome to pillerendering01/... · 2018. 11. 24. · From Marmoset Toolbag Tutorials: Physically-Based Rendering, And You Can Too!, by Joe "Earthquake"

thanks!