geometric skybox camera?

This problem needs some explaining- what i mean by “geometric skybox”, is that i have a sortof miniature version of scenery that i want to render around my level as if i built it full scale. i have 2 cameras, one to follow the player, and one to render the skybox layer geometry’s “mini diorama”. this works, it renders the diorama at the bigger scale. however, i want the skybox camera to move the way the player moves, but at the smaller scale, so that while the player is moving through the level, the skybox geometry appears to move correctly too.

to heavily simplify this complex issue:

i want object “B” to move when object “A” moves, and move with it, but at a smaller scale (aka, a smaller distance). how do i do this?

Well, the easiest, straight forward approach would be to:

  • create your 3d skybox geometry on a dedicated skybox layer.
  • Let the skybox camera only render that dedicated layer and exclude that layer from the main camera.
  • make sure your skybox camera is rendered before the main camera.
  • The main camera’s clear flags should be set to “depth only”.
  • Add a script to the skybox camera that syncs the movement with the main camera. Here you might specify the scaling factor that should be used for the camera syncing.

Note that it would be a good idea to create an empty gameobject where you add everything related to the skybox (the skybox geometry and the camera). So the empty gameobject would be the “world origin” for the skybox geometry. All your script has to do is this:

public Transform skyboxCam;
public Transform mainCam;
public float scale = 0.1f;

void Start()
    if (mainCam == null)
        mainCam = Camera.main.transform;
    if (skyboxCam == null)
        skyboxCam = GetComponent<Camera>();

void LateUpdate()
    skyboxCam.localRotation = mainCam.rotation;
    skyboxCam.localPosition = mainCam.position * scale;

Note that it’s on purpose that we read the worldspace position and rotation from the main cam but setting the local space position and rotation of the skybox camera. This allows us to move / rotate our empty skybox root object whereever we want without changing anything.