Skip to content

WIP: Volume shader readability

This is a suggestion for a modification that would greatly facilitate the work of users who write custom OpenGL shaders. The new functionality allows to query the code used when the shader was last compiled, but more importantly, all shader replacements (both user-defined and built-in replacements) are tagged in the code to make it easier to understand the relationship between tags in the original template and replacement code. For example:

//VTK::ComputeColor::Dec

Become:

//BEGIN VTK::ComputeColor::Dec
uniform sampler2D in_colorTransferFunc_0[1];
          
vec4 computeColor(vec4 scalar, float opacity)          
  {          
  return computeLighting(vec4(texture2D(in_colorTransferFunc_0[0],          
                         vec2(scalar.w, 0.0)).xyz, opacity), 0);          
  }
//END VTK::ComputeColor::Dec

In the current version of VTK, it is not possible to know simply by inspecting the shader code, which portion corresponds to //VTK::ComputeColor::Dec. Users who wish to modify a piece of the shader need to first figure out where the piece of code they want to modify is replaced and what the bounds are. It is not so complicated, but it is time consuming.

Merge request reports