Lights

The framework support the default Firemonkey TLight and the TGorillaLight component. Both components work almost the same currently, but in the future they could differ significantly.

If lights are loaded from files like FBX, DAE or G3D the framework will create instances of TGorillaLight and link the TLightDef definition in the Def property of the light source.

You can select the light components from IDE components palette or create them at runtime.

Extended Properties

NOTICE: Because TGorillaLight is a component for future implementation, we provide new properties, which have no effect yet, due to restrictions inside of the Firemonkey framework.

Property Description
AmbientGet or set the ambient part of light color.
SpecularGet or set the specular part of light color.
IntensityControl the power / intensity of the light computation.
ConstantAttenuationA constant factor applied to the attenuation of a light. By default this value is set to 1.0.
LinearAttenuationA linear factor applied to the attenuation of a light. By default this value is set to 0.0.
QuadraticAttenuationA quadratic factor applied to the attenuation of a light. By default this value is set to 0.0.

Types

The framework currently only supports the default light types provided by Firemonkey framework, but we will extend this functionality in future. So it is recommended to prefer TGorillaLight component instead of the basic TLight component.

Directional Light

LightType Description
TLightType.DirectionalA light that gets emitted in a specific direction. This light will behave as though it is infinitely far away and the rays produced from it are all parallel. The common use case for this is to simulate daylight; the sun is far enough away that its position can be considered to be infinite, and all light rays coming from it are parallel.

https://learnopengl.com/Lighting/Light-casters

var FLight : TGorillaLight;
 
FLight := TGorillaLight.Create(GorillaViewport1);
FLight.Parent : GorillaViewport1;
FLight.LightType := TLightType.Directional;
FLight.RotationAngle.X := -45;

Point Light

LightType Description
TLightType.PointA light that gets emitted from a single point in all directions. A common use case for this is to replicate the light emitted from a bare lightbulb.

https://learnopengl.com/Lighting/Light-casters

var FLight : TGorillaLight;
 
FLight := TGorillaLight.Create(GorillaViewport1);
FLight.Parent : GorillaViewport1;
FLight.LightType := TLightType.Point;
FLight.Position.Point := Point3D(0, -25, -10);

Spot Light

LightType Description
TLightType.SpotThis light gets emitted from a single point in one direction, along a cone that increases in size the further from the light it gets.

https://learnopengl.com/Lighting/Light-casters

Take care of some additional properties to configure, when using spot lights.

Property Description
SpotCutOffRepresents the spot cutoff angle (in degrees) of this TLight.
SpotExponentSpecifies the intensity distribution of the light.

https://subscription.packtpub.com/book/game-development/9781849695046/4/ch04lvl1sec35/implementing-per-fragment-spot-light

var FLight : TGorillaLight;
 
FLight := TGorillaLight.Create(GorillaViewport1);
FLight.Parent : GorillaViewport1;
FLight.LightType := TLightType.Spot;
FLight.Position.Point := Point3D(0, -10, -1);
 
/// Notice: Import to set the correct rotation angle.
FLight.RotationAngle.X := -90;
 
/// Configure the spotlight shadow and lighting
FLight.SpotCutOff := 180;
FLight.SpotExponent := 40;

Multiple Lights

We support multiple light sources in our TGorillaDefaultMaterialSource component and all of its descendants, depending on which platform (Windows/Android) is used.

Platform Lights-Limit
Windows 32-Bit 32
Windows 64-Bit 32
Android 32-Bit 8
Android 64-Bit 8

Next step: Terrain