intake / xrviz

Interactive visualisation interface for Xarrays
https://xrviz.readthedocs.io
BSD 3-Clause "New" or "Revised" License
105 stars 21 forks source link

Volume Rendering for multi-dimensional datasets #71

Open hdsingh opened 3 years ago

hdsingh commented 3 years ago

For the project Web based volume rendering and 3D/4D visualization of Model Forecast (NM389-ISRO) of Indian Space Research Organisation and as a part of Smart India Hackathon 2020, I along with my team members tried to further extend the interface of XrViz to have capabilities for generating a 3D volumetic cube of the data points. Due to time limits of the hackathon, the created interface works perfect for this specific dataset, but may not be completely generalisable as of now. The aim of creating this issue is to suggest 3D volume rendering as a feature, to assist in even better exploration of the dataset. The extended code can be found in SIH-SuperUsers/xrviz.

Implementation Details:

  1. Adding a third dimension creates a challenge by increasing the data size tremendously as compared to a single 2D layer. We handled this by setting a skip interval for each of the dimension, since the data we need to visualize (the small cube) is very less as compared to actual volume. For example, skip_X = 30 means consider only every 30th point along the X-axis. These parmeters can be manually set by the user in the interface. This process of selecting and down sampling the volume has been done using numpy. Also before actually loading the data, it is important to select only that part of the data which is requried.

  2. Plotly has been used for volume rendering, which is already supported by Panel, hence making the process of adding cube in the interface very easy. I also tested the performance of K3D and Ipyvolume, and found those much slower as compared to Plotly. Also the cube generated by plotly looks much better visually.

  3. A basemap can also be added by providing the location of borders as geoJSON.

  4. Opacity and Surface count can be changed by the user to change the visual look of the cube.

The cube can be rotated, viewed along any dimension and the user can zoom in at any point on the surface or inside the volume.

Here are some images of the dashboard showing Temperature as it varies along along latitude and longitude for different pressure levels.

interface3d

Its corresponding 2D plot, bokeh_plot

By asking about an efficient method for volume rendering in pyviz Gitter, I got to know about the issue Implement 3D Volume regridding (in progress) in datashader, which when combined with the VTKVolume pane in Panel will be more efficient (via @philippjfr).

The specific changes can be found in this commit.

This issue might be useful and act as reference for anyone who wants to futher develop this idea.

In case you want to run this dashboard, you may install this condaenv, since default installation of XrViz resulted in some issues for me due to update in dependencies and download the dataset.

philippjfr commented 3 years ago

Very, very cool. Excited to see where this goes.

martindurant commented 3 years ago

Should we expect a PR and discussion around this? If you want to, I'd be happy to wait for the more performant subsample/vtk output. I believe this comes with an embedded colour scale widget, which is critical for configuring the appearance.

I am wondering whether xrviz might be overloaded by both 2D and 3D output. Finding where to put all of the rendering options is already a challenge!

hdsingh commented 3 years ago

It is difficult to fit all three graphs, simply on the screen area, but I feel that benefits of having more information and better analysis/exploration can outweigh this fact.

My aim was to introduce this nice feature to the XrViz community, start a discussion and provide a direction, in case anyone wants to contribute and make this tool even more better and useful. However, it is a bit difficult for me as of now to get some time to work on this.