-
-
Couldn't load subscription status.
- Fork 36.1k
UnrealBloomPass: Use premultipliedAlpha.
#26185
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+665 Bytes
(100%)
examples/screenshots/webgl_postprocessing_unreal_bloom.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.22 KB
(110%)
examples/screenshots/webgl_postprocessing_unreal_bloom_selective.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,8 +74,8 @@ | |
|
|
||
| const params = { | ||
| threshold: 0, | ||
| strength: 3, | ||
| radius: 0.5, | ||
| strength: 5, | ||
| radius: 1, | ||
| exposure: 1 | ||
| }; | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A so-called
materialCopythat does additive blending is not copying. I think that is poorly-named.Do you still think
premultipliedAlphais correct? I find trying to track the logic of the code in this file a bit daunting...If you are not sure, I wonder if changing the behavior for users is worth it?
//
On a related note, I think the existing example has too much bloom effect, and looks better with this one-line change. IMO, there would be no need to change the parameters to try to match the previous look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. E.g.
materialBlendsounds more appropriate.Yes. The pass additively blends over the input. Considering how
CopyPassis implemented,premultipliedAlphashould be set totrue.Let me think about this. That is a valid point since even without the change the effect looks "right".
Yeah, I think I got a little bit excited when
UnrealBloomPassfinally produces a correctly tone-mapped result in the right color space so I couldn't have enough bloom 😅 . I'm fine with turning it down a bit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should set
.premultipliedAlphato true only if the shader outputs premultiplied RGB values. So, the question is: does it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so. The opacity scales all color components, not just alpha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This effect was not written to properly accommodate the premultiplied output from RenderPass.
Given this PR causes breakage for users, and given the change here sill leaves inconsistencies in the code, I'd suggest doing nothing for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On what inconsistencies are you referring to? Is there something else to fix?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I agree the breakage isn't worth the overall change. If someone reports a bug related to blending that can be fixed by setting the
premultipliedAlphatotrue, we can reconsider the PR.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When implementing the fiddle for #24703 (comment), I've noticed that the bloom is too strong given standard values like
1for bloom strength. It seems enablingpremultipliedAlphaas suggested in the PR produces a more consistent results.