Particle flow visualization along empirical vector fields, optimized for Nature-quality supplementary video export.
Luminar renders animated particles flowing along a 2D vector field derived from single-cell trajectory data (e.g., RNA velocity in UMAP/tSNE embedding space). The primary deliverable is a publication-ready H.264 video suitable for submission to Nature Portfolio journals as supplementary material.
A single CSV file with four required columns:
| Column | Type | Description |
|---|---|---|
x |
float | Horizontal position in embedding space |
y |
float | Vertical position in embedding space |
dx |
float | Horizontal velocity component |
dy |
float | Vertical velocity component |
Assumptions derived from reference data (Cebpa.csv):
- Grid is sparse and irregular — vectors exist only where cells are present, not on a regular lattice. Expect 20–30% coverage of the bounding box.
- Coordinates are continuous (typical UMAP range: roughly −10 to +25).
- Velocity magnitudes span ~2 orders of magnitude (0.01–1.1 in reference data). This dynamic range must be handled gracefully.
- Grid spacing is approximately uniform but not guaranteed.
- Row count: expect hundreds to low thousands of grid points (897 in reference data).
- Drag-and-drop or file picker in the browser UI.
- Parse with PapaParse. Validate that all four columns exist and contain numeric values.
- On load, compute and cache: bounding box, Delaunay triangulation, velocity magnitude range.
Current version already does good job.
Current version already does good job.
Particle color is mapped from velocity magnitude at the particle's current position:
- Colormaps available: viridis (default), cividis, inferno, magma, plasma, coolwarm.
- All default colormaps must be colorblind-safe (Nature accessibility requirement).
- Custom single-color mode with bloom providing visual variation.
- Color legend rendered on-canvas showing magnitude-to-color mapping.
- Primary aspect ratio: 16:9 (Nature preferred).
- Secondary option: 4:3 toggle.
- The canvas is always locked to the selected aspect ratio. The vector field is fit within the canvas with uniform scaling and centered, preserving the data's true aspect ratio. Remaining space is filled with the background color.
- Real-time preview renders at screen resolution.
| Preset | Dimensions | Use Case |
|---|---|---|
| 1080p | 1920 × 1080 | Standard supplementary video |
| 4K | 3840 × 2160 | High-quality supplementary |
| Custom | User-defined | Poster or non-standard |
- Codec: H.264
- Container: MP4
- Aspect ratio: 16:9 preferred, 4:3 acceptable
- Compression: Minimal — use CRF 0–10 (visually lossless to lossless)
- User sets export parameters: resolution, duration (seconds), frame rate.
- Switch to offline render mode: the animation loop is decoupled from real-time clock.
- For each frame
iin[0, totalFrames): a. Advance the simulation by exactly one fixeddt. b. Render the frame to an offscreen canvas/framebuffer. c. Read pixels and pass the frame to the encoder. - Encode all frames into H.264 MP4 using ffmpeg.wasm (client-side, no server required).
- Offer the resulting MP4 as a download.
| Parameter | Range / Default |
|---|---|
| Duration | 5 – 120 seconds / 15s |
| Frame rate | 24, 30, 60 fps / 30 fps |
| Resolution | 1080p / 4K / custom |
| CRF | 0 – 18 / 8 |
Because particle lifetimes are staggered and respawns are continuous, any segment of the animation is visually indistinguishable from any other. The exported video can be set to loop in a media player without visible seams. No special crossfade is needed.
During export, display a progress bar with frame count, percentage, and estimated time remaining. The UI should remain responsive (use Web Workers or requestIdleCallback for encoding).
All overlays are rendered directly onto the canvas so they are baked into the exported video.
- Optional: a static title frame (1–3 seconds) at the start of the video.
- Fields: title text, description, author/affiliation.
- Matches the background color, using the same sans-serif font.
- User can place text labels on the canvas (e.g., "M1 Macrophage", "Monocyte") by clicking a position and typing.
- Labels are persistent across frames (baked into the animation).
- Font size, color, and position are adjustable.
┌─────────────────────────────────────────────────────┐
│ Top Bar (title, file loader) │
├──────────────┬──────────────────────────────────────┤
│ │ │
│ Control │ │
│ Sidebar │ Canvas / Viewport │
│ (280px) │ (16:9 locked) │
│ │ │
│ - Particles │ │
│ - Bloom │ │
│ - Color │ │
│ - Export │ │
│ │ │
├──────────────┴──────────────────────────────────────┤
│ Status Bar (fps, particle count) │
└─────────────────────────────────────────────────────┘
Particles: count slider, speed multiplier, trail length, particle size, opacity, lifetime.
Bloom: strength, radius, threshold.
Color: colormap dropdown, velocity scaling mode (raw / log / normalized), background color.
Overlays: scale bar toggle, legend toggle, label editor.
Export: resolution preset, duration, frame rate, CRF, title card fields, export button + progress bar.
- All sliders update the visualization in real time.
- Pan: click-and-drag on canvas.
- Zoom: scroll wheel.
- Hover: tooltip showing local
(x, y)position and(dx, dy)velocity. - Play / Pause button.
| Component | Technology |
|---|---|
| Rendering | Three.js (WebGLRenderer) + custom GLSL shaders |
| Post-processing | Three.js EffectComposer + UnrealBloomPass |
| GPGPU particles | Ping-pong float textures via Three.js |
| UI framework | React |
| Control panel | leva or custom sidebar components |
| CSV parsing | PapaParse |
| Delaunay | d3-delaunay |
| Video encoding | ffmpeg.wasm (H.264 MP4) |
| Colormaps | Custom LUT textures (baked from matplotlib) |
| Metric | Target |
|---|---|
| Real-time preview | 60 fps with 50K particles |
| Max particles (interactive) | 200K at ≥30 fps |
| File load + triangulation | < 1 second for 1K grid points |
| Export speed | ≤ 2× real-time for 1080p30 |
The following are deferred to future phases:
- 3D vector fields and camera orbit paths.
- Cell scatter overlay and cluster metadata coloring.
- Audio reactivity.
- Shareable URLs or iframe embedding.
- Server-side rendering.
- Density-aware seeding (uniform random is sufficient for MVP).