Using GLSL post-process (2D) pixel shader with Slicer

I assume this is a dev rather than user question, that we cannot do it using an extension?

We have some GLSL shaders used to post-process a textured quad. In our application we use this in conjunction with 3D rendering and vertex/pixel shaders on polygonal models, but this shader is applied after all the transforms and normal rendering - essentially just on the contents of the render buffer applied to a quad and then run several passes.

This means - we think - we can take our shader and apply it to any source image using standard OpenGL. @lassoan has previously told us we can do anything VTK can in Slicer and VTK has shader support but he’s not a shader developer and I’m not a slicer developer so any help figuring out what I can do, and where I “get into” Slicer to do this sort of thing, would be wonderful.
e.g. how to attach my shader to a render pipeline or to a view, how to bind any arguments/parameters it needs. We’re in the situation we have shader/OpenGL developers and Slicer developers and a VTK developer but no cross-over between them for this specific case!

I am not sure that it will help, there is this VTK class:

in which you can provide your shader and input data (as a vtkImageData) and get the output data (again as a vtkImageData).

Instead, if you’d like to “add” your shader to the regular VTK rendering pipeline, you may try to ask @pieper. He worked on something similar.

1 Like

see also this link:


This project shows an example of customized rendering shader. See

Here’s the other GLSL code @Davide_Punzo mentioned. It’s less coupled to the vtk rendering process so it can make it simpler to do generic algorithms. At some point I plan to revisit this and see how it compares to the shader options recently added to VTK core and see if it’s still needed.