Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

So why is mobile still doubleLDR?

Discussion in 'Global Illumination' started by AcidArrow, Jun 1, 2017.

  1. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,257
    So why are lightmaps still doubleLDR on mobile? There is no reason for it. Afaik it was because of compatibility with OpenGL es 1, which is not supported any more.

    (Read more here https://forum.unity3d.com/threads/l...ing-from-mac-os-x-to-ios.165757/#post-1133920 )

    And yet the lightmaps on mobile are still doubleLDR. Not only they look bad, they are often the source of bugs (remember when lightmaps were super dark in the editor?) and they increase code complexity all to be compatible with an API that isn't supported any more, which is insane.

     
  2. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    453
    This is something that I've run into once again recently. I suspect it's because mobile texture formats have been an ongoing pain, with nice new formats not being usable if you want to also support older devices?

    But it'd certainly be nice to have the option of enabling RGBM on mobile for the extra range. Are there any decent workarounds? I guess I could write a script to convert the .exr to an RGBM .png after a bake (and render with custom shaders)

    (Edit: Although that's easier said than done... as there appears to be no support for loading HDR .exr textures from an editor script? - I can copy the lightmap into a readable texture, but only from a texture that's already been reduced to doubleLDR, which is no use...)

    (Edit2: Setting a lightmap texture to import as Default rather than Lightmap seems to give an RGBM map, at least while in Android mode - So I may just need to switch that, and decode it appropriately in a custom shader)
     
    Last edited: Jan 8, 2019
  3. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    453
    Strangely, I'm finding that if I set a lightmap to 'default', the expected 8*a* rgb is too bright, and 5*a*rgb seems to match the dLDR lightmap?
     
  4. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    126
    That should no longer be the case in the newest versions of Unity, as HDR lightmaps are supported both for iOS and Android platforms.
     
    bluescrn likes this.
  5. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    453
    How new is newest? - I'm working in 2018.2.7 and haven't seen the option (and the 2019.1 docs don't seem to mention it) - The 'lightmap encoding' option Player Settings isn't present for Android in 2018.2.7

    The docs do confirm that the expected RGBM range is 0-5 now, though. I must have been looking at an old version when I saw references to 0-8.

    Turned out to be easy to get RGBM working on Android though - I just needed to change the import mode of the lightmaps to 'default' (so they get encoded as RGBM), and tweak our custom shaders to decode it.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,257
    I can't double check now since I don't have the alpha installed now, but I believe it's in 2019.1. ( I guess the docs are just out of date )
     
  7. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    126
    That is correct, HDR lightmaps should be available in the latest 2019.1 alpha. In order to make use of HDR lightmaps on mobile, Lightmap Encoding Quality should be set to either High or Medium.
     
    bluescrn likes this.