Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.2 - Русский

Change language to:
English - Français - 日本語 - Português -

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Справка Scilab >> Графики > lighting > lighting

lighting

Lighting overview

Description

Lighting in scilab approximates real world lighting where the appearance of a surface is given by interactions between light rays and the material properties of the surface.

Because simulate real world lighting is complex and computationally expensive, one uses a simplified model.

A light is represented mainly by its colors: ambient, diffuse and specular. It can be created using light function, and deleted using delete function.

The surface material properties is represented also by its colors (ambient, diffuse and specular) and it shininess level.

The surface contains the color_material property that enables the use of the surface color as the diffuse color.

The final surface color is given by the light model equation applied to the product of the surface and light colors. Following there is the light model equation:

  • Ambient color models the light received indirect by the surface and is independent of the surface normal or light direction.

  • Diffuse color models the light received directly, and thus it's dependent of the light ray direction and the surface normal.

  • Specular color defines the specular highlight color.

  • Following one can compare the surface with and without lighting:

    Lighting properties list

    Light properties
    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]".

    Surface properties
    use_color_material:

    This field is use to enable the use of the surface color as diffuse color. Its default value is "on".

    material_shininess:

    This field defines the shininess level of the surface. This parameter controls the shinines color spreading in the surface. Any positive value can be used.

    Good values to use are in the [0 10] range, where low values generates strong highlight and high values generates barely perceptible highlights. The default value is "2".

    ambient_color:

    This field defines the ambient color of the surface. 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]".

    diffuse_color:

    This field defines the diffuse color of the surface. The color is defined by a 3 element vector "[red, green, blue]" with each element in the range [0, 1]. Notice that this field is only used when use_color_material is disabled.

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

    specular_color:

    This field defines the specular color of the surface. 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]".

    Examples

    Point light without color_material:

    plot3d();
    s=gce();
    s.color_flag=0;
    s.thickness=0;
    s.hiddencolor = -1;
    light();
    //change diffuse color to orange
    s.diffuse_color = [1, 0.6, 0];
    s.use_color_material="off";
    //black spots turn dark orange
    s.ambient_color = [1, 0.6, 0];

    Directional light:

    plot3d();
    s=gce();
    l = light();
    s.color_flag=0;
    s.thickness=0;
    l.light_type = "directional";
    l.direction = [0 0 1];
    l.diffuse_color = [1 0.9 0.9];
    l.ambient_color = [0.5 0.4 0.4];
    l.specular_color = [0.5 0.3 0.7];

    See also

    Report an issue
    << light properties lighting load_save >>

    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:
    Thu Feb 14 15:05:04 CET 2019