Creates an instance of ColorMap.
The colors of this color map.
The lower bound of the color map range.
The upper bound of the color map range.
The mode of the color map.
Enables or disables the color map.
Gets or sets the upper bound of the color map range.
Gets or sets the lower bound of the color map range.
Gets or sets the color map mode.
Gets or sets the opacity values of the color map.
Note: if the provided array does not have the same length as the colors array, an exception is raised.
Returns a 1D texture containing the colors of this color map.
The resulting texture.
Represents a 1D color gradient bounded by a
min
andmax
values.Whenever a color map is associated with a grayscale texture, the color intensity of the texture is used a a parameter to sample the color gradient.
Important: since this color map owns a texture, it is disposable. Don't forget to call
dispose()
to free texture memory, when you're finished using the colormap.The
mode
property describes how the intensity of the pixel is interpreted:Elevation
simply takes the intensity value of the pixel,Slope
gets the slope of the pixel (assuming it is an elevation texture), andAspect
gets the aspect (orientation from the north) of the pixel (assuming it is an elevation texture).The
min
andmax
properties describe how the colormap is applied relative to the intensity of the sampled pixel.Pixel intensities outside of those bounds will take the color of the bound that is the closest (i.e if the intensity is greater than
max
, the color will be the rightmost color of the color ramp).The
colors
property takes an array of colors. To create this array, you can use libraries such ascolormap
orchroma-js
to generate the color ramp.To obtain a "discrete" color map, you should use a small number of colors in the ramp. Conversely, to obtain a "linear", continuous color map, you should use a high number of colors, typically 256 values.
Example