Different Lights In Unity

Letting us see our sci fi room!

Currently, our scene is built, but it looks fairly dull and bland, lets add some lighting elements to make it more alive.

There are four key types of lights we can use in Unity — Directional, Point, Spot, and Area.

Directional light — We’ve talked about this already in relation to our skybox, but aside from controlling the sun, we can simply use this as an infinite light source.

Point Light — This is a light source located at a defined point, which emits light in all directions equally. Additionally, we can define an intensity to create different effects as opposed to our infinite directional light.

Spot Light —Spot lights are very similar to a point light, except for the fact they operate in a defined angle which allows us to create a cone-like light source. We also gain control of an inner angle which allows us to soften and sharpen the cone.

Area Light — An Area light is a rectangular or disc shape that emits light from one plane evenly within that shape. We can also spill this out by increasing the range. The key point to note about area lights is that they are resource-intensive and have to be baked into lightmaps rather than ran in real time.

Based upon my sci fi scene, examples of uses for these lights include the following.

Populated my room with emissive props, but having each of these contain their own light source is graphically intensive and doesn’t actually allow many to be rendered.

Instead, we can make use of our directional light to cover the whole scene evenly, with some supplementary point lights where needed. As our directional light is infinite, it will cast shadows from our roof elements. Based upon where our prop lights are in the scene, this wouldn’t make much sense. To combat this, we can create a Layer that we can use as a culling mask, meaning that the light will ignore these game objects. In my scene, I didn’t like how much the floor was illuminated either, so I added this to the mask. My directional light has minimal intensity, as the emissions in my scene are already quite strong. I simply just want to cast a bit of realistic light on some of the prop elements.

Directional light being toggled on and off

Point lights can also be great to draw attention to an area without having an obvious emission point. We can use a few of these around our scene for important objects. In my scene, I’ve used three of these spaced out along the rear wall, in reasonable positions relative to the wall light props for realism. Paired with the directional light this brings a bit more life into the scene and draws the player to the important side of the room, especially as you enter through the darker hallway into a brighter area.

Three point lights being toggled on and off

Lastly, I want to shoot light at the big test tubes to illuminate their glow, to do this, we can angle various spot lights at them, and pick a complimentary color. I used a light blue to cast light on them, as it adds to the emissive green glow quite nicely.

Two spot lights covering the tube with a reasonably wide angle.
Spot lights being toggled on and off

A few extra points about lighting in a game engine.

Coming from a background in live events with often hundreds of lights, less is more! I quickly learnt to fake elements in my scene with the likes of emissives, and larger lights covering multiple props. Originally, I had around 32 lights in my scene, and every adjustment was tanking my PC and resulting in horrendously long bake times. I now only have 6, and comparing screenshots, it actually looks better with less too!

If we have too many lights illuminating one object, we may start to get UV overlaps, tearing, and weird artefacts. Often times, this can be fixed with toggling on Generate Lightmap UVs in the FBX model of the game object, but may also require a reassessment of being static vs dynamic, or the light’s rendering mode.

Ultimately, trying to have a dimly lit area, probably made this a lot more challenging for my first attempts at lighting a scene in Unity, but it allowed me to make mistakes and learn a lot more than creating a big bright room, whilst also giving me space when it comes to audio for enhancing the environment. Lighting can really pull an experience together when used well.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store