Using common lighting features
All lights have several common fields:
- on - turn it on or off
- intensity - control brightness
- ambientIntensity - control ambient effect
- color - select color
Point lights and spot lights also have:
- location - position
- radius - maximum lighting distance
- attenuation - drop off with distance
Directional lights and spot lights also have:
- direction - aim direction
Syntax: PointLight
A PointLight node illuminates radially from a point:
XML Encoding
1 2 3 4 |
<PointLight location='0.0 0.0 0.0' intensity='1.0' color='1.0 1.0 1.0'/> |
Classic Encoding
1 2 3 4 5 |
PointLight { location 0.0 0.0 0.0 intensity 1.0 color 1.0 1.0 1.0 } |
Syntax: DirectionalLight
A DirectionalLight node illuminates in one direction from infinitely far away:
XML Encoding
1 2 3 4 |
<DirectionalLight direction='1.0 0.0 0.0' intensity='1.0' color='1.0 1.0 1.0'/> |
Classic Encoding
1 2 3 4 5 |
DirectionalLight { direction 1.0 0.0 0.0 intensity 1.0 color 1.0 1.0 1.0 } |
Syntax: SpotLight
A SpotLight node illuminates from a point, in one direction, within a cone:
XML Encoding
1 2 3 4 5 6 |
<SpotLight location='0.0 0.0 0.0' direction='1.0 0.0 0.0' intensity='1.0' color='1.0 1.0 1.0' cutOffAngle='0.785'/> |
Classic Encoding
1 2 3 4 5 6 7 |
SpotLight { location 0.0 0.0 0.0 direction 1.0 0.0 0.0 intensity 1.0 color 1.0 1.0 1.0 cutOffAngle 0.785 } |
- The maximum width of a spot light's cone is controlled by the cutOffAngle field
- An inner cone region with constant brightness is controlled by the beamWidth field
XML Encoding
1 2 3 4 |
<SpotLight ... cutOffAngle='0.785' beamWidth='0.52'/> |
Classic Encoding
1 2 3 4 5 |
SpotLight { ... cutOffAngle 0.785 beamWidth 0.52 } |