pysdic_blender.BlenderSpotLight#
- class BlenderSpotLight(position, direction, *, energy=1000.0, spot_size=0.7853981633974483, spot_blend=0.15, color=(1.0, 1.0, 1.0), radius=0.0)[source]#
Bases:
objectA spot light of Blender: a cone of light emitted from a position along a direction.
energy: the power in watts the light would emit without the cone (Blender convention);spot_size: the full opening angle of the cone, in radians in \([0, \pi]\);spot_blend: the fraction of the cone with a smooth edge, in \([0, 1]\) (0: sharp edge);color: the linear RGB color of the light (multiplies the emitted power on each channel, white by default);radius: the radius of the emitting sphere (shadow_soft_sizeof Blender), 0 for a point source.
Radius. Cycles renders the light as a sphere of radius
radiusemitting the same total power. A point source (radius = 0, default) gives sharp shadows and tiny, very intense specular highlights on a glossy surface; a real projector (a few centimeters) gives soft shadows (penumbra of width about2 radiustimes the ratio of the distances occluder-surface / light-occluder) and larger, less saturated highlights. The sphere is physically correct (the “soft falloff” of Blender is disabled).A Blender light emits along its local \(-z\) axis: its rotation maps \(-z\) to
direction(the rotation around the direction does not matter for a spot light). The object is immutable.- Parameters:
position (ArrayLike) – The position \((3,)\) of the light in the world.
direction (ArrayLike) – The direction \((3,)\) of the axis of the cone (normalized).
energy (Real, optional (default:
1000.0)) – The power in watts (non-negative).spot_size (Real, optional (default:
pi / 4)) – The full opening angle in radians.spot_blend (Real, optional (default:
0.15)) – The fraction of the cone with a smooth edge.color (ArrayLike, optional (default:
(1.0, 1.0, 1.0))) – The RGB color \((3,)\) of the light, non-negative linear values (scene-linear Rec.709, as all the colors of Blender). The power of the channel \(c\) isenergy * color[c].radius (Real, optional (default:
0.0)) – The radius of the emitting sphere, in the unit of the scene (non-negative, 0 for a point source). Not the default 0.25 of Blender, whose meaning depends on the unit of the scene.
Examples
from pysdic_blender import BlenderSpotLight light = BlenderSpotLight.looking_at([0.0, -200.0, 600.0], [0.0, 0.0, 0.0], energy=5e5)
- classmethod from_dict(data)[source]#
Create a light from a dictionary of
to_dict()(the default values of the constructor for the missing optional fields, e.g. a white light withoutcolor).- 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 a spot light at
positionpointing totarget(other inputs as the constructor).- Parameters:
position (ArrayLike)
target (ArrayLike)
kwargs (Any)
- Return type:
- property quaternion: ndarray#
The rotation
(w, x, y, z)of the Blender light object (local \(-z\) alongdirection).
- property radius: float#
The radius of the emitting sphere (
shadow_soft_sizeof Blender), 0 for a point source.