This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Light Sources Parameters

Unigine light sources regarded in this section share similar parameters (except for prebaked lightmaps that cannot be tweaked dynamically). They can vary to some extend depending on the source specifics, but the general set is regarded below. For the unique parameters refer to the sources articles.

Deferred Lighting

Deferred lighting is a simplified and faster method to render lights. The main advantage of this method of calculations is that allows substantially much faster and less resource consuming rendering, though producing middle-quality results:

  • By deferred lighting all the objects are uniformly rendered with default Phong shading. Materials setting contribute only to the diffuse and specular components. It must be noted, that being monochrome, specular component is not exactly precise, though remaining visually satisfactory.
  • No additional effects like anisotropy or Fresnel reflection are possible.
  • Anti-aliasing is also unavailable on surfaces lit by deferred lights.

Another variant of deferred lighting is deferred shading. It is super-simplified, even more faster, yet its quality is poorer.

Notice
To use the deferred lighting, set console command render_deferred to 1 (default). To use the deferred shading, set it to 2. (And do not forget render_restart!).
You can also force all lights as deferred lighting by enabling Tools -> Render -> Force deferred.

Deferred lighting flag indicates that the light source should be always rendered as deferred, in spite of the set deferred distance.

Deferred Distance

Deferred distance parameter allows to introduce the principles of LOD system to lighting. When the camera moves away from the bounding sphere of the light source to the specified distance (and further), the lights will start to be rendered as deferred. This gives a very significant speed boost in the scenes with the large number of light sources.

Color

Most noticable property of the light source is its color in RGBA format, determining both the plausibility of virtual representation and the aesthetic component. If the resulting color combinations are tepid and not accurate, the liveliness of the scene can suffer.

Multiplier

Multiplier provides fine control over color intensity of the emited light.

  • The minimum value of 1.0 corresponds to the least saturated light color.
  • The maximum value of 100 equals the most bright and intense color.

Radius

The distance of light irradiation is limited to the sphere with specified radius (in units), allowing to adjust the exact area of the scene to be illuminated. Since dynamic lighting is quite a resource hungry task, the sources should be placed with sagacity and shrewdness to avoid lags by loading.

Attenuation

Attenuation allows to simulate the natural phenomenon of light intensity gradual fading. This parameter determines how fast the intensity diminishes up to the radius distance set for the source.

  • Decreasing the value to the minimum of 0.001 will result in light sphere having sharp and clear edges, which usually contributes to an unnatural feeling about the final rendered image.
  • Increasing the value up to the maximum of 1.0 will render softly dispersed light at the non-illuminated areas border.

Light Mask

Each light source can selectively influence the objects in the scene. If the illumination of some object creates an undesired effect, it can be simply omitted when rendering the light from the source. On the other hand, adding extra lights to a specific object without affecting the rest of the scene can be invigorative and effectively serve the artistic purposes.

To define the objects which would be illuminated by the light source, the matching bit mask should be set for both the source and the object. The bit mask is a string of bits representing the selected decimal numbers in binary system, that is used for sequential comparison with another mask. Two masks match if at least one bit in the masks matches.

Viewport Mask

This mask allows light to be rendered in the viewport. It means, all the objects (or those that are masked) wll be rendered lit. For that, this mask should match the camera Viewport mask. (See the detailed info).

Diffuse Scale

The diffuse component of the light cast by a source represents a directional light illuminating an object. Coming from a single direction, that is defined by the source position in the virtual world, it is spread across the object facing surface. Diffuse scale controls the intensity of this light component. The material of the surface also has its own diffuse characteristic, which is multiplied by the source diffuse scale to get the final rendered image. The scale varies in range from 0 to 2.

Specular Scale

The next component simulating light interation with surfaces is specular one. In contrast to diffuse reflection, where incoming light is reflected in a broad range of directions. It is responsible for creating highlights from incoming light on a surface and is a viewpoint-dependent characteristic. Specular scale modulates the reflective light intensity and is multiplied by the equivalent property specified for the material. The scale varies in range from 0 to 2.

Specular Power

The scattering range of the specular reflection can be fine-tuned using the specular power parameter. It controls the breadth of highlights on the illuminated objects and is multiplied by the glossiness set for the material, because the more polished its surface is, the sharper and more uniformly the light rays are reflected.

  • The minim value of 0 represents more pointed specular hightlights.
  • the maximum value of 2 equals broad and more diffuse hightlights.

Visible Distance

The created world can be of a substantial size, so as the camera moves away from the light source, it can pass out of the view fustum many units away. To lighten the computational load, it is reasonable to set the limits of its visibility. The first step is to define a distance, up to which the light will be rendered as intense as the the sources settings specify. If the distance is set to infinity, the source is always rendered.

Fade Distance

The second step of distant-dependant rendering optimization is to set a fade distance for the source. It enables to percieve the light source as gradually disapering and to avoid visual artifact of flickering. The given parameter allows to render the light with decreasning radiance after the visible distance is past. When having gone beyond the fade distance, the source will not be rendered at all.

Shadow Distance

If the shadows are enabled for the light source, their disaperance should be as imperceptible to the eye as possible. Shadow distance provides such an oppotunity. It defines the distance up to which the casted shadows will fade out to nonexistence slowly blending into the background.

Shadow Settings

Shadowing is undoubtfully an essential aspect of lighting model. But besides the general shadows technique implementation, the ability to tweak the shadow's look is also vital. The specifics of the shadows appearance help to achieve graphic realism by enhancing viewer's perception of the relative object positions in virtual world.

