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.
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?
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.
You can generate this type of normal map yourself using the following additional flags to basisu:
-normal_map -swizzle gggr -renorm
We also have this engine example which lists command lines:
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.