fossils-vtu2obj converts FEM results stored in VTK XML Unstructured Grid
files (.vtu) into:
- an extracted surface mesh,
- an OBJ file with UV coordinates,
- a PNG palette texture generated from a selected scalar field,
- and a matching MTL file for direct import in tools such as Blender.
The project is designed for post-processing workflows around the fossils finite element solver and keeps the core conversion pipeline VTK-only.
Install the command-line tool:
pip install .Install the GUI as well:
pip install ".[gui]"Try the example dataset:
fossils-vtu2obj inspect examples/beam3d.vtu
fossils-vtu2obj list-arrays examples/beam3d.vtu
fossils-vtu2obj preview examples/beam3d.vtu --field stress_von_mises
fossils-vtu2obj convert examples/beam3d.vtu out/beam --field stress_von_mises
fossils-vtu2obj guiThe current application can:
- inspect VTU datasets,
- list point-data and cell-data arrays,
- extract the outer surface with VTK,
- preview scalar coloring or textured output with VTK,
- generate a discrete palette texture PNG,
- generate UV coordinates from a scalar field,
- export
OBJ + MTL + PNG, - open a GUI with a VTU view and an OBJ bundle comparison view.
- Open a
.vturesult file. - Choose a scalar field such as
stress_von_mises. - Choose a colormap and scalar range.
- Preview the result.
- Export an OBJ bundle.
- Open the exported OBJ in Blender or another DCC tool.
The exported texture is a robust palette texture:
- each row repeats the same discrete colormap,
- the scalar field is encoded in the
Ucoordinate, Vstays constant.
This makes the exported mesh more stable under downstream texture filtering than a diagonal-only texture approach.
Inspect a dataset:
fossils-vtu2obj inspect examples/beam3d.vtuList arrays:
fossils-vtu2obj list-arrays examples/beam3d.vtuPreview a scalar field:
fossils-vtu2obj preview examples/beam3d.vtu \
--field stress_von_mises \
--colormap rainbowPreview the textured surface:
fossils-vtu2obj preview examples/beam3d.vtu \
--field stress_von_mises \
--colormap rainbow \
--texturedExport an OBJ bundle:
fossils-vtu2obj convert examples/beam3d.vtu out/beam \
--field stress_von_mises \
--colormap rainbow \
--vmin 0 \
--vmax 120 \
--n-colors 16Export a cell-data field:
fossils-vtu2obj convert examples/beam3d.vtu out/beam_cell \
--field cell_stress_von_mises \
--colormap cool_to_warmCheck the optional native bridge status:
fossils-vtu2obj native-statusThe GUI currently provides:
- a left viewport dedicated to VTU inspection and conversion,
- a right viewport dedicated to exported OBJ/MTL/PNG bundle comparison,
- tabs
Controls,Display, andInfounder each viewport, - scalar field and colormap selection,
- texture preview for the loaded OBJ bundle,
- recent files lists,
- per-view display options such as mesh edges, trihedron, bounding box, background preset, lighting preset, and camera presets.
The repository currently includes:
See examples/README.md for a short description of each dataset.
- Only scalar fields can drive preview and export.
- Vector and tensor arrays are listed during inspection but are not directly convertible.
- The GUI uses cooperative cancellation for long-running operations; an active VTK call cannot be interrupted immediately.
- The optional native
fossilsbridge is not implemented yet.
- INSTALL.md for complete installation and packaging notes
- docs/ARCHITECTURE.md for the technical architecture
- docs/PROJECT_STATUS.md for the current state and roadmap
- docs/AI_HANDOFF.md for project memory aimed at future AI sessions or other coding agents
- AGENTS.md for compact agent-oriented project guidance

