Skip to content

Rewrote bloom preview shaders, making them almost 1:1 with BeatSabers bloom#22

Open
OwenTheProgrammer wants to merge 2 commits into
Swifter1243:masterfrom
OwenTheProgrammer:bs-bloom
Open

Rewrote bloom preview shaders, making them almost 1:1 with BeatSabers bloom#22
OwenTheProgrammer wants to merge 2 commits into
Swifter1243:masterfrom
OwenTheProgrammer:bs-bloom

Conversation

@OwenTheProgrammer
Copy link
Copy Markdown
Contributor

@OwenTheProgrammer OwenTheProgrammer commented May 12, 2026

I spent a week reverse engineering the BeatSaber bloom shaders in hopes to have an accurate bloom preview for Unity. This is finally at the point where I have to verify if im looking at beat saber or my own screenshots (for scenes that actually look good lol) The bloom shader was built from the ground up to be 1:1 with the shader assembly, outside of cb# offsets and such.

Nerd shit:

The only major "change" I had to make was max(0, color) for the bloom passes. Without clamping to zero, black rectangles appear. At first I thought this was a Read-After-Write problem, since theres no command buffer fencing system in this version, but I started to see it in the downsample pass as well.

This effect seems to work in editor, game, and even VR view!
I have automatically excluded reflection probes since I doubt people want bloom in their reflection probe bakes. If you want that, just bitwise OR CameraType.Reflection into EDITOR_CAMERA_TYPES or RUNTIME_CAMERA_TYPES within the BloomPreview script.

I have verified the script almost certainly doesnt break or leave a command buffer active, but if you find a way to break it within reason, im all ears.

The camera attached script has changed a bit, but its mostly the same as before.
image

  • Full Composite: Shows you the final composition of the bloom on your scene. This is the default option.
  • Alpha Only: Displays the alpha channel thats going into the bloom effect, so you can figure out why your screen is entirely white (see note below)
  • Bloom Only: Displays just the bloom stack without overlaying the original framebuffer; quite literally only the bloom.

Note

In some cases, such as using the default Unity skybox without replacing it, you may find your entire screen has bloom. There's a very good chance this is because Unity is writing 100% alpha to the framebuffer. I sadly can't mitigate this directly, however you'd have the same problem within BeatSaber using the Unity skybox. Check the Alpha Only pass to verify your screen is entirely white. If thats not the case, I'll help, but I almost guarantee the solution is one or two changes max.

Showcase

Made a simple scene to show the effect:

Baseline:

image

Alpha Only:

image

Bloom Only:

image

Full Composition:

image

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.

1 participant