This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

LUT Generation Tool

This tool is for generating a LUT texture that is used for shading of a mesh illuminated by light sources. This texture contains baked data on diffuse shading and specular highlights, for all possible camera angles.

LUT Texture: How to Create and Use

To create a LUT shading texture and use it in real-time, follow these steps:

  1. Open Tools panel -> LUT tab.
  2. To define the color of a mesh on lit and non-lit sides, change diffuse shading. On Diffuse keyline, double click on any default key to change its color. Click on the keyline itself to add new color keys. You can can add many as necessary. To delete a key, select it with a right mouse button and drag it upwards.
  3. To define the color of specular highlights for a mesh, change specular shading. On Specular keyline, double click on any default key to change its color. Again, you can add as many new keys as necessary.
  4. Set dimensions of a shading texture using Width and Height drop-down lists.
  5. Save the created shading texture.
  6. After that, you can change shading keys and apply a modified texture to the mesh simply by clicking Update.

Shading Options

Width Width in pixels of the created LUT texture. Increasing the width can be useful for preserving smooth gradients when there are many diffuse keys.
Height Height of the created LUT texture. Increasing the width can be useful for preserving smooth gradients when there are many specular keys.
Diffuse shading Diffuse shading for a mesh. With shading texture, a very fast and cheap texture lookup operation is used to calculate the diffuse color in real time.
  • The shading texture contains diffuse color values for all possible angles of light that strike a surface. This stored color is already multiplied by the diffuse Scale to calculate the final color intensity. The value is also clamped to a possible range for the diffuse component.
  • In real-time the only thing left to be calculated is how the light actually falls onto a surface: if the surface is under direct light, or if the light comes from the back and does not illuminate it. For that, a dot product of incident light vector and a surface normal is computed to determine the angle at which the light hits the surface:

    diffuse_shading = dot(light_direction,normal)

On the picture below is a diffuse shading keyline. It is used to set color keys that indicate how a mesh is shaded in real-time. By default, there are three color keys:

Diffuse shading keys

     Diffuse shading keys
  1. 1 is for the surface color under the direct light. It is used when the light and a surface normal are pointing in exact opposite directions, which means that the light illuminates the front of the surface. By default, it is white.
  2. 0 is a middle point. This color is used when the light and a surface normal are perpendicular to each other. By default, it is black since light does not fall on such surfaces.
  3. -1 is for the color of non-lit surfaces. It is used when the light and a surface normal are pointing exactly in the same direction, which means that the light falls from the back and does not illuminate the surface. By default, it is black as well.

Here are two examples of diffuse color keylines and corresponding shading textures: a default one with a diffuse texture assigned, and a custom one, with coloring for unlit surfaces, as if it is lit from the back.
Default diffuse shading Default diffuse shading texture and diffuse texture applied Default diffuse shading texture and diffuse texture applied
Custom diffuse shading Custom diffuse shading texture Custom diffuse shading texture
Diffuse scale Diffuse scale is a multiplier for diffuse colors:
  • Values in range from 0 to 1 darken diffuse colors. By 0, there is no diffuse coloring at all.
  • The default value of 1 means diffuse colors are left as set on the diffuse keyline.
  • Values higher then 1 brighten diffuse colors till completely white.
Specular lighting Specular lighting is also stored in a shading texture in order not to calculate it in real-time. Specular component influences the resulting coloring of the mesh.
  • The shading texture contains specular highlights color values for all possible angles of light that strike a surface. This stored color is multiplied by the specular Scale and specular Shift to calculate the specular intensity. The result is raised to the power of Glossiness to determine the size of specular highlights.
  • In real-time it is computed how much light has been reflected depending on the angle at which the camera looks at the surface and the light falls, as well as the direction of a surface normal. For that, a vector for the reflected rays of light is found based on light direction and a surface normal. To get the final result, a dot product of the reflection vector and a camera direction is calculated. The higher the dot product, the closer these two vectors and the brighter the reflected specular highlight is.

    specular_shading = dot(reflect(-light_direction,normal),camera_direction);

On the picture below is a specular shading keyline. It is used to set color keys that indicate how a specular component for a mesh is rendered in real-time. By default, there are two color keys:

Specular shading keys

     Specular shading keys
  1. 1 is for specular highlights color. It is used when light rays are reflected directly into the camera. By default, it is white.
  2. 0 is for non-reflecting surface color. This color is used when the reflected light does not get into the camera because it looks on the surface at a different angle. By default, it is black (no specular highlights).
Here is an example of colored specular shading (together with a default diffuse one): specular highlights are yellow while non-reflecting areas are bluish.
Custom shading Custom specular shading texture
Specular scale Specular scale is a multiplier for specular colors:
  • Values in range from 0 to 1 darken specular colors. By 0, there is no specular coloring at all.
  • The default value of 1 means specular colors are left as set on the specular keyline.
  • Values higher then 1 brighten specular colors till completely white.
Glossiness Glossiness determines the width of specular highlights:
  • Low values create wide highlights and are used to simulate rough surfaces that scatter light at wide angle.
  • High values create pinpoint, narrow highlights and are used to simulate smooth surfaces higher then 1 brighten specular colors till completely white.
Angle Angle is used to create metallic-like specular highlights:
  • With values in range from default 1 to the maximum 2 increases the reflective area making it look like a metal.
Shift Shift is used to tweak the angle of specularity:
  • With values in range from 1 to the maximum 2, there is a bright specular highlight when looking directly at the lit surface. When looking from a side at wide angle, specular highlights fades out.
  • On the contrary, with values in range from minimum 0 to 1, there is no specular highlight when looking directly at the lit surface. When looking from a side at wide angle, there is a dull reflection.

Texture Options

Clear Unload the current shading texture, if any, and reset all options to default.
Load Load a saved shading texture.
Update Save all made modifications into the current texture and render a mesh material using updated shading.
Last update: 2017-07-03
Build: ()