# Use one image for a skybox and make it look "seamless"

**URL:** <https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737>\
**Category:** Questions\
**Created:** [December 21, 2022, 5:29am UTC](https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737 "2022-12-21T05:29:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigrig](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bigrig/32/5548_2.png) [@bigrig](https://forum.babylonjs.com/u/bigrig)\
**Post date:** [December 21, 2022, 5:29am UTC](https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737/1 "2022-12-21T05:29:01Z")

</div>

Hi all!  
Is there a way to flip the texture of some faces in a skybox?  
The purpose is to make a skybox with a single image and to make it look more or less seamless by flipping a couple of the images. Like the Front and Right images for example. The top and bottom will never match up, but it should look pretty good going around if two of them can be flipped horizontally.

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

ps. the individual images show up weird in the inspector (and there’s a 404 error for an image with a malformed path in the console), although the skybox renders completely fine!

 ![Screenshot 2022-12-20 at 9.27.31 PM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/3/9/391d6f1070b8c48a2649f0b6e7e9a42787a049a4.png)

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [December 21, 2022, 6:16am UTC](https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737/2 "2022-12-21T06:16:56Z")

</div>

Hello!

You can alter the UVs of your BackgroundSkybox or you can rotate the texture itself using:

`texture.uAng`  
`texture.vAng`

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [December 21, 2022, 12:18pm UTC](https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737/3 "2022-12-21T12:18:28Z")

</div>

The `CubeTexture` is expecting an array of string for the `extensions` parameter, not an array of `Texture`:

[https://www.babylonjs-playground.com/#T32V41#49](https://www.babylonjs-playground.com/#T32V41#49)

As @roland said, I think you will need to update the uvs of each face of the skybox to achieve what you want to do.

---

<div class="post-metadata">

**Author:** ![mawa](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mawa/32/12384_2.png) [@mawa](https://forum.babylonjs.com/u/mawa)\
**Post date:** [December 21, 2022, 12:49pm UTC](https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737/4 "2022-12-21T12:49:17Z")

</div>

> [@bigrig](#):
>
> The top and bottom will never match up, but it should look pretty good going around if two of them can be flipped horizontally.

If you have an image edit app (i.e. photoshop) I would advise you would stick with the skybox cube wrap.  
If you unfold the cube from the skybox, all horizontal faces form just one panoramic image so it’s ez to make it look seamless. For the top and bottom however, there’s a little trick. The skybox requires a 90° rotation of PY and a -90° rotation of NY faces. What I do is I create dynamic objects for these, so I can work on the texture and next it gets rotated in place when I update the dynamic object. The integration is simply worked with gradient masks.  
If you want I could share my psd template with you with the containers, rulers and base masks for integration (which you can still improve depending on your design). It’s still wip as I’m planning to script it and all masks are not yet done. But since I have to do it shortly anyways, I could take a bit of time for that and next share it with you, if it can be of help to you

 ![Capture d’écran 2022-12-21 à 13.37.49](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/b/f/bfbae153ddfe10881e309e9401e02cacf526c4d9.jpeg)  
.  
 ![skybox_tiling_view](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/7/972cc607258ebfc2a96f0261ed49f7dc04a05ab5.png)

---

<div class="post-metadata">

**Author:** ![bigrig](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/bigrig/32/5548_2.png) [@bigrig](https://forum.babylonjs.com/u/bigrig)\
**Post date:** [December 21, 2022, 3:51pm UTC](https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737/5 "2022-12-21T15:51:39Z")

</div>

> [@Evgeni\_Popov](#):
>
> I think you will need to update the uvs of each face of the skybox to achieve what you want to do.

Hm. So then i would need to construct the skybox differently in order to be able to adjust the UV of each individual face, right?

Whereas `CubeTexture` gives me only one texture and `texture.vAng` applies to the entire texture rather than to an individual face. Correct?

@mawa thks for the tips! I’m trying to create the skybox from a user supplied image dynamically (From Stable Diffusion), so can’t take it into photoshop. But you got me thinking about how to build that all out dynamically.

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [December 21, 2022, 4:07pm UTC](https://forum.babylonjs.com/t/use-one-image-for-a-skybox-and-make-it-look-seamless/36737/6 "2022-12-21T16:07:34Z")

</div>

> [@bigrig](#):
>
> So then i would need to construct the skybox differently in order to be able to adjust the UV of each individual face, right?

You can call `convertToFlatShadedMesh()` on the skybox mesh to make sure each face has its own set of 3 vertices and update the uv coordinates of these vertices to achieve what you want.
