Light
Description
A Light
object represents a light source within a scene. The
properties of the object control the appearance and behavior of the light
source.
Creation
Description
creates a
l
= images.ui.graphics.LightLight
object with default property values. Use l
to query and modify properties of the Light
object after you create the
object.
sets properties of the object using one or more name-value arguments. For example,
l
= images.ui.graphics.Light(Name=Value
)images.ui.graphics.Light(Intensity=0.8)
creates a
Light
object with an intensity of 0.8
.
Properties
Enabled
— Light source is enabled
"on"
(default) | on/off logical value
Light source is enabled, specified as "on"
or "off"
, or as a numeric or logical
1
(true
) or 0
(false
). A value of "on"
is equivalent to
true
, and "off"
is equivalent to
false
. The value is stored as an on/off logical value of type OnOffSwitchState
.
When this value is "on"
(the default value), the light source is
enabled. You can specify the Enabled
property for individual
Light
objects, or update all light objects in a
Viewer
object by setting the Lighting
property
of the viewer. For example, specifying the Lighting
value as
"off"
automatically updates the Enabled
property value for all Light
objects associated with the
Viewer
object to "off"
.
Position
— Location of light source
[0 0 0]
(default) | 3-element vector
Location of the light source, specified as a 3-element vector of the form [x y z]. This value specifies the point from which the light illuminates the viewer scene, in world coordinates.
Intensity
— Intensity of light source
0.6
(default) | numeric scalar
Intensity of the light source, specified as a numeric scalar in the range [0, 1]. A greater value corresponds to a brighter light source.
Size
— Size of light source
0.15
(default) | numeric scalar
Size of the light source, specified as a numeric scalar in the range [0, 1]. This
property affects the visualization of only those Volume
objects
displayed using cinematic rendering, meaning the value of the RenderingStyle
property of the Volume
object
is "CinematicRendering"
. A value of 0
specifies a
point light source. A value of 1
specifies a light the same size as
the bounding sphere that contains all objects in the viewer.
PositionMode
— Mode for light position
"right"
(default) | "manual"
| "auto"
| "headlight"
| "left"
| "camera-above"
| ...
Mode for the light position, specified as one of these values.
"headlight"
— Light is at the camera location and moves with the camera."right"
— Light is above and to the right of the camera and moves with the camera."left"
— Light is above and to the left of the camera and moves with the camera."camera-above"
— Light is above the camera and moves with the camera."target-right"
— Light is to the right of the camera target and moves with the camera."target-left"
— Light is to the left of the camera target and moves with the camera."target-above"
— Light is above the camera target and moves with the camera."target-below"
— Light is below the camera target and moves with the camera."target-behind"
— Light is behind the camera target and moves with the camera."manual"
— The light is at the position specified by thePosition
property. The light does not move with the camera."auto"
— The light moves with the camera.
Examples
Create Light Source Object
Create a light source object with default property values.
light1 = images.ui.graphics.Light
light1 = Light with properties: Enabled: on Position: [0 0 0] PositionMode: "right" Intensity: 0.6000 Size: 0.1500
Create a light source object located up and to the left of the camera.
light2 = images.ui.graphics.Light(PositionMode="left")
light2 = Light with properties: Enabled: on Position: [0 0 0] PositionMode: "left" Intensity: 0.6000 Size: 0.1500
Version History
Introduced in R2023bR2024b: Creation function renamed from images.ui.graphics3d.Light
The function you use to create a new Light
object has been renamed from
images.ui.graphics3d.Light
to
images.ui.graphics.Light
. There are no plans to remove support for
references to the old function name.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)