Skip to content

1Utkarsh1/Dynamic-NerF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dynamic-NeRF Banner

Python PyTorch License Status Stars

Novel view synthesis for dynamic 3D scenes β€” rendered with neural magic.

πŸš€ Quick Start Β· πŸ“– Usage Β· πŸ“Š Results Β· πŸ—ΊοΈ Roadmap


πŸ”„ What is Dynamic-NeRF?

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.


✨ Key Features

πŸ• 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

🧩 Architecture

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
Loading

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

πŸ“Š Datasets

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.py for preprocessing utilities.


πŸ”§ Installation

# 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

πŸ“ˆ Usage

Data Preprocessing

# 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

Training

# 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

Rendering

# 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

Experiments & Notebooks

# Launch Jupyter for interactive exploration
jupyter notebook experiments/

πŸ“ Project Structure

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

πŸ“Š Results

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

πŸ—ΊοΈ Roadmap

  • 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

🀝 Contributing

Contributions are warmly welcome! Here's how to get started:

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add some amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“š References

Click to expand references
  1. Mildenhall, B. et al. β€” "NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis" β€” ECCV (2020)
  2. Pumarola, A. et al. β€” "D-NeRF: Neural Radiance Fields for Dynamic Scenes" β€” CVPR (2021)
  3. Li, Z. et al. β€” "Neural Scene Flow Fields for Space-Time View Synthesis of Dynamic Scenes" β€” CVPR (2021)
  4. Park, K. et al. β€” "Nerfies: Deformable Neural Radiance Fields" β€” ICCV (2021)
  5. Xian, W. et al. β€” "Space-time Neural Irradiance Fields for Free-Viewpoint Video" β€” CVPR (2021)
  6. Du, Y. et al. β€” "Neural Radiance Flow for 4D View Synthesis and Video Processing" β€” ICCV (2021)

πŸ“„ License

Distributed under the MIT License. See LICENSE for details.


Made with ❀️ by Utkarsh Rajput


Visitors

About

Dynamic Neural Radiance Fields (Dynamic-NeRF) - A PyTorch implementation for synthesizing novel views of dynamic scenes. This project extends NeRF with temporal encoding and spatio-temporal attention mechanisms to handle moving objects and time-varying environments. Includes complete training and rendering pipelines, data preprocessing tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors