Light sources

Lightning Types

ApertusVR provides three types of lighting:

Spot

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

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

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));
}

Last updated