-
Notifications
You must be signed in to change notification settings - Fork 1
Light
Josh Stovall edited this page Dec 21, 2020
·
8 revisions
Create a light.
See the live demo.
var options = {
type: "ambient",
color: 0xFF0000,
intensity: 1,
distance: 100,
decay: 1
}
var light = new XR.Light(options);
Name | Type | Options | Default | Description |
---|---|---|---|---|
type |
string |
ambient directional hemisphere point rect spot
|
point |
type of light |
angle |
float | 1 |
Maximum angle of light dispersion from its direction whose upper bound is Math.PI/2 (makes spotlight wider) | |
color |
color | white |
light color | |
decay |
float |
0 to 1
|
0 |
The amount the light dims along the distance of the light |
distance |
int | > 0
|
0 |
Maximum range of the light |
helper |
bool | false |
add a helper | |
intensity |
float |
0 to 1
|
1 |
The light's intensity, or strength |
penumbra |
float |
0 to 1
|
1 |
makes edges softer |
position |
array | xyz coordinates | [0,0,0] |
position of light |
width |
float | 1 |
width (for rect lights) | |
height |
float | 1 |
height (for rect lights) |
Type of light.
-
ambient
globally illuminates all objects in the reality equally -
directional
emitted in a specific direction (like the sun) -
hemisphere
positioned directly above the scene, with color fading from the sky color to the ground color -
point
emitted from a single point in all directions (like a lightbulb) -
rect
emits light uniformly across the face a rectangular plane (like a window or ceiling panel light) -
spot
emitted from a single point in one direction (like a flashlight)
Color of the light.
The light's intensity, or strength.
Maximum range of the light. Default is 0 (no limit).
The amount the light dims along the distance of the light
Adds a light helper. Useful for debugging.