SlideShare a Scribd company logo
Calibrating Lighting and Materials in
              Far Cry 3
    Stephen McAuley, Ubisoft Montréal
         stephen.mcauley@ubisoft.com
Diffuse Albedo
BRDF

 Diffuse albedo:
BRDF

 Torrance-Sparrow microfacet BRDF:
BRDF

 Lambert diffuse BRDF:
Motivation

   Natural, saturated colours
   Consistent across materials
   Consistent under all lighting conditions
   Diffuse lighting balanced with specular
Diffuse Albedo vs Diffuse Albedo
Diffuse Reflectance vs Specular Reflectance




Too Dark            Correct           Too Bright
Capturing Diffuse Albedo




    Remove lighting            Remove camera curve


                      Albedo
Original
After Colour Correction
Capturing Diffuse Albedo

 Use the Macbeth ColorChecker™ as reference.
 Made by X-Rite, http://www.xrite.com/
 24 colour patches with known sRGB values.
Capturing Diffuse Albedo

 Photograph material alongside ColorChecker™.
 Lighting must be consistent.
 Use ColorChecker™ patches to find transform.
Affine Transform [Malin11]

 Pro: removes cross-talk between channels
 Con: linear transform
Polynomial Transform [Malin11]

 Pro: accurately adjusts levels
 Con: channel independent
Linear Least Squares

 Given X and Y, find A such that:



 Linear least squares: best approximation is:




 Solve using Gauss-Jordan elimination.
Affine Transform

 Let xj be our photographed ColorChecker™ patches.
 Let yj be the target ColorChecker™ values.
Polynomial Transform

 Let xj be our photographed ColorChecker™ patches.
 Let yj be the target ColorChecker™ values.
Colour Correction Tool

   Command line tool.
   Launched by a Photoshop script.
   Operates in xyY colour space.
   Applies the following transforms
    [Malin11]:

    Affine            Polynomial       Affine
Future Work

Improve tool:
 ColorChecker™ detection
 dcraw to obtain raw sensor data
 Adobe Camera Model for lens
  correction


Improve capturing:
 Investigate polarising filters.
Original
After Lens and Colour Correction
Sky Colour

 Hue and saturation given by two gradient textures:




             Sun side          Sun opposite side

 Luminance given by CIE Sky Model.
 Cloud layers blended on top.
CIE Sky Model

 Models the luminance distribution of the sky.
 Based on angular distances:        zenith


    φ - sky element to zenith.         θz
    θ - sky element to sun.                     φ
                                  sun
    θz - sun to zenith.
                                             θ       sky element
CIE Sky Model

 Luminance is given relative to that of the zenith:



 Five coefficients to give different sky models.
       φ - sky element to zenith      θz
                                               φ
       θ - sky element to sun
                                           θ
       θz - sun to zenith
CIE Sky Model

 Make relative to sun intensity not zenith intensity:
    More consistent sky luminance over all times of day




        φ - sky element to zenith           θz
                                                     φ
        θ - sky element to sun
                                                 θ
        θz - sun to zenith
CIE Sky Model

 Chose custom coefficients:
                           a      b       c       d      e

    CIE clear sky model   -1.0   -0.32   -10.0   -3.0   0.45

    Far Cry 3 sky model   -1.0   -0.08   -24.0   -3.0   0.30
Sky Lighting

 Use sky dome as hemispherical light.




 Create SH coefficients from gradients and CIE model.
 Sky lighting and sky will always match.
 Variations in sky lighting.
Original Light Probe




                       Midday
Final Light Probes




 Dawn          Morning   Afternoon   Dusk
Before
After
Problems

 Loss of control:
    Concept art had different ambient and sky colours.




 Saturation:
    Sky lighting too saturated.
    Sky dome not saturated enough.
Polarising Filter




      Without a polarising filter   With a polarising filter
                                            PiccoloNamek at the English language Wikipedia
Polarising Filter

 Apply a fake polarising filter in the sky dome shader:
     skyColor.rgb *= g_SkyPostProcess.rgb




 Also reduces direct sky reflection:
    Applied to the sky in captured cube maps.
