LightSource¶

Attributes¶

 LightSource(win[, pos, diffuseColor, …]) Class for representing a light source in a scene.

Details¶

class psychopy.visual.LightSource(win, pos=(0.0, 0.0, 0.0), diffuseColor=(1.0, 1.0, 1.0), specularColor=(1.0, 1.0, 1.0), ambientColor=(0.0, 0.0, 0.0), colorSpace='rgb', lightType='point', attenuation=(1, 0, 0))[source]

Class for representing a light source in a scene.

Only point and directional lighting is supported by this object for now. The ambient color of the light source contributes to the scene ambient color defined by ambientLight.

Warning

This class is experimental and may result in undefined behavior.

Parameters
• win (~psychopy.visual.Window) – Window associated with this light source.

• pos (array_like) – Position of the light source (x, y, z, w). If w=1.0 the light will be a point source and x, y, and z is the position in the scene. If w=0.0, the light source will be directional and x, y, and z will define the vector pointing to the direction the light source is coming from. For instance, a vector of (0, 1, 0, 0) will indicate that a light source is coming from above.

• diffuseColor (array_like) – Diffuse light color.

• specularColor (array_like) – Specular light color.

• ambientColor (array_like) – Ambient light color.

• colorSpace (str) – Colorspace for diffuse, specular, and ambient colors.

• attenuation (array_like) – Values for the constant, linear, and quadratic terms of the lighting attenuation formula. Default is (1, 0, 0) which results in no attenuation.

property ambientColor

Ambient color of the material.

property ambientRGB

Diffuse color of the material.

property attenuation

Values for the constant, linear, and quadratic terms of the lighting attenuation formula.

property diffuseColor

Diffuse color of the material.

property diffuseRGB

Diffuse color of the material.

property lightType

Type of light source, can be ‘point’ or ‘directional’.

property pos

Position of the light source in the scene in scene units.

property specularColor

Specular color of the material.

property specularRGB

Diffuse color of the material.