Module three_d::renderer::light

source ·
Expand description

A collection of lights implementing the Light trait.

Lights shines onto objects in the scene, note however that some materials are affected by lights, others are not.

Structs

  • A light which shines on all surfaces. Can be uniform (a light that shines equally on any surface) or calculated from an environment map using the Environment struct.
  • Specifies how the intensity of a light fades over distance. The light intensity is scaled by 1 / max(1, constant + distance * linear + distance * distance * quadratic).
  • A light which shines in the given direction. The light will cast shadows if you generate a shadow map.
  • Precalculations of light shining from an environment map (known as image based lighting - IBL). This allows for real-time rendering of ambient light from the environment (see AmbientLight).
  • A light which shines from the given position in all directions.
  • A light which shines from the given position and in the given direction. The light will cast shadows if you generate a shadow map.

Traits

  • Represents a light source.

Functions

  • Returns shader source code with the function calculate_lighting which calculate the lighting contribution for the given lights and the given LightingModel. Use this if you want to implement a custom Material but use the default lighting calculations.