# Large skybox disappears

**URL:** <https://forum.babylonjs.com/t/large-skybox-disappears/13213>\
**Category:** Questions\
**Created:** [August 8, 2020, 7:38am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213 "2020-08-08T07:38:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dshah\_H](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dshah_h/32/3607_2.png) [@Dshah\_H](https://forum.babylonjs.com/u/Dshah_H)\
**Post date:** [August 8, 2020, 7:38am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/1 "2020-08-08T07:38:29Z")

</div>

I have setup a skybox with size: 10000.0 but the scene I am creating a is very large, if I set skybox to 30000.0 it doesn’t show skybox, and if I keep on 10000.0, my scene is not displaying full, what should I do in this situation?

```
            // Skybox
            var skybox = BABYLON.Mesh.CreateBox("skyBox", 10000.0, scene);
            var skyboxMaterial = new BABYLON.StandardMaterial("skyBox", scene);
            skyboxMaterial.backFaceCulling = false;
            skyboxMaterial.reflectionTexture = new BABYLON.CubeTexture("./assets/skybox6/", scene);
            skyboxMaterial.reflectionTexture.coordinatesMode = BABYLON.Texture.SKYBOX_MODE;
            skyboxMaterial.diffuseColor = new BABYLON.Color3(0, 0, 0);
            skyboxMaterial.specularColor = new BABYLON.Color3(0, 0, 0);
            skyboxMaterial.disableLighting = true;
            skybox.material = skyboxMaterial;
            skybox.infiniteDistance = true;
            skybox.renderingGroupId = 0;

```

statistics from scene

 ![Screenshot 2020-08-08 at 10.37.22 AM](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/d/df72a2c8bc39ac7119cab3de3bb3b732833180e5.png)

---

<div class="post-metadata">

**Author:** ![Dshah\_H](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dshah_h/32/3607_2.png) [@Dshah\_H](https://forum.babylonjs.com/u/Dshah_H)\
**Post date:** [August 8, 2020, 10:40am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/3 "2020-08-08T10:40:28Z")

</div>

here is a PG of the issue: [Babylon.js Playground](https://www.babylonjs-playground.com/#S8NQ4N)

I also realised its not skybox issue, if I remove skybox it is still not showing all objects in the scene, it loads part of objects on moving forward.

---

<div class="post-metadata">

**Author:** ![kvasss](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kvasss/32/3774_2.png) [@kvasss](https://forum.babylonjs.com/u/kvasss)\
**Post date:** [August 8, 2020, 10:54am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/4 "2020-08-08T10:54:22Z")

</div>

Hi. Increase camera.maxZ  
Yourcamera.maxZ = 30000 or whatever you want  
And… maybe read docs? [Camera - Babylon.js Documentation](https://doc.babylonjs.com/api/classes/babylon.camera)

---

<div class="post-metadata">

**Author:** ![Dshah\_H](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dshah_h/32/3607_2.png) [@Dshah\_H](https://forum.babylonjs.com/u/Dshah_H)\
**Post date:** [August 8, 2020, 11:06am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/5 "2020-08-08T11:06:23Z")

</div>

Thanks, regarding docs, trust me I only post when I couldn’t find anything after searching everywhere, sometimes we can miss a small details, and being not very good in English is another issue. anyway thanks for the tip.

---

<div class="post-metadata">

**Author:** ![kvasss](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/kvasss/32/3774_2.png) [@kvasss](https://forum.babylonjs.com/u/kvasss)\
**Post date:** [August 8, 2020, 11:08am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/6 "2020-08-08T11:08:18Z")

</div>

hey its only humor)) but read docs))

---

<div class="post-metadata">

**Author:** ![dennemark](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dennemark/32/10745_2.png) [@dennemark](https://forum.babylonjs.com/u/dennemark)\
**Post date:** [September 10, 2020, 7:59am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/7 "2020-09-10T07:59:24Z")

</div>

Hi,  
I actually would like to reopen this issue.  
I am facing a similar situation. My camera has a rather low maxZ to avoid rendering of too many objects. My skymaterial settings are similar to Dshah\_H and the skybox has a size that it is a bit bigger than the rest of the scene.  
Now moving around on the scene, parts of the skybox are only visible, if they are within the maxZ of the camera. I am using infiniteDistance (ping @Deltakosh ), I would have expected that the skybox still is visible no matter how large the maxZ of the camera is. What exactly is the effect of infiniteDistance?  
My current workaround is to move a spheric sky"box" with the position of the camera, so it is always within bounds of maxZ.

---

<div class="post-metadata">

**Author:** ![dennemark](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dennemark/32/10745_2.png) [@dennemark](https://forum.babylonjs.com/u/dennemark)\
**Post date:** [September 10, 2020, 8:13am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/8 "2020-09-10T08:13:30Z")

</div>

Just realising, that inspector only shows infiniteDistance for box objects, is this correct?  
It is not shown in my current spheric skybox. I just created a reflectionprobe of my skybox (since i am using the sky shader) and applied this reflectionprobe to scene.createDefaultSkybox. It created an hdrSkyBox that has a toggle for infiniteDistance. (The resulting hdrSkyBox is no looking good, though. Seems to be difficult to get a reflection texture for the sky shader. I might just use an environment map)

Weird that I find out about just after asking for help here. But I would still be curious if infiniteDistance is only available for Box Meshes, it would be great to use it on a sphere, too, since camera maxZ is spheric.

---

<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:** [September 10, 2020, 8:55am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/9 "2020-09-10T08:55:29Z")

</div>

`infiniteDistance` is a property of `TransformNode` but is only used for meshes to remove the meshes with `infiniteDistance = true` from the computation of the world extends in `Scene.getWorldExtends`. So it won’t help in your case.

Why not having the skybox move with the camera even with a skybox:

[https://www.babylonjs-playground.com/#S8NQ4N#1](https://www.babylonjs-playground.com/#S8NQ4N#1)

---

<div class="post-metadata">

**Author:** ![dennemark](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/dennemark/32/10745_2.png) [@dennemark](https://forum.babylonjs.com/u/dennemark)\
**Post date:** [September 11, 2020, 9:02am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/10 "2020-09-11T09:02:17Z")

</div>

Oh this is actually also very useful information! Great way to exclude the skybox from world extends calculation. Smart!

You wrote

```auto
scene.onBeforeRenderObservable.add(() => {
            skybox.position.copyFrom(camera.position);
      });

```

For me it also works to just asign the activeCamera position, it does not require the onBeforeRenderObservable. Are there some side effects or is this ok too?  
`skybox.position = scene.activeCamera.position;`

---

<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:** [September 11, 2020, 9:44am UTC](https://forum.babylonjs.com/t/large-skybox-disappears/13213/11 "2020-09-11T09:44:54Z")

</div>

> [@dennemark](#):
>
> Are there some side effects or is this ok too?

No, I think it’s fine!
