Skip to content

Customize the Skybox

eisclimber edited this page Jan 18, 2024 · 3 revisions

Customize the Skybox

A skybox of the application is the the "background"-image of the virtual world. It encloses it at distance infinity, giving the scene a perception of depth.

A common use is to render a background that matches the look of the actually modeled, much closer GameObjects. If done correctly the transmission between the two might be hard to spot, giving the impression of a much a bigger modeled scene. An example for this would be modeling a room's interior and using a skybox for displaying everything outside. To be clear: That does not mean it is an perfectly accurate representation of the surroundings, since everything rendered far away. But it might help sell the illusion looking in a "real" environment while beeing in a room looking outside.

Alongside providing a background it can also provide lighting information for the whole scene. Often a special format is used, that requires special cameras: HDRi. A good place to find free to use HDRis (and Materials and Textures) is Poly Haven. "Ready to use"-skyboxes can be found at the Unity Asset store or at "Assets/ExPresSXR/Materials/Skyboxes/".

Creating Your Own Skybox/HDRi

If you do not find a fitting HDRi or want a very special background, one can be created with a smartphone (of lesser quality of course).

It might be the case that your Smartphone's Camera-App provides a "3D-Panorama"-Feature that can be used for making such images. These apps might attach location information to the picture. The following description shows a method using the Street View App that should not do that.

  1. Download the Street View App from the Play Store or the Play Store. Don't worry you do NOT need to publish your image on Street View.
  2. Create a new 360 degree image by selecting the "Create" and "360 degree". After accepting the permission prompts (you can decline GPS-access) the image can be captured.
  3. The capturing is done by moving the cameras to the dots shown on screen.
    Tip: Move your feet out of the way when making the bottom image if capturing in while standing up:) Important: If your skybox should capture rather near objects and you want to get the floor to the correct height, try to capture another 360- image while keeping your phone close to the floor!
  4. Once the capture was completed go to "Profile" and select the new image.
  5. Press the share button on bottom of your screen (three dots connected by lines), click "Share Privately" in the popup and select how you want to send it to your pc.
  6. You will receive a normal .jpg-file which now has to be imported into Unity.

Create a Skybox Material in Unity

Once the skybox image/HDRi has been obtained, move it into your Unity project. Create a new Material in Unity and change it's "Shader" at the top of the Inspector from "Default" to "Skybox > Panoramic". Finally drag your image onto the material's "Spherical (HDR)"-property.

Another option would be to simply change the colors of the default skybox.
This is done by copying the material at "Assets/Material/Skybox/DefaultSkybox.mat" or creating a new Material and changing it's "Shader" to "Skybox > Procedural".
This new skybox material can be modified, e.g. by changing it's color or the exposure (brightness).

With a skybox material created, it now must be set as skybox for the scene.

Changing the Skybox of a Scene

After obtaining or creating a skybox material it can be set by dragging it into the viewport or by:

  1. Going to "Window > Rendering > Lighting > Settings".
  2. Selecting "Environment" at the top of the window.
  3. Assign the skybox material to "Skybox Material".
  4. Modify the properties like exposure and rotation to your likings.

If the floor seems to be too high for your purposes, try to capture another 360 image while keeping your phone close to the floor.

ExPresS XR Wiki

Tutorial Pages

Code Documentation

Clone this wiki locally