# Light sources

## Lightning Types

ApertusVR  provides three types of lighting:

### Spot

```cpp
Ape::Light::Type::SPOT
```

This Light works like a flashlight. It produces a solid cylinder of light that is brighter at the center and fades off.

### Directional

```cpp
Ape::Light::Type::DIRECTIONAL
```

This Light simulates a huge source that is very far away - like daylight. Light hits the entire scene at the same angle everywhere.

### Point

```cpp
Ape::Light::Type::POINT
```

This Light spreads out equally in all directions from a point.

## Reflection types

The `Ape::ILight` class has a wide range of properties. Two of the most important are the diffuse and specular color. Each defines how much specular and diffuse lighting a material reflects.

### Diffuse

Diffuse light is reflected equally in all directions. This is one component of dynamic lighting. It is affected by the distance and angle between the surface and the light, but is unaffected by the viewer's position or viewing angle.

### Specular

This is light that reflects more intensely along and around the reflection vector from a surface. It is used to add highlights to a surface that make it look shiny. Specular reflection is not only affected by the relationship between the surface and the light, but also the viewer - since when the viewer is closer, they will see a brighter spot at the point of reflection.

## Eamples

Create a directional light:

```
if (auto light = std::static_pointer_cast<Ape::ILight>(mpSceneManager->createEntity("light", Ape::Entity::LIGHT).lock()))
{
	light->setLightType(Ape::Light::Type::DIRECTIONAL);
	light->setLightDirection(Ape::Vector3(1, -1, 0));
	light->setDiffuseColor(Ape::Color(0.35f, 0.35f, 0.35f));
	light->setSpecularColor(Ape::Color(0.35f, 0.35f, 0.35f));
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apertus.gitbook.io/vr/introduction/features/basic/light-sources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
