Applying Color and Opacity with Scenegraph
- Last UpdatedFeb 19, 2025
- 1 minute read
This topic relates to Scenegraph.
Applying Color and Opacity
The Color and Opacity functionality manages two different visualization aspects: color and opacity. These functionalities can be managed independently or together depending on the type of value passed.
Supported platforms
Setting color and opacity
User can manage color and opacity through the following fields.
|
Mode |
Fields |
|---|---|
|
Stateful mode |
colorAndOpacityIDs |
|
Stateless mode |
setColorAndOpacityForID, setColorAndOpacityForAllID, resetColorAndOpacityForID, resetColorAndOpacityForAllID |
Parameters
The colorAndOpacityIDs, setColorAndOpacityForID, and setColotAndOpacityForAllID fields require the following parameters:
-
Key - Set this value to the geometry unique ID. The ID could be, for example, retrieved from a PickSensor. Only setColorAndOpacityForAllID can pass the name of the file node to apply the setting to all file content.
-
Value - Contains the parameters to customize override color and opacity.
-
Color and opacity - SFLOAT (0-1 range) to set opacity only, SVEC3 (RGB in 0-1 range) to set color only, or SVEC4 to set both color (RGB in 0-1 range) and opacity (0-1 range).
Examples
These are examples of valid key and values.
-
Example setting of only opacity: scene02|jersey_001=0.5
-
Example setting of only color: scene02|jersey_001=1 0 0
-
Example setting of both color and opacity: scene02|jersey_001=1 0 0 0.5
