This is the main repository for the code from the my Master Thesis. Other than me, a number of BSc students have made their theses based on this and I will try to keep the list updated with the different updates, new features and toolkit components that are added.
This Unity plugin is composed of a underlying architecture that connects VTK and Unity using a shared OpenGL context (see Wheeler et al.'s plugin on which this is based here) and a toolbox of UI components that are called for interactive manipulation through introspection on the VTK classes. In particular, these components are to be compounded in order to create a modular UI where the data for the VTK pipelines can be inserted.
If you want to contribute, there a number of parts where you could do so. If you are more interested in the UI part of the plugin, you can develop or refine the UI components in the Toolbox. If you want to enhance or expand the architecture you are free to do so. You can fork this repository but we ask you to open a pull request when you are at a stable stage in your development so we can maintain this tool updated and running rather than fragmenting it in numerous repositories.
C:/Users/<your-username>/Documents/VtkUnity/
) referred to from here on as %WORKSPACE%
%WORKSPACE%
create two folders, Vtk
and VtkUnityWorkbench
%WORKSPACE%/Vtk/
create the folders Source
, Build
and Install
%WORKSPACE%/Vtk/
(you can also use a git UI client for these steps)git clone https://github.com/Kitware/VTK.git source
git checkout v8.1.2
git submodule update --init
%WORKSPACE%/Vtk/source
and the build directory to %WORKSPACE%/Vtk/Build
Configure
and select Visual Studio 15 2017 generator, with platform x64, click Finish
and wait till the configuration endsAdvanced
in the top barCMAKE_INSTALL_PREFIX
to %WORKSPACE%/Vtk/Install
INSTALL_*_DIR
to %WORKSPACE%/Vtk/Install/*
for each of the entriesModule_VtkPython
Module_VtkRenderingExternal
Module_VtkWrappingPythonCore
Module_VtkWrappingTools
PYTHON_EXECUTABLE
points to the right python.exe
file (i.e. Python 3.7.X)VTK_PYTHON_VERSION
to 3.7
VTK_WRAP_PYTHON
Configure
and wait for CMake to finishPYTHON_*
point to the right Python 3.7.X files and directoriesConfigure
and wait for CMake to finishVTK_ENABLE_VTKPYTHON
Configure
and wait for CMake to finishGenerate
and wait for CMake to finish%WORKSPACE%/Vtk/Build/VTK.sln
with Visual Studio 2017Release x64
The compilation of the VTK library could take up to two hours depending on the performances of your computer. If it takes longer than that, we suggest you switch to a more powerful workstation for ease of development, as otherwise it could become very difficult and stressful.
%WORKSPACE%/VtkUnityWorkbench/
(you can also use a git UI client for these steps)git clone https://github.com/EnlitHamster/VtkUnityWorkbench.git VtkUnityWorkbench
git submodule update --init
%WORKSPACE%/VtkUnityWorkbench/Source/VtkToUnityPlugin/
as %PLUGINDIR%
%PLUGINDIR
create the folders Build
and Install
%PLUGINDIR%/source
and the build directory to %PLUGINDIR%/Build
Configure
and select Visual Studio 15 2017 generator, with platform x64, click Finish
and wait till the configuration endsAdvanced
in the top barMY_OWN_INSTALL_PREFIX
to %PLUGINDIR%/Install
PYTHON_*
point to the right Python 3.7.X files and directoriesVTK_DIR
to %WORKSPACE%/Vtk/Build
Configure
and wait for CMake to finishGenerate
and wait for CMake to finish%PLUGINDIR%/Build/VtkToUnityPlugin.sln
with Visual Studio 2017Release x64
At the end of this procedure, you should have some main crucial files:
%WORKSPACE%/Vtk/Install/bin
should now contain the DLL files for VTK C++%WORKSPACE%/Vtk/Install/lib/python3.7/site-packages
should contain the pyc files for VTK Python%PLUGINDIR%/Install
should now contain the DLL file and the build files for VtkUnityWorkbench%PYTHONDIR%
, the install directory of Python 3.7, should contain python37.dll
and python37_d.dll
First of all, we need now to install VTK Python somewhere accessible to Python. We strongly recommend doing this installing it in the global Python install directory %PYTHONDIR%/Lib/site-packages
, by copying in there %WORKSPACE%/Vtk/Install/lib/python3.7/site-packages/vtk
, and then the contents of %WORKSPACE%/Vtk/Install/bin
inside %PYTHONDIR%/Lib/site-packages/vtk
(or to any place within the PATH environmental variable, the important thing is that Python must be able to access the DLL files). To test whether this works, run a command line terminal, open the Python interpreter python
and run import vtk
. If it returns no error, VTK Python should be correctly installed.
At the moment, VtkUnityWorkbench does not support virtual environments, but it is a feature which we plan to introduce soon.
From here on we will refer to %WORKSPACE%/VtkUnityWorkbench/Source/VtkToUnityExample/
as %UNITYDIR%
. Copy the contents of %PLUGINDIR%/Install
into %UNITYDIR%/Assets/VtkToUnity/vtktounitybinary/Plugins/x86_64/
. Add %UNITYDIR%
to your Unity Hub projects and download the correct Unity version. This should be enough to have your setup ready to go.
A number of outstanding issues are still open regarding the Workbench. We aim at producing a solution that is stream-lined and ready-for-use. As such, our most important objectives are: