This is for embedding a VTP file into a standalone HTML web app for 3D viewing with vtk.js
Please head over to the releases page and download the pre-built HTML file from the latest release notes with the Python script for "injecting" a VTP mesh file into the viewer.
Once you have both files downloaded, point the Python script to both your VTP mesh file and the prebuilt HTML file:
python inject_data.py <path_to_mesh>.vtp index.html
This will ouptut a new HTML file next to the mesh file where you can view that mesh and share the HTML file for anyone to view it (with/without an internet connection and without sharing the original mesh file).
Install the app:
npm install
Build the static HTML app:
npm run-script build
Inject your .vtp
mesh file into the app:
python inject_data.py <path_to_mesh>.vtp dist/index.html
And then you can share the produced .html
file with the same basename as the
mesh for 3D viewing anywhere!
For building source in the HTML file, see DustinJackson/html-webpack-inline-source-plugin#79
The given mesh file should have a point data array named 'RGB'
.
Appended | Ascii | Binary | |
---|---|---|---|
None | ✅ | ✅ | ✅ |
LZ4 | ❌ | ❌ | ❌ |
ZLib | ✅ | ✅ | ✅ |
LZMA | ❌ | ❌ | ❌ |
Of the supported formats, Appended-ZLib
has the mallest file size. For one specific mesh, here is a comparison. This should scale:
Appended | Ascii | Binary | |
---|---|---|---|
None | 27 Mb | 48 Mb | 35 Mb |
ZLib | 8.7 Mb | 48 Mb | 11 Mb |