SlideShare una empresa de Scribd logo
1 de 54
Descargar para leer sin conexión
Outline
•   sRGB – DX9, DX10, XBox 360

•   Tone Mapping

•   Motion Blur
sRGB Outline
•   sRGB & gamma review

•   Alpha Blending: DX9 vs. DX10 & XBox 360

•   sRGB curve: PC vs. XBox 360
sRGB Review
Terminology:
• Color textures are stored in “gamma space”
• Want our pixel shader to run in “linear space”
sRGB & Gamma Conversions

    sRGB Read:


    sRGB Write:


    Hardware
  Gamma Curve:
Alpha Blending w/ sRGB Writes
   DX9 vs DX10 & XBox 360
Alpha Blending w/ sRGB Writes
     DX9 vs DX10 & XBox 360




Notice the thicker smoke, glows on the gravity gun, and health GUI
Alpha Blending on DX10 HW and XBox 360
DX9 with sRGB writes




DX10 & XBox 360 with sRGB writes
Important Details
•   DX10 hardware running on DX9 will blend
    with DX10’s behavior!

•   This affects DX9 games that have already
    shipped!
Solutions
1.   Detect DX10 behavior and simulate the
     sRGB write in shader code forcing gamma
     blending
2.   Let your artists tweak your materials for the
     obvious cases

We chose #2, and the artists only modified 40
  out of thousands of materials in HL2, Ep1,
  Ep2, TF2, and Portal
Example From Half-Life 2
sRGB Curve: PC vs. XBox 360
•   PC hardware uses the actual sRGB curve
•   XBox 360 uses a piecewise linear approximation to
    the sRGB curve




NOTE: The smooth curve representing the PC sRGB curve in these slides doesn’t
      accurately represent the actual sRGB curve that is linear in the low end.
Different Gamma Spaces
•   We stopped using the term “Gamma Space”
    and instead...

    •   “PC Gamma Space” – Official sRGB curve


    •   “360 Gamma Space” – Piecewise linear sRGB
        approximation found on the XBox 360

    •   “Linear Space”
PC Gamma on PC




  (Using PC Gamma textures on the PC)
Uncorrected 360 Results




(Using PC Gamma textures on the XBox 360)
What Just Happened?
On PC, linear in pixel shader:




On 360, nonlinear in pixel shader:
Solutions
1.   XBox 360-only developers: Use a
     Photoshop color space plug-in
2.   Simulate sRGB reads and writes in shader
     code (Performance!)
3.   Convert color textures at tool time and use
     the hardware gamma curve

Orange Box uses #3. Let’s take a closer look...
The Orange Box Solution for XBox 360

•   Want to use the hardware “sRGB” reads & writes
•   We can modify the input textures so that the 360’s
    piecewise linear read gets us to linear space!

    Preprocess:



    Run-time:

•   But, 360 gamma space looks wrong on a TV or
    monitor! Need to get back to PC gamma space...
Using the Hardware Gamma Curve



 On 360:




 HW Gamma:


We also use the hardware gamma curve to optionally
 correct for “blacker-than-black” colors displayed on
 a television and the deeper gamma of televisions.
XBox 360 Lossy sRGB Read




•   In linear space, the lossy range is 0.0-0.14, so generally OK.
    This caused very few issues for us, but...
•   Don’t use the hardware sRGB reads for post processing or
    feedback effects! Simulate the piecewise linear sRGB read in
    shader code...it’s only ~11 asm instructions.
sRGB Summary
•   Alpha blending differences exist
    •   We let the artists tweak around this


•   XBox 360 has a different gamma space
    •   Convert color textures PC -> 360 Gamma Space
    •   Set hardware gamma ramp for end correction


•   XBox 360 HW sRGB read is lossy at the dark
    end (in linear space, 0.0-0.14)
Tone Mapping Outline
•   Brief overview of Valve’s HDR rendering

•   Building the histogram

•   Computing the tonemap scalar
Overview of Valve’s HDR Rendering
•   Lighting data and environment maps are
    stored in HDR linear space
•   Every pixel shader scales the linear HDR
    value by our tonemap scalar (Back buffer is
    RGBA8888!)
•   Incrementally build histogram each frame
•   Tonemap scalar is generated from the
    current histogram each frame

•   More details on the first 2 points:
    http://www.valvesoftware.com/publications.html
Building the Histogram




