I want do add Basis texture compresson support to my project, I have added Basis already and
it is loaded as Module. But the texture (.basis file) is not loaded/added.
In general I use the same mechanism as the Editor export. So it is basically app.preload() which loads
the Assets from the config.json file.
If I set the texture to preload:true the app.preload() function “hangs”. If I set it to preload: false in the config.json it does load, but not show. No errors in the console though.
There is used app.assets.loadFromUrl() method used, not app.preload()
How this application of Basis texture is handled internally when app.preload() is used? Or has anyone an idea?
It is not online. This is master repo only. Just to show you how I do the stuff. You can use the Basic scene and add a texture to the basic.json and the asset to the config.
it is also needed by now to enable the preload option for the BASIS module in the settings.js file of the component
/**
* Load all assets in the asset registry that are marked as 'preload'
*/
async doPreloadAssets(app) {
app.preload(function(err) {
if (err) {
console.error('Preload Error: ', err);
}
// Trigger event when the app is configured and assets are preloaded
console.log('Assets preloaded.');
app.fire('app:configured');
});
}
Wenn the Asset is set to preload:true in config.json which is needed for BASIS to add it to the model in the scene then no callback is called it seems. Is there another param to rreceive in app.preload(function(err) else than err?
I see in chrome dev tools that the .basis file has been loaded. Does it matter that maybe the mime type is not correct?
When I use the corresponding jpg and delete the variants in config.json it works.
So it is definetly a problem with the Basis compression or handling with this type of texture.
As said I do not know how do PlayCanvas apply the Basis library nor if it is maybe a webpack problem
Finally I was able to receive an error from playcanvas.js as I removed the variants object from the config.json and put the .basis file as url. But maybe this is due that I left the filename as jpg…
Hi angain and sorry to bother, but when I export a scene with the editor I get this bundled ZIP with a lot of files. When I run this locally using Live Server plugin in VS Code it works as expected. Where is this Basis js file (basis.wasm.js) instanciated? In case of Ammo I see that there is a AmmoLib, but I cannot find a BASISLib somewhere on the window object? Is it attached to pc or pc.Application.
In this example:
There is something like this:
pc.basisDownload(
‘…/lib/basis/basis.wasm.js’,
‘…/lib/basis/basis.wasm.wasm’,
‘…/lib/basis/basis.js’,
function () {
Hi @yaustar, good news it is working now, it seems that I really have to use this:
pc.basisDownload() - It is not automatically detected when putting the files path in the module settings like this. Anyway thanks for your help and sorry to have bothered you much. Have a nice weekend!