Lecture 11: Shading
COMP5822M – High Perf. Graphics
– Texturing,blending,masking
Copyright By PowCoder代写 加微信 powcoder
COMP5822M – High Perf. Graphics
– BRDF models
– Micro-facet overview
– Direct light
– Indirect light
– More indirect light
COMP5822M – High Perf. Graphics
COMP5822M – High Perf. Graphics
The Rendering Equation
COMP5822M – High Perf. Graphics
The Rendering Equation
COMP5822M – High Perf. Graphics
The Rendering Equation
COMP5822M – High Perf. Graphics
What goes into each of these?
COMP5822M – High Perf. Graphics
– Lightemittedbysurface
in a certain direction – Just add this in.
COMP5822M – High Perf. Graphics
– When does a surface
emit light? Well..
– Heat (black body radiation) – Flourescense
– Current flowing through
a semiconductor? …
COMP5822M – High Perf. Graphics
– When does a surface
emit light? Well..
– Heat (black body radiation)
– Flourescense
– Current flowing through
a semiconductor? …
– When and where our
artist tells us it does.
– Texture / Material property.
COMP5822M – High Perf. Graphics
– Ifyouhaveseparate
emissive data
– Goes well together
with Bloom.
COMP5822M – High Perf. Graphics
– Ifyouhaveseparate
emissive data
– Goes well together
with Bloom.
Src: https://developer.download.nvidia.com/books/HTML/gpugems/gpugems_ch21.html
The Rendering Equation
COMP5822M – High Perf. Graphics
What goes into each of these?
COMP5822M – High Perf. Graphics
– Bi-directionalReflection Distribution Function
– E.g. RDF
COMP5822M – High Perf. Graphics
– Twocomponents – Diffuse
– Specular
– Twocomponents – Diffuse
– Specular
COMP5822M – High Perf. Graphics
Src: Real Time Rendering
– Twocomponents
– Diffuse – Lambertian (subsurf.)
– Specular – Microfacets (surface)
COMP5822M – High Perf. Graphics
Src: Real Time Rendering
COMP5822M – High Perf. Graphics
– Lambertian – ~ dot(n, l)
COMP5822M – High Perf. Graphics
– Lambertian – ~ dot(n, l)
– Note: metals have almost zero lambertian
(all reflection occurs at surface; very short skin depth.)
COMP5822M – High Perf. Graphics
– MetalvsDielectric
– “Metallic Workflow”
– Metalness parameter
– MetalvsDielectric
– “Metallic Workflow”
– Fresnel only for dielectics, metals are differentTM
– Metalness parameter
COMP5822M – High Perf. Graphics
Src: https://learnopengl.com/PBR/Theory
– Surface/specular
– Microfacet models
– Tiny perfect mirrors
COMP5822M – High Perf. Graphics
Src: https://learnopengl.com/PBR/Theory
– Surface/specular
– Microfacet models
– Tiny perfect mirrors
COMP5822M – High Perf. Graphics
Src: https://learnopengl.com/PBR/Theory
COMP5822M – High Perf. Graphics
– Described by a few different properties
– Normal distribution function (NDF)
– Fresnel term (amount of reflection)
– Geometry function (self shadowing term)
– Described by a few different properties
– Normal distribution function (NDF)
– Fresnel term (amount of reflection)
– Geometry function (self shadowing term)
𝑓 𝒍,𝒗= 𝑟,μ𝑓𝑎𝑐𝑒𝑡
𝐷 𝒉 𝐹 𝒗,𝒉 𝐺 𝒍,𝒗,𝒉 4 𝒏⋅𝒍 𝒏⋅𝒗
COMP5822M – High Perf. Graphics
– Described by a few different properties
Normal distribution function (NDF) Fresnel term (amount of reflection) Geometry function (self shadowing term)
𝑓 𝒍,𝒗= 𝑟,μ𝑓𝑎𝑐𝑒𝑡
𝐷 𝒉 𝐹 𝒗,𝒉 𝐺 𝒍,𝒗,𝒉 4 𝒏⋅𝒍 𝒏⋅𝒗
COMP5822M – High Perf. Graphics
– Described by a few different properties – Normal distribution function (NDF), 𝐷
– Fresnel term (amount of reflection), 𝐹
– Geometry function (self shadowing term), 𝐺
𝑓 𝒍,𝒗= 𝑟,μ𝑓𝑎𝑐𝑒𝑡
𝐷 𝒉 𝐹 𝒗,𝒉 𝐺 𝒍,𝒗,𝒉 4 𝒏⋅𝒍 𝒏⋅𝒗
COMP5822M – High Perf. Graphics
– Described by a few different properties
– Normal distribution function (NDF)
– Fresnel term (amount of reflection)
– Geometry function (self shadowing term)
COMP5822M – High Perf. Graphics
Src: https://learnopengl.com/PBR/Theory
(Trowbridge -Reitz GGX)
Geometry (Schlick GGX)
COMP5822M – High Perf. Graphics
(w/ Schlick approx.)
Src: https://learnopengl.com/PBR/Theory
Fresnel in meatspace
COMP5822M – High Perf. Graphics
Increasing reflection
with increasing angle (to normal)
Fresnel in meatspace
Increasing reflection
with increasing angle (to normal)
Increasing reflection
with increasing angle (to normal)
COMP5822M – High Perf. Graphics
Fresnel in meatspace
Increasing reflection
with increasing angle (to normal)
Increasing reflection
with increasing angle (to normal)
Try this yourself. Works with most (non metal) surfaces.
(Can use any light source. If you use a candle/flame, please be careful. Fire sets stuff on fire if you’re not careful.)
COMP5822M – High Perf. Graphics
Fresnel in meatspace
Increasing reflection
with increasing angle (to normal)
Increasing reflection
with increasing angle (to normal)
Try this yourself. Works with most surfaces.
(Can use any light source. If you use a
Paper = very diffuse.
candle/flame, please be careful. Fire sets stuff
(Strong lambertian)
on fire if you’re not careful.)
COMP5822M – High Perf. Graphics
Fresnel in meatspace
Increasing reflection
with increasing angle (to normal)
Increasing reflection
with increasing angle (to normal)
Try this yourself. Works with most surfaces.
(Can use any light source. If you use a
Paper = very diffuse.
candle/flame, please be careful. Fire sets stuff
(Strong lambertian)
on fire if you’re not careful.)
COMP5822M – High Perf. Graphics
Fresnel in meatspace
Increasing reflection
with increasing angle (to normal)
Increasing reflection
with increasing angle (to normal)
Try this yourself. Works with most surfaces.
(Can use any light source. If you use a
Paper = very diffuse.
candle/flame, please be careful. Fire sets stuff
(Strong lambertian)
on fire if you’re not careful.)
COMP5822M – High Perf. Graphics
– PBR: Read Natty Hoffman’s Theory Intro.
– “Physics and Math of Shading”
https://blog.selfshadow.com/publications/s2013-shading- course/hoffman/s2013_pbs_physics_math_notes.pdf
– Information about the physics/models behind the shading schemes.
COMP5822M – High Perf. Graphics
Incident Lighting
COMP5822M – High Perf. Graphics
Incident Lighting
– Sofar:Lightsources
– Point lights, spot lights, directional lights
– Area lights, polygonal lights?
– =Directlight/illumination
– Shadow maps fall under this as well!
COMP5822M – High Perf. Graphics
Tangent: Area light sources?
– Seee.g.LinearlyTransformedCosines(LTC)
– “Real-Time Polygonal-Light Shading with Linearly Transformed Cosines”,
Heitz, Dupuy, Hill & Neubelt (2016)
COMP5822M – High Perf. Graphics
(Has a WebGL demo!)
– https://eheitzresearch.wordpress.com/415-2/
Incident Lighting
– Sofar:Lightsources
– Point lights, spot lights, directional lights
– Area lights, polygonal lights?
– =Directlight/illumination
– Shadow maps fall under this as well!
COMP5822M – High Perf. Graphics
Direct Illumination
COMP5822M – High Perf. Graphics
Indirect Illumination
COMP5822M – High Perf. Graphics
Indirect Illumination
COMP5822M – High Perf. Graphics
Indirect Illumination
COMP5822M – High Perf. Graphics
Indirect Illumination
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatit? – No!
– Participating media! – Atmosphere
– Smoke, fog, haze, …
– Onebounce:Singlescattering – Main component of “godrays”
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatit? – No!
– Participating media! – Atmosphere
– Smoke, fog, haze, …
– Onebounce:Singlescattering – Main component of “godrays”
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatit? – No!
– Participating media! – Atmosphere
– Smoke, fog, haze, …
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatit? – No!
– Participating media! – Atmosphere
– Smoke, fog, haze, …
– Many bounces: Multiple Scattering – Default state of nature.
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatmustbeit?
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatmustbeit? – Kinda.
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatmustbeit? – Kinda.
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatmustbeit? – Kinda.
COMP5822M – High Perf. Graphics
Indirect Illumination
– Thatmustbeit? – Kinda.
– Plus variations
with multiple interactions in various orders.
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
Is it important?
COMP5822M – High Perf. Graphics
How do we deal with indirect illumination?
– Identify important contributions
– Modelthem
– Approximate as necessary
– Implement efficiently
COMP5822M – High Perf. Graphics
Tangent: What’s missing?
– Important type of path missing!
– Canyouidentifyit?
COMP5822M – High Perf. Graphics
Tangent: What’s missing?
– Important type of path missing!
– Canyouidentifyit?
COMP5822M – High Perf. Graphics
Tangent: What’s missing?
– Important type of path missing!
– Canyouidentifyit?
– Without this, the light source isn’t visible.
– Often it isn’t.
COMP5822M – High Perf. Graphics
Tangent: What’s missing?
– Important type of path missing!
– Canyouidentifyit?
– Without this, the light source isn’t visible.
– Often it isn’t.
– Not very relevant for point lights.
COMP5822M – High Perf. Graphics
Tangent: What’s missing?
– Important type of path missing!
– Canyouidentifyit?
– Without this, the light source isn’t visible.
– Often it isn’t.
– Not very relevant for point lights.
COMP5822M – High Perf. Graphics
From LTC Demo: https://blog.selfshadow.com/sandbox/ltc.htm
COMP5822M – High Perf. Graphics
How do we deal with indirect illumination?
– Identify important contributions
– Modelthem
– Approximate as necessary
– Implement efficiently
COMP5822M – High Perf. Graphics
Tangent: Notation
– Commonnotationfordescribingpaths: – Events:
– L: light source
– E: eye / camera
– S: specular reflection
– D: diffuse reflection -…
– Regular expression syntax:
– X+:oneormoreofX
– X*: zero or more of X
– X?: zero or one X
– X|Y: either X or Y
COMP5822M – High Perf. Graphics
Tangent: Notation
– Example:
– L(D|S)E : direct illumination
– LD?S*E: traditional “Whitted” ray tracing
– Not same as e.g. L(D|S)*E!
COMP5822M – High Perf. Graphics
Tangent: Notation
– Doesn’tconsiderparticipatingmedia – Would need another event type
COMP5822M – High Perf. Graphics
Basic model
– Directilluminationonly
– You already know this one.
– With / without shadow maps
COMP5822M – High Perf. Graphics
Basic model
– Directilluminationonly
– You already know this one.
– With / without shadow maps
– Phong: Diffuse and Specular reflections – SimilarforotherBRDFs
COMP5822M – High Perf. Graphics
Basic model
– Ambientlight
– The most approximate approximation of indirect illum.
– Models light that has bounced around many times
– And thus comes equally from all directions
COMP5822M – High Perf. Graphics
Basic model
– Ambientlight
– The most approximate approximation of indirect illum.
– Models light that has bounced around many times
– And thus comes equally from all directions
– Makes scene visible even if in shadow / no direct illum.
– Really cheap.
– Cons: Very very very very very very […] approximate.
– Difficult to control / “get right”.
COMP5822M – High Perf. Graphics
– How bad is it actually?
– Depends on how even your illumination is.
– Main volume of indoor spaces tend to be evenly lit.
– E.g. tried to set up my lecturing location here with
even light, at least from the front.
– Exploreyourself!
– Get a diffuse white surface (e.g., white paper)
– Does it look evenly white when rotating?
If yes: constant ambient maybe not that bad?
COMP5822M – High Perf. Graphics
– Two sets of techniques:
– First: trying to fix/improve ambient
– Second: indirect/global illumination models
COMP5822M – High Perf. Graphics
Ambient Occlusion
– Recall: ambient is light coming equally from all directions
COMP5822M – High Perf. Graphics
Ambient Occlusion
– Recall: ambient is light coming equally from all directions
COMP5822M – High Perf. Graphics
Ambient Occlusion
– Recall: ambient is light coming equally from all directions
COMP5822M – High Perf. Graphics
Ambient Occlusion
– Recall: ambient is light coming equally from all directions
– Concaveregions: Ambient light blocked.
COMP5822M – High Perf. Graphics
Ambient Occlusion
– Recall: ambient is light coming equally from all directions
– Concaveregions:
Ambient light blocked. – To varying degrees.
COMP5822M – High Perf. Graphics
Ambient Occlusion
– AmbientOcclusion/Obscurance(AO)modelsthis – This helps highlight surface details
2021/2022 Src: “The Alchemy screen-space ambient obscurance algorithm” COMP5822M – High Perf. Graphics McGuire, Osman, Bukowski & Hennessey (2011)
Ambient Occlusion
COMP5822M – High Perf. Graphics
𝐿𝐴 𝜔,𝒏 𝑑𝜔=2𝜋𝐿𝐴 Ω+
Ambient Occlusion
COMP5822M – High Perf. Graphics
𝐿𝐴 𝜔,𝒏 𝑑𝜔<2𝜋𝐿𝐴 Ω+
𝐿𝐴 𝜔,𝒏 𝑑𝜔=2𝜋𝐿𝐴 Ω+
Ambient Occlusion
- How do we evaluate it? - Ray tracing
- Geometric
- Screen space
COMP5822M – High Perf. Graphics
Ambient Occlusion Volumes
- Geometricapproach
- “Ambient Occlusion Volumes”, McGuire (2010)
- (And related works)
COMP5822M – High Perf. Graphics
Ambient Occlusion Volumes
- Geometricapproach
“Ambient Occlusion Volumes”, McGuire (2010) (And related works)
COMP5822M – High Perf. Graphics
Src: “Ambient Occlusion Volumes”, McGuire (2010)
Screen space techniques
- “Screenspaceambientocclusion”(SSAO) - Most common approaches
- Manyvariations
- Ambient Occlusion
- Ambient Obscurance
- Screen Space Global Illumination
/ Screen Space Directional Occlusion -...
COMP5822M – High Perf. Graphics
Screen space techniques
- Basicidea:
- Inspect depth buffer in a local
neighbourhood
- E.g. how much of the horizon
is obscured?
COMP5822M – High Perf. Graphics
Screen space techniques
- Basicidea:
- Inspect depth buffer in a local
neighbourhood
- E.g. how much of the horizon
is obscured?
COMP5822M – High Perf. Graphics
Src: https://learnopengl.com/Advanced-Lighting/SSAO
SSAO - Implementation
- Take N samples in neighbourhood
- Disc vs. hemisphere
- Random or patterns (see papers)
- Blurresults
- Fewer samples in previous step
- Clever blurs (bilateral, ...) can help
COMP5822M – High Perf. Graphics
SSAO - Implementation
- Take X samples in neighbourhood
- Disc vs hemisphere
- Random or patterns (see papers)
- Blurresults
- Allows use of fewer samples in previous step
- Clever blurs (bilateral, ...) can help
COMP5822M – High Perf. Graphics McGuire, Osman, Bukowski & Hennessey (2011)
Src: “The Alchemy screen-space ambient obscurance algorithm”
SSAO – False AO
- Gotcha:ambiguousdepthbufferconfigurations
COMP5822M – High Perf. Graphics
SSAO – False AO
- Gotcha:ambiguousdepthbufferconfigurations
COMP5822M – High Perf. Graphics
SSAO – False AO
- Workaround:
- Threshold when sampling neighbourhood
- Too far away: assume “open” space
- Otherapproaches:
- Multiple layers
- Multiple views -...
COMP5822M – High Perf. Graphics
SSAO – False AO
- Workaround:
- Threshold when sampling neighbourhood
- Too far away: assume “open” space
- Otherapproaches:
- Multiple layers
- Multiple views -...
COMP5822M – High Perf. Graphics
Src: https://www.babylonjs.com/demos/ssao/
SSAO – False AO
- Workaround:
- Threshold when sampling neighbourhood
- Too far away: assume “open” space
False AO around the cat.
- Otherapproaches:
- Multiple layers
- Multiple views -...
COMP5822M – High Perf. Graphics
Src: https://www.babylonjs.com/demos/ssao/
SSAO – False AO
- Threshold:producesreverseproblem
- White “halos” around foreground objects.
COMP5822M – High Perf. Graphics
SSAO – False AO
- Threshold:producesreverseproblem
- White “halos” around foreground objects.
Greedfall (https://guides4gamers.com/sites/19/screenshots/2019/09/1920/the-battle-of-the-red-spears-1.jpg)
COMP5822M – High Perf. Graphics
Assassin’s Creed 3 https://www.youtube.com/watch?v=3yq_5dBSy2E
SSAO – False AO
- Threshold:producesreverseproblem
- White “halos” around foreground objects.
Greedfall (https://guides4gamers.com/sites/19/screenshots/2019/09/1920/the-battle-of-the-red-spears-1.jpg)
COMP5822M – High Perf. Graphics
Assassin’s Creed 3 https://www.youtube.com/watch?v=3yq_5dBSy2E
SSAO – Edges
- Screenedgesareproblematic
- General issue with screen space techniques
COMP5822M – High Perf. Graphics
SSAO – Edges
- Screenedgesareproblematic
- General issue with screen space techniques
COMP5822M – High Perf. Graphics
Greedfall (Note: just for illustration, not sure if/how they solved this.) (https://guides4gamers.com/sites/19/screenshots/2019/09/1920/the-battle-of-the-red-spears-1.jpg)
SSAO – Edges
- Screenedgesareproblematic
- General issue with screen space techniques
COMP5822M – High Perf. Graphics
Greedfall (Note: just for illustration, not sure if/how they solved this.) (https://guides4gamers.com/sites/19/screenshots/2019/09/1920/the-battle-of-the-red-spears-1.jpg)
SSAO – Edges
- Screenedgesareproblematic
- General issue with screen space techniques
Outside of rendered area. No depth buffer values here!
COMP5822M – High Perf. Graphics
Greedfall (Note: just for illustration, not sure if/how they solved this.) (https://guides4gamers.com/sites/19/screenshots/2019/09/1920/the-battle-of-the-red-spears-1.jpg)
SSAO – Edges
- Screenedgesareproblematic
- General issue with screen space techniques
- Sometimesvisible
- SSAO: less AO along the edge of the screen
- (Other techniques similar)
COMP5822M – High Perf. Graphics
SSAO – Edges
- Fixes/workarounds
- Render slightly larger view
=> information around edges of visible image
– Play with texture address modes
(e.g. MIRRORED_REPEAT?)
– Ignore problem.
COMP5822M – High Perf. Graphics
Extensions – SSDO / SSGI
– SSAO:removeambientcontribution
– SSDO/SSGI: add single bounce
– Still account for AO.
– SSDO: consider light direction
when evaluating AO.
COMP5822M – High Perf. Graphics
Extensions – SSDO / SSGI
– SSAO:removeambientcontribution
– SSDO/SSGI: add single bounce
– Still account for AO.
– SSDO: consider light direction
when evaluating AO.
COMP5822M – High Perf. Graphics
Extensions – SSDO / SSGI
– SSAO:removeambientcontribution – SSDO/SSGI: add single bounce
Still account for AO.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com