How to use one or several objects have rendered as skybox?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By zcaliptium

Hello!
I am new with Godot… And I want to make simple 3D space game.
Sure spacesim can’t exist without fancy backgrounds.
I found that suggested solution with cubemap is not enough for my purpose.
It can’t be just static 6-sided textured box.

May I have skybox just as one or several objects locked to player’s viewpoint?
As example you have skybox as box or sphere mesh with sky textures and also some objects like oscillating 3D planet, sun etc.

It works in a such way in Source engine for example.

I didn’t find good enough guide about it.
If somebody did such thing what the best way to do it in Godot?

I’d like to know how to do this myself.

I’d like to have a SkyBox Scene drawn as the sky in my game scene.

Maybe we could just sync camera rotation and FOV between the two scenes using a script?

Not sure how to get the rendering working on this.

unfa | 2020-01-11 18:09

In order to use meshes as a background in 3D, you will need to create a CanvasLayer with a SubViewport which contains the background scene. The Camera3d rotation of the background scene should copy the Camera3d rotation of the main scene. Then you set WorldEnvironment.environment.background_mode = BGMode.BG_CANVAS
See the below scene for layout.

viewport_bg_scene