Microfacet BRDF

 Torrance-Sparrow microfacet BRDF: [Lazarov11]
Distribution Function

 Use normalised Blinn-Phong:




 Specular power m in range [1, 8192]
 Encoded as glossiness g in [0, 1] where:
Fresnel Term

 Schlick’s approximation for Fresnel:




 Spherical gaussian approximation: [Lagarde12]
Visibility Term

 Call the remaining terms the visibility term:




 Many games have V(l, v, h) = 1 making specular too
  dark. [Hoffman10] [Lazarov11]
Visibility Term

 Schlick-Smith:
    Roughness dependent.




 Calculate a from Beckmann roughness k or Blinn-
  Phong specular power m: [Lazarov11]
Approximating Schlick-Smith

 Cost of Schlick-Smith is 8 instructions per
  light. [Lazarov2011]
 Too expensive for our budget:
   Especially when applied to every light.
 Approximate by integrating Schlick-Smith
  over the hemisphere.
Approximating Schlick-Smith
Approximating Schlick-Smith

   Still 8 instructions! 
   Dependent only on glossiness…
   …just like our existing energy conservation term.
   Find a cheap curve to approximate both:
Approximating Schlick-Smith
Approximating Schlick-Smith
Approximating Schlick-Smith

 Chose the following approximation:



 Simple (and free) modification of initial energy
  conservation term.
 Preferred to underestimate:
    Schlick-Smith known to over brighten.
    Makes artifacts less visible.
Specular Filtering

 Needed specular filtering to:
    Reduce shimmering.
    Preserve appearance in the distance.




     Without Filtering                      With Filtering
Specular Filtering

 Needed specular filtering to:
    Reduce shimmering.
    Preserve appearance in the distance.




     Without Filtering                      With Filtering
Specular Filtering

 Use Toksvig’s formula to scale the specular power,
  using the length of the filtered normal: [Hill11]




 Store these scales in a texture.
 Ideally use to adjust gloss map.
Specular Filtering

 Cost of adding an extra texture too high.
 Gloss maps not used in every shader.
    Could not combine Toksvig map with existing gloss map.




 Free channels in our DXT5 compressed normal maps:

                0xFF       Y     0x00       X
Specular Filtering

 Artists paint gloss in alpha
  channel of normal map.

 Store gloss combined with
  Toksvig in red channel:

  Gloss    Y    0x00     X
Toksvig Maps

 Compression of normal y component affected:




         Without gloss              With gloss
Toksvig Maps

 Compression of normal y component affected:




         Without gloss              With gloss
Toksvig Maps

 Gloss map is optional.
                                                  Gloss +
                                                  Toksvig
 With:
   Combine with Toksvig.

                                       Averaged
 Without:                              Toksvig
   Average Toksvig to single value.
Toksvig Off
Toksvig On
Conclusions

 Calibrate your materials!
 Physically-based is a great starting point:
   Tweaking is needed.
   Not everything is simulated.
   Good tools are essential.
 Can make the change late in a project.
 Possible on current-generation consoles.
References
   [Darula02] Stanislav Darula and Richard Kittler, CIE General Sky Standard Defining
    Luminance Distributions, eSim 2002, http://mathinfo.univ-reims.fr/IMG/pdf/other2.pdf
   [Hill11] Stephen Hill, Specular Showdown in the Wild West,
    http://blog.selfshadow.com/2011/07/22/specular-showdown/
   [Hoffman10] Naty Hoffman, Crafting Physically Motivated Shading Models for Game
    Development, SIGGRAPH 2010, http://renderwonk.com/publications/s2010-shading-
    course/
   [Lagarde12] Sébastien Lagarde, Spherical Gaussian Approximation for Blinn-Phong,
    Phong and Fresnel, 2012, http://http://seblagarde.wordpress.com/2012/06/03/spherical-
    gaussien-approximation-for-blinn-phong-phong-and-fresnel/
   [Lazarov11] Dimitar Lazarov, Physically Based Lighting in Call of Duty: Black Ops,
    SIGGRAPH 2011, http://advances.realtimerendering.com/s2011/index.html
   [Malin11], Paul Malin, personal communication
