3D Look-Up Table (3D LUT)


Topic:  GrossGrade for Expert > Technologies >

3D Look-Up Table (3D LUT)

Previous page Parent topic

3D Look-Up Table (3D LUT)

Many of you are familiar with 3D LUT technology, with its ubiquity, flexibility, wide possibilities and often use it in technical needs or even in creativity. But those of you for whom this thing remains a "magic black box" are strongly recommended, reluctantly, to read this section to the end.

Let's figure it out from simple to complex.


What is LUT?


look-up-tables_1d_lutStands for Look-Up Table (transform table). In general, it is an array of matches between the input and output values of a variable (or several variables). It is usually used to replace complex calculations with a simple search operation. In this case, those values of the variable that are not in the array are calculated using interpolation based on the available values.


What is Color LUT (CLUT)?


look-up-tables_1d_clutThis is a color look-up / conversion table, usually used to calibrate input / output devices, technical manipulations such as color space conversion, and creative photo / video processing (the latter is sometimes called Look LUTs, or simply "looks", because they determine how the image will look, represent a kind of "image appearance").


What is the difference between 1D and 3D Color LUT?



A one-dimensional (1D) look-up table contains a transformation of one independent variable, it contains an array of N values and can describe, for example, the curve which changes one of the color coordinates.


There is a kind of one-dimensional table that contains transformations of 3 independent color coordinates (like three separate curves), and it is not considered a full three-dimensional table, because the coordinates are not related to each other. This table is called 3x 1D LUT (three times one-dimensional table), its size is N*3.


A three-dimensional (3D) look-up table contains a transformation of three related coordinates describing the movement of points in the color space. Such a table is of size N*N*N (N to the power of 3) and is the most flexible version of the LUT with the most extensive features. The value of N is usually chosen odd so that the neutral axis (grayscale) always has elements.


The elements of a three-dimensional table are called voxels – the three-dimensional equivalent of pixels. There are also tables of other dimensions, such as 4D, but here we will consider mainly only three-dimensional color look-up tables – 3D Color LUTs.


What good does 3D Color LUT give us?


This is an excellent solution for processing video or photo groups, which is also often used for processing single images. The speed of use, as well as the ease of sharing, transfer "appearance" of color correction between different applications – all this increases the popularity of 3D LUT every day in the professional industry and in the field of amateur processing. In the net there are thousands of ready-made "looks", both paid and free, distributed by various manufacturers.


The ability to completely change the color mood of a photo or video with one click attracts many users. There are also many situations where the use of LUT is the only solution to any technical problem, for example, the implementation of some transformation that can not be expressed by mathematical formulas.


Hardware support for this technology is growing every day, there is equipment that somehow supports LUT loading, for example, devices converting video signal in real time based on the tables loaded in them, professional monitors with built-in LUTs. For the PC, the efficiency of calculating large tables with the help of powerful computing resources of video cards, including the use of nonlinear interpolation, is increased.


The benefits of direct rendering instead of using the 3D LUT


But no matter how many good words were said about the all-powerful 3D LUT technology, and yet it is partly a rough surrogate. One of the drawbacks of tables is limited resolution. Quite often such resolutions are used as 17*17*17, 33*33*33, which is much less than the color gamut resolution for 24-bit images, which is 256*256*256 voxels. It is clear that such a table can save much less color information than is theoretically possible.


To store a 3D LUT with the resolution of 256*256*256 you will need about 50 megabytes of memory, and it will be processed for a long time. But for the color depth of 48 bits color resolution becomes simply unaffordable – 65536*65536*65536! A table of this resolution would take about 1.5 petabytes (about 1.5 million gigabytes) of computer memory! As the resolution of the 3D table grows, the amount of memory it occupies grows with acceleration.


Table elements have a certain bit depth. The following are the most commonly used numerical types of 3D LUT elements.

Numeric type and bit depth

Available range of values

Integer number, 8 bit

0 .. 255

Integer number, 10 bit

0 .. 1023

Integer number, 12 bit

0 .. 4095

Integer number, 14 bit

0 .. 16383

Integer number, 16 bit

0 .. 65535

Real number, 16 bit

-∞ .. +∞ (working range is 0 .. 1)

Real number, 32 bit

-∞ .. +∞ (working range is 0 .. 1)

But although each individual element of the table can be represented with great precision, this does not negate the fact that the number of these elements (table resolution) is strictly limited and usually small.


