Skybox Imports, Vite and extensions

Vitejs has changed the way of importing assets now:

import sky3 from "/public/static/sky3.jpg";

I curious if Babylonjs is going to change how a skybox is imported?

I also figured out how to configure Panorama to Cubemap skybox extensions if anyone is interested:

const Sky_Box = () => {
    const skybox = MeshBuilder.CreateBox("", { size: 32.0 }, scene); //64,128,256,512,1024
    skybox.checkCollisions = true;
    var skyboxMaterial = new StandardMaterial("", scene);
    skyboxMaterial.backFaceCulling = false;
    skyboxMaterial.reflectionTexture = new CubeTexture(
        "/static/skyBoxArray/",  // can this link be changed?
        scene,
        ["px.jpg", "py.jpg", "pz.jpg", "nx.jpg", "ny.jpg", "nz.jpg"] //extensions
        // ["px.png", "py.png", "pz.png", "nx.png", "ny.png", "nz.png"]
    );
    skyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;
    skyboxMaterial.diffuseColor = new Color3(0, 0, 0);
    skyboxMaterial.specularColor = new Color3(0, 0, 0);
    skybox.material = skyboxMaterial;
};
Sky_Box();

We do not import anything or expect anything special in Babylon :slight_smile: This is all only dev tools changes and as long as you provide a valid url in Babylon, it should be all happy.

1 Like

You don’t need to import it if it will be served from your static folder - or did I miss something? That URL /static/skyBoxArray is just used to get the full URLs to download for each side of the cube texture…