This page has been translated automatically.
Unigine Basics
1. Introduction
2. Managing Virtual Worlds
3. Preparing 3D Models
4. Materials
6. Implementing Application Logic
7. Making Cutscenes and Recording Videos
8. Preparing Your Project for Release
9. Physics
10. Optimization Basics
11. PROJECT2: First-Person Shooter
12. PROJECT3: Third-Person Cross-Country Arcade Racing Game
13. PROJECT4: VR Application With Simple Interaction
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Lighting

In computer graphics, it is lighting what makes a scene look realistic. Properly installed and adjusted lighting can enhance a very mediocre scene, and by contrast, the impression of a well-modeled scene can be ruined by placing light sources carelessly, which can also negatively affect performance. Proper lighting determines the overall atmosphere of the picture displayed to the user. Light can help you to convey mood, emphasize the advantages and hide the flaws.

Objects in the scene won't look flat if they have light and shade upon them, that is, light is distributed on the object's shape depending on the position of its various surfaces in relation to the light source. To make objects look three-dimensional, they must have light, highlight, halftone, and the most shaded part of the surface — core of shadow. The latter is always illuminated to some degree by light reflected from other objects (reflected light). Finally, objects themselves cast a shadow on neighboring objects, which is usually darker than their own shadow. Only the right balance of all these light phases can convey the object's volume with the utmost plausibility.

In computer graphics lighting is divided into two categories:

  • Direct – rays of light come from the light source directly onto the surface.
  • Reflected – rays are reflected from the surface, scattered, and form a soft fill light.

There are many methods for calculating reflected illumination, and one of the best known (and probably the most 'honest') is Global Illumination (GI).

A light source emits rays made up of photons — particles that carry information about the light color and brightness. Falling on a surface, the rays illuminate it, but the photons lose some of their energy, causing the ray color and brightness to change. Then the rays are reflected (photons bounce back) and fall on the next surface, losing some more energy. The number of such "bounces" is determined by the rendering settings.

In addition to reflected light, there is also Ambient Occlusion (AO). This is the effect of shading in corners, cracks, and narrow openings. Imagine that a beam of light flies into the corner of the room, is reflected several times from both walls, and gradually fades. The farther is the corner into the room, the less light gets there.

Without the AO texture With the AO texture

As a rule, Ambient Occlusion is used to artistically emphasize the shading effect — in real life, light rays do not lose energy so quickly that the corners of the room become as dark as they sometimes are in games. If the engine supports physically correct lighting, then it can calculate the rate of energy loss by the light beam on its own, and you don't have to create a specific Ambient Occlusion texture. But having this texture would help you to emphasize the relief of the object drawn on the main texture (otherwise the material may look more flat). The AO texture is a black-and-white texture that stores shadows cast from diffuse lighting.

Last update: 2024-08-16
Build: ()