Documentation/Entity Types/Base/Light.type
From NeoAxis Engine Wiki
| Language: | Status: | Approved |
Contents |
Lights
Light is a Base Entity Type and it's purpose is to light your scene. Without lights there are no shadows and the whole scene looks flat and unnatural. This article will show how to add a light, describe light's properties and show three different light types.
Adding and positioning a light
To Add a light to your map, go to Entity Types window, and select Light under Types -> Base rollout. Place the light source on your map in desired position. You will be able to adjust it later on. Hit Esc or click on any folder to stop adding the Light objects.
To change the light position, rotation or scale, select it, by clicking on it on the map or from the list in Map Entities window on the right hand side of your screen. There are two ways to change these paramteres - you can use tools from the toolbar (Select and Move, Select and Rotate, Select and Scale) or enter desired values in Map Object rollout in Properties window. Size of value 300 300 300 corresponds to the size of sun.
Repositioning the light will have immediate effect on shadows (if the light is set to cast shadows), you will be able to see it in the map editor window.
Light Properties
Apart from Position, Rotation and Scale, there are other properties that let you characterize the light source.
| Property name | Description |
|---|---|
| AllowDynamicLightning | Setting this to False will disable this light. |
| AllowStaticLightning | Used for static lightning calculation - lightmaps (StaticLightingManager.type). |
| AttenuationConstant | This is a kind of multiplier that influences all attenuation settings. |
| AttenuationLinear | This setting defines how light dimnishes with distance. It uses a linear function. |
| AttenuationQuadric | This setting defines how light dimnishes with distance. It uses a quadric function. |
| AttenuationRange | This setting defines what is the attenuation range. |
| AttenuationRangeAutomatic | Allows to automatically calculate the attenuation range for your light. |
| CastShadows | Set to True to have the light cast shadows. |
| DiffuseColor | Light color. Values from 0 to 255 in RGBA colorspace. |
| DiffusePower | This value defines how bright is the light's diffuse color. |
| LightType | Point, Directional or Spot. See Section X of this article for examples. |
| SpecularColor | If illuminated object(s) has specular color or map, this parameter will alter the object's specular color. Values range from 0 to 255 in RGBA colorspace. |
| SpecularPower | Defines how strong will be the specularity of illuminated object(s).Values range from 1 to 10. |
| SpotlightFalloff | This value defines how soft are edges of the light. The higher value the softer are the edges, maximum value is 1. This works only for Spot light type. |
| SpotlightInnerAngle | This value sets the width of the inner ray of light - how much is the light focused around the ray's center. The difference will only be seen if SpotlightFalloff is set higher than minimum value. Also, if SpotlightInnerAngle has the same value as SpotlightOuterAngle, the effect will be similar to when SpotlightFallOff is set to minimum. |
| SpotlightOuterAngle | This is used to set how wide is the ray of light. Values are in range from 0 to 180, where 180 is the widest. |
Light Types
There are three light types available:
- Spot
- Point
- Directional
Spot Light
Spot light works like a torchlight - it casts light in a defined direction and allows to see the divergence of rays. It can be used in all sorts of lamps
Point Light
Point light shines in all directions from its center and fades away in a set distance. Can be used to illuminate the individual scenes, such as lampposts.
Directional Light
Directional light illuminates evenly the entire map, and it can be placed anywhere, as objects don't influence its behaviour. It can be compared to sunlight.