Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
0.8.4:lights [2022/07/20 13:57] – [Point Light] admin0.8.4:lights [2022/07/22 12:55] (current) – [Multiple Lights] admin
Line 9: Line 9:
 You can select the light components from IDE components palette or create them at runtime. 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^
 +|Ambient|Get or set the ambient part of light color.|
 +|Specular|Get or set the specular part of light color.|
 +|Intensity|Control the power / intensity of the light computation.|
 +|ConstantAttenuation|A constant factor applied to the attenuation of a light. By default this value is set to 1.0.|
 +|LinearAttenuation|A linear factor applied to the attenuation of a light. By default this value is set to 0.0.|
 +|QuadraticAttenuation|A quadratic factor applied to the attenuation of a light. By default this value is set to 0.0.|
 ===== Types ===== ===== Types =====
  
Line 17: Line 29:
 ^LightType ^Description ^ ^LightType ^Description ^
 |TLightType.Directional|A 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.| |TLightType.Directional|A 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.|
 +
 +{{:0.8.4:light_casters_directional.png?nolink|}}
 +
 +[[https://learnopengl.com/Lighting/Light-casters]]
  
 <file pascal> <file pascal>
Line 30: Line 46:
 ^LightType ^Description ^ ^LightType ^Description ^
 |TLightType.Point|A 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.| |TLightType.Point|A 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.|
 +
 +{{:0.8.4:light_casters_point.png?nolink|}}
 +
 +[[https://learnopengl.com/Lighting/Light-casters]]
  
 <file pascal> <file pascal>
Line 43: Line 63:
 ^LightType ^Description ^ ^LightType ^Description ^
 |TLightType.Spot|This light gets emitted from a single point in one direction, along a cone that increases in size the further from the light it gets.| |TLightType.Spot|This light gets emitted from a single point in one direction, along a cone that increases in size the further from the light it gets.|
 +
 +{{:0.8.4:light_casters_spotlight_angles.png?nolink|}}
 +
 +[[https://learnopengl.com/Lighting/Light-casters]]
 +
 +Take care of some additional properties to configure, when using spot lights.
 +
 +^Property ^Description^
 +|SpotCutOff|Represents the spot cutoff angle (in degrees) of this TLight.|
 +|SpotExponent|Specifies the intensity distribution of the light.|
 +
 +{{:0.8.4:spotlight.jpg?nolink|}}
 +
 +[[https://subscription.packtpub.com/book/game-development/9781849695046/4/ch04lvl1sec35/implementing-per-fragment-spot-light]]
 +
 +<file pascal>
 +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;
 +</file>
 ===== Multiple Lights ===== ===== Multiple Lights =====
  
-We support multiple light sources depending on which platform (Windows/Android) is used.+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^ ^Platform ^Lights-Limit^
Line 53: Line 103:
 |Android 64-Bit| 8 | |Android 64-Bit| 8 |
  
 +Next step: [[terrain|Terrain]]