A plugin that links the VTK Library to Unreal Engine 5.3.
Currently, this plugin does the following:
- Download & build VTK (infer/change the version in the install script file)
- Expose VTK to your complete Unreal project (public, but you may want this private)
- Provide a blueprint function "DistanceBetweenTwoPoints" for testing
vtkMath.h
(based on an official VTK example, cross-compatible) - Provide a blueprint function "ReadStructuredGridTest" for more complex vtk includes (loosely based on an official VTK example
- ✔️ Complete cross-compatibility for Windows/Linux/Mac (tested)
This plugin is quite verbose as it aims to be a foundation for implementing & testing VTK functionality in UE.
Check the Unreal Log for [VtkPlugin]
to see what's happening (also valid for the blueprint functions).
- Delay-loading (which would be better practice) is currently disabled and all VTK dlls are instantly loaded.
- This prevents module reloading.
- Cross-compatibility only through an RTTI enabled Wrapper module (
VtkWrapper
)- Using PImpl pattern
- UE on Unix is per default compiled without RTTI and will clash with RTTI-functionality used in some VTK includes (also discussed here)
- Wrapper modules also employed by Unreal, e.g., in the
OpenExrWrapper
(see here)
You can use the [*.bat|*.sh|*.command]
installation scripts to download and build VTK for UE automatically.
By default it will do a Release
build, but you can tell it to do a Debug
build by starting it with Debug
as a parameter.
If you do a Debug build, don't delete your build folder (./Temporary
) at the end of the script. The *.dll
files store the path to its debug symbols which remain there.
# Release build
.\install_vtk_windows.bat
# Debug build (do not delete build folder at the end)
.\install_vtk_windows.bat debug
Alternatively, download & build the VTK library yourself and copy the files to the correct locations:
- Copy the includes to
VtkPlugin/Source/ThirdParty/VtkLibrary/Public
- Windows
- Copy
*.lib
files toVtkPlugin/Source/ThirdParty/VtkLibrary/[Release|Debug]/lib
folder - Copy
*.dll
files toVtkPlugin/Source/ThirdParty/VtkLibrary/[Release|Debug]/bin
folder
- Copy
- Linux
- Copy
*.so
files toVtkPlugin/Source/ThirdParty/VtkLibrary/Linux/[Release|Debug]/lib
folder
- Copy
- Mac
- Copy
*.dylib
files toVtkPlugin/Source/ThirdParty/VtkLibrary/Mac/[Release|Debug]/lib
folder
- Copy
Prerequisites:
For test data have a look at the VTKData repository (files here are referenced in the official VTK examples): https://github.com/open-cv/VTKData
If there are linking errors with the VTK library, have a look in the Source/ThirdParty/VtkLibrary
folder:
- Check if your VTK binaries are in the correct folder
- Check if your VTK includes are present
- Check if
VtkLibrary.Build.cs
correctly finds your VTK includes & binaries
If the necessary VTK binaries don't exist, they may have not been built. Check which VTK module is missing and enable it explicitly in your build configuration for VTK.
- If you used our installation script: Add
-DVTK_MODULE_ENABLE_VTK_<module_name>=WANT
to the cmake call - If you build yourself with the commandline: Same as above
- If you build yourself using the CMake GUI: Check the
Advanced
box, then you can search for the missing module name