File: Lut.md | Updated: 11/15/2025
Represents a lookup table for colormaps. It is used to determine the color values from a range of data values.
const lut = new Lut( 'rainbow', 512 );
const color = lut.getColor( 0.5 );
Lut is an addon, and must be imported explicitly, see Installation#Addons.
import { Lut } from 'three/addons/math/Lut.js';
Constructs a new Lut.
colormap | Sets a colormap from predefined list of colormaps. Default is 'rainbow'.
---|---
count | Sets the number of colors used to represent the data array. Default is 32.
This flag can be used for type testing.
Default is true.
The lookup table for the selected color map
The currently selected color map.
The maximum value to be represented with the lookup table.
Default is 1.
The minimum value to be represented with the lookup table.
Default is 0.
The number of colors of the current selected color map.
Default is 32.
Adds a color map to this Lut instance.
name | The name of the color map.
---|---
arrayOfColors | An array of color values. Each value is an array holding a threshold and the actual color value as a hexadecimal number.
Returns: A reference to this LUT.
Copies the given lut.
lut | The LUT to copy.
---|---
Returns: A reference to this LUT.
Creates a canvas in order to visualize the lookup table as a texture.
Returns: The created canvas.
Returns an instance of Color for the given data value.
alpha | The value to lookup.
---|---
Returns: The color from the LUT.
Sets the given LUT.
value | The LUT to set.
---|---
Returns: A reference to this LUT.
Configure the lookup table for the given color map and number of colors.
colormap | The name of the color map.
---|---
count | The number of colors. Default is 32.
Returns: A reference to this LUT.
Sets the maximum value to be represented with this LUT.
max | The maximum value to be represented with the lookup table.
---|---
Returns: A reference to this LUT.
Sets the minimum value to be represented with this LUT.
min | The minimum value to be represented with the lookup table.
---|---
Returns: A reference to this LUT.
Updates the given canvas with the Lut's data.
canvas | The canvas to update.
---|---
Returns: The updated canvas.