Thanks

   Naty Hoffman, 2K Games (@renderwonk)
   Paul Malin, Activision Central Tech (@p_malin)
   Stephen Hill, Ubisoft Montréal (@self_shadow)
   Philippe Gagnon, Ubisoft Montréal
   Mickael Gilabert, Ubisoft Montréal (@mickaelgilabert)
   Vincent Jean, Ubisoft Montréal
   Minjie Wu, Ubisoft Montréal
   Derek Nowrouzezahrai, Université de Montréal
Any Questions?
 stephen.mcauley@ubisoft.com
 @stevemcauley
 http://blog.stevemcauley.com/
Calibrating Lighting and Materials in Far Cry 3

More Related Content

What's hot

High Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in FrostbiteHigh Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in Frostbite
Electronic Arts / DICE
 
Frostbite on Mobile
Frostbite on MobileFrostbite on Mobile
Frostbite on Mobile
Electronic Arts / DICE
 
Past, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesPast, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in Games
Colin Barré-Brisebois
 
Physically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in FrostbitePhysically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in Frostbite
Electronic Arts / DICE
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3guest11b095
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
Guerrilla
 
Lighting Shading by John Hable
Lighting Shading by John HableLighting Shading by John Hable
Lighting Shading by John HableNaughty Dog
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
Electronic Arts / DICE
 
The Technology of Uncharted: Drake’s Fortune
The Technology of Uncharted: Drake’s FortuneThe Technology of Uncharted: Drake’s Fortune
The Technology of Uncharted: Drake’s FortuneNaughty Dog
 
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
Colin Barré-Brisebois
 
Lighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow FallLighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow Fall
Guerrilla
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
Pope Kim
 
CEDEC 2018 - Towards Effortless Photorealism Through Real-Time Raytracing
CEDEC 2018 - Towards Effortless Photorealism Through Real-Time RaytracingCEDEC 2018 - Towards Effortless Photorealism Through Real-Time Raytracing
CEDEC 2018 - Towards Effortless Photorealism Through Real-Time Raytracing
Electronic Arts / DICE
 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the Fallen
Benjamin Glatzel
 
A Real-time Radiosity Architecture
A Real-time Radiosity ArchitectureA Real-time Radiosity Architecture
A Real-time Radiosity Architecture
Electronic Arts / DICE
 
Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)
Tiago Sousa
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationTaking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Guerrilla
 
Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1
Ki Hyunwoo
 
DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3
Electronic Arts / DICE
 
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Johan Andersson
 

What's hot (20)

High Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in FrostbiteHigh Dynamic Range color grading and display in Frostbite
High Dynamic Range color grading and display in Frostbite
 
Frostbite on Mobile
Frostbite on MobileFrostbite on Mobile
Frostbite on Mobile
 
Past, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in GamesPast, Present and Future Challenges of Global Illumination in Games
Past, Present and Future Challenges of Global Illumination in Games
 
Physically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in FrostbitePhysically Based and Unified Volumetric Rendering in Frostbite
Physically Based and Unified Volumetric Rendering in Frostbite
 
A Bit More Deferred Cry Engine3
A Bit More Deferred   Cry Engine3A Bit More Deferred   Cry Engine3
A Bit More Deferred Cry Engine3
 
Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2Deferred Rendering in Killzone 2
Deferred Rendering in Killzone 2
 
Lighting Shading by John Hable
Lighting Shading by John HableLighting Shading by John Hable
Lighting Shading by John Hable
 
Photogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars BattlefrontPhotogrammetry and Star Wars Battlefront
Photogrammetry and Star Wars Battlefront
 
The Technology of Uncharted: Drake’s Fortune
The Technology of Uncharted: Drake’s FortuneThe Technology of Uncharted: Drake’s Fortune
The Technology of Uncharted: Drake’s Fortune
 
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
More Performance! Five Rendering Ideas From Battlefield 3 and Need For Speed:...
 
Lighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow FallLighting of Killzone: Shadow Fall
Lighting of Killzone: Shadow Fall
 
Rendering Tech of Space Marine
Rendering Tech of Space MarineRendering Tech of Space Marine
Rendering Tech of Space Marine
 
CEDEC 2018 - Towards Effortless Photorealism Through Real-Time Raytracing
CEDEC 2018 - Towards Effortless Photorealism Through Real-Time RaytracingCEDEC 2018 - Towards Effortless Photorealism Through Real-Time Raytracing
CEDEC 2018 - Towards Effortless Photorealism Through Real-Time Raytracing
 
Volumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the FallenVolumetric Lighting for Many Lights in Lords of the Fallen
Volumetric Lighting for Many Lights in Lords of the Fallen
 
A Real-time Radiosity Architecture
A Real-time Radiosity ArchitectureA Real-time Radiosity Architecture
A Real-time Radiosity Architecture
 
Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)Rendering Technologies from Crysis 3 (GDC 2013)
Rendering Technologies from Crysis 3 (GDC 2013)
 
Taking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next GenerationTaking Killzone Shadow Fall Image Quality Into The Next Generation
Taking Killzone Shadow Fall Image Quality Into The Next Generation
 
Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1Rendering AAA-Quality Characters of Project A1
Rendering AAA-Quality Characters of Project A1
 
DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3DirectX 11 Rendering in Battlefield 3
DirectX 11 Rendering in Battlefield 3
 
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
Terrain Rendering in Frostbite using Procedural Shader Splatting (Siggraph 2007)
 

Similar to Calibrating Lighting and Materials in Far Cry 3

A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
Mark Kilgard
 
Shiny Pixels and Beyond: Real-Time Raytracing at SEED
Shiny Pixels and Beyond: Real-Time Raytracing at SEEDShiny Pixels and Beyond: Real-Time Raytracing at SEED
Shiny Pixels and Beyond: Real-Time Raytracing at SEED
Electronic Arts / DICE
 
Advanced Lighting Techniques Dan Baker (Meltdown 2005)
Advanced Lighting Techniques   Dan Baker (Meltdown 2005)Advanced Lighting Techniques   Dan Baker (Meltdown 2005)
Advanced Lighting Techniques Dan Baker (Meltdown 2005)mobius.cn
 
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdfPapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
Adam Hill
 
Phong Shading over any Polygonal Surface
Phong Shading over any Polygonal Surface Phong Shading over any Polygonal Surface
Phong Shading over any Polygonal Surface
Bhuvnesh Pratap
 
Raskar Keynote at Stereoscopic Display Jan 2011
Raskar Keynote at Stereoscopic Display Jan 2011Raskar Keynote at Stereoscopic Display Jan 2011
Raskar Keynote at Stereoscopic Display Jan 2011
Camera Culture Group, MIT Media Lab
 
HR3D: Content Adaptive Parallax Barriers
HR3D: Content Adaptive Parallax BarriersHR3D: Content Adaptive Parallax Barriers
HR3D: Content Adaptive Parallax Barriers
Matt Hirsch - MIT Media Lab
 
graphics notes
graphics notesgraphics notes
graphics notes
Sonia Pahuja
 
Light effect
Light effectLight effect
Light effect
Vanitha Chandru
 
Practical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsxPractical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsx
MannyK4
 
One day short course on Green Building Assessment Methods - Daylight Simulation
One day short course on Green Building Assessment Methods - Daylight SimulationOne day short course on Green Building Assessment Methods - Daylight Simulation
One day short course on Green Building Assessment Methods - Daylight Simulationekwtsang
 
Shadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL HardwareShadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL Hardware
Mark Kilgard
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Douglas Lanman
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applications
stefan_b
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++
鍾誠 陳鍾誠
 
Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...
Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...
Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...
Vincent Sitzmann
 
Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)
Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)
Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)Jia-Bin Huang
 
