Search Unity

Custom Bloom(HDR) does not work correctly on some android devices.

Discussion in 'Image Effects' started by bomul0327, Jun 18, 2019.

  1. bomul0327

    bomul0327

    Joined:
    Oct 2, 2015
    Posts:
    14
    Hello. guys.
    I have a graphics issue on android. I need a help.
    I created my custom bloom and some other post processing effects using HDR for android. My problem is that some devices do not support HDR correctly. My devices are Galaxy J5(2015) and Galaxy S4 LTE-A. I checked HDR option both in camera and Project Settings. I checked other devices work correctly.

    I used OnRenderImage(RenderTexture src, RenderTexture dst) for my post processing effects, and my render texture's format is RenderTextureFormat.DefaultHDR.

    For checking whether HDR works, I used SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.DefaultHDR). The result was true but, SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGB111110Float)'s result was false, which is widely used format for HDR in android.

    Are there any alternative way to use HDR Bloom in those devices? Is this situation is unity's bug or not?

    Thanks!
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,028
  3. bomul0327

    bomul0327

    Joined:
    Oct 2, 2015
    Posts:
    14
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,028
    In any case, HDR formats may not be supported on some older devices, so you need to provde some kind of fallback solution for those.
     
  5. bomul0327

    bomul0327

    Joined:
    Oct 2, 2015
    Posts:
    14
    What may be general solutions for the fallback? LDR Bloom? Any keywords would be appreciated.
    Anyway thanks for your help aleksandrk!
     
  6. bomul0327

    bomul0327

    Joined:
    Oct 2, 2015
    Posts:
    14
    I upload my test result.
     

    Attached Files:

  7. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,028
    If you check for ARGBHalf and ARGBFloat and both are not supported, it means there's no HDR support.
    I'd say no bloom if no HDR, but this is too project-specific :)
     
    bomul0327 likes this.
  8. DavidSWu

    DavidSWu

    Joined:
    Jun 20, 2016
    Posts:
    183
    I've found that 10:10:10:2 is supported on many mobiles. The range is 0..1 but you can treat it as 0..4 (or 0..2) with scaling and still have 8 or 9 bits of precision.
    In the old days, we used to do bloom with 8 bits per channel and it still looked half decent. But then TV's back then didn't really render what you asked them to so.
     
    forestrf likes this.
  9. bomul0327

    bomul0327

    Joined:
    Oct 2, 2015
    Posts:
    14
    @DavidSWu
    It seems like 10:10:10:2 is not supported on J5(2015).
    I thought up a method without HDR, but I didn't test it and don't know specific way to implement now.
    My idea is if the color's luminosity is greater than 1, save (luminosity - 1) to alpha channel. Then, multiply the color value by the saved one in shader.
    I don't have any idea how to get color's luminosity before bloom pass now, but I'll try later.
     
    forestrf likes this.
  10. DavidSWu

    DavidSWu

    Joined:
    Jun 20, 2016
    Posts:
    183
    That is a classic trick! I used that in Full Auto https://en.wikipedia.org/wiki/Full_Auto
     
    bomul0327 likes this.