vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::Light Struct Reference

Component representing a light source in the scene. More...

#include <light.h>

Public Attributes

float radius = 10.0f
 Attenuation cutoff (point/spot/area)
float innerConeAngle = 0.5f
 Spot: full-brightness cone, radians.
float outerConeAngle = 0.785f
 Spot: falloff edge, radians.
float areaWidth = 1.0f
 Rect width along the local X axis.
float areaHeight = 1.0f
 Rect height along the local Y axis.
float areaRadius = 0.5f
 Disk radius.
bool twoSided = false
 Area lights: emit from both faces.
float shadowBias = 0.5f
 How far the depth compare slides toward the light, in shadow texels (0..4).
float shadowNormalBias = 1.0f
 How far the point moves off the surface before the compare, in shadow texels (0..4).
float shadowDistance = 100.0f
 Directional only: world distance the cascades cover.
int shadowPriority = 0
 Which lights keep a shadow when more cast than the atlas holds; higher first.
float sourceRadius = glm::radians(0.5f)
 How large the light's source is, which is how soft its shadows are.
float flicker = 0.0f
 How deep the light wavers, as a fire's does: 0 holds it steady, 1 dips it to dark.

Detailed Description

Component representing a light source in the scene.

Pose comes from the Transform. Area lights emit along -direction (a spot along +direction); their intensity is point-equivalent, so from afar they light like a point light of the same intensity.

Member Data Documentation

◆ shadowBias

float Vkm::Engine::Light::shadowBias = 0.5f

How far the depth compare slides toward the light, in shadow texels (0..4).

In texels of the light's own map at the receiver, so one value holds for every light type, range and distance; grown where the light grazes (biasSlide in shaders/shadows.glsl).

◆ shadowNormalBias

float Vkm::Engine::Light::shadowNormalBias = 1.0f

How far the point moves off the surface before the compare, in shadow texels (0..4).

Along the surface's normal, by this times the sine of the light's angle to it: nothing head-on, all of it where the light grazes.

◆ shadowPriority

int Vkm::Engine::Light::shadowPriority = 0

Which lights keep a shadow when more cast than the atlas holds; higher first.

Among equals the nearest to the camera wins. Unread on a directional light: one always comes before any spot or point, and the lowest slot casts.

◆ sourceRadius

float Vkm::Engine::Light::sourceRadius = glm::radians(0.5f)

How large the light's source is, which is how soft its shadows are.

Directional: angular radius in radians (the sun is about 0.0047), also sizing its highlight. Spot and point: emitter radius in metres, sizing their highlight too (a sphere light). 0 is hard. The procedural sky draws the key light's sun at this size.

◆ flicker

float Vkm::Engine::Light::flicker = 0.0f

How deep the light wavers, as a fire's does: 0 holds it steady, 1 dips it to dark.

Shading alone, by the world's clock (flickerWave): the intensity stays what the scene saves and gameplay reads, and a probe or the irradiance volume bakes it steady. A directional light does not flicker.


The documentation for this struct was generated from the following file: