Novel view synthesis for dynamic 3D scenes β rendered with neural magic.
π Quick Start Β· π Usage Β· π Results Β· πΊοΈ Roadmap
Dynamic-NeRF extends the landmark Neural Radiance Fields technique to handle time β capturing moving objects, shifting lighting, and real-world scene dynamics. Where traditional NeRF freezes the world, Dynamic-NeRF lets it breathe.
Reconstruct and render any dynamic 3D scene from multi-view video at any viewpoint, at any moment in time.
| π Temporal Encoding | π― Spatio-Temporal Attention | π¬ Static-Dynamic Decomposition |
|---|---|---|
| Models time as a first-class dimension β every frame is a new slice of the 4D world | Intelligent attention mechanisms that zero-in on what's actually moving | Clean separation of static backgrounds from dynamic foreground objects |
| πΌοΈ Novel View Synthesis | π Temporal Consistency | β‘ Efficient Ray Sampling |
|---|---|---|
| Generate photo-realistic viewpoints at arbitrary space-time coordinates | Silky-smooth interpolation between time steps β no flickering | Optimized coarse-to-fine sampling for fast, high-quality rendering |
The model stacks a time-conditioned MLP, Fourier positional encoding, and a spatio-temporal attention module into a hierarchical coarse-to-fine rendering pipeline.
graph TD
A["π· Multi-View Video Frames"] --> B["Ray Generation"]
B --> C["Positional Encoding\n(x, y, z, t, ΞΈ, Ο)"]
C --> D["Coarse MLP\n(Static Background)"]
C --> E["Fine MLP\n(Dynamic Foreground)"]
D --> F["Hierarchical Sampler"]
E --> F
F --> G["Spatio-Temporal\nAttention"]
G --> H["Volume Rendering"]
H --> I["πΌοΈ Novel View Output"]
style A fill:#6366f1,color:#fff
style I fill:#06b6d4,color:#fff
style G fill:#8b5cf6,color:#fff
Core components:
- Time-Conditioned MLP β network conditioned on
(x, y, z, ΞΈ, Ο, t)jointly - Temporal Embedding β Fourier feature encoding specialized for time
- Spatio-Temporal Attention β dynamic region weighting across space and time
- Hierarchical Sampling β coarse pass informs fine-grained ray marching
Supports three data modalities out of the box:
- π§ͺ D-NeRF Dataset β synthetic sequences with controlled object motion and ground-truth cameras
- π¨ Custom Blender Sequences β rendered scenes with full camera parameter access
- π Real-World Multi-View Video β captured footage of dynamic, uncontrolled scenes
See
src/scripts/preprocess_data.pyfor preprocessing utilities.
# 1. Clone the repository
git clone https://github.com/1Utkarsh1/dynamic-nerf.git
cd dynamic-nerf
# 2. Create and activate a virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# 3. Install as an editable package (recommended)
pip install -e .
# β or β install dependencies directly
pip install -r requirements.txt# Blender synthetic dataset
python -m src.scripts.preprocess_data \
--input_dir /path/to/blender/data \
--output_dir data/processed/blender_dataset \
--dataset_type blender
# Video input (with custom FPS)
python -m src.scripts.preprocess_data \
--input_dir /path/to/video.mp4 \
--output_dir data/processed/video_dataset \
--dataset_type custom_video \
--fps 24# Default config
python -m src.train \
--config configs/default.yaml \
--data_path data/processed/dataset \
--output_dir checkpoints/experiment1
# Custom hyperparameters
python -m src.train \
--config configs/default.yaml \
--data_path data/processed/dataset \
--output_dir checkpoints/experiment2 \
--batch_size 2048 \
--learning_rate 1e-4 \
--num_iterations 300000# Render novel views
python -m src.render \
--config configs/default.yaml \
--checkpoint checkpoints/experiment1/model_200000.pt \
--output_dir results/novel_views
# Render a time-varying video
python -m src.render \
--config configs/default.yaml \
--checkpoint checkpoints/experiment1/model_200000.pt \
--output_dir results/video \
--render_video \
--time_range 0 1 60# Launch Jupyter for interactive exploration
jupyter notebook experiments/dynamic-nerf/
βββ src/
β βββ models/
β β βββ nerf.py # Static NeRF baseline
β β βββ dynamic_nerf.py # Dynamic NeRF (main model)
β βββ data/
β β βββ dataset.py # Dataset classes & loaders
β βββ utils/
β β βββ ray_utils.py # Ray generation & sampling
β β βββ config.py # Config management
β β βββ visualization.py # Visualization helpers
β βββ scripts/
β β βββ preprocess_data.py # Data preprocessing
β βββ train.py # Training entrypoint
β βββ render.py # Rendering entrypoint
βββ experiments/ # Jupyter notebooks
βββ configs/
β βββ default.yaml # Default configuration
βββ data/ # Dataset storage
βββ docs/ # Documentation & images
βββ results/ # Saved renders & visualizations
Performance benchmarks on the D-NeRF dataset β higher PSNR/SSIM and lower LPIPS is better:
| Scene | PSNR β | SSIM β | LPIPS β | Training Time |
|---|---|---|---|---|
| π© Lego | 32.8 | 0.961 | 0.042 | 8.5 hrs |
| π΄ Bouncing Balls | 30.2 | 0.942 | 0.063 | 7.2 hrs |
| π¦ T-Rex | 29.7 | 0.937 | 0.072 | 9.1 hrs |
| 𧬠Mutant | 31.5 | 0.953 | 0.047 | 8.3 hrs |
| πͺ Hook | 30.9 | 0.948 | 0.055 | 7.8 hrs |
- Repository structure & project setup
- Baseline static NeRF implementation
- Dynamic extension with temporal encoding
- Spatio-temporal attention mechanisms
- Temporal embedding experimentation
- Data preprocessing pipeline
- Training & rendering pipeline
- Documentation & result visualization
- Pre-trained model zoo
- Interactive demo application
- Advanced optimization techniques
- Mobile / web deployment
Contributions are warmly welcome! Here's how to get started:
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Click to expand references
- Mildenhall, B. et al. β "NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis" β ECCV (2020)
- Pumarola, A. et al. β "D-NeRF: Neural Radiance Fields for Dynamic Scenes" β CVPR (2021)
- Li, Z. et al. β "Neural Scene Flow Fields for Space-Time View Synthesis of Dynamic Scenes" β CVPR (2021)
- Park, K. et al. β "Nerfies: Deformable Neural Radiance Fields" β ICCV (2021)
- Xian, W. et al. β "Space-time Neural Irradiance Fields for Free-Viewpoint Video" β CVPR (2021)
- Du, Y. et al. β "Neural Radiance Flow for 4D View Synthesis and Video Processing" β ICCV (2021)
Distributed under the MIT License. See LICENSE for details.