Around the World in 80 Shaders
Around the World in 80 ShadersAround the World in 80 Shaders
Around the World in 80 Shaders
stevemcauley
 
Rendering basics
Rendering basicsRendering basics
Rendering basics
icedmaster
 

Similar to Calibrating Lighting and Materials in Far Cry 3 (20)

A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
A Practical and Robust Bump-mapping Technique for Today’s GPUs (slides)
 
Shiny Pixels and Beyond: Real-Time Raytracing at SEED
Shiny Pixels and Beyond: Real-Time Raytracing at SEEDShiny Pixels and Beyond: Real-Time Raytracing at SEED
Shiny Pixels and Beyond: Real-Time Raytracing at SEED
 
Advanced Lighting Techniques Dan Baker (Meltdown 2005)
Advanced Lighting Techniques   Dan Baker (Meltdown 2005)Advanced Lighting Techniques   Dan Baker (Meltdown 2005)
Advanced Lighting Techniques Dan Baker (Meltdown 2005)
 
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdfPapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
 
Phong Shading over any Polygonal Surface
Phong Shading over any Polygonal Surface Phong Shading over any Polygonal Surface
Phong Shading over any Polygonal Surface
 
Raskar Keynote at Stereoscopic Display Jan 2011
Raskar Keynote at Stereoscopic Display Jan 2011Raskar Keynote at Stereoscopic Display Jan 2011
Raskar Keynote at Stereoscopic Display Jan 2011
 
HR3D: Content Adaptive Parallax Barriers
HR3D: Content Adaptive Parallax BarriersHR3D: Content Adaptive Parallax Barriers
HR3D: Content Adaptive Parallax Barriers
 
graphics notes
graphics notesgraphics notes
graphics notes
 
Dual photography
Dual photographyDual photography
Dual photography
 
Light effect
Light effectLight effect
Light effect
 
Practical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsxPractical spherical harmonics based PRT methods.ppsx
Practical spherical harmonics based PRT methods.ppsx
 
One day short course on Green Building Assessment Methods - Daylight Simulation
One day short course on Green Building Assessment Methods - Daylight SimulationOne day short course on Green Building Assessment Methods - Daylight Simulation
One day short course on Green Building Assessment Methods - Daylight Simulation
 
Shadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL HardwareShadow Mapping with Today's OpenGL Hardware
Shadow Mapping with Today's OpenGL Hardware
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
 
Shadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive ApplicationsShadow Techniques for Real-Time and Interactive Applications
Shadow Techniques for Real-Time and Interactive Applications
 
smallpt: Global Illumination in 99 lines of C++
smallpt:  Global Illumination in 99 lines of C++smallpt:  Global Illumination in 99 lines of C++
smallpt: Global Illumination in 99 lines of C++
 
Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...
Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...
Scene Representation Networks: Continuous 3D-Structure-Aware Neural Scene Rep...
 
Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)
Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)
Moving Cast Shadow Detection Using Physics-based Features (CVPR 2009)
 
Around the World in 80 Shaders
Around the World in 80 ShadersAround the World in 80 Shaders
Around the World in 80 Shaders
 
Rendering basics
Rendering basicsRendering basics
Rendering basics
 

Recently uploaded

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 

Recently uploaded (20)

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 

