Bridging High-Energy Physics with High-Fidelity 3D Visualisation — a real-time gRPC bridge between Geant4 particle physics simulations and Blender's rendering engine.
The defining architectural decision is language-agnostic API design using Protocol Buffers and gRPC over HTTP/2. Instead of tightly coupling two very different systems (C++ Geant4 and Python Blender), the project defines a clean contract in hep.proto and implements it independently in both languages.
A persistent background server managing the Geant4 run manager, GDML geometry loading, and physics processes. Implements a custom G4SteppingAction to capture track data at every simulation step. Serves as the gRPC server, streaming TrackFrame messages to the client. Thread-safe state machine governs run control.
Bidirectional streaming over HTTP/2: the client sends commands (Start, Pause, Stop, Step) while simultaneously receiving a stream of track data. TrackFrame objects group particle steps into chunks to minimise latency. CRC32 checksums on every frame ensure data integrity during high-speed streaming.
Context-aware Blender UI panel for simulation configuration. Background thread for non-blocking gRPC communication (prevents Blender UI freeze during streaming). BMesh-based Single-Mesh Architecture for ultra-fast rendering. Geometry Nodes for energy-dependent track thickness.
IDLE → RUNNING → PAUSED → FINISHED. C++ std::condition_variable suspends the Geant4 event loop without consuming CPU cycles. "Step Event" mode processes exactly one physics event then pauses — ideal for debugging complex shower topologies.
Traditional Blender addons create one object per particle track. In a HEP event with 1,000+ tracks, this causes thousands of draw calls and materials — freezing the viewport. The solution: all tracks consolidated into a single Blender Mesh object using the low-level BMesh API. Vertices and edges are added dynamically as data streams in. Result: 10-50x viewport performance improvement, maintaining 30-60 FPS even with 10,000+ track segments.
Instead of thousands of materials (one per particle type), each particle species is encoded as a specific RGB value in the vertex colour layer (Electrons = Green, Photons = Yellow, Muons = Blue, etc.). A single material renders all 20+ particle types with clear visual distinction. The alpha channel is reserved for energy encoding.
The energy deposited at each simulation step is stored in the alpha channel of the vertex colour. A Geometry Nodes modifier reads this alpha value and modulates the track thickness in real-time — thicker tracks where more energy is deposited. This creates an immediate, intuitive visual representation of the Bragg Peak (the characteristic energy loss spike as charged particles slow to a stop), requiring zero post-processing.
HEPBlenderFusion supports 8 industry-standard Geant4 physics lists via the G4PhysListFactory, covering the full range of HEP use cases:
Particle support: e⁻, e⁺, γ, proton, neutron, μ⁺/⁻, π⁺/⁻, and more. Energy ranges from MeV to TeV.