This is used to determine where the planet camera should draw planets. Stencil is overridden to contain a value of 1 in pixels where the ship has been drawn.Default Layer Mask is set to ignore the Skybox layer as it will be drawn later.The render pipeline is setup to write "1" into the stencil buffer: The stack is set up such that planets are drawn after the ship, and the stars are drawn last: The background will be drawn by another camera and should be set to Uninitialized. The player camera render type is set to Base and is assigned the 3dSkyBox_Ship render pipeline. Each render pipeline will override the stencil buffer such that the overlaying camera does not draw on top of what is already there. This is achieved by having a different render pipeline for each camera. Therefore, we would like to be able to draw the closer objects first. This is however not ideal for performance as any stars blocked by a planet, or planets blocked by the player, will be drawn regardless. This intuitively means that the skybox furthest away should be the base camera, and that the planets and player should be drawn on top as overlay cameras. The camera stack list on the base camera determines the order which the overlay cameras should be rendered in (top to buttom). One for rendering the player, one for rendering the planets, and one for rendering both the stars and a 2D skybox: In the space scene example however, since distances are so big, an additional camera has been created to render a 3D skybox with objects that are very far away (stars). In the common case, a single 3D skybox is enough to achieve the desired effect. The scene has one player camera, and one camera for each 3D skybox. Compared to only having a 2D skybox, the elements in the 3D skybox have the advantage of being rendered in real time and can therefore contain animations, particles etc. It is rendered behind the playable area to create the illusion that the game world is much larger than it actually is. Different cameras for creating the illusion of grand scaleĪ 3D Skybox is a miniature "subscene" residing outside the bounds of the playable area.
![skybox3d unity skybox3d unity](https://i.ytimg.com/vi/h6EvjzKhZtU/maxresdefault.jpg)
![skybox3d unity skybox3d unity](https://uploads-ssl.webflow.com/5d64ad209093d7b315c3591a/5ebb82f54c78e03a2ceef0fc_unity-2017-tutorial-custom-skybox-large.jpg)
This demo showcases how Camera Stacking can be used to draw a 3-Dimensional Skybox which is used to improve visual fidelity of the unreachable areas of a scene.