Calibrating Lighting and Materials in Far Cry 3

  • 1.
  • 2. Calibrating Lighting and Materials in Far Cry 3 Stephen McAuley, Ubisoft Montréal stephen.mcauley@ubisoft.com
  • 3.
  • 8. Motivation  Natural, saturated colours  Consistent across materials  Consistent under all lighting conditions  Diffuse lighting balanced with specular
  • 9. Diffuse Albedo vs Diffuse Albedo
  • 10. Diffuse Reflectance vs Specular Reflectance Too Dark Correct Too Bright
  • 11. Capturing Diffuse Albedo Remove lighting Remove camera curve Albedo
  • 14. Capturing Diffuse Albedo  Use the Macbeth ColorChecker™ as reference.  Made by X-Rite, http://www.xrite.com/  24 colour patches with known sRGB values.
  • 15. Capturing Diffuse Albedo  Photograph material alongside ColorChecker™.  Lighting must be consistent.  Use ColorChecker™ patches to find transform.
  • 16. Affine Transform [Malin11]  Pro: removes cross-talk between channels  Con: linear transform
  • 17. Polynomial Transform [Malin11]  Pro: accurately adjusts levels  Con: channel independent
  • 18. Linear Least Squares  Given X and Y, find A such that:  Linear least squares: best approximation is:  Solve using Gauss-Jordan elimination.
  • 19. Affine Transform  Let xj be our photographed ColorChecker™ patches.  Let yj be the target ColorChecker™ values.
  • 20. Polynomial Transform  Let xj be our photographed ColorChecker™ patches.  Let yj be the target ColorChecker™ values.
  • 21. Colour Correction Tool  Command line tool.  Launched by a Photoshop script.  Operates in xyY colour space.  Applies the following transforms [Malin11]: Affine Polynomial Affine
  • 22.
  • 23.
  • 24. Future Work Improve tool:  ColorChecker™ detection  dcraw to obtain raw sensor data  Adobe Camera Model for lens correction Improve capturing:  Investigate polarising filters.
  • 26. After Lens and Colour Correction
  • 27.
  • 28. Sky Colour  Hue and saturation given by two gradient textures: Sun side Sun opposite side  Luminance given by CIE Sky Model.  Cloud layers blended on top.
  • 29. CIE Sky Model  Models the luminance distribution of the sky.  Based on angular distances: zenith  φ - sky element to zenith. θz  θ - sky element to sun. φ sun  θz - sun to zenith. θ sky element
  • 30. CIE Sky Model  Luminance is given relative to that of the zenith:  Five coefficients to give different sky models. φ - sky element to zenith θz φ θ - sky element to sun θ θz - sun to zenith
  • 31. CIE Sky Model  Make relative to sun intensity not zenith intensity:  More consistent sky luminance over all times of day φ - sky element to zenith θz φ θ - sky element to sun θ θz - sun to zenith
  • 32. CIE Sky Model  Chose custom coefficients: a b c d e CIE clear sky model -1.0 -0.32 -10.0 -3.0 0.45 Far Cry 3 sky model -1.0 -0.08 -24.0 -3.0 0.30
  • 33. Sky Lighting  Use sky dome as hemispherical light.  Create SH coefficients from gradients and CIE model.  Sky lighting and sky will always match.  Variations in sky lighting.
  • 35. Final Light Probes Dawn Morning Afternoon Dusk
  • 37. After
  • 38. Problems  Loss of control:  Concept art had different ambient and sky colours.  Saturation:  Sky lighting too saturated.  Sky dome not saturated enough.
  • 39. Polarising Filter Without a polarising filter With a polarising filter PiccoloNamek at the English language Wikipedia
  • 40. Polarising Filter  Apply a fake polarising filter in the sky dome shader: skyColor.rgb *= g_SkyPostProcess.rgb  Also reduces direct sky reflection:  Applied to the sky in captured cube maps.
  • 41.
  • 42. Microfacet BRDF  Torrance-Sparrow microfacet BRDF: [Lazarov11]
  • 43. Distribution Function  Use normalised Blinn-Phong:  Specular power m in range [1, 8192]  Encoded as glossiness g in [0, 1] where:
  • 44. Fresnel Term  Schlick’s approximation for Fresnel:  Spherical gaussian approximation: [Lagarde12]
  • 45. Visibility Term  Call the remaining terms the visibility term:  Many games have V(l, v, h) = 1 making specular too dark. [Hoffman10] [Lazarov11]
  • 46. Visibility Term  Schlick-Smith:  Roughness dependent.  Calculate a from Beckmann roughness k or Blinn- Phong specular power m: [Lazarov11]
  • 47. Approximating Schlick-Smith  Cost of Schlick-Smith is 8 instructions per light. [Lazarov2011]  Too expensive for our budget:  Especially when applied to every light.  Approximate by integrating Schlick-Smith over the hemisphere.
  • 49. Approximating Schlick-Smith  Still 8 instructions!   Dependent only on glossiness…  …just like our existing energy conservation term.  Find a cheap curve to approximate both:
  • 52. Approximating Schlick-Smith  Chose the following approximation:  Simple (and free) modification of initial energy conservation term.  Preferred to underestimate:  Schlick-Smith known to over brighten.  Makes artifacts less visible.
  • 53. Specular Filtering  Needed specular filtering to:  Reduce shimmering.  Preserve appearance in the distance. Without Filtering With Filtering
  • 54. Specular Filtering  Needed specular filtering to:  Reduce shimmering.  Preserve appearance in the distance. Without Filtering With Filtering
  • 55. Specular Filtering  Use Toksvig’s formula to scale the specular power, using the length of the filtered normal: [Hill11]  Store these scales in a texture.  Ideally use to adjust gloss map.
  • 56. Specular Filtering  Cost of adding an extra texture too high.  Gloss maps not used in every shader.  Could not combine Toksvig map with existing gloss map.  Free channels in our DXT5 compressed normal maps: 0xFF Y 0x00 X
  • 57. Specular Filtering  Artists paint gloss in alpha channel of normal map.  Store gloss combined with Toksvig in red channel: Gloss Y 0x00 X
  • 58. Toksvig Maps  Compression of normal y component affected: Without gloss With gloss
  • 59. Toksvig Maps  Compression of normal y component affected: Without gloss With gloss
  • 60. Toksvig Maps  Gloss map is optional. Gloss + Toksvig  With:  Combine with Toksvig. Averaged  Without: Toksvig  Average Toksvig to single value.
  • 63. Conclusions  Calibrate your materials!  Physically-based is a great starting point:  Tweaking is needed.  Not everything is simulated.  Good tools are essential.  Can make the change late in a project.  Possible on current-generation consoles.
  • 64. References  [Darula02] Stanislav Darula and Richard Kittler, CIE General Sky Standard Defining Luminance Distributions, eSim 2002, http://mathinfo.univ-reims.fr/IMG/pdf/other2.pdf  [Hill11] Stephen Hill, Specular Showdown in the Wild West, http://blog.selfshadow.com/2011/07/22/specular-showdown/  [Hoffman10] Naty Hoffman, Crafting Physically Motivated Shading Models for Game Development, SIGGRAPH 2010, http://renderwonk.com/publications/s2010-shading- course/  [Lagarde12] Sébastien Lagarde, Spherical Gaussian Approximation for Blinn-Phong, Phong and Fresnel, 2012, http://http://seblagarde.wordpress.com/2012/06/03/spherical- gaussien-approximation-for-blinn-phong-phong-and-fresnel/  [Lazarov11] Dimitar Lazarov, Physically Based Lighting in Call of Duty: Black Ops, SIGGRAPH 2011, http://advances.realtimerendering.com/s2011/index.html  [Malin11], Paul Malin, personal communication
  • 65. Thanks  Naty Hoffman, 2K Games (@renderwonk)  Paul Malin, Activision Central Tech (@p_malin)  Stephen Hill, Ubisoft Montréal (@self_shadow)  Philippe Gagnon, Ubisoft Montréal  Mickael Gilabert, Ubisoft Montréal (@mickaelgilabert)  Vincent Jean, Ubisoft Montréal  Minjie Wu, Ubisoft Montréal  Derek Nowrouzezahrai, Université de Montréal
  • 66. Any Questions? stephen.mcauley@ubisoft.com @stevemcauley http://blog.stevemcauley.com/

Editor's Notes

  1. On Far Cry 3, we began to make these changes to help our artists create high quality visuals, looking at our shading, our lighting but also our materials.
  2. In Photoshop we first have to click around the ColorChecker to tell the tool where to find it.
  3. Then we can run the colour calibration script.
  4. This is just using the average Toksvig factor.