Environment
Environment lighting properties
- Environment
- .constructor(scene) ⇒ Environment
- .coefficients
- .intensity
- .tint
- .getCoefficients<T>(out) ⇒ T
- .getTint<T>(out) ⇒ T
- .setCoefficients(v) ⇒ void
- .setTint(v) ⇒ void
.constructor(scene: Scene) ⇒ Environment
Constructor
Param | Type | Description |
---|---|---|
scene | Scene |
.coefficients: Float32Array
Equivalent to getCoefficients.
Note: Prefer to use getCoefficients for performance.
.coefficients
Equivalent to setCoefficients.
.intensity: number
Get intensity of environment lighting.
Incoming environment lighting is multiplied by this factor.
.intensity
Set intensity of environment lighting.
.tint: Float32Array
Equivalent to getTint.
Note: Prefer to use getTint for performance.
.tint
Equivalent to setTint.
.getCoefficients<T>(out: T) ⇒ T
.getCoefficients() ⇒ Float32Array
Get spherical harmonics coefficients for indirect lighting.
These are 9 spherical harmonics coefficients for indirect diffuse lighting.
Returns: Spherical harmonics coefficients. Always 27 elements, every consecutive 3 values representing the red, green, blue components of a single coefficient. Unused/empty coefficients at the end can be 0.
Param | Type | Description |
---|---|---|
out | T | Preallocated array to write into, to avoid garbage, otherwise will allocate a new Float32Array. |
Template Param | Type Definition |
---|---|
T | extends NumberArray |
.getTint<T>(out: T) ⇒ T
.getTint() ⇒ Float32Array
Get tint for environment lighting.
Incoming environment lighting color channels are multiplied by these values.
Returns: Tint values - red, green, blue.
Param | Type | Description |
---|---|---|
out | T | Preallocated array to write into, to avoid garbage, otherwise will allocate a new Float32Array. |
Template Param | Type Definition |
---|---|
T | extends NumberArray |
.setCoefficients(v: Readonly<NumberArray>) ⇒ void
Set spherical harmonics coefficients for indirect lighting.
Note: The scene must have been packaged with environment lighting on for this to take effect.
Example: Coefficients from WebXR Lighting Estimation can be passed as follows:
Param | Type | Description |
---|---|---|
v | Readonly<NumberArray> | A set of spherical harmonics coefficients, every 3 elements constituting the red/green/blue components of a single coefficient. Should be 0, 3, 12 or 27 array elements. Passing an empty array disables indirect lighting. |
.setTint(v: Readonly<NumberArray>) ⇒ void
Set tint for environment lighting.
Param | Type | Description |
---|---|---|
v | Readonly<NumberArray> | New tint value. Expects a 3 component array. |