However, it's not so scary. There are LUT formats that have an irregular discrete grid, which helps to reduce the visibility of segmentation, and also allows you to rationally use the resolution of the table. And even a regular 3D LUT with resolution 33*33*33 is able to maintain the desired color correction with sufficient accuracy. The fact is that usually color grading does not imply sharp changes between very close colors. I.e. it is usually a smooth thing, affecting some colors slightly more, the other colors slightly less, making change "fading".


The problem is that any high-precision color corrections that make sharp changes between very close colors (for example, changing the saturation of colors whose hue belongs to a very small range of 2 to 3 degrees) will be lost or form side effects while maintaining the entire correction in a 3D LUT of not high enough resolution with a regular grid. Those who are familiar with mathematics and DSP can draw an analogy with Nyquist frequency and high frequency losses during sampling, if we consider our color correction function as a signal with a spectrum of frequencies.


The illustrations below compare the results of direct color correction with the results of the same color correction using 3D LUT of resolutions 65*65*65 and 33*33*33 with regular discreteness and linear interpolation:




In this experiment were specifically chosen conditions under which the difference between the two methods is clearly evident, in the daily work with natural images you rarely notice such defects. However, using the LUTs incorrectly, it would be possible not to guess that there are some losses / distortions in the correction results. Although it is clear that the losses will be present almost always, visually assess their total is hardly possible. For use in the field of purely creative treatments, these problems are not so critical, since the author himself evaluates the result and agrees with it.


Below are graphs illustrating the number of errors on a simple example of one-dimensional LUT approximating some random curve:




Note that the last graph shows an irregular adaptive LUT, which gives much less errors than a regular table of the same resolution. However, the construction of an irregular LUT is a more complex and long task, the algorithm for calculating the result based on such a table is also slower, in addition, more memory space is required because of the need to store additional information about the irregularity of the step / grid.


For performance reasons, most applications use linear interpolation as the simplest method to calculate colors based on 3D LUT, but the results of this method may not look quite natural. But this pursuit of speed is not limited. Three-dimensional linear interpolation has several varieties (in order to simplify the calculations): full trilinear, prism, pyramidal and tetrahedral. The latter method is the fastest, the most rough, and as you might guess, quite common in applications working with 3D LUT.


Tetrahedral interpolation by its nature is not suitable for all color spaces. It works well only for spaces where the neutral axis is parallel to one of the diagonals of the cube (additive / substantive color models like RGB). For spaces where the neutral axis is parallel to one of the coordinate axes (perceptual color models like LAB), this method works worse. [link]


With cubic or spline interpolation, the results will generally look more natural than with linear interpolation, however, it should be understood that this usually does not affect the number of errors, at least in the case of regular-step tables. Compare the two graphs:




Of course, this only makes sense if the tables do not have sufficient resolution. For the same reason, for example, it is not possible to obtain any truthful sub-pixel details in image upsampling, no matter what interpolation algorithm is used. But you can get a smoother and nicer picture, despite the fact that it may not be true.


The disadvantage of LUTs is also the inherent limitation of the range of input values. Usually to some extent this is a problem when working with HDR (High Dynamic Range) images, where colors are represented by floating-point numbers. In this case, the LUT tables are not applicable to values that are outside some predefined range (typically 0.0 – 1.0). Extrapolation outside the range can smooth things out a bit, but, as with interpolation, it only creates some visible naturalness.


In general, all of the above applies to a large extent to both 1D and 3D LUT.


What's all this about?


To the fact that any tool should be used for its intended purpose, and it would be nice to know the operating instructions. If your LUT gives an unsatisfactory result, you either use it incorrectly or use it for unintended purposes.


The color correction in GrossGrade is primarily aimed at the final rendering inside GrossGrade, and the export to 3D LUT function is just a variant of using the correction in other programs, which has both advantages and disadvantages. Although perhaps this option will suit you in a hundred percent of cases. Just keep in mind that all of the above is true for all LUT formats and applications that work with them. And, therefore, some color corrections calculated inside GrossGrade by the "Render" function may look better (or just slightly different) than the same corrections inside GrossGrade during work (when LUT is used for preview) or when LUT is exported to third-party applications.


Knowing the nature of 3D LUT, you can use all the advantages of this technology, and at the same time will control possible errors.



See also