pysdic_blender.BlenderAreaLight#
- class BlenderAreaLight(position, direction, *, size, size_y=None, shape='SQUARE', up=None, energy=1000.0, color=(1.0, 1.0, 1.0), spread=3.141592653589793)[source]#
Bases:
objectAn area light of Blender: a flat emitting surface (square, rectangle, disk or ellipse), e.g. an LED panel or a diffuser.
shape:"SQUARE"or"DISK"(one dimensionsize),"RECTANGLE"or"ELLIPSE"(dimensionssizealong the local \(x\) axis andsize_yalong the local \(y\) axis);energy: the total power in watts emitted by the surface (Blender convention);color: the linear RGB color of the light (white by default);spread: the angle of the cone of emission of each point of the surface, in radians in \(]0, \pi]\) (\(\pi\): a Lambertian emitter; smaller: a directional panel, like a honeycomb grid).
The surface is centered on
positionand emits from one side only, alongdirection(the local \(-z\) axis of the Blender light). Its local \(y\) axis (alongsize_y) isupmade orthogonal todirection: it orients a rectangle or an ellipse around the direction. The object is immutable.- Parameters:
position (ArrayLike) – The center \((3,)\) of the surface in the world.
direction (ArrayLike) – The direction \((3,)\) of emission, normal to the surface (normalized).
size (Real) – The side (
"SQUARE","RECTANGLE") or the diameter ("DISK","ELLIPSE") along the local \(x\) axis, in the unit of the scene (positive).size_y (Optional[Real], optional) – The dimension along the local \(y\) axis, required for
"RECTANGLE"and"ELLIPSE", forbidden for"SQUARE"and"DISK".shape (str, optional (default:
"SQUARE")) –"SQUARE","RECTANGLE","DISK"or"ELLIPSE".up (Optional[ArrayLike], optional) – The direction \((3,)\) of the local \(y\) axis of the surface (made orthogonal to
direction, must not be parallel to it). By default, an arbitrary deterministic axis (seeup): give it for a rectangle, an ellipse or a square whose orientation matters.energy (Real, optional (default:
1000.0)) – The power in watts (non-negative).color (ArrayLike, optional (default:
(1.0, 1.0, 1.0))) – The RGB color \((3,)\), non-negative linear values.spread (Real, optional (default:
pi)) – The angle of emission in radians, in \(]0, \pi]\).
Examples
from pysdic_blender import BlenderAreaLight panel = BlenderAreaLight.looking_at( [0.0, -300.0, 500.0], [0.0, 0.0, 0.0], size=200.0, size_y=100.0, shape="RECTANGLE", up=[1.0, 0.0, 0.0], energy=2e5, )
- property direction: ndarray#
The unit direction \((3,)\) of emission, normal to the surface (read-only).
- classmethod from_dict(data)[source]#
Create a light from a dictionary of
to_dict()(position,directionandsizerequired, the default values of the constructor for the other fields).- Parameters:
- Return type:
- classmethod from_json(path)[source]#
Create a light from a JSON file (see
from_dict()).- Parameters:
path (str)
- Return type:
- classmethod looking_at(position, target, **kwargs)[source]#
Create an area light centered at
positionemitting towardstarget(other inputs as the constructor).- Parameters:
position (ArrayLike)
target (ArrayLike)
kwargs (Any)
- Return type:
- property quaternion: ndarray#
local \(-z\) along
direction, local \(y\) alongup.- Type:
The rotation
(w, x, y, z)of the Blender light object
- property size_y: float | None#
The dimension along the local \(y\) axis (
up), None for"SQUARE"and"DISK".
- to_dict(description=None)[source]#
Export the light to a dictionary (
position,direction,up,shape,size,size_y,energy,color,spread).upis the actual local \(y\) axis, so the orientation is kept exactly.