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

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.

I believe what you want is the sample in this docs page: Unity - Manual: Texture compression in WebGL

If you look under “Create builds for desktop and mobile browsers from a script”, that script does exactly that. Let me know if you have any questions!

1 Like

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 - WEBGL_compressed_texture_astc API | Can I use... Support tables for HTML5, CSS3, etc or WEBGL_compressed_texture_astc extension - Web APIs | MDN - 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!

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.

You can check this in your WebGL application in your browser console:

var c = document.getElementById("glcanvas"); //this should be the id of your WebGL canvas
var g = c.getContext("webgl");
g.getSupportedExtensions();