VolumeManagerdecides it needs to rebuild its shader it starts with collecting all needed code snippets. The shader code is saved in multiple glsl resource files and annotated with preprocessing commands for the joining process. Also, the (hardcoded) per volume uniform names are collected. (See also next chapter) A code snippet with its associated uniforms is called a
Segment. The segments along with information about the used volumes and other things are passed the
MultiVolumeShaderMipconstructor which is part of BVV.
SegmentedShader. This shader is still not compiled.
VolumeManagernode for the first time it has to compile the shader first. But before that happens the
VolumeShaderFactorytransforms the code one last time. Among other things the uniforms which currently are strewn all over the code are extracted and placed in a UBO for Vulkan compatibility. Then finally a shaderPackage with the final code is given to BVV to compile and use.
NOTE: A breakpoint placed at
returnis also the optimal place to extract shader code for manual debugging.
Vector3f slicingPlaneuniform for each volume which will be used in the sampling part of the shader we need to add it to the corresponding segments key lists in the
VolumeManager. (At the time of writing (11.03.2021) this would be line 260 and 264 because there are two kind of sampling segments.)
.setCustomUniformForVolume(..)of the current shader. In our example we could add our code to the loop over
.setCustomFloatArrayUniformForVolume(..)has to be used.