# CubeTexture from 6 TGA/DDS files

**URL:** <https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645>\
**Category:** Questions\
**Created:** [November 8, 2024, 1:13pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645 "2024-11-08T13:13:50Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinhui](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vinhui/32/41914_2.png) [@vinhui](https://forum.babylonjs.com/u/vinhui)\
**Post date:** [November 8, 2024, 1:13pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/1 "2024-11-08T13:13:50Z")

</div>

Hi,

I have cubemap textures that consist of 6 individual TGA or DDS files. It seems that it currently only can load cubetextures from 6 individual files if the browser supports the filetype. Is this correct?

> **[Babylon.js Playground](https://www.babylonjs-playground.com/#UU7RQ%234202)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL and WebGPU 3D scenes

Is there a way to work around this? Can I make a `CubeTexture` from 6 individual `Texture` objects?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 8, 2024, 3:47pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/2 "2024-11-08T15:47:42Z")

</div>

Sorry I do not get the question 🙂 Your PG seems to work

---

<div class="post-metadata">

**Author:** ![vinhui](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vinhui/32/41914_2.png) [@vinhui](https://forum.babylonjs.com/u/vinhui)\
**Post date:** [November 8, 2024, 3:49pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/3 "2024-11-08T15:49:15Z")

</div>

Sorry, i shoulve explained the playground a bit more. The skybox should show something instead of being black. The cube in the middle just shows that the same dds texture does work in non-cubetexture context. Comment line 14 to see what it should be.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 8, 2024, 3:50pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/5 "2024-11-08T15:50:15Z")

</div>

ok I understand 😃

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 8, 2024, 3:51pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/6 "2024-11-08T15:51:15Z")

</div>

Let me check what is going on 🙂

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 8, 2024, 3:56pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/7 "2024-11-08T15:56:27Z")

</div>

Ok so I know what is going on: the DDS decoder (or any decoder) are not invoked from the CubeTexture loader side.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 8, 2024, 4:04pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/8 "2024-11-08T16:04:50Z")

</div>

Not a bug per se. Simply not a supported feature

---

<div class="post-metadata">

**Author:** ![vinhui](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vinhui/32/41914_2.png) [@vinhui](https://forum.babylonjs.com/u/vinhui)\
**Post date:** [November 8, 2024, 4:28pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/9 "2024-11-08T16:28:20Z")

</div>

Is there an internal code path I could take to make this work?

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 8, 2024, 7:42pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/10 "2024-11-08T19:42:38Z")

</div>

Unforhttps://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/8tunately this would be complex. The current cubeTexture relies on the canvas to decode the image:  
[Babylon.js/packages/dev/core/src/Engines/Extensions/engine.cubeTexture.ts at 22e2e0a97d2fb341deb5e73551d2eb20ebac4b9d · BabylonJS/Babylon.js](https://github.com/BabylonJS/Babylon.js/blob/22e2e0a97d2fb341deb5e73551d2eb20ebac4b9d/packages/dev/core/src/Engines/Extensions/engine.cubeTexture.ts#L252)

That being said, you can pack a full cube texture inside a DDS so maybe this is the way to go for you?

[hdri\_test | Babylon.js Playground](https://playground.babylonjs.com/#BH23ZD#1)

---

<div class="post-metadata">

**Author:** ![vinhui](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/vinhui/32/41914_2.png) [@vinhui](https://forum.babylonjs.com/u/vinhui)\
**Post date:** [November 9, 2024, 11:25am UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/11 "2024-11-09T11:25:51Z")

</div>

I’m kinda stuck with external assets. I’ll just use the 6 individual textures and combine them in shader. Won’t give a perfect result, but should be good enough in my case.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [November 9, 2024, 2:27pm UTC](https://forum.babylonjs.com/t/cubetexture-from-6-tga-dds-files/54645/12 "2024-11-09T14:27:05Z")

</div>

Rally sorry about that:(
