SKETCHUP LOGO 300X110
How to use Lookup Table for Renders

Stay in touch

Get all the latest news, promotions and offers for Sketchup Guru Courses right in your inbox

How to use Lookup Table for Renders

How to use Lookup Table for Renders

How to use Lookup Table for Renders

What are Lookup Table for Renders?

Lookup tables (LUTs) are an excellent technique for optimizing the evaluation of functions that are expensive to compute and inexpensive to cache. By pre-computing the evaluation of a function over a domain of common inputs, expensive runtime operations can be replaced with inexpensive table lookups. If the table lookups can be performed faster than computing the results from scratch (or if the function is repeatedly queried at the same input), then the use of a lookup table will yield significant performance gains.

A Lookup Table (LUT) can be used to achieve color correction using a Post Process Volume. Instead of using three one-dimensional (1D) lookup tables, a single three-dimensional (3D) Lookup Table is used. This offers more sophisticated color transformation, which can be used for something like desaturation.

Implementation of Lookup Table for Renders

Most modern GPUs offer hardware-accelerated trilinear, 3D texture lookups (the interpolation unit was originally necessary for mipmapped, 2D texture lookups)

First, we load our high-resolution image into a standard 2D texture. Next, we load our 3D color correction mapping as a 3D texture, being careful to enable trilinear filtering.

At runtime, we transform our input image by sampling the color in the normal fashion and then by performing a dependent texture lookup into the 3D texture (using the result of the 2D texture lookup as the 3D texture’s input indices). The output of the 3D texture is our final, color-transformed result.

Shader Analysis

The most common question is probably “Why are the scale and offset factors necessary?” The answer relates to the coordinate system that the texture-mapping hardware uses to sample from our LUT. Specifically, the hardware texture-sampling algorithms sample (by default) from one extreme of the data set to the other. Though this is entirely reasonable when texturing image data, it is not appropriate for sampling numerical data sets, because it introduces nonlinearities near the texture’s edges.

Shader Optimization

This code has obvious acceleration opportunities. First, as the scale and offset factors are constant across the image, they can be computed once and passed in as constants. (Or even better, they can be directly compiled into the fragment shader.) Second, it is good practice to use the smallest LUT that meets your needs (but no smaller). For “primary grading” color corrections, where one only modifies the color of the primaries (RGB) and secondaries (CMY), a 2x2x2 table will suffice! Finally, for consumer-grade applications, an integer texture format may suffice (of course, still with trilinear interpolation enabled). But be aware that 8 bits is not sufficient to prevent banding in LUT color transforms.

System Integration

  1. Generate (and cache) the 3D lattice as a 2D image, preferably in the same byte order as the GPU will expect in step 3.
  2. Apply arbitrary color correction to this lattice image (using a standard color-correction pipeline), treating the 3D lattice image as a proxy for the final color correction you wish to apply.
  3. Load both the high-resolution image and the 3D texture to the GPU.
  4. Draw source imagery using the fragment shader in Listing 24-1.

Hope this Blog helped you.

For more SketchUp tutorials you can check out https://www.sketchupguru.com/blog/

You can also check more tutorial videos for sketchup on our YouTube Channel,

https://www.youtube.com/c/SketchupGuru

To know about the Top Online 3D Rendering Courses for 2022 click,

Leave a Reply

Your email address will not be published. Required fields are marked *

Serious about taking your rendering and modelling skills to the next level?
Sign up for The Complete Sketchup & Vray Course for Interior Design!
Gumroad logo transparent
Udemy logo transparent
Skillshare logo transparent
Autodesk logo for sketchup blog and courses

subscribe to the SketchUp guru newsletter!

Never miss any news, deals or updates on new tutorials, podcasts or events!
Sign-up to my amazing newsletter and get all the tools you need to become a pro designer directly in your mailbox!
Bonus for new subscribers *** FREE RESOURCE KIT *** Don’t miss out!

*By subscribing to the newsletter you agree to the storage and use of personal data as stated in and in accordance with our privacy policy

Creating tutorials and sharing assets & tools for anyone dreaming of an Interior Design and Architecture career.

check my socials

Contact Me

Copyright 2021 © Sketchup Guru

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close