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

Proposed RFC Feature : Bloom Mask #125

Open
SZUxiegumeng opened this issue Mar 3, 2023 · 3 comments
Open

Proposed RFC Feature : Bloom Mask #125

SZUxiegumeng opened this issue Mar 3, 2023 · 3 comments
Labels
rfc-feature Request for Comments for a Feature

Comments

@SZUxiegumeng
Copy link

SZUxiegumeng commented Mar 3, 2023

Summary:

This proposal outlines an extended ability to control the bloom effect on an object-by-object basis in StandardPBR materialtype.

What is the relevance of this feature?

Why is this important? What are the use cases? What will it do once completed?

Feature design description:

This design is mainly divided into two parts: bloom pass and wind bloomMask implementation in StandardPBR materialtype.

Design of the bloom pass:

I added two subpasses to the bloom pass to generate the mask texture and blend the scene colors. And bloomMask Pass outputs the mask texture in response to the BloomMask attribute in MaterialSrg.

image

Design of the bloomMask for bloom in StandardPBR materialtype:

This attribute is a floating-point value that enhances/degrades its own bloom effect.
image

Other settings

Added global switches and material lua scripts to optimize performance.

  • I added a global switch to control the on/off of the extended feature.

image

  • When the bloomMask value of the material is 0, the bloomMask shader is disabled.

Result

bloomMask_RFC

Technical design description:

One of the important things is the modification of bloompass.

             {
                 "Name": "BloomMaskPass",
                "TemplateName": "BloomMaskPassTemplate",
                "Connections": [
                    {
                        "LocalSlot": "InputColor",
                        "AttachmentRef": {
                            "Pass": "Parent",
                            "Attachment": "InputOutput"
                        }
                    }
                ]
            }

            {
                "Name": "BloomMaskBlendPass",
                "TemplateName": "BloomMaskBlendPassTemplate",
                "Connections": [
                    {
                        "LocalSlot": "InputColor",
                        "AttachmentRef": {
                            "Pass": "Parent",
                            "Attachment": "InputOutput"
                        }
                    }

                    {
                        "LocalSlot": "InputMask",
                        "AttachmentRef": {
                            "Pass": "BloomMaskPass",
                            "Attachment": "OutputEntityMask"
                        }
                    }
                ]
            }

            {
                "Name": "BloomDownsamplePass",
                "TemplateName": "BloomDownsamplePassTemplate",
                "Connections": [
                    {
                        "LocalSlot": "Input",
                        "AttachmentRef": {
                            "Pass": "BloomMaskBlendPass",
                            "Attachment": "OutputColor"
                        }
                    }
                ]
            }

Since most objects don't use this feature, you can turn off their shader.

image

What are the advantages of the feature?

Precise control of bloom effects on an object-by-object basis
In addition, we can enable or disable this feature conveniently without causing other impacts..

What are the disadvantages of the feature?

This feature adds some performance and memory overhead.

How will users learn this feature?

users only need to add the Bloom component and adjust the bloomMask attribute of the material panel.

Are there any open questions?

  • An extra texture is output in the pipeline. Currently, this feature uses only one channel to implement the ability. There should be more post-processing feature to use this texture to achieve precise effect control on an object-by-object basis.
  • The reason why the output is not in standard forwardPs is that the extension function is small and special. Isolate this code as a separate design for post-processing.
@galibzon
Copy link
Collaborator

galibzon commented Mar 15, 2023

Approved. This is a welcome feature, but the bloomMask flag should be a boolean shader option, typically named as o_bloomMask. With a shader option the build pipeline can do dead code elimination when this flag is set to false.

@SZUxiegumeng
Copy link
Author

Approved. This is a welcome feature, but the bloomMask flag should be a boolean shader option, typically named as o_bloomMask. With a shader option the build pipeline can do dead code elimination when this flag is set to false.

As a floating point number, bloomMask can strengthen or weaken the bloom strength of a single object, for example, 0.5x or 2x. If it's a boolean value, the user can only turn on/off, which reduces the capability of the feature, so the bloomMask is not considered a boolean shader option.

@moudgils
Copy link
Contributor

Since this RFC is accepted please open a PR and move this RFC to this folder - https://github.com/o3de/sig-graphics-audio/tree/main/rfcs where we will track all the new RFCs. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfc-feature Request for Comments for a Feature
Development

No branches or pull requests

3 participants