blendify.lights package#

Submodules#

blendify.lights.area module#

class blendify.lights.area.AreaLight(color: Union[ndarray, Tuple[float, float, float]], strength: float, tag: str, cast_shadows: bool = True, **kwargs)[source]#

Bases: Light

Base class for different AreaLights varying in shape.

class blendify.lights.area.CircleAreaLight(size: float, **kwargs)[source]#

Bases: AreaLight

property size: float#
class blendify.lights.area.EllipseAreaLight(size: Union[ndarray, Tuple[float, float]], **kwargs)[source]#

Bases: AreaLight

property size: ndarray#
class blendify.lights.area.RectangleAreaLight(size: Union[ndarray, Tuple[float, float]], **kwargs)[source]#

Bases: AreaLight

property size: ndarray#
class blendify.lights.area.SquareAreaLight(size: float, **kwargs)[source]#

Bases: AreaLight

property size: float#

blendify.lights.base module#

class blendify.lights.base.Light(**kwargs)[source]#

Bases: Positionable

Abstract base class for all the light sources.

property blender_light: Object#
property cast_shadows: bool#
property color: ndarray#
property max_bounces: int#
property strength: float#

blendify.lights.collection module#

class blendify.lights.collection.LightsCollection(*args, **kwargs)[source]#

Bases: object

add_area(shape: str, size: Union[float, ndarray, Tuple[float, float]], strength: float = 100, color: Union[ndarray, Tuple[float, float, float]] = (1.0, 1.0, 1.0), cast_shadows=True, quaternion: Union[ndarray, Tuple[float, float, float, float]] = (1, 0, 0, 0), translation: Union[ndarray, Tuple[float, float, float]] = (0, 0, 0), tag: Optional[str] = None) AreaLight[source]#

Add AreaLight light source to the scene. Shape of the area is controlled by shape parameter

Parameters:
  • shape (str) – type of the AreaLight, one of: [square, circle, rectangle, ellipse]

  • size (Union[float, Vector2d]) – size of the area of the area light for circle and square or [x, y] sizes of the area light for rectangle and ellipse

  • strength (float, optional) – strength of the light source emitted over the entire area of the light in all directions (default: 100)

  • color (Vector3d, optional) – color of the light source (default: (1.0, 1.0, 1.0))

  • cast_shadows (bool, optional) – whether the light source casts shadows or not (default: True)

  • quaternion (Vector4d, optional) – rotation applied to the Blender object (default: (1,0,0,0))

  • translation (Vector3d, optional) – translation applied to the Blender object (default: (0,0,0))

  • tag (str, optional) – name of the created collection in Blender to represent the point cloud. If None is passed the tag is automatically generated (default: None)

Returns:

subclass of AreaLight (depending on shape), created and added to the scene

Return type:

AreaLight

add_point(strength: float = 100, shadow_soft_size: float = 0.25, color: Union[ndarray, Tuple[float, float, float]] = (1.0, 1.0, 1.0), cast_shadows=True, quaternion: Union[ndarray, Tuple[float, float, float, float]] = (1, 0, 0, 0), translation: Union[ndarray, Tuple[float, float, float]] = (0, 0, 0), tag=None) PointLight[source]#

Add PointLight light source to the scene

Parameters:
  • strength (float, optional) – strength of the light source emitted over the entire area of the light in all directions (default: 100)

  • shadow_soft_size (float, optional) – light size for ray shadow sampling (Raytraced shadows) in [0, inf] (default: 0.25)

  • color (Vector3d, optional) – color of the light source (default: (1.0, 1.0, 1.0))

  • cast_shadows (bool, optional) – whether the light source casts shadows or not (default: True)

  • quaternion (Vector4d, optional) – rotation applied to the Blender object (default: (1,0,0,0))

  • translation (Vector3d, optional) – translation applied to the Blender object (default: (0,0,0))

  • tag (str, optional) – name of the created collection in Blender to represent the point cloud. If None is passed the tag is automatically generated (default: None)

