Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2024.1.0 - Français


light properties

Light overview

Description

The light entity contains the properties to change lighting appearance. Lights aren't visible in the axes but they affect the surface appearance (see lighting for a detailed explanation about lighting).

Lights can be created using light function, and deleted using delete function.

Light properties list

visible:

This field defines if the light is enabled "on" or disabled "off".

light_type:

This field defines the type of light used. There are two types available:"directional" and "point". Directional lights are positioned infinitely far from the surface thus emitting parallel rays.

Point lights are defined as a point in space thus emitting rays in all directions. The default value is "point".

direction:

This field defines the ray direction for directional light. The direction can be changed using a 3 element vector "[x, y, z]" representing a vector starting from the origin.

The default value is "[0 0 1]".

position:

This field defines the light position for point light. The position can be changed using a 3 element vector "[x, y, z]".

The default value is "[0 0 1]".

ambient_color:

This field defines the ambient color of the light. The color is defined by a 3 element vector "[red, green, blue]" with each element in the range [0, 1].

The default value is "[0.1 0.1 0.1]".

diffuse_color:

This field defines the diffuse color of the light. The color is defined by a 3 element vector "[red, green, blue]" with each element in the range [0, 1].

The default value is "[1 1 1]".

specular_color:

This field defines the specular color of the light. The color is defined by a 3 element vector "[red, green, blue]" with each element in the range [0, 1].

The default value is "[1 1 1]".

user_data:

This field can be use to store any scilab variable and to retrieve it.

tag:

This field can be use to store a character string generally used to identify the light entity. It allows to give it a "name". Mainly used in conjunction with findobj() and get()/set() functions.

Examples

// point light
plot3d;l=light();s=gce();
for i=0:1000
    sleep(5);
    x = 2*cos(i*%pi/180);
    y = 2*sin(i*%pi/180);
    z = 2;
    l.position = [x y z];
end

// change light to directional mode
l.light_type = "directional";
l.direction = [1 0 1];
l.ambient_color = [0.1 0.1 0.1];
s.diffuse_color = [0.4 0.4 0.4];
s.use_color_material = "off";
s.color_flag = 0;
s.thickness = 0;
s.hiddencolor = -1;
s.specular_color = [0.6 0.6 0.6];
sleep(5000);

l2 = light(ambient_color=[0 0 0], diffuse_color = [0.8 0.8 1], type="point", position=[0 3 4]);
sleep(5000);
delete(l);
l2.specular_color = [1 0.6 0];

See also

  • lighting — Lighting overview
  • light — creates a light object in the given axes
  • delete — delete a graphic entity and its children.
Report an issue
<< light Éclairage lighting >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Jun 17 17:52:28 CEST 2024