Lighting

There are several types of lighing available in meshrender, including ambient, directional, and point lights. All lighting classes are subclasses of Light.

AmbientLight

class meshrender.AmbientLight(color, strength)

Bases: meshrender.light.Light

An ambient light, which flatly shades all objects in the world.

__init__(color, strength)

Initialize an ambient light with the given color and strength.

Parameters:
  • color ((3,) float) – The RGB color of the light in (0,1).
  • strength (float) – The strength of the light.

DirectionalLight

class meshrender.DirectionalLight(direction, color, strength)

Bases: meshrender.light.Light

A far-away light with a given direction.

__init__(direction, color, strength)

Initialize a directional light with the given direction, color, and strength.

Parameters:
  • direction ((3,) float) – A unit vector indicating the direction of the light.
  • color ((3,) float) – The RGB color of the light in (0,1).
  • strength (float) – The strength of the light.
direction

(3,) float – A unit vector indicating the direction of the light.

PointLight

class meshrender.PointLight(location, color, strength)

Bases: meshrender.light.Light

A nearby point light source that shines in all directions.

__init__(location, color, strength)

Initialize a point light with the given location, color, and strength.

Parameters:
  • location ((3,) float) – The 3D location of the point light.
  • color ((3,) float) – The RGB color of the light in (0,1).
  • strength (float) – The strength of the light.
location

(3,) float – The 3D location of the point light.