Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Physically based bloom #6703

Closed

Conversation

StarLederer
Copy link
Contributor

Objective

  • Make the bloom effect energy conserving
  • Make the bloom effect impossible to misconfigure
  • Add a physically based alternative to threshold to preserve existing flexibility

Explanation

What is bloom

Bloom occurs in real life when light passes through an imperfect medium such as a lens and slightly scatters around before continuing on its way to the sensor or the retina. Bloom is effectively just a blur effect created by imperfections in glass or human eyes.

Motivation

To emulate it in a natural-looking way it should be energy-conserving and based on its real-life counterpart. The existing implementation is quite close but it does not emulate the scattering perfectly and is certainly not energy-conserving. As a result, the current implementation is easy to configure in an obnoxious way and ruin the look of the game.

Examples

Bloom example with existing implementation:

Bloom example in this PR:

Lighting example with existing implementation of bloom:

Lighting example with bloom in this PR:

Note: The existing implementation could look closer to this PR if the intensity is turned down, however, the existing implementation never results in a natural look at high intensity values, that is what the examples try to highlight.

Existing implementation with intensity of 1 (not related to a physical parameter):

Bloom in this PR with intensity of 1 (light is equally as likely to exit at any point of the lens). This is still WIP since the whole screen should be the same color

Solution

  • Calculate mip amount differently so that there the screen can be averaged to a single color at intensity of 1.
  • Interpolate between each mip based on bloom intensity rather than adding them together.
  • Implement "deblooming" (same as tinting the lens and increasing the exposure; that way light that scatters more loses energy. This restores the artistic control previously provided by threshold but in a physically-based manner)

Changelog

Changed:

  • Bloom has a more natural look.
  • Deblooming parameter replaces threshold and knee.

Migration Guide

  • Remove threshold and knee fields from all instances of core_pipeline::bloom::BloomSettings.
  • Optinally use the deblooming filed to approximate the look threshold values above 0 created.

@pkupper
Copy link
Contributor

pkupper commented Nov 20, 2022

For your awareness: There is already another open pull request adressing some of the issues you brought up in your YouTube comment:
#6677
It also implements ACES tonemapping which also contributes to better looking bloom.

@StarLederer
Copy link
Contributor Author

Thanks! I'll close this PR and and see if my contribution can be useful in #6677 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants