Compress to basis from the outside of PlayCanvas

I would like to compress a texture from the outside of PlayCanvas studio.

Just for test purpose, I compressed a single texture and downloaded the project.

On config.json file, the config data looks like the below.

            "file": {
                "filename": "FLAKE_N.jpg",
                "size": 218594,
                "hash": "e3828b0650d7da009f036f91d42d12db",
                "variants": {
                    "basis": {
                        "filename": "FLAKE_N.basis",
                        "hash": "61c71192cea9273d03cfd23fe5ff4f27",
                        "size": 94424,
                        "sizeGzip": 94283,
                        "opt": 8,
                        "quality": 128,
                        "compressionMode": "etc",
                        "noFlip": true,
                        "url": "files/assets/140621579/1/FLAKE_N.basis"
                "url": "files/assets/140621579/1/FLAKE_N.jpg"

According to the official github page,

the default quality is 128.

But I couldn’t find any related information about “opt”.

Can anyone give me some more detail information what the ‘opt’ is for?


1 Like


1 Like

Hi @sooyong_Kim,

You’re right this part isn’t documented and handled mostly internally. opt is used to flag “swizzledGGGR” textures which is used for high(er) quality normal maps. See this code.


Thanks for feedback

However, when I see the code, only thing I can find is that the “opt” is used.

I can’t find any purpose of it.

When I get the information of the basis file, it show as below.

I can’t find any related information about ‘opt’

Can you give more clear definition of it?


Hi @sooyong_Kim ,

When a texture is basis compressed in the editor with “Normals” enabled:

The editor copies the texture’s G channel to RGB and the R channel to A before compression. The backend then sets the opt value of the texture asset to 8.

At runtime when we load the basis texture asset we choose the correct normal sampling method based on this value.

Hope that makes more sense.


Thanks for the information.

I also wonder what option should I use to create the same basis compress by just using basisu command.

Hi @sooyong_Kim,

You can generate this type of normal map yourself using the following additional flags to basisu:
-normal_map -swizzle gggr -renorm


1 Like

We also have this engine example which lists command lines:

1 Like

What if I create a basis compression format widthout -swizzle gggr option from the outside of playcanvas editor. Then, which value should I set for the ‘opt’ variable?

In this case you don’t need to specify anything for opt.

@slimbuck do you only set the -mipmap option conditionally when that texture has mipmaps enabled in the editor, or is it always set when using Basis compression?

Correct, only when mipmaps is selected.

1 Like