DirectionalLight

DirectionalLight[col,pt]

is a threedimensional graphics directive that specifies the directional light of color col from the point pt to the center of the bounding box to use in coloring 3D surfaces.

DirectionalLight[col,{pt1,pt2}]

uses a directional light along the vector from pt1 to pt2.

Details

  • DirectionalLight is also known as free directional light.
  • DirectionalLight is typically used to create brighter highlights and darker shadows on objects by casting light rays equally from a given direction.
  • DirectionalLight[col,{pt1,pt2}] yields parallel simulated light rays of color col in the direction vector defined by {pt1,pt2}.
  • Colors of light sources col can be defined by RGBColor, Hue or any other color specification.
  • The setting for DirectionalLight affects only colors associated with diffuse and specular reflection on a 3D surface.
  • Light sources with color specifications col of the form {dcol,Specularity[scol]} are effectively taken to have colors dcol for purposes of diffuse reflection, and scol for purposes of specular reflection.
  • Diffuse reflection is taken to follow Lambert's law, with light effectively scattered equally in all directions from a surface.
  • Specular reflection effectively takes light to be scattered only close to the mirrorreflection direction, as specified in the notes for Specularity.
  • Light source positions and aiming points pti can be specified as follows:
  • {x,y,z}explicit coordinates that move with the graphic
    Scaled[{x,y,z}]scaled coordinates that move with the graphic
    ImageScaled[{x,y,z}]coordinates fixed relative to the final displayed image
  • In ImageScaled[{x,y,z}], the and run from 0 to 1 across the width and height of the bounding box of the final displayed image. The coordinate runs orthogonal to the plane of the display and is 0 at the back of the 3D region and 1 at the front.
  • Coordinates specified in Scaled and ImageScaled will often not be between 0 and 1.

Examples

open allclose all

Basic Examples  (3)

Directional light on surfaces:

Style a surface in a plot:

A directional light from the top of the specular surface:

Scope  (5)

Lighting Specification  (4)

Directional light is specified by a color and a vector defined by two points:

Directional lights with different colors:

Directional lights with different directions:

Directional lights on a specular surface:

Lighting Positions  (1)

Specify the light position in the view coordinate system using ImageScaled:

The light source position is always fixed relative to the view point:

Generalizations & Extensions  (8)

Predefined colored lighting:

The colored lighting is equivalent to the following explicit setting:

Predefined accent lighting:

The accent lighting is equivalent to the following explicit setting:

Predefined neutral lighting:

The neutral lighting is equivalent to the following explicit setting:

Predefined three-point lighting:

The three-point lighting is equivalent to the following explicit setting:

Specify lighting for each object:

Specify lighting within the graphics:

If not specified, the target direction is given toward the center of the objects:

Specify diffuse and specular colors separately for both objects and lights:

Applications  (3)

Set up four white spheres on a plane:

Directional light:

Different light instruments at the corner points:

Build a scene with multiple objects and light sources:

Animate the spotlights:

Properties & Relations  (1)

Directional light yields rays parallel to the specified direction:

Possible Issues  (1)

The default light scheme uses several colored light sources:

Set Lighting to None to turn off the default lights:

Wolfram Research (2021), DirectionalLight, Wolfram Language function, https://reference.wolfram.com/language/ref/DirectionalLight.html.

Text

Wolfram Research (2021), DirectionalLight, Wolfram Language function, https://reference.wolfram.com/language/ref/DirectionalLight.html.

CMS

Wolfram Language. 2021. "DirectionalLight." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/DirectionalLight.html.

APA

Wolfram Language. (2021). DirectionalLight. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/DirectionalLight.html

BibTeX

@misc{reference.wolfram_2024_directionallight, author="Wolfram Research", title="{DirectionalLight}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/DirectionalLight.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_directionallight, organization={Wolfram Research}, title={DirectionalLight}, year={2021}, url={https://reference.wolfram.com/language/ref/DirectionalLight.html}, note=[Accessed: 22-November-2024 ]}