Search Unity

Feature Request Creating a single build with both ASTC and DXT texture formats included.

Discussion in 'Web' started by dinkelstefan, Sep 11, 2023.

  1. dinkelstefan

    dinkelstefan

    Joined:
    Mar 13, 2019
    Posts:
    30
    It would be nice if we could create a single build with textures encoded as both ASTC and as DXT and to let the unity client decide which files to use.

    This way you can optimally support all platforms without having to build everything twice and adding custom checks to the index.html.

    The main reasoning here is having two complete builds adds a lot of complexity and storage size. Plus that DXT uses too much RAM on mobile browsers and that ASTC takes quite a while to decompress on desktop.
     
  2. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    fxlange likes this.
  3. avataris-io

    avataris-io

    Joined:
    Jun 23, 2020
    Posts:
    37
    Sorry, if this is a stupid question - or was answered already somewhere else, but: Are there any plans from Unity to support ASTC for PC browsers too? And if not, why not?

    As far as I saw ASTC is supported by some newer browsers for PC too - https://caniuse.com/mdn-api_webgl_compressed_texture_astc or https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_compressed_texture_astc - and it would be soooo much easier and more performant and faster and just awesome, if we could use ASTC for both, mobile as well as PC builds.

    Are there any chances we will see such a ASTC support for PC browsers soon? It could also be a choice for regular PC builds maybe?

    Thank you!
     
  4. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    So, what matters is if the GPU of the device running the browser supports ASTC compression, and most(all?) desktop GPUs do not. As an example while Vulkan theoretically allows a desktop GPU to support ASTC they don’t. DirectX doesn’t allow it even in theory.

    You'll see in the attached image the result of me checking for supported extensions using Firefox on my work PC. ASTC isn't returned as a supported extension.
    Edit: I incorrectly called gl.GetSupportedExtensions("WEBGL...") here by passing the extension, my bad. I should've called it without passing anything initially for that list.

    All we do from our side is check for that extension to say whether the device supports ASTC. So if you choose ASTC and your GPU supports it, your textures will be ASTC compressed, otherwise, it'll show a warning that it isn't supported and decompress the texture.

    I'm now mulling over our documentation and whether we need to clarify something there.
     

    Attached Files:

  5. unityruba

    unityruba

    Unity Technologies

    Joined:
    Nov 6, 2020
    Posts:
    273
    You can check this in your WebGL application in your browser console:
    Code (JavaScript):
    1. var c = document.getElementById("glcanvas"); //this should be the id of your WebGL canvas
    2. var g = c.getContext("webgl");
    3. g.getSupportedExtensions();