Search Unity

Specific bloom effect without HDR

Discussion in 'Image Effects' started by Deleted User, Dec 13, 2020.

  1. Deleted User

    Deleted User

    Guest

    Hi, I'm trying to make a simple bloom effect on a lightbulb in LDR. Unfortunately, EVERYTHING glows. I don't want to use any external packages except Post-Processing V2. Making multiple layers doesn't seem to change anything. Any help would be appreciated, thanks.
     
  2. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Here's a simple explanation of how bloom works:
    1. The frame texture is copied
    2. It is then darkened until only intensities above the set threshold remain
    3. The image is blurred
    4. It is blended back into the frame
    If you are using LDR, there are no color values brighter than white so any threshold value will cause everything to glow. Also, since this is a image effect, object layers will obviously not be able to limit which objects glow.

    One trick you can do is to make your entire scene darker, so nothing that isn't supposed to glow is full white, then use color correction to brighten the scene after the bloom. This will add banding to your image, however.
     
  3. Deleted User

    Deleted User

    Guest

    Thanks, but if that is the case, how do all the other LDR games do it? I've seen several non-HDR games with decent bloom effect. The idea of making everything darker is good for my game, but mayby somthing a bit more practical?
     
  4. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Many LDR games store a "brightness" value in the framebuffer alpha channel, then use that value to brighten the color value before applying the threshold. This was common in the PS2 era, early PS3/360 games, and low end mobile.

    Of course, this means you have to use custom shaders because by default Unity's standard shaders just write the same value (1) into the framebuffer alpha channel. You'll also have to modify the bloom post processing shader to use that alpha channel.
     
  5. Deleted User

    Deleted User

    Guest

    I'm playing decent-quality games on modern consoles, and the only difference on my HDR TV is that the lights and darks are more vivid. Both have bloom effects for headlights and stuff. They must use SDR, which is what I am trying to use (sorry, I thought there was only HDR and LDR). Is Unity LDR by default?
     
  6. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    TV HDR/SDR is something completely different than game rendering HDR/LDR. In games "HDR" means storing color values beyond the 0-1 range of standard RGBA8888 rendering (which is usually reffered as "LDR"), to produce more accurate results in effects like bloom, reflections, transparencies and etc.

    In LDR, your light bulb, the sun disk, and a white wall are all clamped at 1.0, while in HDR the bulb could be 10.0 and the sun 5000.0, while the white wall is only 1.0. If your bloom threshold is set to 1.0, the wall wouldn't glow at all, and the sun disk would glow a lot more than the light bulb.

    And yes, if you are using the built-in pipeline (not URP or HDRP), Unity is LDR by default. You need to go into the graphics settings to enable HDR rendering, or do it per-camera.

    Modern games pretty much render in HDR exclusively. LDR is really only used in mobile due to the abundance of crappy GPUs.
     
    Deleted User likes this.
  7. Deleted User

    Deleted User

    Guest

    Thanks for the help KokkuHub! The reason I didn't want to use HDR before was because I didn't know the difference between render HDR and output HDR. That REALLY confused me. If LDR is only used on low-end platforms, then I don't really need it on my PC. I am sure that a few light bulbs won't use up 4gb of VRAM ;)