This is the technical documentation for Tangram’s lights. For a conceptual overview of the lighting system, see the Lights Overview.
The lights
element is a top-level element in the scene file. Individual lights are defined by a light name under this element.
lights:
mainlight:
type: directional
Required string. Can be anything*. No default.
lights:
light1:
type: ambient
directionalLight:
type: directional
point-light:
type: point
- For technical reasons, hyphens in light names are converted to underscores internally. Thus "light-1" becomes "light_1". For this reason, you may not have two lights whose names are identical except for a hyphen in one case and an underscore in the same place in the other (eg "light-1" and "light_1"a) as they will be interpreted as the same name.
Required string. One of ambient
, directional
, point
, or spotlight
. No default.
lights:
light1:
type: ambient
light2:
type: directional
light3:
type: point
light4:
type: spotlight
Optional parameter. number, [R, G, B]
, hex-color, or css color name. Numerical values go from 0
to 1
. Defaults to 0
.
light1:
type: point
diffuse: white
ambient: .3
Optional parameter. number, [R, G, B]
, hex-color, or css color name. Numerical values go from 0
to 1
. Defaults to 1
.
light1:
type: point
diffuse: white
Optional parameter. number, [R, G, B]
, hex-color, or css color name. Numerical values go from 0
to 1
. Default is 0
.
light1:
type: directional
direction: [0, 1, -.5]
diffuse: white
specular: ‘#FFFF99’
Optional Boolean. Default is true
.
Allows a defined light to be disabled or enabled through the JavaScript API.
light1:
type: point
visible: false
Required vector. [x, y, z]
. Defaults to [0.2, 0.7, -0.5]
light1:
type: directional
direction: [0, 1, -.5]
Required vector [x, y, z]
, [lat, long], or { lat: number, lng: number }. Vectors may be specified in meters m
or pixels px
, depending on the value of origin
. [lat, long]s may be specified as lists or objects of the format { lat: number, lng: number}. No default value. Default unit for vectors are m
.
lights:
cameralight:
type: point
position: [0px, 0px, -700px]
origin: camera
worldlight-ground:
type: point
position: [ 0m, 100m, 500m ]
origin: ground
worldlight-world:
type: point
position: [-74.00976419448853, 40.70531887544228, 500m]
origin: world
Optional string, one of world
, camera
, or ground
. Defaults to world
.
Sets the reference point for the position
parameter:
world
: sets x and y in [lat, lng] and z inm
from the groundcamera
: sets x and y inpx
from the camera center, and z inm
from the cameraground
: sets x and y inpx
from the camera center, and z inm
from the ground
light1:
type: point
position: [0px, 0px, 300px]
origin: ground
Optional number or [inner_radius, outer_radius]
. Assumes units of meters m
. Defaults to null
.
If only a single number is set, it defines the outer radius, and the inner radius is set to 0
.
light1:
type: point
diffuse: white
radius: [300,700]
Optional number. Defaults to 1
.
Sets the exponent of the attenuation function, which is applied between the inner and outer radius
values.
light1:
type: point
radius: [300,700]
attenuation: 0.2
This is the same as the directional light's direction property.
This is the same as the point light's position property.
This is the same as the point light's origin property.
This is the same as the point light's radius property.
This is the same as the point light's attenuation property.
Optional number, in degrees. Defaults to 20
.
Sets the width of the spotlight's beam.
light1:
type: spotlight
direction: [0, 1, -.5]
position: [0, 0, 300]
origin: ground
radius: 700
angle: 45
Optional number. Defaults to 0.2
.
This parameter sets the exponent of the spotlight's fallof, from the center of the beam to the edges. Higher values will give a sharper spotlight.
light1:
type: spotlight
direction: [0, 1, -.5]
position: [0, 0, 300]
origin: ground
diffuse: white
ambient: .3
radius: 700
attenuation: 0.2
angle: 45
exponent: 10.