•   Amortize the cost of building the histogram over 16
    frames
    •   Update one bucket per frame
    •   Sample post-tonemapped frame
•   Use an asynchronous occlusion query to count pixels
    in range
Sampling Each Histogram Bucket
Evaluating the Histogram
•   Our first implementation was based on median
    luminance (Shipped in HL2: Episode One, Day of
    Defeat, Lost Coast)




          (NOTE: All histograms are in linear space!)

•   But, we ran into too many cases in The Orange Box
    that caused tonemapping to behave strangely.
Dark Skies!




This environment was tonemapping too dark
Dark Skies!




        This is what we wanted
Bright Pixels Matter
•   Experiment: Don’t use median luminance (50%)
•   Use a different histogram threshold: Keep 5% of bright pixels
    in top bins
Results From Using 95% Threshold




       This worked great! Except for...
Zombies on Fire!




          Bright pixels from the fire caused
      tone mapping to over darken the screen!
Need a Secondary Rule
•   Primary rule: Brightness threshold
            rule
•   Secondary rule: Use median luminance as a darkness barrier
               rule




              (NOTE: All histograms are in linear space!)
Zombies Fixed With Both Rules




     This worked! But we still had one issue...
Oscillations From Blinking Lights




   Blinking lights cause oscillations in the histogram that
  cause unwanted oscillations in the final tonemap scalar!
The “Sticky Bin”
•   Make bin containing 95% target “sticky”




•   This causes minor variations in light to have no effect
    until passing threshold
“Sticky Bin” Fixes Oscillations
Final Tonemapping Heuristics
1.   Bright pixel threshold

2.   Median luminance (darkness barrier)

3.   Sticky bin
Motion Blur




(A section from the non-real-time Portal trailer 2006)
Motion Blur Goals
•   Isolated, self-sufficient system

•   Shader models 2.0, 2.0b, 3.0

•   No additional memory (system or video)

•   Performance!

•   I don’t want to spend more than one week
Evaluating Types of Motion Blur
1.   Camera rotations – Can be done in post
2.   Camera translations – Needs depth or
     vector image for correct parallax
3.   Object translations – Needs vector image or
     “fins”
4.   Object rotations & animation – Needs
     vector image or “fins”

•    We chose #1 with some of #2
Motion Blur: Where in the Pipeline?
We don’t want to blur the weapon!




1.   Render full scene
2.   Motion blur
3.   Render view model / weapon
4.   Render GUI
Rendering Motion Blur
Camera Rotation: Pitch
•   Blur vector is just vertical
Camera Rotation: Yaw
•   Not as simple as pitch

•   Need two separate solutions

•   We roll when we turn left/right while looking
    down!
Camera Rotation: Yaw (Part A)
•   Blur vector is horizontal
•   This fades in/out with pitch
Camera Rotation: Yaw (Part B)
•   Roll motion blur
•   This fades in/out with pitch




This approximation is very efficient to implement!
Portal Falling Blur
•   When falling and looking down generate
    forward motion vectors
Generating the Final Blur Vector
•   Blur vectors computed per-pixel:
     • Pitch: Full screen vertical vector
     • Yaw: Full screen horizontal vector
     • Yaw: Roll vector
     • Falling: Inside/out vector



•   Combine these individually weighted vectors

•   Sample along the vector and average
Special Case: Portal Transitions
•   Moving through portals caused a jolt




•   Use last frame’s blur values when moving a
    far distance in a single frame
Special Case: System Hitches
•   Another process stole CPU cycles from the
    game and caused a hitch
    •   “You’ve got mail!”
    •   “Time to update your software!”


•   System hitches can cause one very blurry
    frame

•   Time lapse between frames greater than 0.1
    seconds, we disable motion blur for that
    frame
Special Case: Headache




•   Variable frame rate and blur made people sick
    •   Only an issue when frame rate is low with variable frame
        rate (Does not apply to the 360 since we’re vsync’d!)
    •   Motion blur vector is globally scaled down as frame rate
        drops from 50-30 fps
    •   Use minimal motion blur to achieve the effect. We only use
        15% of full-frame shutter!
    •   Limit blur to 4% of screen width
Motion Blur Summary
•   Isolated system

•   Blur from camera rotation only

•   Special case Portal falling blur

•   Acceptable performance & no additional
    memory

•   90% of Orange Box customers
Summary
•   sRGB – DX9, DX10, XBox 360

•   Tone Mapping

