AltspaceVR — Create a Dark World in Unity
How to create a pitch black world in AltspaceVR using Unity
It would seem a trvial task, remove all lights and your world goes dark. Sadly this is not the case and the necessary hoops to jump through are less than intuitive, especially to new users.
I have found one way to acheive a pitch black world through some trial and error, and I follow most of these steps at the start of any new project. This ensures I have as much control of the environmental lighting as I can.
Basic Project Setup — turn out the lights
The following will assume that you have AltspaceVR Unity Uploader installed and any necessary configuration completed such as ensuring Android plug-ins are installed and configured.
Put Your Avatar in the Dark
By default, AltspaceVR will create a global Directional Light for your avatar. If you do not override this default light, your avatar will always look like it is lit by the noon sun, even if your world is pitch black.
Create your new Scene. By default it will have a Directional Light
- Select the Directional Light and rename it to “Directional Light — Avatar Darkness”
- Set Intensity: 0
- Set Color: Black
- Set Mode: Real Time
- Click the “Layers” dropdown and “Add layer…”
- Create Layer 14 “Nav Mesh” — (not necessary for lighting, but you might as well do this now, as you may need this layer later, anyway)
- Create Layer 15 “Avatar Lighting” — This layer is critical, although the name is not.
- Click back on the Directional Light, and set Culling Mask to Layer 15 Avatar Lighting. You may need to set to None first to clear prior layers.
Your avatar will no longer be lit until you want it to be.
Darken the skies
Even without specific lighting, Unity will generate ambient light for the environment from the skybox. This setting is not obvious, so use the following procedure to remove any environmental lighting.
This is what you’ll likely see if you were to upload your scene.
In Unity all objects are black and unlit, but the skybox is still there.
In Altspace, the skybox is used to light the environment.
We need to change this.
- Open the menu: Windows -> Rendering -> Lighting Settings
- The top portion needs to be cleared of all environmental lighting,
- Set Skybox Material to a Black material. You may need to create a new material if you don’t have one. You can ignore the warning if it says the shader does not support a skybox.
- Set Sun Source: None (light)
- Set Environment Lighting,
- Source: Gradient — must be gradient. a solid Color will NOT work. (why???)
- For the gradient, set Sky Color, Equator Color, and Ground Color all to Black.
Now when you upload your scene, both Unity and Altspace should show a completely black world.
Light your world
Here I have added a plane for ground and a cube, as well as one additional dark purple Directional light with all layers, including Layer 15 — Avatar Lighting added to the Culling Mask, to see them by. As you can see the environment looks good both within Unity as well as in AltspaceVR.