Search Unity

[ANDROID] COMPRESSED HDR LIGHTMAPS ARE NOT ENCODED

Discussion in 'Global Illumination' started by puppetsUnity, Aug 9, 2019.

  1. puppetsUnity

    puppetsUnity

    Joined:
    Jun 29, 2015
    Posts:
    5
    Unity2019.2
    In PC platform editor ,hdr lightmap values look fine,white.
    Snipaste_2019-08-09_10-53-08-pc.png
    But In android platform editor ,hdr lightmap values like clamp 0~1 (uncorrect )after compress in ASTC HDR format
    Snipaste_2019-08-09_10-52-33.png
     
    Last edited: Aug 9, 2019
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Please make sure that Lightmap Encoding is set to High Quality for Android platform in the Player settings. Keep the texture compression settings at their defaults. Also, make sure that you are in Linear color space. Rebake the lighting and see if the issue reproduces.

    You can also try switching to RGB9e5 compression and see if that helps in your case.
     
  3. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    We are also experiencing this issue of clipped hdr lightmaps with ASTC on Unity 2019.1

    Switching to RGB9e5 helps, but seems to require way more memory, so an ASTC compression would be way better.
    And yes project is set to high quality lightmaps and linear.
     
  4. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Compressing a HDR texture with a method that supports HDR should obviously not clamp to [0,1] so this sounds like a bug to me.

    It would be helpful if you can create a minimal project that shows this issue and then with the project opened click Help > Report A Bug to create a bug report containing the minimal project. This would enable us to take a closer look. Thanks!
     
  5. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    My lightmaps are also clamp in ASTC HDR with encoding set to High. I am using unity 2019.3.11f1

    And ASTC HDR cubemaps compress with convolution type to Specular reflections are all washed out
     
  6. blanx

    blanx

    Joined:
    Feb 26, 2016
    Posts:
    73
    Still had no time to time to make a test project, but for us this is also still true.
    ASTC HDR is clamped.
     
  7. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    @Cerberus_team already reported a bug for this, so no need to report another one.
     
  8. Reshima

    Reshima

    Joined:
    Dec 10, 2012
    Posts:
    51
    @florianpenzkofer could you link the bug report (if any) please? I'm interested in this too. What's the ETA for the fix? Thanks
     
  9. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    Should be fixed in 2019.4.6f1, from the release notes:
    • Graphics: Fixed an incorrect clamping of ASTC HDR lightmaps. (1256699)
     
  10. marcosdana

    marcosdana

    Joined:
    Mar 18, 2019
    Posts:
    4
    Hi!

    I’ve been dealing with a problem during the last few days. I’m making an AR Foundation image tracking app running on Android. I’m baking lights into prefabs using a script that I found on the web. Till here everything works fine. The problem appears when I run the app on my android mobile, textures make a weird effect. If I load game objects that define the prefab directly on the hierarchy tab without actually making a prefab and try to run this on my phone textures load well (and in the play mode of unity look well too), but if I make a prefab, bake textures using script into prefabs and then try to load that prefab using the Ar Tracked Image Manager, the weird effect appears. Is kind of hard to illustrate this with words so I’m uploading 2 dif. images. One is the play mode result before building for Android and the other is what I get on my phone.

    Anyone have any clue what might be going on here?
     

    Attached Files:

  11. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    327
    Hey there, a few questions for you:
    - Which script are you using to bake lighting into the prefabs, could you post a link?
    - What are the values of the "Lightmap Encoding" and "Texture Compression" project settings? Does the issue happen regardless of those settings?

    I'd suggest opening a bug report, since this looks like a bug to me.
     
  12. marcosdana

    marcosdana

    Joined:
    Mar 18, 2019
    Posts:
    4

    Hi!
    I've started a new project from scratch and now is working fine. I guess that there was a problem with some packages when I updated the AR Foundation version in my previous project. Anyway, the script that i'm using is the one on this link, working fine for my Unity project version [2020.3.1f1-ARF 4.0.12]
    https://github.com/Ayfel/PrefabLightmapping
    Thanks for your reply!
     
    Pema-Malling likes this.
  13. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Compressor Quality Fast, ASTC HDR 4x4 results in clamped values.

    Single 2k by 2k HDR lightmap
    Active platform is Android.
    ASTC HDR 4x4

    Normal Compressor quality takes approx. 55 seconds to a minute to import a single lightmap.
    Fast compressor quality takes approx. 2-3 seconds...

    I do regular Android builds, I prefer to keep my active platform as Android so I don't have to keep swapping platforms. But this is slowing down game immensely. Just loading into the scene takes a *long* time in 2020.3, the profiler shows it is processing textures/loading them. We have 11 lightmaps and entering the scene takes 15~ seconds in Play mode because of texture related scene load operations in the profiler.

    I'd swap to Fast, but Fast clamps the HDR values...:

    FAST:
    upload_2021-6-19_13-28-25.png

    NORMAL:
    upload_2021-6-19_13-30-21.png

    NOTE: I only reimported ONE of my lightmaps, that's why the mesh in the background is still clamped.

    So yes, this is extremely frustrating. Is this a bug?
     
    JamesArndt likes this.
  14. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    If the values are really clamped then it‘s a bug. Do you know if this happens in 2021.x?
    Some ASTC compressor improvements are being backported to 2020.3.14.
     
  15. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Could the outcome you see in my images be caused by something else? They look completely different, right? The FAST quality doesn't just look like it has compression artifact because of FAST compression. The colours are entirely different through the entire scene. I figured this means the values are being cutoff or limited in some way?

    I'm not sure if it happens in 2021. Ill try an empty protect with just this one light map texture and try to reproduce it.
     
  16. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Also, as 2020 is an LTS release, am I right to say that it doesnt matter if this bug occurs in 2021 or not? It should be fixed in 2020. It is not an Enhancement. It is potentially just a bug right? I am submitting my bug report under 2020 LTS and after submission will download and check in 2021 to see if it is present.
     
  17. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    I asked about 2021 because the ASTC compression changes that were made 2021 are being backported. So if this doesn‘t happen in 2021 then there is a chance that the issue will be fixed by that backport.

    Thanks for submitting the bug report.
     
    Prodigga likes this.
  18. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Can confirm it happens in 2021 too. (2021.1.12f1)

    Bug report submitted Case 1344592
    upload_2021-6-21_9-22-13.png
     
    JamesArndt likes this.