The shadows from the light source can be enabled or disbled by checking the appropriate box on the Shadow tab. The following parameters will define its appearance:

Shadow Offset

The shadows position can be cheated by setting the offset along the three coordinates relative to the source position. It can help to gain necessary visual effect of altering shadow shape without changing the light direction. To aid the offset orientation, there are shown additional vizualizer axes, repeating the source's axes alignment.

Shadow Map Size

The size of the shadow map defines the shadow quality and influences the rendering speed. It can be flexibly adapted by choosing the appropriate The larger the map used for a source casting shadows is, the smoother and true to life the result is, though gained at the cost of higher memory consumption. The lower the resolution is, the more blocky and jagged the shaddows outline appears. However, the low-resolution maps significantly alleviate memory loading, especially when several maps are used at the same time. Still, they are more processor-intensive while calculating the softness (?).

The following sizes of the shadow map are available for flexible adaptation to the particular requirenments:

  • 64
  • 128
  • 256
  • 512 (set by default as balanced between the visual quality and performance limitations)
  • 1024
  • 2048
  • 4096

Shadow Ambient Color

Effective simulation of the natural environment demands that the shadows should not simply be absolutely dark regions projecting object geometry, but include diffuse contribution of the light propagating in a scene and used to color the shadowed surface. The ambient color parameter allows to control the shadow density by specifing the intensity of the base ambient color (corresponding to the light source one) in the shadowed areas.

  • The minimum value of 0 corresponds to the most dense shadow cast by the light source. However, the actual darkness of the shadow will depend on the amount of light in the scene.
  • The minimum value of 1 results in having no visible shadows, as the ambient color intensity in shadowed and non-shadowed areas will be equal.

Shadow Bias

When testing if a point is shadowed from the light emited by the source, its distance is compared to the depth value stored in the shadow map. Since the precision of depth map is limited, one map pixel may contain depth values for several sampled points along the lit surface. If the closest point is stored as a depth value, others will appear father away from light and will be rendered shadowed. This false positive test result is called a self-shadowing artifact.

However, occasional inexact shadowing of the scene objects can be corrected using the bias parameter. It controlls the depth offset added to the current depth value stored in the shadow map.

  • If the shadow appears to "bleed", the bias value should be increased. This prosedure eliminates the self-shadowing effect, as the points will appear closer to light source when compared to the map depth value. On the other hand, if the bias value is set too high, the shadow will look detached from the object casting it.
  • Decreasing the bias makes the depth test less inclusive, but results in banding and moire pattern on the surface.

Shadow Slope

The shadow artifacts are not only conditioned by the numerical inprecision of shadow map depth values. Geometry component should also be taken into consideration. A shadow map texel is projected to some surface area in the scene despite representing a single depth value. As a result, this area is shadowed as perpendicular to the light source, even if it slants away. But the offset on steep slopes needs to be quite bigger than on the flat ones, making it hard to choose one constant value appropriate for correct shadowing. The Slope parameter compensates for this fact and determines how much bias should be applied in compliance with the steepness of the slope (up to 90 degrees). Incresing the value will add to the applied offset The slope value is added to the constant bias value.

Shadow Softness

For the shadows to have a natural look, it is essential to gain the refine and smooth penumbra transitions along its outline. The Softness parameter defines the size of the blur applied to the shadow edge.

  • Increasing sofness parameter is very salutary for low-resolution shadow maps: you can get by with using them if high softness values are applied. However, pixel artifacts can appear even with shadow maps of very high resolution, so slightly adding a softness is also beneficial.
  • Low softness values correspons to the crisp and sharp shadow edges. It is pertinent to create harsh and inhospitable environment. Direct sun rays on a clear day or small and concentrated light source (for example, a bare light bulb) require hard-edged shadows. If the space scenery is construsted, the lack of atmosphere will also result in such a shadows.
  • Higher softness values correspond to the natural light on a cloudy and humid day or serve to accentuate the effect of soft indirect lighting. On the whole, soft shadows help to create comfortable and relaxing feeling.

The softness parameter is available only with the high quality of shaders.

Translucence

In real life a lot of objects and surfaces consists of translucent components. Leaves and paper, water and glass, marble and human skin - all are characterised by some degree of transparancy. As the refraction indices of translucent mediums differ from that of the environment, the light is transmitted into the object and after that can be scattered and absorbed inside of it. This visual phenomenon is called the subsurface scattering. The remaining light having passed through a translucent object, illuminates it from behind and forms a specific shadow-like projection.

Source-dependent translucence can be enabled or disbled by checking the appropriate box on the Shadow tab. In the engine the physically accurate simulation of this effect is achieved by applying the blending on the base of shadow map depth values. Proceeding from the latter, shadow map size is of importance to the translucent detalization.

In the material that casts translucent shadows, both Cast shadow and Cast translucence boxes should also be checked.

Translucence Bias

As translucence uses the shadow map depth values, it is exposed to the same artifacts, as described in the Shadow Bias paragraph. Translucence bias is used to mitigate the detrimental effect by providing the offset of depth values in a shadow map for translucent objects:

  • Increasing the bias value adds to the stored depth and eliminates the effect of smeared surface, but at the same time can result in a visual flatness of the object, if set too high.
  • Decresing the value sets the translucent pixels offset closer to the light source, but endangers the solidity of represented surface.
  • The default of 2.0 lends realism to the translucence objects and balances the depth value.
Last update: 2017-07-03
Build: ()