Search Unity

Feature Request Option to have per platform compression overrides for textures

Discussion in 'Global Illumination' started by joshuacwilde, Sep 2, 2020.

  1. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    731
    On mobile, we are using ASTC 4x4 exclusively now. Everytime we bake, we have to remember to change the new lightmap textures to use ASTC in the iOS and Android overrides. It would be very nice to have this as an additional option rather than just a single checkbox for whether or not lightmaps should be compressed.
     
    nxtboyIII and AcidArrow like this.
  2. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    Hi @joshuacwilde. Thanks for the suggestion. Actually, we have been talking about this exact problem in our team recently.

    To be sure I understand you correctly, are you saying that you want full control of texture settings from within the Lighting Settings? Not only do you want to specify the texture format for all baked texture outputs. You want to be able to specify specific formats per texture type (shadowmask, directional lightmap, lightmap) and potentially per-platform (Win, iOS, etc.) as well, right? This leads to a lot of potential combinations and I fear that will translate into a lot of UI complexity. This conflicts with our goal of keeping the Lighting Settings simple and for that reason we are bit hesitant about adding this. However, it may be worth it.

    On a related note, we may be changing the Compression=On|Off toggle (in Lighting settings) to a an enum Compression=Off|Low Quality|Medium Quality|High Quality. The primary goal for doing this is to address this bug. I know this is not what you are asking but I figured you may be interested.

    Have you considered whether you can use the bakeCompleted event and TextureImporter.SetPlatformTextureSettings + SaveAndReimport to automatically set the desired formats after each bake? I think that would work.
     
  3. rasmusn

    rasmusn

    Unity Technologies

    Joined:
    Nov 23, 2017
    Posts:
    103
    An alternative solution to having full texture format settings in Lighting Settings is that the lightmapper simply never overwrites existing texture. This would allow you to do a first-time bake, then modify format settings in texture importer, and then rebake without losing those modifications. This solution has its own set of drawbacks, but it allows us to sidestep the UI complexity issue mentioned above.
     
    zalogic likes this.
  4. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    731
    @rasmusn yeah that's what I am asking for is what you described in your first post. The problem with the alternative solution in your second post is that if the lightmapper added a new map because we increased resolution or the map got bigger, we would have to change it for that new texture(s). So that basically means we will just have to check after each bake.

    High, medium, and low settings for the lightmap compression wouldn't be useful to me.

    Another solution might be to have a global texture import format per platform. This would be even more helpful and would do the same job.

    It seems writing a script to reimport on bake completed would work, it's just an extra step we would rather not do.