Question on 3D rendering in Slicer

Hello all,

I am aware that Slicer uses the VTK library for rendering. I have read a few sources on the internet that describe how VTK uses the OpenGL graphics library by default. Therefore, I believe there is no doubt that VTK uses the OpenGL renderer.

My question is: Is it possible for Slicer to enable VTK to use the Direct3D renderer? I am not suggesting completely replacing OpenGL with Direct3D, as Direct3D is Windows-oriented, but rather allowing users to choose between OpenGL and Direct3D for rendering.

Additionally, I believe Slicer should have a dedicated 3D settings option in its configuration for rendering and visualization. This could include various options related to rendering. I think this is an interesting topic to consider in Slicer.

Thank you!

That would be a pretty significant change, and many parts of Slicer are closely tied to the parts of VTK that rely heavily on OpenGL (e.g. volume rendering, interactive 3d widgets, etc). But the data in Slicer can be exported to other renderers if you want to do other things, like render with shadows or custom shaders.

My requirement is to use Direct3D for the things you mentioned, such as volume rendering, interactive 3D widgets etc. The data export functionality you mentioned is completely different from my requirements.

VTK is adding support for Direct3D/Vulkan/Metal rendering via its new WebGPU backend and Slicer will switch to that when feature parity and stability is comparable with the current OpenGL backend. However, this low-level implementation detail generally should not matter for application developers. What is the reason that you are interested in Direct3D?

1 Like

OpenGL is no longer being developed, which is why I am looking for alternative libraries.

VTK provides a higher level API than OpenGL. If you use VTK then you can be sure that your code will run on Windows, macOS, Linux, web, and mobile, without ever having to adapt to low-level, platform-specific APIs.

Currently, under the hood, VTK is adding WebGPU support, which - depending on the underlying platform - uses Direct3D, Metal, and Vulkan. You can already enable the WebGPU backend in VTK and render using Direct3D.

By the way, OpenGL API will be available in the foreseeable future (few decades or so), just its runtime performance, maintenance, etc. cost will gradually increase, so it will become less and less desirable. I would also note that Direct3D is not a very safe bet either. It is entirely possible that it will be replaced by WebGPU or some new API in the years to come. If you want to be isolated from these industry changes then you are better off using higher-level frameworks and not get stuck with one of today’s low-level platform-specific APIs.

1 Like

Great. Thanks for the explanation. I understand it now.