# Load CubeTexture

**URL:** <https://forum.babylonjs.com/t/load-cubetexture/57783>\
**Category:** Questions\
**Created:** [April 12, 2025, 2:27am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783 "2025-04-12T02:27:48Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![KallkaGo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kallkago/32/45789_2.png) [@KallkaGo](https://forum.babylonjs.com/u/KallkaGo)\
**Post date:** [April 12, 2025, 2:27am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/1 "2025-04-12T02:27:48Z")

</div>

How to load cubeTetxure using full url without AssetsManager ？

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 12, 2025, 10:54am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/3 "2025-04-12T10:54:33Z")

</div>

Here is PG example - [https://playground.babylonjs.com/#UU7RQ#4316](https://playground.babylonjs.com/#UU7RQ#4316)

```auto
skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("https://playground.babylonjs.com/textures/skybox", scene);

```

More info in the Docs - [Babylon.js docs](https://doc.babylonjs.com/features/featuresDeepDive/environment/skybox#creating-a-cubetexture)  
API - [Babylon.js docs](https://doc.babylonjs.com/typedoc/classes/BABYLON.CubeTexture)

---

<div class="post-metadata">

**Author:** ![KallkaGo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kallkago/32/45789_2.png) [@KallkaGo](https://forum.babylonjs.com/u/KallkaGo)\
**Post date:** [April 12, 2025, 11:07am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/4 "2025-04-12T11:07:35Z")

</div>

This PG instance does not seem to use the full url and the documentation states `rootUrl: defines the url of the texture or the root name of the six images`

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 12, 2025, 12:07pm UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/5 "2025-04-12T12:07:39Z")

</div>

The [CubeTexture constructor](https://doc.babylonjs.com/typedoc/classes/babylon.cubetexture#constructor) takes a base URL and (by default) appends “\_px.jpg”, “\_nx.jpg”, “\_py.jpg”, “\_ny.jpg”, “\_pz.jpg” and “\_nz.jpg” to load the +x, -x, +y, -y, +z, and -z facing sides of the cube.

What do you mean speaking of full URL? Do you have an example of full URL?  
From my point of view, this base URL `"https://playground.babylonjs.com/textures/skybox"` is the full URL which one needs to define in order to create CubeTexture.

---

<div class="post-metadata">

**Author:** ![KallkaGo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kallkago/32/45789_2.png) [@KallkaGo](https://forum.babylonjs.com/u/KallkaGo)\
**Post date:** [April 12, 2025, 12:32pm UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/6 "2025-04-12T12:32:59Z")

</div>

Like threejs cubeTextureLoad passes in an array for url，the url of each image in the array is full  
docs:[CubeTextureLoader](https://threejs.org/docs/?q=cube#api/en/loaders/CubeTextureLoader)  
example :[cubemap](https://threejs.org/examples/#webgl_materials_cubemap)  
source code:[code](https://github.com/mrdoob/three.js/blob/f230fe9147bfbf9c689a8d62b72d757395a513c9/examples/webgl_materials_cubemap.html#L52C1-L58C7)

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 12, 2025, 12:46pm UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/7 "2025-04-12T12:46:25Z")

</div>

You may also use .env format, it is much simpler

```auto
    const hdrTexture = new BABYLON.CubeTexture("textures/country.env", scene);
    scene.environmentTexture = hdrTexture
    scene.createDefaultSkybox(scene.environmentTexture, true, (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2, 0, false);

```

Example - [Babylon.js Playground](https://playground.babylonjs.com/#ZZ7WFZ)

---

<div class="post-metadata">

**Author:** ![KallkaGo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kallkago/32/45789_2.png) [@KallkaGo](https://forum.babylonjs.com/u/KallkaGo)\
**Post date:** [April 13, 2025, 2:41am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/8 "2025-04-13T02:41:12Z")

</div>

Since our project needs to support .env and six images at the same time, I am still looking for a solution. If not, I cannot use the complete url image array. Maybe I need to process the url in advance.

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 13, 2025, 3:42am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/9 "2025-04-13T03:42:00Z")

</div>

If I understand you correctly, you may use `files`array

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/2/82239eaf8ca53f0ab7712fdda30901f4193ca79d.png)  
But if you need to retrieve those files from different sources rather than from one folder (rootUrl), you may need to use your own processor.  
Source - [Babylon.js/packages/dev/core/src/Materials/Textures/cubeTexture.ts at 1fa51fc7f8268a8cd43b205305ec2fafea2edb82 · BabylonJS/Babylon.js · GitHub](https://github.com/BabylonJS/Babylon.js/blob/1fa51fc7f8268a8cd43b205305ec2fafea2edb82/packages/dev/core/src/Materials/Textures/cubeTexture.ts#L177)

---

<div class="post-metadata">

**Author:** ![KallkaGo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kallkago/32/45789_2.png) [@KallkaGo](https://forum.babylonjs.com/u/KallkaGo)\
**Post date:** [April 13, 2025, 4:04am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/10 "2025-04-13T04:04:22Z")

</div>

cool this works fine, but requires the texture array to be provided in a certain order

---

<div class="post-metadata">

**Author:** ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)\
**Post date:** [April 13, 2025, 4:23am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/11 "2025-04-13T04:23:32Z")

</div>

> [@KallkaGo](#):
>
> requires the texture array to be provided in a certain order

Well, otherwise it would be hard to guess which face of cube is where 🙂  
I believe it is the same in Three? - [three.js/src/textures/CubeTexture.js at bd9ac7da732e696fb2df8243c413dd877c11ad3a · mrdoob/three.js · GitHub](https://github.com/mrdoob/three.js/blob/bd9ac7da732e696fb2df8243c413dd877c11ad3a/src/textures/CubeTexture.js#L11)

---

<div class="post-metadata">

**Author:** ![KallkaGo](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kallkago/32/45789_2.png) [@KallkaGo](https://forum.babylonjs.com/u/KallkaGo)\
**Post date:** [April 13, 2025, 8:56am UTC](https://forum.babylonjs.com/t/load-cubetexture/57783/12 "2025-04-13T08:56:53Z")

</div>

in threejs use px nx py ny and so on…  
but in babylon if i use Cubetexture files options in order of `[px, py, pz, nx, ny, nz]` 🤣
