Light sources

There are three types of light sources in the Varwin library:

All light sources are visible in the editor, but invisible in preview mode

Setting in the inspector

In the settings of the inspector, for all light sources the same parameters are set to change

../../_images/image-159.png
  1. Color - set the color of the outgoing light

  2. Distance - the distance to which the light can travel at most

  3. intensity - sets the density of the incident light on a surface

  4. Shadows type - Parameter that affects the shadows of objects within the light range of this source. Among the available parameters of this block there are available:

    • No shadows - Objects do not cast shadows
    • Hard shadows - Objects cast clear shadows
    • Soft shadows - The objects cast more blurred shadows than hard shadows
  5. Shadow strength - sets the intensity of shadows cast by objects

There is an additional setting in the Inspector for the floodlight, which regulates the angle of illumination by the given light source

../../_images/image-236.png

Spotlight

The floodlight source shines, respectively, like a spotlight

../../_images/image-714.png

Behaviors are defined for floodlighting:

../../_images/image-160.png
  1. Spotlight angle - angle of light propagation from the spotlight

  2. Range of light - the distance over which light can spread to a maximum extent

  3. light intensity - sets the density of the incident light on a surface

  4. Shadow intensity - sets the intensity of casting shadows from objects

  5. Glow Color - sets the color of the outgoing light. To set the color, click on the color in the block and specify the color either in HEXA/RGBA/HSLA formats or in the palette. More about working with color

  6. Type of shadows - Parameter that affects the shadows of objects that are in the range of the light from this source. Among the available parameters of this block are available:

    • No shadows - Objects do not cast shadows
    • Hard shadows - Objects cast clear shadows
    • Soft shadows - The objects cast more blurred shadows than hard shadows

Example of usage

In the standard project “Flying bot world” place a spotlight over the robot’s head

../../_images/image-422.png

In the logic editor, assemble the following diagram. Note that in the last block the light is given a constant rotation along the Y-axis

../../_images/image-516.png

Apply logic and run the project

../../_images/gif_22.gif

Directional light

Directional light is a global light source, you can position it on stage like the sun. Its position and scale don’t matter, only its rotation - you can place it under the ground. It determines where the light will fall from

../../_images/image-89.png ../../_images/gif_14.gif

Note

If the scene template already has a global light source, setting this will not affect the lighting

Behaviors are defined for directional light:

../../_images/image-163.png
  1. light intensity - sets the density of incident light on a surface

  2. shadow intensity - sets the intensity of casting shadows from objects

  3. Glow Color - sets the color of the outgoing light. To set the color, click on the color in the block and specify the color either in HEXA/RGBA/HSLA formats or in the palette. More about working with color

  4. type of shadows - Parameter that affects the shadows of objects in the light range of this source. Among the available parameters of this block are available:

    • No shadows - Objects do not cast shadows
    • Hard shadows - Objects cast clear shadows
    • Soft shadows - Objects cast more blurred shadows than hard shadows

Spotlight

The point light, unlike the previous ones, shines in all directions at once - no matter what rotation you set it to

../../_images/image-95.png

Behaviors are defined for point light:

../../_images/image-164.png
  1. Range of light - the distance over which light can travel at most

  2. light intensity - sets the density of light falling on a surface

  3. Shadow intensity - sets the intensity of shadows cast by objects

  4. Glow Color - sets the color of the outgoing light. To set the color, click on the color in the block and specify the color either in HEXA/RGBA/HSLA formats or in the palette. More about working with color

  5. Type of shadows - Parameter that affects the shadows of the objects that are in the range of the light from this source. Among the available parameters of this block are available:

    • No shadows - Objects do not cast shadows
    • Hard shadows - Objects cast clear shadows
    • Soft shadows - Objects cast more blurred shadows than hard shadows

Lack of light

../../_images/image-105.png