Skip to content

Use vtk.js for visualization #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nikoscham opened this issue May 21, 2025 · 5 comments
Open

Use vtk.js for visualization #24

nikoscham opened this issue May 21, 2025 · 5 comments
Assignees
Labels
enhancement New feature or request FEAScript 0.2.0

Comments

@nikoscham
Copy link
Member

This issue has been added to the FEAScript roadmap for the upcoming 0.2.0 release (https://github.com/orgs/FEAScript/discussions/17). With vtk.js we can visualize both the results and the computational mesh. Additionally, we could export a .vtk file to allow users to download the results.

@sridhar-mani
Copy link
Collaborator

sridhar-mani commented May 21, 2025

VTK format is very messy and is for advanced meshes i think our current gmsh is good for visualization. I will see if i could ways to visualize it for future 3d cases too somehow.

Edit - Considering maybe we can use it for exporting capabilities to export our result in some way.

@nikoscham
Copy link
Member Author

VTK format is very messy and is for advanced meshes i think our current gmsh is good for visualization. I will see if i could ways to visualize it for future 3d cases too somehow.

Edit - Considering maybe we can use it for exporting capabilities to export our result in some way.

Yes, Gmsh also offers visualization capabilities. However, vtk.js is written in pure JavaScript, making it potentially easier to integrate into our tutorials or in the FEAScript platform. It provides (at least from what I know from ParaView) advanced features such as domain slicing, contour plots, stream tracing, mesh visualization, etc..

I'm not sure how difficult or messy integrating the vtk.js library would be, as I only have limited experience with the .vtk file format. In the past, I have exported Fortran FEM results to a .vtk file and visualized them in ParaView (take a look of the Fortran code here). I think adding .vtk export functionality, as you mentioned, would be a great starting point, with vtk.js integration potentially coming later. Alternatively, there is a vtk loader for Three.js (example here), but I believe it is no longer actively supported or maintained.

@nikoscham nikoscham self-assigned this May 21, 2025
@sridhar-mani
Copy link
Collaborator

sridhar-mani commented May 21, 2025

The tricky thing is that volume rendering that is normally possible in paraview for the vtk or vtu format is not possible in vtk.js. It is only possible with the integration of vtk.wasm for js approach.

@nikoscham
Copy link
Member Author

I see your point. I doubt however if FEAScript would support 3D computations in the near future. We are staying at 2D, at least for the next release. Thus the lack of volume rendering is not a significant concern for now. Furthermore, when we finally go to 3D we could use 2D slices, contour surfaces, streamlines, etc, for visualization (at least this is what I use in ParaView).

I couldn't' find any alternatives for visualizing results on real-time, apart from vtk.js. The plotly.js library we use now is, according to my opinion, very limited and I think we should abandon it until the next release. We need something specialized for FEM results.

@sridhar-mani
Copy link
Collaborator

I have worked extensively with vtk.js so i can integrate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request FEAScript 0.2.0
Projects
None yet
Development

No branches or pull requests

2 participants