Babylon set CubeTexture

Hey, I want to create a sky, therefor I found a solution, where I create big box.

In the "sky" part has to be somehow the path to the image or what ever idk.

Anybody knows the solution here?

skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("sky", scene);

PS: I dropped my sky img in the assets folder Important: I'm writing my code in javascript

DOKU: https://doc.babylonjs.com/features/featuresDeepDive/environment/skybox


I'm new to microStudio and Babylon.js but trying to learn fast.

Are your textures all in a folder called "sky" in the assets folder of microStudio? According to Babylon.js's document, Babylon.js seems to want the imported sky textures in a specific format (i.e. in a folder with each of the different sides of the sky in that folder as mentioned in the snippet below):

"In that /skybox directory, we must find 6 sky textures, one for each face of our box. Each image must be named per the corresponding face: “skybox_nx.jpg” (left), “skybox_ny.jpg” (down), “skybox_nz.jpg” (back), “skybox_px.jpg” (right), “skybox_py.jpg” (up), “skybox_pz.jpg” (front). The "_nx.jpg" is added to your path.

Skybox textures need not be textures of sky alone. You can search the Internet for skyboxes and find buildings, hills, mountains, trees, lakes, planets, stars, you name it (all can be used nicely) as part of skybox textures, but some require a payment."

So perhaps you create a folder in microStudio's sprite assets and call it "sky" then put all your jpgs in there and try importing?

However, I've not tested yet if Babylon.js can actually import from microStudio's asset folder; hopefully so, but may not be able to. If not, you might want to try the second suggestion if you can find a .dds file instead:

"You can also use dds files to specify your skybox. These special files can contain all information required to setup a cube texture:

javascript skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("/assets/textures/SpecularHDR.dds", scene)"

You likely then wouldn't have to deal with folders and just pass the https:// URL into new BABYLON.CubeTexture.

My skybox takes 10 seconds to load - but then it works.


thx a Lot @Loginus! But for me it's not working in only javascript.

Maybe u find a solution, would be very epic!


version JavaScript >> https://microstudio.io/i/Loginus/babylonsky2/

choose a name for your skybox. Give the texture a name for the skybox and finally add "_nx.jpg", "_ny.jpg", "_nz.jpg", "_px.jpg", "_py.jpg", "_pz.jpg"

If the name is "abc", the files will be named "abc_nx.jpg", "abc_ny.jpg" ....

Drag the files to the "Assets" tab (if you don't see this tab, turn it on in the project settings).

When you want to create a skybox, you provide the directory address and skybox name. "path/name" .

If the skybox name is "abc", enter the address "assets/abc" .

skyboxTexture = new BABYLON.CubeTexture( "assets/abc" , scene);

Post a reply



Validate your e-mail address to participate in the community