---
name: "Light Source Tutorial"
type: topic
aliases: ["Lightpoint Tutorial"]
source: https://community.bistudio.com/wiki/Light_Source_Tutorial
revid: 370877
updated: 2025-02-21T10:44:02Z
---

# Light Source Tutorial

Armed Assault v1.00

### Basics

A **light source** is a non-physical object that shines a light. Its light does not cast shadows (only the sun or the moon can) and can go through walls. It can be of one of these two types:

- A **light point** (glowing light source) is an all-directional light source, like a floating lightbulb, that emits light all around it.
- A **light reflector**, much like projectors or vehicle headlights, is a beam-shaped light that was introduced in Arma 3 v2.06 (see [this example below](../topics/Light_Source_Tutorial.md#heli-spotlight)).

Such light source is **[local](../topics/Multiplayer_Scripting.md#locality)** to the computer where the script has been called; one player could see a light in the dark while another would not have such light "object" created.

#### Colour

Colour set via [setLightColor](../commands/setLightColor.md) determines the lens [flare](../topics/Light_Source_Tutorial.md#flare) effect colour, as well as light's first colour.

#### Ambient

Colour set via [setLightAmbient](../commands/setLightAmbient.md) determines the outer colour shone by the light source.

> [!IMPORTANT]
> Light colour does not affect AI spotting ability, but ambient **does**.

#### Flare

The flare is the "colour point" centre that emits light. It can be visible or invisible (set by [setLightUseFlare](../commands/setLightUseFlare.md)).

> [!NOTE]
> Flare is **not** visible by day, even using [setLightDayLight](../commands/setLightDayLight.md).

### How To

The list of all light source commands can be found in the Lights command group category.

#### Create a Light Source

```sqf
private _lightSource = "#lightpoint" createVehicleLocal player modelToWorld [0, 2, 1.5];
// alternatively, a light reflector (cone) can be created since Arma 3 v2.06
private _lightSource = "#lightreflector" createVehicleLocal player modelToWorld [0, 2, 1.5];
```

> [!NOTE]
> A light source is **local** (and all the light commands take a local argument too), hence [createVehicleLocal](../commands/createVehicleLocal.md)'s usage.

#### Set Light Colour

##### Colour

```sqf
_lightSource setLightColor [0.25, 1, 1]; // also defines Flare colour
```

##### Ambient Colour

```sqf
_lightSource setLightAmbient [1, 1, 1]; // sets the colour applied to the surroundings
```

#### Set Flare

> [!NOTE]
> For the flare to be visible, all the following values (use flare, size, visibility) must be defined and light colour [set by](../topics/Light_Source_Tutorial.md#colour-2) [setLightColor](../commands/setLightColor.md) must not be [0,0,0].

##### Enable Flare (Arma 3 v0.50)

```sqf
_lightSource setLightUseFlare true;
```

##### Set Flare Size (Arma 3 v0.50)

```sqf
_lightSource setLightFlareSize 1; // in metre
```

##### Set Flare Visibility (Arma 3 v0.50)

```sqf
_lightSource setLightFlareMaxDistance 100; // in metre
```

#### Set Light Brightness

##### Set Brightness

```sqf
_lightSource setLightBrightness 8;
```

> [!IMPORTANT]
> Does **not** work with `#lightreflector` - use [setLightIntensity](../topics/Light_Source_Tutorial.md#set-intensity) instead.

##### Set Intensity (Arma 3 v0.50)

```sqf
_lightSource setLightIntensity 3000;
```

##### Set Attenuation (Arma 3 v0.50)

```sqf
_lightSource setLightAttenuation [0, 2, 4, 4, 0, 9, 10]; // [start, constant, linear, quadratic, hardLimitStart, hardLimitEnd]
```

> [!NOTE]
> Formula is `1 / (constant + linear × dist + quadratic × dist × dist)` - see [setLightAttenuation](../commands/setLightAttenuation.md) for more information.

#### Make Light Visible by Day (Arma 3 v0.50)

```sqf
_lightSource setLightDayLight true; // only for the light itself, not the flare
```

#### Set IR (Arma 3 v2.06)

```sqf
_lightSource setLightIR true;
```

#### Set Reflector Angles (Arma 3 v2.06)

##### Set Cone Parameters

```sqf
_lightReflector setLightConePars [90, 45, 1];
```

##### Set Reflector Volume Shape

```sqf
_lightReflector setLightVolumeShape ["a3\data_f\VolumeLightFlashlight.p3d", [1, 1, 1]];
```

#### Delete Light Source

```sqf
deleteVehicle _lightSource; // as simple as that
```

### Examples

#### Dark Souls

```sqf
skipTime -dayTime;

_lightSource = "#lightpoint" createVehicleLocal [0,0,0];
_lightSource attachTo [player, [0, 0, 1.5]];
_lightSource setLightColor [0,0,0];
_lightSource setLightAmbient [1,0.8, 0.25];
_lightSource setLightBrightness 0.15;
```

#### Contact

```sqf
skipTime -dayTime;

private _position = player modelToWorld [0, 20, 1.5];
private _lightSource = "#lightpoint" createVehicleLocal _position;
_lightSource setLightColor [0,1,1];
_lightSource setLightAmbient [0.2,0.0,0.3];
_lightSource setLightUseFlare true;
_lightSource setLightFlareSize 3;
_lightSource setLightFlareMaxDistance 3.5;
_lightSource setLightBrightness 4;
_lightSource setLightDayLight true;

_lightSource spawn {
    while { sleep 0.05; player distance _this > 2 } do
    {
        _this setLightBrightness 4 max (40 / (player distance _this));
    };
    deleteVehicle _this;
};
```

#### Heli Spotlight

```sqf
private _reflector = "#lightreflector" createVehicleLocal [0, 0, 0];
_reflector attachTo [myHeliVariable, [0, 0, 0], "light_l"];
_reflector setLightColor [1, 1, 1];
_reflector setLightAmbient [1, 1, 1];
_reflector setLightIntensity 1e6;
_reflector setLightConePars [60, 10, 1];
private _vector3D = [[[0, 1, 0], [0, 0, 1]], 0, -45, 0] call BIS_fnc_transformVectorDirAndUp;
_reflector setVectorDirAndUp _vector3D;

private _light = "#lightpoint" createVehicleLocal [0, 0, 0];
_light attachTo [myHeliVariable, [0, 0, 0], "light_l"];
_light setLightColor [1, 1, 1];
_light setLightAmbient [1, 1, 1];
_light setLightUseFlare true;
_light setLightFlareSize 5;
_light setLightFlareMaxDistance 500;
_light setLightBrightness 1000;
_light setLightIntensity 10;
```

### See Also

- Command Group: Lights

<sub>Source: [BI Community Wiki — Light Source Tutorial](https://community.bistudio.com/wiki/Light_Source_Tutorial) (revision 370877).</sub>
