[SOLVED] Possible to compress externally loaded textures?


I’m currently working on a project where I need to load external textures from a server (where new textures can be uploaded, removed).

No problem loading the textures, but one thing that has been instrumental in ensuring good performance has been texture compression, especially for iOS (sometimes needed to avoid crashes on certain devices). What options are available for compressing external textures? I saw these posts as I was searching the forum. It seems based on these posts below that it may be possible with .DDS files loaded from a hosting server that supports it? (does firebase storage or amazon buckets support this?)

Simply compress your external textures to the Basis format. The Basis compressor tool is here:

You can then load them as shown in this engine-only example:


1 Like

Awesome, will try this tomorrow, thanks!

1 Like

Hey @will do you know what settings were used for the demo you sent, when compressing? I’m using the following command and tried a few other listed on the basis github page

basisu x.png

I tried loading the output basis file from firebase storage and while I can see part of the texture, the UVs are off when applied to the model, I also tried dropping the .basis file right into the editor and loading it as an asset the same way, and the output ends up completely white and throws this error

WebGL: INVALID_VALUE: uniform1iv: no array

Will keep tinkering away but just wondering if I’m missing something obvious as it looked to work well in on those cubes in the playcanvas sample

@slimbuck might know more on this one

1 Like

You need to:

  1. Ensure that the Basis WASM module is in your project. The easiest way to do this is to select any texture in your project, scroll to the COMPRESSION section in the Inspector, check ‘Basis’ and then hit IMPORT BASIS.
  2. Write a script that loads your remote Basis file and apply it to a material. For example:
var FetchBasis = pc.createScript('fetchBasis');

FetchBasis.attributes.add('url', { type: 'string' });

// initialize code called once per entity
FetchBasis.prototype.initialize = function() {
    // Create an asset representing our remote Basis file
    const basisAsset = new pc.Asset(this.url.split('/').pop(), 'texture', {
        url: this.url

    // Add the asset to the registry
    // Handle the asset once it's downloaded and ready to be used
    basisAsset.ready((asset) => {
        const material = this.entity.model.material;
        material.diffuseMap = asset.resource;

    // Issue the request to load the remote Basis asset

This Basis file should work to test with:



Hi @adkaros,

You will need to include the -y_flip option to basis when compressing.



That worked, thanks @slimbuck !