•   Motion Blur

•   Additional details about our rendering:
    http://www.valvesoftware.com/publications.html
Thanks!


Alex Vlachos, Valve

Más contenido relacionado

Último

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Destacado

PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...DevGAMM Conference
 

Destacado (20)

Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 

GDC 2008 Post Processing In The Orange Box

  • 1.
  • 2. Outline • sRGB – DX9, DX10, XBox 360 • Tone Mapping • Motion Blur
  • 3. sRGB Outline • sRGB & gamma review • Alpha Blending: DX9 vs. DX10 & XBox 360 • sRGB curve: PC vs. XBox 360
  • 4. sRGB Review Terminology: • Color textures are stored in “gamma space” • Want our pixel shader to run in “linear space”
  • 5. sRGB & Gamma Conversions sRGB Read: sRGB Write: Hardware Gamma Curve:
  • 6. Alpha Blending w/ sRGB Writes DX9 vs DX10 & XBox 360
  • 7. Alpha Blending w/ sRGB Writes DX9 vs DX10 & XBox 360 Notice the thicker smoke, glows on the gravity gun, and health GUI
  • 8. Alpha Blending on DX10 HW and XBox 360 DX9 with sRGB writes DX10 & XBox 360 with sRGB writes
  • 9. Important Details • DX10 hardware running on DX9 will blend with DX10’s behavior! • This affects DX9 games that have already shipped!
  • 10. Solutions 1. Detect DX10 behavior and simulate the sRGB write in shader code forcing gamma blending 2. Let your artists tweak your materials for the obvious cases We chose #2, and the artists only modified 40 out of thousands of materials in HL2, Ep1, Ep2, TF2, and Portal
  • 12. sRGB Curve: PC vs. XBox 360 • PC hardware uses the actual sRGB curve • XBox 360 uses a piecewise linear approximation to the sRGB curve NOTE: The smooth curve representing the PC sRGB curve in these slides doesn’t accurately represent the actual sRGB curve that is linear in the low end.
  • 13. Different Gamma Spaces • We stopped using the term “Gamma Space” and instead... • “PC Gamma Space” – Official sRGB curve • “360 Gamma Space” – Piecewise linear sRGB approximation found on the XBox 360 • “Linear Space”
  • 14. PC Gamma on PC (Using PC Gamma textures on the PC)
  • 15. Uncorrected 360 Results (Using PC Gamma textures on the XBox 360)
  • 16. What Just Happened? On PC, linear in pixel shader: On 360, nonlinear in pixel shader:
  • 17. Solutions 1. XBox 360-only developers: Use a Photoshop color space plug-in 2. Simulate sRGB reads and writes in shader code (Performance!) 3. Convert color textures at tool time and use the hardware gamma curve Orange Box uses #3. Let’s take a closer look...
  • 18. The Orange Box Solution for XBox 360 • Want to use the hardware “sRGB” reads & writes • We can modify the input textures so that the 360’s piecewise linear read gets us to linear space! Preprocess: Run-time: • But, 360 gamma space looks wrong on a TV or monitor! Need to get back to PC gamma space...
  • 19. Using the Hardware Gamma Curve On 360: HW Gamma: We also use the hardware gamma curve to optionally correct for “blacker-than-black” colors displayed on a television and the deeper gamma of televisions.
  • 20. XBox 360 Lossy sRGB Read • In linear space, the lossy range is 0.0-0.14, so generally OK. This caused very few issues for us, but... • Don’t use the hardware sRGB reads for post processing or feedback effects! Simulate the piecewise linear sRGB read in shader code...it’s only ~11 asm instructions.
  • 21. sRGB Summary • Alpha blending differences exist • We let the artists tweak around this • XBox 360 has a different gamma space • Convert color textures PC -> 360 Gamma Space • Set hardware gamma ramp for end correction • XBox 360 HW sRGB read is lossy at the dark end (in linear space, 0.0-0.14)
  • 22. Tone Mapping Outline • Brief overview of Valve’s HDR rendering • Building the histogram • Computing the tonemap scalar
  • 23. Overview of Valve’s HDR Rendering • Lighting data and environment maps are stored in HDR linear space • Every pixel shader scales the linear HDR value by our tonemap scalar (Back buffer is RGBA8888!) • Incrementally build histogram each frame • Tonemap scalar is generated from the current histogram each frame • More details on the first 2 points: http://www.valvesoftware.com/publications.html
  • 24. Building the Histogram • Amortize the cost of building the histogram over 16 frames • Update one bucket per frame • Sample post-tonemapped frame • Use an asynchronous occlusion query to count pixels in range
  • 26. Evaluating the Histogram • Our first implementation was based on median luminance (Shipped in HL2: Episode One, Day of Defeat, Lost Coast) (NOTE: All histograms are in linear space!) • But, we ran into too many cases in The Orange Box that caused tonemapping to behave strangely.
  • 27. Dark Skies! This environment was tonemapping too dark
  • 28. Dark Skies! This is what we wanted
  • 29. Bright Pixels Matter • Experiment: Don’t use median luminance (50%) • Use a different histogram threshold: Keep 5% of bright pixels in top bins
  • 30. Results From Using 95% Threshold This worked great! Except for...
  • 31. Zombies on Fire! Bright pixels from the fire caused tone mapping to over darken the screen!
  • 32. Need a Secondary Rule • Primary rule: Brightness threshold rule • Secondary rule: Use median luminance as a darkness barrier rule (NOTE: All histograms are in linear space!)
  • 33. Zombies Fixed With Both Rules This worked! But we still had one issue...
  • 34. Oscillations From Blinking Lights Blinking lights cause oscillations in the histogram that cause unwanted oscillations in the final tonemap scalar!
  • 35. The “Sticky Bin” • Make bin containing 95% target “sticky” • This causes minor variations in light to have no effect until passing threshold
  • 36. “Sticky Bin” Fixes Oscillations
  • 37. Final Tonemapping Heuristics 1. Bright pixel threshold 2. Median luminance (darkness barrier) 3. Sticky bin
  • 38. Motion Blur (A section from the non-real-time Portal trailer 2006)
  • 39. Motion Blur Goals • Isolated, self-sufficient system • Shader models 2.0, 2.0b, 3.0 • No additional memory (system or video) • Performance! • I don’t want to spend more than one week
  • 40. Evaluating Types of Motion Blur 1. Camera rotations – Can be done in post 2. Camera translations – Needs depth or vector image for correct parallax 3. Object translations – Needs vector image or “fins” 4. Object rotations & animation – Needs vector image or “fins” • We chose #1 with some of #2
  • 41. Motion Blur: Where in the Pipeline? We don’t want to blur the weapon! 1. Render full scene 2. Motion blur 3. Render view model / weapon 4. Render GUI
  • 43. Camera Rotation: Pitch • Blur vector is just vertical
  • 44. Camera Rotation: Yaw • Not as simple as pitch • Need two separate solutions • We roll when we turn left/right while looking down!
  • 45. Camera Rotation: Yaw (Part A) • Blur vector is horizontal • This fades in/out with pitch
  • 46. Camera Rotation: Yaw (Part B) • Roll motion blur • This fades in/out with pitch This approximation is very efficient to implement!
  • 47. Portal Falling Blur • When falling and looking down generate forward motion vectors
  • 48. Generating the Final Blur Vector • Blur vectors computed per-pixel: • Pitch: Full screen vertical vector • Yaw: Full screen horizontal vector • Yaw: Roll vector • Falling: Inside/out vector • Combine these individually weighted vectors • Sample along the vector and average
  • 49. Special Case: Portal Transitions • Moving through portals caused a jolt • Use last frame’s blur values when moving a far distance in a single frame
  • 50. Special Case: System Hitches • Another process stole CPU cycles from the game and caused a hitch • “You’ve got mail!” • “Time to update your software!” • System hitches can cause one very blurry frame • Time lapse between frames greater than 0.1 seconds, we disable motion blur for that frame
  • 51. Special Case: Headache • Variable frame rate and blur made people sick • Only an issue when frame rate is low with variable frame rate (Does not apply to the 360 since we’re vsync’d!) • Motion blur vector is globally scaled down as frame rate drops from 50-30 fps • Use minimal motion blur to achieve the effect. We only use 15% of full-frame shutter! • Limit blur to 4% of screen width
  • 52. Motion Blur Summary • Isolated system • Blur from camera rotation only • Special case Portal falling blur • Acceptable performance & no additional memory • 90% of Orange Box customers
  • 53. Summary • sRGB – DX9, DX10, XBox 360 • Tone Mapping • Motion Blur • Additional details about our rendering: http://www.valvesoftware.com/publications.html