Returns:

created and added to the scene object

Return type:

PointLight

add_spot(strength: float = 100, spot_size: float = 0.785398, spot_blend: float = 0.15, shadow_soft_size: float = 0.25, color: Union[ndarray, Tuple[float, float, float]] = (1.0, 1.0, 1.0), cast_shadows=True, quaternion: Union[ndarray, Tuple[float, float, float, float]] = (1, 0, 0, 0), translation: Union[ndarray, Tuple[float, float, float]] = (0, 0, 0), tag=None) SpotLight[source]#

Add SpotLight light source to the scene

Parameters:
  • strength (float, optional) – strength of the light source that light would emit over its entire area if it wasn’t limited by the spot angle (default: 100)

  • spot_size (float, optional) – angle of the spotlight beam in [0.0174533, 3.14159] (default: 0.785398)

  • spot_blend (float, optional) – the softness of the spotlight edge in [0, 1] (default: 0.15)

  • shadow_soft_size (float, optional) – light size for ray shadow sampling (Raytraced shadows) in [0, inf] (default: 0.25)

  • color (Vector3d, optional) – color of the light source (default: (1.0, 1.0, 1.0))

  • cast_shadows (bool, optional) – whether the light source casts shadows or not (default: True)

  • quaternion (Vector4d, optional) – rotation applied to the Blender object (default: (1,0,0,0))

  • translation (Vector3d, optional) – translation applied to the Blender object (default: (0,0,0))

  • tag (str, optional) – name of the created collection in Blender to represent the point cloud. If None is passed the tag is automatically generated (default: None)

Returns:

created and added to the scene object

Return type:

SpotLight

add_sun(strength: float = 10, angular_diameter: float = 0.00918043, color: Union[ndarray, Tuple[float, float, float]] = (1.0, 1.0, 1.0), cast_shadows=True, quaternion: Union[ndarray, Tuple[float, float, float, float]] = (1, 0, 0, 0), translation: Union[ndarray, Tuple[float, float, float]] = (0, 0, 0), tag=None) DirectionalLight[source]#

Add DirectionalLight light source to the scene

Parameters:
  • strength (float, optional) – strength of the light source in watts per meter squared (W/m^2) (default: 100)

  • angular_diameter (float, optional) – angular diameter of the Sun as seen from the Earth in [0, 3.14159] (default: 0.00918043)

  • color (Vector3d, optional) – color of the light source (default: (1.0, 1.0, 1.0))

  • cast_shadows (bool, optional) – whether the light source casts shadows or not (default: True)

  • quaternion (Vector4d, optional) – rotation applied to the Blender object (default: (1,0,0,0))

  • translation (Vector3d, optional) – translation applied to the Blender object (default: (0,0,0))

  • tag (str, optional) – name of the created collection in Blender to represent the point cloud. If None is passed the tag is automatically generated (default: None)

Returns:

created and added to the scene object

Return type:

DirectionalLight

items()[source]#
keys()[source]#
remove(obj_or_tag: Union[Light, str])[source]#
values()[source]#

blendify.lights.common module#

class blendify.lights.common.DirectionalLight(strength: float, angular_diameter: float, color: Union[ndarray, Tuple[float, float, float]], tag: str, cast_shadows: bool = True, **kwargs)[source]#

Bases: Light

property angular_diameter: float#
class blendify.lights.common.PointLight(strength: float, shadow_soft_size: float, color: Union[ndarray, Tuple[float, float, float]], tag: str, cast_shadows: bool = True, **kwargs)[source]#

Bases: Light

property shadow_soft_size: float#
class blendify.lights.common.SpotLight(strength: float, spot_size: float, spot_blend: float, color: Union[ndarray, Tuple[float, float, float]], shadow_soft_size: float, tag: str, cast_shadows: bool = True, **kwargs)[source]#

Bases: Light

property shadow_soft_size: float#
property spot_blend: float#
property spot_size: float#

Module contents#