Loading basis textures while using ES6 imports and PBRMaterials

I’ve got a couple of questions around basis texture loading,

First is about importing the basis loader in an ES6 / Webpack project. At a guess I need to import a couple of things as side effects like so;

import { Texture } from "@babylonjs/core/Materials/Textures/texture"
import "@babylonjs/core/Materials/Textures/Loaders/basisTextureLoader"
import "@babylonjs/core/Misc/basis"

I’m not convinced this is working though, as I can’t see my browser downloading the decoder in the network tab of devtools

My second question is whether basis textures are expected to work with PBRMaterials, fiddling with the basis PG example (https://playground.babylonjs.com/#4RN0VF#23) would appear that they are incompatible, so I was wondering whether this is a deliberate decision and if so why?

Thanks in advance!

1 Like

nevermind, turns out i needed to import the basis texture loader like so;

import { _BasisTextureLoader } from "@babylonjs/core/Materials/Textures/Loaders/basisTextureLoader"

and then everything worked fine - also for whatever reason on my own project it worked fine on a PBRMaterial - so I’m not sure why it wouldn’t on the Playground

It does not work in the PG because if you don’t set the metallic or roughness properties, you are in the specular glossiness model and you must set the reflectivity texture.

Setting metallic/roughness is easier:

https://playground.babylonjs.com/#4RN0VF#24

2 Likes