Skip to content

Instantly share code, notes, and snippets.

@PriyanshJalan
Created November 20, 2022 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PriyanshJalan/5756dfa7f9cf966092e8639a64fb3f3b to your computer and use it in GitHub Desktop.
Save PriyanshJalan/5756dfa7f9cf966092e8639a64fb3f3b to your computer and use it in GitHub Desktop.

My Summer of Code 2022 with CB-Geo group under the NumFOCUS umbrella orgaisation has ended. I had the amazing opportunity to collaborate with my mentors Krishna Kumar, Andrew Solis and Paul A. Navrátil.

Project Details

My project involved creating an OpenXR compliant visualisation for the Material Point Method (MPM) results of a simulation. The goal of project was to be able to extract real-world slope topography through image capture and then look into performing an in-situ or real-time visualisation of the extracted topography. This unfinished goal will motivate me to contribute further to the project.

Summary of the Coding Period

I started off the project by making myself with Material Point Method itself. Learning about simulating the intrinsics of the discretised particles of the media as a hybrid Eulerian and Lagrangian was enlightening. Then I took my time to understand the code implementation along with input-output considerations in the codebase.

I then started to look into implementing the visualisation using Unity and Unreal game engine. I chose to move ahead with Unity as it had smaller iteration time. I used the Hololens 2 device to visualise the results and used Microsoft Mixed Reality Toolkit (MRTK). At the time of the start of the project I was using 2.8.x release of MRTK. MRTK3 was released as a public preview which was built upon the Unity XR Interaction toolkit and had better performance and abstractions across different devices. I upgraded the Unity project to use MRTK3.

After finalising the tools and tech stack I looked into integrating the Visualisation toolkit (VTK) files with unity. VTKPolyData was used in the codebase to store the results after the simulation. It took me a while to figure out what would be the best approch to load in the .vtp files, using c++ code in .dotnet using .asmdef which would create platform specific dependancies? or preprocessing these files?

The existing pipeline uses ParaView to visualise the results hence preprocessing these files to generate .txt or .csv files became the preferred option. I then created Unity scripts to load in these files with a lot of back and forth in Unity documentation and choosing the right function and folder structure to have the results during deployment. I then rendered the geometry of the simulation per timestep for the toy dataset.

I tried my code on larger dataset of the OSO LandSlide but it was bottlenecked by the memory size. The current implementation in inefficient and in future contribution I plan to load the text files as binary objects and hope to make the code work for larger files and not just the smaller column3D particles.

Contribution

I created a fork of the codebase here and contributed PR#736 to the codebase with a sample Unity project and instructions to create a new project. These details are stated in the README file of the forked codebase.

The output of the project looks like the following video.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment