"Endless sky"?

Is it possible to have two cameras running at the same time in the GE? For example, you’d have camera 1 doing all of the normal game camera functions like following the player, but on a seperate layer you’d have camera 2 sitting inside of the skybox, mimicing the orientation of camera 1 and rendering the skybox as if it was in the same layer as camera 1.

It was possible in Unity3d, but I can’t figure out how to do it in blender. It wasn’t really much of an issue until recently, but as my game is coming farther along I realized that if I spawn an object too far away, it’ll be on the outside of the skybox and can’t be seen.

You could do it one of two ways.

  1. You could put the skybox in background scene, and use Python to sync the game camera and the background scene’s camera to have the same rotation, or

  2. You could use the bge.texture module to render from another camera and apply the texture to a plane that is far away.

The first method is the easiest and generally preferred way to go about it.

SkyBox.blend (1.01 MB)

Just a quick level to show you this is possible with the scene actuator set to background.
Basically I duplicated my main camera into the skybox scene and took away its ability to move and centered it but its still rotates from mouse input.

If you notice the ground plane in the world scene is bigger than the skybox in the skybox scene.

thanks. got it working … but there’s a very very very very tiny delay in the sync between scenes… enough that it drives me crazy. don’t suppose there’s any way around that (I assume its because of logic tick timers … but it’s already on 0 :confused: )

I am thinking the delay might be caused by an offset effect based on how far you are from the origin where the camera resides. If you were at a far corner of the map the camera projection may not be true to what you should see.

I should’ve mentioned, you could also put the skybox in the same scene as the game, and just vertex parent it to something parented to the camera. The skybox would be rather large, but it’s a way to go as well.

@Goalatio - The delay you notice is probably the background scene’s camera being updated after the game camera gets updated. Try ensuring that the sync code runs after the game camera gets updated (for example, after a mouse-look script executes).

I haven’t looked at the code. If you copy the orientation from one object to the other, you (logically) get a one frame delay. This is because both object do not change orientation at the same frame.

To get around that you can copy the orientation for all cameras from a third “master” object. This master should be invisible.
You still get a one frame delay, but you will not see it ;).

Btw. use skybox with vertex parent = no delay at all.