Table of Contents

Class LightSource

Namespace
OmegaEngine.Graphics.LightSources
Assembly
OmegaEngine.dll

A light source that illuminates PositionableRenderables in a Scene.

public abstract class LightSource
Inheritance
object
LightSource
Derived

Properties

Ambient

The ambient color this light source emits

public Color Ambient { get; set; }

Property Value

Color

Diffuse

The diffuse color this light source emits

public Color Diffuse { get; set; }

Property Value

Color

Enabled

Shall the light source affect its surroundings?

public bool Enabled { get; set; }

Property Value

bool

MaxShadowRange

The maximum distance between shadow casters and receivers to consider.

public float MaxShadowRange { get; set; }

Property Value

float

Remarks

Lower values can improve performance by excluding distant shadow casters.

Name

Text value to make it easier to identify a particular camera

public string? Name { get; set; }

Property Value

string

SourceRadius

The radius of the body emitting the light.

public float SourceRadius { get; set; }

Property Value

float

Remarks

Used to taper shadow volumes into umbra cones surrounded by penumbras. 0 for an idealized point source, whose shadow volumes never converge.

Specular

The specular color this light source emits

public Color Specular { get; set; }

Property Value

Color

Methods

GetShadowFactor(BoundingSphere, Ray, float)

Calculates the shadow intensity.

protected static float GetShadowFactor(BoundingSphere receiverSphere, Ray shadowRay, float shadowRadius)

Parameters

receiverSphere BoundingSphere

Bounding sphere of the shadow receiver in floating world space.

shadowRay Ray

Ray pointing from the light source to the shadow caster in floating world space.

shadowRadius float

The radius of the shadow at the shadow receiver.

Returns

float

A value from 0 (fully lit) to 1 (fully shadowed).

GetShadowFactor(BoundingSphere, Ray, float, float, float)

Calculates the shadow intensity, tapering the shadow volume into an umbra cone surrounded by a penumbra.

protected float GetShadowFactor(BoundingSphere receiverSphere, Ray shadowRay, float casterRadius, float sourceDistance, float projectionDistance)

Parameters

receiverSphere BoundingSphere

Bounding sphere of the shadow receiver in floating world space.

shadowRay Ray

Ray pointing from the light source to the shadow caster in floating world space.

casterRadius float

The radius of the shadow caster.

sourceDistance float

The distance from the light source to the shadow caster; PositiveInfinity for an idealized parallel source.

projectionDistance float

The distance from the shadow caster to the shadow receiver, projected onto the light direction.

Returns

float

A value from 0 (fully lit) to 1 (fully shadowed).

Remarks

The penumbra is applied as a linear blend rather than an occlusion area computation, so it darkens uniformly instead of fading towards its outer edge.

GetShadowed(BoundingSphere, BoundingSphere)

Creates a copy of this light source with simple shadowing applied.

[Pure]
public abstract LightSource GetShadowed(BoundingSphere receiverSphere, BoundingSphere casterSphere)

Parameters

receiverSphere BoundingSphere

The bounding sphere of the shadow receiver in world space.

casterSphere BoundingSphere

The bounding sphere of the shadow caster in world space.

Returns

LightSource

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

See Also