Page Summary
-
Light.Builderis a factory class used to create and customizeLightobjects in Sceneform. -
It provides methods to set light properties such as color, intensity, falloff radius, and cone angles for spotlights.
-
You can also control whether a light casts shadows using the
setShadowCastingEnabledmethod. -
After configuring the desired properties, call the
build()method to create a newLightinstance.
Factory class for Light
Public Methods
| Light | |
| Light.Builder | |
| Light.Builder | setColorTemperature
(float temperature)
Sets the "RGB" color of the light based on the desired "color temperature."
|
| Light.Builder | |
| Light.Builder | setInnerConeAngle
(float coneInner)
Spotlights shine light in a cone, this value determines the size of the inner part of the
cone.
|
| Light.Builder | setIntensity
(float intensity)
Sets the light intensity which determines how bright the light is in Lux (lx) or Lumens (lm)
(depending on the light type).
|
| Light.Builder | setOuterConeAngle
(float coneOuter)
Spotlights shine light in a cone, this value determines the size of the outer part of the
cone.
|
| Light.Builder | setShadowCastingEnabled
(boolean enableShadows)
Determines whether the light casts shadows, or whether synthetic objects can block the light.
|
Inherited Methods
Public Methods
public Light.Builder setColor ( Color color)
Sets the "RGB" color of the light. Note that intensity if is a separate parameter, so you should set the pure color (i.e. each channel is in the [0,1] range). However setting values outside that range is valid.
Parameters
public Light.Builder setColorTemperature (float temperature)
Sets the "RGB" color of the light based on the desired "color temperature."
Parameters
public Light.Builder setFalloffRadius (float falloffRadius)
Sets the range that the light intensity falls off to zero. This has no affect on infinite light types - the Directional types.
Parameters
public Light.Builder setInnerConeAngle (float coneInner)
Spotlights shine light in a cone, this value determines the size of the inner part of the cone. The intensity is interpolated between the inner and outer cone angles - meaning if they are the same than the cone is perfectly sharp. Generally you will want the inner cone to be smaller than the outer cone to avoid aliasing.
Parameters
public Light.Builder setIntensity (float intensity)
Sets the light intensity which determines how bright the light is in Lux (lx) or Lumens (lm) (depending on the light type). Larger values produce brighter lights and near zero values generate very little light. A household light bulb will generally have an intensity between 800 - 2500 lm whereas sunlight will be around 120,000 lx. There is no absolute upper bound but values larger than sunlight (120,000 lx) are generally not needed.
Parameters
public Light.Builder setOuterConeAngle (float coneOuter)
Spotlights shine light in a cone, this value determines the size of the outer part of the cone. The intensity is interpolated between the inner and outer cone angles - meaning if they are the same than the cone is perfectly sharp. Generally you will want the inner cone to be smaller than the outer cone to avoid aliasing.
Parameters
public Light.Builder setShadowCastingEnabled (boolean enableShadows)
Determines whether the light casts shadows, or whether synthetic objects can block the light.

