14.07.2015 Views

Real Shading in Unreal Engine 4 - Self Shadow

Real Shading in Unreal Engine 4 - Self Shadow

Real Shading in Unreal Engine 4 - Self Shadow

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Real</strong> <strong>Shad<strong>in</strong>g</strong> <strong>in</strong> <strong>Unreal</strong> Eng<strong>in</strong>e 4Brian Karis(brian.karis@epicgames.com)


Goals• More realistic image• Material layer<strong>in</strong>g– Better workflow– Blended <strong>in</strong> shader• Timely <strong>in</strong>spiration from Disney– Presented <strong>in</strong> this course last year


Overview• <strong>Shad<strong>in</strong>g</strong> model• Material model• Light<strong>in</strong>g model


<strong>Shad<strong>in</strong>g</strong> Model


• LambertDiffuse BRDF– Saw little effect of more sophisticated modelsLambertBurley


• Generalized microfacet modelSpecular BRDF– Compared many options for each term– Use same <strong>in</strong>put parametersf l, v =D h F(l, h)G l, v, h4(n ⋅ l)(n ⋅ v)


Specular distribution• Trowbridge-Reitz (GGX)– Fairly cheap– Longer tail looks much more naturalf l, v =D h F(l, h)G l, v, h4(n ⋅ l)(n ⋅ v)GGXBl<strong>in</strong>n-Phong


Geometric shadow<strong>in</strong>g• Schlick– Matched to Smith– Cheaper, difference is m<strong>in</strong>or– Uses Disney’s roughness remapp<strong>in</strong>g*f l, v =D h F(l, h)G l, v, h4(n ⋅ l)(n ⋅ v)n ⋅ vG Schlick (v)n ⋅ vG Smith (v)α = 0.1 α = 0.5 α = 0.9


Fresnel• Schlick– Approximate the powerf l, v =D h F(l, h)G l, v, h4(n ⋅ l)(n ⋅ v)Identical for all practical purposes


Image-based light<strong>in</strong>g : Problem• Only use s<strong>in</strong>gle sample per environment map• Match importance-sampled referenceHL i l f l, v cos θ l dl≈ 1 NNk=1L i l k f l k , v cos θ lkp l k , v


Image-based light<strong>in</strong>g : Solution• Same as Dimitar’s: split the sum• Pre-calculate both parts1NNk=1L i l k f l k , v cos θ lkp l k , v≈1 NNk=1L i l k1NNk=1f(l k , v) cos θ lkp(l k , v)


Pre-filtered environment map• 1 st sum stored <strong>in</strong> cubemap mips– Pre-filter for specific roughness’s– Fixed distribution, assume n = v– Loses stretched highlights1NNk=1L i l k≈ Cubemap. Sample(r, mip)


Environment BRDF• 2 nd sum stored <strong>in</strong> 2D lookup texture (LUT)Roughness1NNk=1f(l k , v) cos θ lkp(l k , v)cos θ v= LUT. r ∗ F 0 + LUT. g


Importance-sampled reference


Split sum approximation


Complete approximation (n=v)


Importance-sampled referenceSplit sum approximationComplete approximation (n=v)


Material Model


Material model• BaseColor– S<strong>in</strong>gle color• Metallic– Less chance of error• Roughness– Very clear <strong>in</strong> its mean<strong>in</strong>g• Cavity– Used for small scale shadow<strong>in</strong>gMetallic 0 to 1Metal with roughness 0 to 1Non-metal with roughness 0 to 1


Material model lessons• Specular parameter is confus<strong>in</strong>g– Not really needed– Replaced with CavitySamaritanDiffuseColorSpecularColorSpecularPowerInfiltratorBaseColorMetallicSpecularRoughnessNowBaseColorMetallicRoughnessCavity


• TODO:anotherimageMaterial layer<strong>in</strong>g


Material layer<strong>in</strong>g tools• Added layers to our node graph based material editor– Layers use exist<strong>in</strong>g material function feature– Added material attributes struct• Layer workflow similar to previous texture workflow


Material layer<strong>in</strong>g


Material layer<strong>in</strong>g


