trixi-framework / trixi-framework/Trixi.jl

Blender visualization for Trixi

Open
#1,369 0 comments 3 reactions 0 assignees View on GitHub
documentation enhancement visualization
Dominant language
Julia
Stars
731
Forks
166
Avg merge
2d 18h
Merged PRs (30d)
25

Description

This issue documents a workflow for Trixi to visualize results as photorealistic images and animations using Paraview and the open-source software [Blender](https://www.blender.org/). The general workflow is based on a [tutorial for Flexi](https://www.flexi-project.org/?page_id=1136), and has been modified to work with Trixi and the current Blender version (3.4.1).

Furthermore it can be a starting point for future developments. Open tasks for the visualization are:

- [ ] Further development of the scripts to create a proper visualization pipeline
- [ ] Create a tutorial

### Workflow:
Trixi2Vtk → Paraview → Blender

### Images:
First use [Trixi2Vtk](https://trixi-framework.github.io/Trixi.jl/stable/visualization/#Trixi2Vtk) to convert your solution files into .vtu format.

These .vtu-files can then be read into Paraview, where you can setup the visualization. After this is done, save the setup as a statefile (.pvsm) and export the scene as a .x3d-file.

![Screenshot from 2023-03-09 14-25-16](https://user-images.githubusercontent.com/114223904/224036693-9e39d85b-e224-4aba-9637-b9e1e8dd9b86.png)

The .x3d-file can then be imported into Blender. Now you have many options to create a nice looking image. Essential steps are to assign materials to the geometry, add lights and specifiy camera positions. The [Flexi Tutorial ](https://www.flexi-project.org/?page_id=1136) gives a nice overview of the steps. However, it was written for an older Blender version and the user interface has changed quite a bit.

![Screenshot from 2023-03-09 14-21-43](https://user-images.githubusercontent.com/114223904/224036914-d7bbaa43-622b-4207-b44a-612cb7f877a4.png)

Once this is all done, just start to render and you will obtain the final image.

![test_render_Viewpoint_025](https://user-images.githubusercontent.com/114223904/224037241-2960299c-02be-465b-a421-6c712a9d4eee.png)

### Animation:
Since both Blender and Paraview have a python API, this process can be automated. The idea is to export one .x3d-file in Paraview for each step in your animation. This is done by executing the script [paraview_x3d_export.py](https://gist.github.com/patrickersing/52daabd456b8921c2dd55e6149339926#file-paraview_x3d_export-py).
Then use one .x3d-file to setup a single frame in blender (add material, camera, lights and render settings) and save this as a .blend file. This file will then contain the general render settings. Afterwards executing the script [animate_blender.py](https://gist.github.com/patrickersing/52daabd456b8921c2dd55e6149339926#file-animate_blender_twolayer-py) will update the visualization object based on the .x3d-files and render an image for each. This produces several image files in .png-format, that can be converted into video, for example by using the `ffmpeg` command: `ffmpeg -framerate 5 -pattern_type glob -i '*.png' out.mp4`

Contributor guide

Open the contributing guide

Research direction

Start with the existing Trixi2Vtk → ParaView → Blender workflow, including paraview_x3d_export.py and animate_blender.py, and compare it with the linked Flexi tutorial. Clarify whether the contribution should be a tutorial, further script development, or both. Done should mean the selected workflow is documented or automated sufficiently for another user to produce images or animations.

Written by the indexing model from the issue text.

Assessment

Tech stack
blender, julia, python
Domain
computer-graphics, data-visualization, documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.