public class SoColorMap extends SoNode
SoIndexedTexture2 node and colors.
The data value coming from the SoIndexedTexture2 node is used as an index into the color map defined by the colorMap field or the predefinedColorMap field.
The predefinedColorMap field allows you to specify a predefined color map or using value NONE, that the color map is contained in the colorMap field.
The min and max fields define the range of the data values that will actually be used. The color map is modified such that only data values ranging from min to max will be mapped to the color map. The figure below illustrates the effects of these fields:
The SoColorMap node acts like an SoShaderProgram with an SoFragmentShader. Standard Open Inventor operations on textures will be disabled on all subsequent nodes, thus using an SoTexture2 node or multitexturing after this node will not give the expected result.
NOTE: The SoColorMap node must be inserted before the SoIndexedTexture2. This node puts the color map in the next available texture unit, so this unit must not be used for any other purpose in your application. On hardware which doesn't support
ARB_fragment_program but supports
EXT_paletted_texture , the next available texture unit is not used and thus remains available for use by the application. If your graphics hardware does not support the ARB_fragment_program or the EXT_paletted_texture OpenGL extension, this node has no effect. SoColorMap is only used to color SoIndexedTexture2 nodes. To specify a color map for volume rendering, see SoTransferFunction.
The following example shows how to apply an indexed texture on a geometry node:
SoColorMap colorMap = new SoColorMap(); colorMap.predefinedColorMap.setValue( SoColorMap.PredefinedColorMaps.TEMPERATURE ); colorMap.min.setValue( -1000 ); colorMap.max.setValue( 20000 ); SoIndexedTexture2 indexedTexture = new SoIndexedTexture2(); indexedTexture.imageIndex.setValue(size, SoSFArray.DataTypes.SIGNED_SHORT, data); root.addChild( colorMap ); root.addChild( indexedTexture ); root.addChild( geometry );
File format/default:
ColorMap {
| min | 0 |
| max | 0 |
| predefinedColorMap | TEMPERATURE |
| colorMapFormat | RGB_ALPHA |
| colorMap | 0 |
Action behavior:
SoGLRenderAction, SoCallbackAction
Sets: SoColorMapElement
See also:
| Modifier and Type | Class and Description |
|---|---|
static class |
SoColorMap.ColorMapFormats
Color map format.
|
static class |
SoColorMap.Interpolations
The colormap interpolation type.
|
static class |
SoColorMap.PredefinedColorMaps
Predefined color map.
|
Inventor.ConstructorCommandVERBOSE_LEVEL, ZeroHandle| Constructor and Description |
|---|
SoColorMap()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getNumColor()
This convenience method returns the number of colors in the color map (ie: colorMap.getNum()/Number of components or 256 if a predefined color map is used)
|
boolean |
hasTransparency()
Returns true if the current color map contains alpha values less than 1.
|
affectsState, callback, copy, copy, distribute, doAction, getAlternateRep, getBoundingBox, getByName, getMatrix, getPrimitiveCount, getRenderUnitID, GLRender, GLRenderBelowPath, GLRenderInPath, GLRenderOffPath, grabEventsCleanup, grabEventsSetup, handleEvent, isBoundingBoxIgnoring, isOverride, pick, rayPick, search, setOverride, touch, writecopyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaultsdispose, getEXTERNPROTO, getName, getPROTO, isDisposable, isSynchronizable, setName, setSynchronizablegetAddress, getNativeResourceHandle, startInternalThreads, stopInternalThreads@Deprecated public static final int LUMINANCE
SoColorMap.ColorMapFormats.LUMINANCE instead.@Deprecated public static final int ALPHA
SoColorMap.ColorMapFormats.ALPHA instead.@Deprecated public static final int LUMINANCE_ALPHA
SoColorMap.ColorMapFormats.LUMINANCE_ALPHA instead.@Deprecated public static final int RGB
SoColorMap.ColorMapFormats.RGB instead.@Deprecated public static final int RGB_ALPHA
SoColorMap.ColorMapFormats.RGB_ALPHA instead.@Deprecated public static final int NONE
SoColorMap.PredefinedColorMaps.NONE instead.@Deprecated public static final int GRAY
SoColorMap.PredefinedColorMaps.GRAY instead.@Deprecated public static final int TEMPERATURE
SoColorMap.PredefinedColorMaps.TEMPERATURE instead.@Deprecated public static final int PHYSICS
SoColorMap.PredefinedColorMaps.PHYSICS instead.@Deprecated public static final int STANDARD
SoColorMap.PredefinedColorMaps.STANDARD instead.@Deprecated public static final int GLOW
SoColorMap.PredefinedColorMaps.GLOW instead.@Deprecated public static final int BLUE_RED
SoColorMap.PredefinedColorMaps.BLUE_RED instead.@Deprecated public static final int SEISMIC
SoColorMap.PredefinedColorMaps.SEISMIC instead.@Deprecated public static final int BLUE_WHITE_RED
SoColorMap.PredefinedColorMaps.BLUE_WHITE_RED instead.@Deprecated public static final int INTENSITY
SoColorMap.PredefinedColorMaps.INTENSITY instead.@Deprecated public static final int LABEL_256
SoColorMap.PredefinedColorMaps.LABEL_256 instead.@Deprecated public static final int VOLREN_RED
SoColorMap.PredefinedColorMaps.VOLREN_RED instead.@Deprecated public static final int VOLREN_GREEN
SoColorMap.PredefinedColorMaps.VOLREN_GREEN instead.@Deprecated public static final int AIRWAY
SoColorMap.PredefinedColorMaps.AIRWAY instead.@Deprecated public static final int AIRWAY_SURFACES
SoColorMap.PredefinedColorMaps.AIRWAY_SURFACES instead.@Deprecated public static final int INTENSITY_REVERSED
SoColorMap.PredefinedColorMaps.INTENSITY_REVERSED instead.@Deprecated public static final int NEAREST
SoColorMap.Interpolations.NEAREST instead.@Deprecated public static final int LINEAR
SoColorMap.Interpolations.LINEAR instead.public final SoSFFloat min
SoIndexedTexture2 node.
Values less than min and greater than max will be set to colorMap[0] and colorMap[colorMap.getNum()-1] respectively. If min is less than the minimum of the indexed texture minValue , it will be clamped to this minimum. If max is greater than the maximum of the indexed texture maxValue , it will be clamped to this maximum. When min and max are equal to 0 (the default), the entire range of data values is used.
Setting (min,max) to (64,192) while the predefined STANDARD color map is selected and in the case of a UNSIGNED_BYTE indexed texture will make the color map as shown:

public final SoSFEnum<SoColorMap.PredefinedColorMaps> predefinedColorMap
| GRAY | ![]() |
| TEMPERATURE | ![]() |
| PHYSICS | ![]() |
| STANDARD | ![]() |
| GLOW | ![]() |
| BLUE_RED | ![]() |
| SEISMIC | ![]() |
| BLUE_WHITE_RED | ![]() |
| INTENSITY | ![]() |
| LABEL_256 | ![]() |
| VOLREN_RED | ![]() |
| VOLREN_GREEN | ![]() |
| AIRWAY | ![]() |
| AIRWAY_SURFACES | ![]() |
NOTE: In the images above the checkerboard pattern shows through where the color map alpha (opacity) value is less than 1.0.
If it is set to NONE, the fields below must be set.
public final SoSFEnum<SoColorMap.ColorMapFormats> colorMapFormat
LUMINANCE means one component per color for a grayscale color map.
ALPHA means one alpha component per color.
LUMINANCE_ALPHA means two components per color, luminance and alpha. In such a case the colorMap float array contains a list of two floats. Index 0 is luminance, index 1 is alpha, index 2 is luminance, index 3 is alpha and so on.
RGB means three components per color, ordered red first, then green and blue.
RGB_ALPHA means four components per color, ordered red first, then green, blue, and alpha.
An alpha value equal to zero means "fully transparent", an alpha value equal to one means "opaque".
public final SoMFFloat colorMap
colorMapFormat. It is equal to the number of colors defined multiplied by the number of components per color. For example, for an RGBA color map of length n, there should be 4*n float values in the field. If a predefined color map is specified, the values of this field are not used.public final SoSFEnum<SoColorMap.Interpolations> interpolation
public boolean hasTransparency()
public int getNumColor()
Generated on February 24, 2026, Copyright © Thermo Fisher Scientific. All rights reserved. http://www.openinventor.com