4PERSPEKTYWAKRAJOWA• Bezpieczeństwo energetyczne kraju – <strong>in</strong>westycje realizowaneprzez Grupę, związane m.<strong>in</strong>. z budową lub odbudowąjednostek wytwórczych, mają wpływ na poziombezpieczeństwa energetycznego kraju.• Ochrona środowiska i realizacja polityki klimatycznejprowadzonej przez Unię Europejską – dywersyfikacjaMirella Panek-Owsiańskaportfela wytwórczego (m.<strong>in</strong>. wzrost udziału OZE) wpływaPrezeska Forum Odpowiedzialnego Biznesu“na realizację założeń polityki unijnej. Grupa podejmujeteż działania prośrodowiskowe, m.<strong>in</strong>. ograniczające emisjęDostęp do zróżnicowanej i bezpiecznej energii,gazów cieplarnianych.w przystępnej cenie, niegenerującej kosztów społecznychi środowiskowych to największe wyzwanie• Wzrost konkurencyjności rynku – rozwój oferty produktowej,nowoczesne kanały komunikacji dopasowane dopotrzeb klientów (w tym defaworyzowanych) rozwijają dla naszego kraju. Jeśli Polska nie podejmie w porękonkurencyjność rynku. działań na rzecz rozwoju i modernizacji swoichmocy, jeśli zignoruje konieczność dywersyfikacji orazposzukiwania alternatywnych źródeł energii, naszagospodarka utraci szansę na bardziej zrównoważonyrozwój. Polityka klimatyczna UE rodzi wiele wyzwańdla Polski – tak dla biznesu, jak i dla społeczeństwa.Strategiczne decyzje wymagają dialogu społecznegoze wszystkimi uczestnikami rynku energii, potrzebnajest wspólna wizja oraz współpraca różnychsektorów. Grupa TAURON jest jedną z firm, którapodejmuje wyzwanie i stawia przed sobą ambitnecele zawarte w „Strategii zrównoważonego rozwojuGrupy TAURON na lata 2012-2015 z perspektywą doroku 2020”. Wyzwanie tym większe, że będzie wymagałozmiany struktury wytwarzania energii poprzezzwiększenie udziału <strong>in</strong>nych niż węgiel źródeł, w tymOZE. Dzięki takiej strategii firma ma szansę zostaćliderem w strategii łączenia bezpieczeństwa energetycznegoz <strong>in</strong>westycjami związanymi z zapobieganiemzmian klimatu.”ROZDZIAŁ 2 | PERSPEKTYWA ZRÓWNOWAŻONEGO ROZWOJU25


Inverse square falloffOld falloffInverse square


Area Lights


• Consistent material appearanceArea light requirements– Energy evaluated with diffuse BRDF and specular BRDF should match• Approaches po<strong>in</strong>t light model as solid angle approaches zero– Don’t want to lose any aspect of our shad<strong>in</strong>g model• Fast enough to use everywhere– Otherwise artists will bias roughness


Specular D modification• Widen specular distribution by light’s solid angle– We presented this last year• Problems– Glossy surfaces don’t look glossy anymore


ReferenceSpecular D modification


Representative po<strong>in</strong>t• Pick one representative po<strong>in</strong>t on light source shape• <strong>Shad<strong>in</strong>g</strong> model can be used directly• Po<strong>in</strong>t with largest contribution is a good choice• Approximate us<strong>in</strong>g smallest angle to reflection ray


Sphere lights• Irradiance identical to po<strong>in</strong>t light– If sphere above horizon• Closest po<strong>in</strong>t between ray and sphere– Approximates smallest angle


Sphere light energy conservation• Specular distribution has been widened by light’s solid angle– We already have an approximation for this us<strong>in</strong>g “Specular D modification”– Only use normalization term– Divide out orig<strong>in</strong>al normalization, multiply <strong>in</strong> new


ReferenceRepresentative po<strong>in</strong>t


Representative po<strong>in</strong>t applied to Tube Lights


• Tons of extra stuff– Importance sampl<strong>in</strong>g code– Area light formulas– Lots of math In the course notes


Thanks• Epic– Render<strong>in</strong>g team– All the artists mak<strong>in</strong>g me look good• Special thanks to Sébastien Lagarde• Stephen Hill and Stephen McAuley for valuable <strong>in</strong>put

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!