blendify.lights package

Submodules

blendify.lights.area module

class blendify.lights.area.AreaLight(color: 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: ndarray | Tuple[float, float], **kwargs)[source]

Bases: AreaLight

property size: ndarray
class blendify.lights.area.RectangleAreaLight(size: 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: float | ndarray | Tuple[float, float], strength: float = 100, color: ndarray | Tuple[float, float, float] = (1.0, 1.0, 1.0), cast_shadows=True, rotation_mode: str = 'quaternionWXYZ', rotation: ndarray | Tuple[float, float, float, float] | Tuple[float, float, float] | Tuple[Tuple[float, float, float], Tuple[float, float, float], Tuple[float, float, float]] | Positionable | Tuple[ndarray | Tuple[float, float, float], float] | Tuple[Positionable, float] = None, translation: ndarray | Tuple[float, float, float] = (0, 0, 0), tag: 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)

  • rotation_mode (str) – type of rotation representation. Can be one of the following: - “quaternionWXYZ” - WXYZ quaternion - “quaternionXYZW” - XYZW quaternion - “rotvec” - axis-angle representation of rotation - “rotmat” - 3x3 rotation matrix - “euler<mode>” - Euler angles with the specified order of rotation, e.g. XYZ, xyz, ZXZ, etc. Refer to scipy.spatial.transform.Rotation.from_euler for details. - “look_at” - look at rotation, the rotation is defined by the point to look at and, optional, the rotation around the forward direction vector (a single float value in tuple or list)

  • rotation (RotationParams) – rotation parameters according to the rotation_mode - for “quaternionWXYZ” and “quaternionXYZW” - Vec4d - for “rotvec” - Vec3d - for “rotmat” - Mat3x3 - for “euler<mode>” - Vec3d - for “look_at” - Vec3d, Positionable or Tuple[Vec3d/Positionable, float], where float is the rotation around the forward direction vector in degrees

  • 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: ndarray | Tuple[float, float, float] = (1.0, 1.0, 1.0), cast_shadows=True, rotation_mode: str = 'quaternionWXYZ', rotation: ndarray | Tuple[float, float, float, float] | Tuple[float, float, float] | Tuple[Tuple[float, float, float], Tuple[float, float, float], Tuple[float, float, float]] | Positionable | Tuple[ndarray | Tuple[float, float, float], float] | Tuple[Positionable, float] = None, translation: 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)

  • rotation_mode (str) – type of rotation representation. Can be one of the following: - “quaternionWXYZ” - WXYZ quaternion - “quaternionXYZW” - XYZW quaternion - “rotvec” - axis-angle representation of rotation - “rotmat” - 3x3 rotation matrix - “euler<mode>” - Euler angles with the specified order of rotation, e.g. XYZ, xyz, ZXZ, etc. Refer to scipy.spatial.transform.Rotation.from_euler for details. - “look_at” - look at rotation, the rotation is defined by the point to look at and, optional, the rotation around the forward direction vector (a single float value in tuple or list)

  • rotation (RotationParams) – rotation parameters according to the rotation_mode - for “quaternionWXYZ” and “quaternionXYZW” - Vec4d - for “rotvec” - Vec3d - for “rotmat” - Mat3x3 - for “euler<mode>” - Vec3d - for “look_at” - Vec3d, Positionable or Tuple[Vec3d/Positionable, float], where float is the rotation around the forward direction vector in degrees

  • 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: ndarray | Tuple[float, float, float] = (1.0, 1.0, 1.0), cast_shadows=True, rotation_mode: str = 'quaternionWXYZ', rotation: ndarray | Tuple[float, float, float, float] | Tuple[float, float, float] | Tuple[Tuple[float, float, float], Tuple[float, float, float], Tuple[float, float, float]] | Positionable | Tuple[ndarray | Tuple[float, float, float], float] | Tuple[Positionable, float] = None, translation: 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)

  • rotation_mode (str) – type of rotation representation. Can be one of the following: - “quaternionWXYZ” - WXYZ quaternion - “quaternionXYZW” - XYZW quaternion - “rotvec” - axis-angle representation of rotation - “rotmat” - 3x3 rotation matrix - “euler<mode>” - Euler angles with the specified order of rotation, e.g. XYZ, xyz, ZXZ, etc. Refer to scipy.spatial.transform.Rotation.from_euler for details. - “look_at” - look at rotation, the rotation is defined by the point to look at and, optional, the rotation around the forward direction vector (a single float value in tuple or list)

  • rotation (RotationParams) – rotation parameters according to the rotation_mode - for “quaternionWXYZ” and “quaternionXYZW” - Vec4d - for “rotvec” - Vec3d - for “rotmat” - Mat3x3 - for “euler<mode>” - Vec3d - for “look_at” - Vec3d, Positionable or Tuple[Vec3d/Positionable, float], where float is the rotation around the forward direction vector in degrees

  • 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: ndarray | Tuple[float, float, float] = (1.0, 1.0, 1.0), cast_shadows=True, rotation_mode: str = 'quaternionWXYZ', rotation: ndarray | Tuple[float, float, float, float] | Tuple[float, float, float] | Tuple[Tuple[float, float, float], Tuple[float, float, float], Tuple[float, float, float]] | Positionable | Tuple[ndarray | Tuple[float, float, float], float] | Tuple[Positionable, float] = None, translation: 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)

  • rotation_mode (str) – type of rotation representation. Can be one of the following: - “quaternionWXYZ” - WXYZ quaternion - “quaternionXYZW” - XYZW quaternion - “rotvec” - axis-angle representation of rotation - “rotmat” - 3x3 rotation matrix - “euler<mode>” - Euler angles with the specified order of rotation, e.g. XYZ, xyz, ZXZ, etc. Refer to scipy.spatial.transform.Rotation.from_euler for details. - “look_at” - look at rotation, the rotation is defined by the point to look at and, optional, the rotation around the forward direction vector (a single float value in tuple or list)

  • rotation (RotationParams) – rotation parameters according to the rotation_mode - for “quaternionWXYZ” and “quaternionXYZW” - Vec4d - for “rotvec” - Vec3d - for “rotmat” - Mat3x3 - for “euler<mode>” - Vec3d - for “look_at” - Vec3d, Positionable or Tuple[Vec3d/Positionable, float], where float is the rotation around the forward direction vector in degrees

  • 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: Light | str)[source]
remove_background_light()[source]

Remove background light from the scene. Also removes ShaderNodeBackground if it was added via scene.attach_blend.

Returns:

None

set_background_light(strength: float = 1.0, color: ndarray | Tuple[float, float, float] = (1.0, 1.0, 1.0))[source]

Set background light in a scene. Can be used to create ambient lightning in a scene.

Returns:

None

values()[source]

blendify.lights.common module

class blendify.lights.common.DirectionalLight(strength: float, angular_diameter: float, color: 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: 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: 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