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

Implement convolution bloom #6194

Open
ettiSurreal opened this issue Jan 28, 2023 · 6 comments
Open

Implement convolution bloom #6194

ettiSurreal opened this issue Jan 28, 2023 · 6 comments

Comments

@ettiSurreal
Copy link

Describe the project you are working on

Still small test projects just for fun.

Describe the problem or limitation you are having in your project

It isn't possible to easily make custom shapes for the glow effect to make it more interesting or physically accurate.
This isn't really a limitation I am currently having, moreso something i thought the engine can benefit from.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Recently, i have watched a video on the history and different implementations of bloom/glow effects.
https://youtu.be/ml-5OGZC7vE
Near the end the video goes over the Bloom Convolution effect which Unreal Engine had for nearly 6 years by now.
https://docs.unrealengine.com/5.0/en-US/bloom-in-unreal-engine (if you wanna read up on it)
Unlike regular bloom, it uses FFT to convert the image to frequency space, modifies the new image, then uses inverse FFT to convert it back into the original image. Then the new image is used for the bloom.

While this technique is more expensive, it allows the use of custom bloom kernel images, which makes it trivial to change the shape of the bloom, to for example streaks or a star.
Unreal's docs state that it's mainly intended for pre-rendered or in-game cinematics, as well as high end devices. As the engine had the effect for over half a decade and fast algorithms for FFT exist now, i assume this might be viable to implement now.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This seems like the best algorithm to use for the FFT. MIT license, works in 2D and 3D, compatible with Vulkan, mobile and Metal.
https://github.com/DTolm/VkFFT
Maybe it could be implemented as an overall function the users can use in their shaders? Seems like a potentially useful thing.

The user should be able to switch between the regular and convolution based blur, based on their needs since this method is more expensive. I will assume that the current glow settings will be usable for the convolution method as well.
When convolution is selected, the user is able to apply a convolution kernel image that will be applied into the FFT space image before it is converted back.

If this enhancement will not be used often, can it be worked around with a few lines of script?

It might be possible to implement as a shader? But it's far from easy to do.

Is there a reason why this should be core and not an add-on in the asset library?

New functionality for a built-in effect.

@QbieShay
Copy link

Sounds like something that would add constant overhead for a very restricted usecase 🤔

@ettiSurreal
Copy link
Author

Sounds like something that would add constant overhead for a very restricted usecase 🤔

I did mention that you can toggle between the current and convolution bloom for your needs. So there hopefully wouldn't be any performance overhead when it's left at the current implementation.

@yosoyfreeman
Copy link

I personally don't think the trade off in quality/performances is worth it here. With Godot 4 developing and polishing new render features (Which includes a new bloom algorithm) I can't see de pros of adding a new render heavy feature than even unreal states is not recommended for real time game play. The new bloom algorithm allows for circular realistic way.

After reading about it, part of the benefit consist in the incorporation of some kind of lens flare around the bloom, which could be achieved by a Lens flare post process effect that i think Godot as a hole could benefit from and be used in realtime.

To the start shaped bloom... I don't know how complicated it would be (Someone on the render side can tell us?) but a default star shape could work in this situation.

This would produce really nice effect for real time usage.

@Zireael07
Copy link

(Which includes a new bloom algorithm)

Even this normal bloom is a performance killer in many cases, btw

@Calinou
Copy link
Member

Calinou commented Jan 31, 2023

If you just want anamorphic lens flares (where bloom appears to be "stretched" horizontally with blue lines), I don't think you don't need convolution bloom to implement this. This has been implemented in numerous engines in the past 10 years, so I doubt it uses an approach that is expensive by today's standards.

Also, if your goal is to get better bloom on small objects, then something like godotengine/godot#56452 (comment) needs to be done instead.

@passivestar
Copy link

Related: proposal for anamorphic bloom #9695

@Calinou Calinou changed the title Implement Convolution Bloom Implement convolution bloom Aug 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants