The space platform provides virtual world creators with lighting tools that can create a huge variety of amazing, atmospheric spaces.
There is no one right way to light a region. Getting the right lighting can take a few attempts. This How To looks at the combination of different light types, both realtime and baked, in the Mirage demo scene.
Baking and lightmaps
Each light in a scene is either baked or realtime. Most light types (with the exception of Area lights) can be either.
Realtime influences inworld performance. Baked increases upload size.
In the Mirage demo scene the creator has used a combination of real-time and baked lighting.
Ambient and directional light
When you create a new scene in unity it will have two light sources by default;
A directional light which is an object in the scene you can rotate like any other object.
The directional light will cast shadows in the direction you rotate it.
For the Mirage scene in this How To the directional light has been deleted from the scene. Directional light is often used as the source of sunlight in an exterior scene. In the Mirage scene shadows are cast by the point lights in each room.
The Ambient light has no source in the scene and is modified via Window / Lighting from the top menu bar.
In this scene the ambient source is the skybox; the color range of the skybox informs the color range of the ambient light in the scene. You can also use either a flat colour source, or three gradient options. The skybox option works well in the Mirage region but doesn't always look good, depending on the skybox itself.
Adding lights to a scene
You can add lights and light probes to a scene by clicking create / light in the scene hierarchy window. Leaving light in the name of all your lights will allow you to search for them in the hierarchy.
Area lights are used in this scene to project different tinted light from a plane into each room.
Area lights are very efficient but do not cast shadows. They are baked only.
The direction of the light from the plane is indicated by the yellow line.
The hanging lights in the Mirage scene are mesh lamps, on the walls and ceilings, with point lights attached to them.
Point lights emit light in all directions at once over an area visible as a wire-frame sphere.
The point lights in this scene are set to real-time and are the source of dynamic shadows on avatars and other non-static objects in the scene.
The hanging lights also have a halo component added to give a simple visual indication of their status as light source.
The Mirage scene also contains one baked point light, called “CenterLight.”
The creator used a wide area baked point light here because an area light on ceiling would have undermined the shadows cast by the other ceiling and wall lights in the scene.
Spot lights project light from a cone point and are used in this scene to illuminate the NPCs showcasing clothing items. They are set to realtime and project the shadows of the NPCs onto the back wall.
The Light Circle in the centre of the main room has meshes where the Standard Shader is set as Emissive; the mesh radiates light.
If the emission value is between 0 and 1 the mesh surface will appear to be a light source but does not actually emit light.
If the emission value is set above 1 for one or more color channel the mesh suface will emit a faint HDR light.
This can be very good for LEDs and small light piping. It also contributes to light bounce off shiny surfaces.
Emissive surfaces are only applied to static objects, and only for baked lighting.
Emissive surfaces may generate some artefacts on materials with detail maps when viewed in webgl.
Light probes sample the combination of light sources in the scene and allow moving objects in the scene; most obviously visiting avatars; to be well lit by the baked light sources that otherwise would only have an impact on in the static components of the scene itself, via the lightmap textures.
You can lay out as many or as few light probes as you want. You should aim to place light probes at the places in the scene where different light sources obviously overlap.
In this scene the creator has focused on light probes at head height, with a particular grouping around the intense light conditions of the fashion studio.
You can toggle the light probes to be visible nor not via the Gizmo menu above the scene window.
Baking the scene
Once all your light sources and light probes have been laid out and all the static objects that will form the fabric of the scene are in place, your final act before submitting the scene to the server is to bake.
This function is a once click process, triggered from the Build button at the bottom of the Lighting window.
It may take a while for the bake to complete. It will take longer the higher the baked resolution you set. Unity defaults to 50 texels per unit but this scene was run at 20 and could probably have come down to 10 without any significant change in the result.
Once the bake has completed you will have lightmaps for your scene which will automatically be uploaded when you submit to the server.
The lightmaps are then blended with the textures in the scene to give you the look and feel you have created.
When you bake the scene Unity will also apply the light information to the light probes and the reflection probes in the scene.
You can also bake ambient occlusion and reflection probes as part of the same process.