Lexis
1.1.0
Vocabulary of events and shared objects for BBP and HBP software
|
Being able to specify a mapping between scalar variables and parameters used for represent visually those variable is a recurring theme in visualization applications. An exemplary case is the transfer functions that map density to RGBA and opacity values in volume rendering with an emission-absorption optical model.
This specification describes the messages to deal with maps as a particular case of transfer function (TF). The more generic case will be addressed in a separate document.
This document follows the discussion initiated in by [https://github.com/HBPVIS/Lexis/pull/19]
Defining a color map with control points only makes sense if the application shader is capable of computing its values at runtime. In other words, the shader has to be able to compute any value that resolves the linear/Gaussian/etc function defined by control points. That (heavy and incompatible with real-time rendering) computation has to be implemented for all technologies used by the shaders (currently c++, glsl, cuda, ispc, etc). If generalization is wanted in the form of a method of the color map event (implemented in C++), that method has to compute the transformation from the control points to a lookup table in order to feed the shaders. And in that case, why not simply expose the color map as a simple lookup table, and leave the control point management to the client application?
The UI holds the state of the transfer function, and overwrites any value held by the renderer.
A simple event defines a range and a transfer function for each 'channel'. In our case, channels are the diffuse color, the opacity (alpha), the light emission, and the contribution to the geometry (how much of the geometry material is impacted by the transfer function). Each lookup table can have a variable number of values.
namespace lexis.render; table Color { red: float; // [0..1] green: float; // [0..1] blue: float; // [0..1] } table MaterialLUT { range: [double:2]; // Range of value to which the color map should apply diffuse: [Color]; // Diffuse color emission: [Color]; // Light emission alpha: [float]; // Opacity [0..1] contribution: [float]; // Contribution rate to the existing surface material [0..1] }