Tag Archives: lights

Lighting in PlayCanvas

In this tutorial you will learn how to add and modify lighting in your game. You can use different types of lights and have multiple lights in any scenes to change the feel and atmosphere of the game. The three types of lights you can use are:

  • Directional light – light rays come from one direction
  • Point light – a sphere of light that shines in all directions
  • Spot light – a cone of light

Watch the video below to see how you can use lighting in your own PlayCanvas game.

Lighting in Unity

This video explains how to add different types of lighting to your 3D game environment in Unity. Different types of lights can be used for different purposes in a game. For example, light could emit from headlights on a car, a lantern held by a player, a street light, a lamp in a room, or a sun in a solar system.

Here are some examples of the different types of lighting available in Unity. Scroll down to watch the video.

A directional light setup in Unity
A directional light setup in Unity
A point light setup in Unity.
A point light setup in Unity.
A spotlight setup in Unity.
A spotlight setup in Unity.

Watch the video below to find out how to add lighting to your own 3D game project in Unity.

Basic lighting and emitting light from objects in Maya

This tutorial explains how to use lights in Maya and also how to emit light from an object such as the Sun or a light bulb (so that it glows). Please note that this video is a basic overview to get you started with some of the many lights and lighting effects you can use in Maya. You can also download printed instructions here.

Adding light decay

You can download the instructions from here if you would like light in your project to lose its intensity or reach over a distance.

Christmas Lights Arduino project

The project

This project involves green and red LED lights which flash in an alternating pattern. In this project, you will use two LEDs but you can add as many as you want if you have enough jumper wires and LEDs.

Scroll down to view the instructions or click here to download a PDF copy of the instructions.

What you need:

  • 1 x Arduino Uno or compatible board
  • 1 x red LED
  • 1 x green LED
  • 2 x 470 Ohm resistor (yellow-violet-black-black-brown, or yellow-violet-brown-gold)
  • 1 x Solderless breadboard
  • 3 x jumper wires


Picture1 Picture2 Picture3

Wiring it up

The LEDs are connected to pins 12 and 13 and each one has a 470 Ohm resistor connect to GND via the breadboard.

The code

Here is the Arduino sketch code:

Christmas lights - blinking red and green LEDs
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int redLED = 13;
int greenLED = 12;
// the setup routine runs once when you press reset:
void setup() { 
 // initialize the digital pin as an output.
 pinMode(redLED, OUTPUT);
 pinMode(greenLED, OUTPUT); 
// the loop routine runs over and over again forever:
void loop() {
 digitalWrite(redLED, HIGH); // turn the LED on (HIGH is the voltage level)
 digitalWrite(greenLED, LOW); // turn the LED off by making the voltage LOW
 delay(100); // wait for a second
 digitalWrite(redLED, LOW); // turn the LED off by making the voltage LOW
 digitalWrite(greenLED, HIGH); // turn the LED on (HIGH is the voltage level)
 delay(100); // wait for a second

Use the Arduino IDE to write this code, verify it and then upload it to the Arduino board. For an extra challenge, why not add a light sensor so that the lights only come on when it’s dark, or a button so that the lights can be switched on and off easily? You can also use a chain of LEDs instead of separately wiring them up to a breadboard.