javascriptthree.jsskybox

Threejs skybox out of range


I am writing a 3d game in javascript with threejs. I made a skybox, and it works, but if I make my cameras near and far distances too small it doesn't show.

I understand why this happens, the camera attached to my player doesn't see as far as the skybox. If I make my cameras "near" and "far" attributes large enough (corresponding to the size of my game map) I can make it so that my skybox is always within range, but I don't want that, since I don't want the camera to see all the objects that far away.

Any ideas of how to force the camera to see the skybox but still have a small "far" attribute so as to no see all the objects in the world?

Any help would be greatly appreciated.


Solution

  • There’s scene.background, which can be set to a CubeTexture.