Most visited

Recently visited

Light

public abstract class Light
extends Object

java.lang.Object
   ↳ com.viro.core.Light
Known Direct Subclasses
AmbientLight AmbientLight is a Light that emits ambient light that affects all objects equally, at constant intensity in all directions. 
DirectionalLight DirectionalLight is a Light that illuminates all objects in the Scene from the same direction with constant intensity. 
OmniLight OmniLight is a Light that emits light in all directions from a given position, with decreasing intensity over distance. 
Spotlight Spotlight is a Light that illuminates objects within a cone-shaped area, in a given direction, with decreasing intensity over distance. 


Light is a light source that illuminates Nodes in the Scene. Lights can be added to Nodes so they are part of the overall scene graph. The area each Light illuminates depends on its type, which is determined by the subclass of Light used. Spotlight, for example, illuminates a cone-shaped area; AmbientLight, on the other hand, illuminates everything in the Scene with a constant intensity.

The way in which a Light interacts with each surface of a Geometry to produce a color depends on the materials used by the Geometry, along with the properties of the Light itself. For more information see the Lighting and Materials guide.

Lights are performance intensive so it is recommended to use as few as possible, and only to light dynamic objects in the Scene. For static objects, it is better to use pre-generated lighting (e.g. baking the lighting into textures).

Summary

Nested classes

class Light.LightBuilder<R extends Light, B extends LightBuilder<R, B>>

LightBuilder abstract class for building subclasses of Light

Public methods

void dispose()

Release native resources associated with this Light.

long getColor()

Get the Color of this Light.

int getInfluenceBitMask()

Get the influence bit mask for this Light, which determines how it interacts with individual Nodes.

float getIntensity()

Return the intensity of this Light, which measures its brightness.

float getTemperature()

Get the temperature of the light, in Kelvin.

void setColor(long color)

Set the Color of this Light.

void setInfluenceBitMask(int bitMask)

This property is used to make Lights apply to specific Nodes.

void setIntensity(float intensity)

Set the intensity of this Light.

void setTemperature(float temperature)

Set the temperature of the light, in Kelvin.

Public methods

dispose

void dispose ()

Release native resources associated with this Light.

getColor

long getColor ()

Get the Color of this Light.

Returns
long The color.

getInfluenceBitMask

int getInfluenceBitMask ()

Get the influence bit mask for this Light, which determines how it interacts with individual Nodes. See setInfluenceBitMask(int) for more information.

Returns
int The influence bit mask.

getIntensity

float getIntensity ()

Return the intensity of this Light, which measures its brightness.

Returns
float The intensity of the light.

getTemperature

float getTemperature ()

Get the temperature of the light, in Kelvin.

Returns
float The temperature in Kelvin.

setColor

void setColor (long color)

Set the Color of this Light.

Parameters
color long: The color.

setInfluenceBitMask

void setInfluenceBitMask (int bitMask)

This property is used to make Lights apply to specific Nodes. Lights and Nodes in the Scene can be assigned bit-masks to determine how each Light influences each Node.

During rendering, Viro compares each Light's influenceBitMask with each node's lightReceivingBitMask and shadowCastingBitMask. The bit-masks are compared using a bitwise AND operation:

If (influenceBitMask & lightReceivingBitMask) != 0, then the Light will illuminate the Node (and the Node will receive shadows cast from objects occluding the Light).

If (influenceBitMask & shadowCastingBitMask) != 0, then the Node will cast shadows from the Light.

The default mask is 0x1.

Parameters
bitMask int: The bit mask to set.

setIntensity

void setIntensity (float intensity)

Set the intensity of this Light. Set to 1000 for normal intensity. When using physically-based rendering, this value is specified in Lumens. When using non-physical rendering, the intensity is simply divided by 1000 and multiplied by the Light's color.

Lower intensities will decrease the brightness of the light, and higher intensities will increase the brightness of the light.

Parameters
intensity float: The intensity of the Light.

setTemperature

void setTemperature (float temperature)

Set the temperature of the light, in Kelvin. Viro will derive a hue from this temperature and multiply it by the light's color (which can also be set, via setColor(long)). To model a physical light with a known temperature, you can leave color of this Light set to (1.0, 1.0, 1.0) and set its temperature only.

The default value for temperature is 6500K, which represents pure white light.

Parameters
temperature float: The temperature in Kelvin.

Hooray!