In this article we will give access to an example of custom colormap editor done using shaders.

Note: The example comes with a script to generate a solution to be loaded by Visual Studio under Windows. Some modifications have to be done if you want to test it on another platform supported by Open Inventor.

Configure, build and load

  1. First thing first, in order to be able to launch the demonstrator you will need a valid installation of, at least, Open Inventor 10.9 C++ for Windows (please refer to Download Page). In the following document, the folder where Open Inventor is installed will be referred as OIVHOME.
  2. Once Open Inventor is installed on your computer, download the Demo Package from here. It is a zip archive with the following content
    • setup-build.bat : a simple batch file which will simplify the generation of Visual Studio Solution
    • README.txt: text file with general informations
    • LICENSE.txt: the license associated with the project
    • CMakeList.txt: the top CMakeLists used to generate the Visual Studio Solution
    • colormap_editor : folder containing source of the project
    • Shaders are located in colormap_editor\shaders folder
  3. Open the file setup-build.bat with a text editor to set the value defining your configuration
    • set the OIVHOME value to point to the folder where is installed Open Inventor on your system
    • Optionnal : this setup will generate a solution to be loaded with Visual Studio 2019. If you want to use another version of Visual Studio please take a look at line 21 (cmake call) and line 28 to change the path to your Visual Studio. Eventually if you did not download a Visual Studio 2017 version of Open Inventor, change the OIVARCH variable so it matches your configuration

Once the script files matches your configuration simply double click on it. It will run cmake configuration, cmake generation and open the generated solution with Open Visual Studio 2019.

Run the example

Once the solution is loaded in Visual Studio, simply choose Debug or Release configuration and run the default project. Note this is higly recommended to use Release to get better performances.

Some details

  • From top to bottom you can interact with
    • Alpha Curve
    • Color Control Points
    • Hue of current selected control point
    • Saturation of current selected control point
    • Value (HSV definition of "Value") of current selected control point
  • When switching to picking mode (escape key) you can interact with the sliders of the colormap to edit it. Double clicking on the alpha curve or the color control points slider allows to add control points, while right clicking on a control point will delete it. And all control points (except the ones at extremities) can be moved horizontally to adjust their value.
  • You can switch The layout to a "windowed" one, customize the Interpolation Space and define a different Colormap Size by using the Options menu.
  • The result can be exported as an SoColormap or SoTransferFunction via the File menu so it can be imported, later, in a scene graph.