blenderproc.python.types.LightUtility module

class blenderproc.python.types.LightUtility.Light(type='POINT', name='light', blender_obj=None)[source]

Bases: blenderproc.python.types.EntityUtility.Entity

get_color(frame=None)[source]

Returns the RGB color of the light.

Parameters:frame (Optional[int]) – The frame number at which the value should be returned. If None is given, the current frame number is used.
Return type:Color
Returns:The color at the specified frame.
get_distance(frame=None)[source]

Returns the falloff distance of the light (point where light is half the original intensity).

Parameters:frame (Optional[int]) – The frame number at which the value should be returned. If None is given, the current frame number is used.
Return type:float
Returns:The falloff distance at the specified frame.
get_energy(frame=None)[source]

Returns the energy of the light.

Parameters:frame (Optional[int]) – The frame number at which the value should be returned. If None is given, the current frame number is used.
Return type:float
Returns:The energy at the specified frame.
get_type(frame=None)[source]

Returns the type of the light.

Parameters:frame (Optional[int]) – The frame number at which the value should be returned. If None is given, the current frame number is used.
Return type:str
Returns:The type at the specified frame.
set_color(color, frame=None)[source]

Sets the color of the light.

Parameters:
  • color (Union[list, Color]) – The rgb color to set.
  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.
set_distance(distance, frame=None)[source]

Sets the falloff distance of the light = point where light is half the original intensity.

Parameters:
  • distance (float) – The falloff distance to set.
  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.
set_energy(energy, frame=None)[source]

Sets the energy of the light.

Parameters:
  • energy (float) – The energy to set. If the type is SUN this value is interpreted as Watt per square meter, otherwise it is interpreted as Watt.
  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.
set_type(type, frame=None)[source]

Sets the type of the light.

Parameters:
  • type (str) – The type to set, can be one of [POINT, SUN, SPOT, AREA].
  • frame (Optional[int]) – The frame number which the value should be set to. If None is given, the current frame number is used.
setup_as_projector(pattern, frame=None)[source]
Sets a spot light source as projector of a pattern image. Sets location and angle of projector to current
camera. Adjusts scale of pattern image to fit field-of-view of camera: $(0.5 +

rac{X}{Z cdot F}, 0.5 + rac{X}{Z cdot F cdot r}, 0)$

where $F$ is focal length and $r$ aspect ratio. WARNING: This should be done after the camera parameters are set!

param pattern:pattern image to be projected onto scene as np.ndarray.
param frame:The frame number which the value should be set to. If None is given, the current frame number is used.