Post

GSoC 2025 - Final Report

GSoC 2025 - Final Report

This is the final report of my GSoC 2025 project Better interfacing of Blender and MDAnalysis with MDAnalysis organization under the mentorship of Yuxuan Zhuang and Brady Johnston.

This project aimed to define, prototype and implement various APIs along with an integrated GUI in Blender that together provide advanced visualization capabilities for MDAnalysis as outlined in my proposal.

My contributions were to Molecular Nodes, a popular Blender extension that allows importing MDAnalysis universes and provides advanced rendering capabilities through a GUI. This project improved the scripting capabilities of Molecular Nodes through new API for existing and new features and also added a new GUI to improve the interactive visualization experience.

Code

All the code for this project can be found in the gsoc-2025 branch of the Molecular Nodes repo as PR #875 that merges these onto main. The appendix lists individual PRs, design discussions and weekly progress reports that were part of this project. Overall, this project contributed 7.5k+ lines of new code, tests and documentation to the Molecular Nodes repo through 25+ PRs.

Contributions

Here is a summary of my contributions:

Multiple styles / representations for Trajectories

Molecular Nodes already had support for multiple styles for the Molecule entity prior to this project. This project extended this support to the Trajectory entity as well. With this, a single MDAnalysis universe loaded into Blender can have multiple styles / representations based either on MDAnalysis selection phrases or AtomGroups. All style specific configurations can be made through the API as well as the new Viewport GUI.

Trajectory Multiple Styles Trajectory Multiple Styles

Annotations

Annotations support is newly added to Molecular Nodes as part of this project. Annotations allow drawing text, arrows, lines and other shapes as overlays over the 3D models to show info or analysis results that are dynamic, can be interactively viewed and rendered. The annotations support is built to be easily extensible by end users to write their own annotation types based on their analysis needs by only using high level utilities. A common API interface along with automatic GUI support is provided by the implementation. A few annotations for displaying atom info, center-of-masses, distance between center-of-masses, canonical dihedral angles and universe info are bundled for Trajectories, grid axes and grid info for Density grids. A few others to add generic 2d and 3d labels in scenes are provided for all entities.

Annotations Annotations

Revamped Density Entity

Molecular Nodes had support for density grids in the MRC2014 format prior to this project (with mrcfile). This project revamped this support to use MDAnalysis GridDataFormats to support a wider variety of density grids. A new Density ISO Surface Style Geometry Node was added (programatically) to support both positive and negative ISO values, contours and slicing along the three major axes. This now allows visualizing MDAnalysis DensityAnalysis results written to .dx files like the Calculating the solvent density around a protein example.

Density Entity Density Entity

Viewport GUI

A new GUI was added to the 3D Viewport region of Blender as part of this project. This GUI is accessible from the side panel (or the n-panel) of the 3D Viewport and displays all the Molecular Node entities, entity specific configurations like trajectory details, styles and annotations. The panels in this GUI allow for easy customization (with instant visualizations) of all the values that are configurable through the API as well. All the elements of this GUI are animatable as well in Blender.

Viewport GUI

Canvas features - Rendering / Animation

The Canvas support in Molecular Nodes was at its early stages prior to this project. Animation support was added by rendering individual frames and putting them together using Blender’s Video Sequence Editor APIs. An automatic compositor setup was added to allow rendered annotation images to be composited over the final renders. A generic framework was added that allows temporarily overriding Blender render settings for generating images and movies and restoring them back. A new Camera class and a frame_view method allows for framing any region of interest from different view points for renders.

Canvas Animation

Acknowledgements

I would like to thank my mentors Yuxuan Zhuang and Brady Johnston who interacted with me prior to the project as well, provided valuable feedback, insights and guided me throughout this project. A special thanks to Tyler Reddy for feedback and support in discussions prior to the project. I would also like to thank everyone at MDAnalysis for being so warm, welcoming and providing me this opportunity as I start my open source journey. Finally, a big thanks to Google and the GSoC team for this wonderful program that definitely helped me learn and grow.

Appendix

PRs

Overall pull request: PR #875

Individual PRs:

PR #Description
#882Add basic trajectory API
#887Add UI for entities in 3D Viewport
#888Add style branches support for Trajectories
#891Add base framework for annotations
#900Add custom validation support for annotations
#901Annotations draw handler base
#903Add basic line drawing support for annotations
#905Add support for AtomGroup selections through API interface
#906Add depth support for annotation text
#907Add canonical dihedrals trajectory annotation
#909Rendering support for annotations
#910Trajectory Universe Info, generic 2D and 3D label annotations
#913Use property indexing instead of reference to avoid crashes
#916Density entity - style interface, gui, annotations
#917Use MDAnalysis GridDataFormats for density grids
#918Density Annotations and additions
#920Density ISO Surface Style
#926Automatic compositor setup to handle annotations overlay in renders
#929Add support to override common annotation params
#932Add rendering animation support to Canvas
#937Fix entity type discrepancies
#938Add frame view support to Canvas
#940Add MDAnalysisTests dependency to tests and docs
#941Add density examples to docs
#942Add Canvas examples doc
#943Add tutorials and API examples to docs

Discussions

#Description
#870GSoC 2025: High level structure to start with
#879GSoC 2025: Styles support for MDA Universes
#889GSoC 2025: Annotations support for entities
#914GSoC 2025: DX file support for density visualizations
#924UI in 3D viewport n-panel vs Object Properties
#925GSoC 2025: Compositor setup for Renders
#928GSoC 2025: Wrapping up

Weekly Progress

WeekDescription
Week 1Basic universe management APIs and GUI - Initial approach
Week 2Discussions on styles support for Trajectories
Week 3Trajectory API, GUI and Styles support
Week 4Design of Annotations
Week 5Base framework for Annotations
Week 6Annotations implementation - I
Week 7Annotations implementation - II
Week 8Rendering support for Annotations
Week 9Refactored Density Entity
Week 10Density Annotations and new ISO Surface style
Week 11Auto Compositor setup
Week 12Canavs updates
This post is licensed under CC BY 4.0 by the author.