Menu - Top - Home - Donate to Me

H3DU.LightSource

Back to documentation index.

H3DU.LightSource([params], [ambient], [diffuse], [specular])

Specifies parameters for light sources.

NOTE: The default shader program assumes that all colors specified in this object are in companded sRGB.

Parameters

Members

Methods

H3DU.LightSource#ambient

A 4-element vector giving an additional color to multiply with the ambient color of each object, in the red, green, and blue components respectively. The default is (0,0,0,1), or black.

NOTE: This property is not used in the default shader program.

Default Value: "[0,0,0,1]"

H3DU.LightSource#diffuse

A 4-element vector giving an additional color to multiply with the diffuse or albedo color (base color) of each object, in the red, green, and blue components respectively. See also H3DU.PbrMaterial#albedo. Each component ranges from 0 to 1. The default is (1,1,1,1), or white.

Default Value: "[1,1,1,1]"

H3DU.LightSource#position

Light position. An array of four numbers, where the first three numbers are the X, Y, and Z components and the fourth number is the W component.

Default Value: "[0,0,1,0]"

H3DU.LightSource#radius

Radius of the light source. If 0, the light's intensity doesn't change with distance.

Default Value: 0

H3DU.LightSource#specular

A 3-element vector giving the color of the light when it causes a specular reflection, in the red, green, and blue components respectively. Each component ranges from 0 to 1. A specular reflection is a reflection in the opposite direction from the direction the light reaches the object in, like a mirror. Specular reflections can cause shiny highlights depending on the viewing angle. The default is (1,1,1), or white.

NOTE: The default shader uses this only for H3DU.Material, not for H3DU.PbrMaterial.

Default Value: "[1,1,1]"

H3DU.LightSource#setParams(params)

Sets parameters for this material object.

Parameters

Return Value

This object. (Type: H3DU.LightSource)

Back to documentation index.