3dgs-warp-scratch

guoriyueAGPL-3.0活跃维护

用 NVIDIA Warp 和 Python 从零实现 3D 高斯泼溅,代码简洁,CPU/GPU 都能跑,适合边动手边学现代图形学。

Build 3D Gaussian Splatting from scratch with NVIDIA Warp in Python — CPU/GPU compatible, with a clean and minimalist design focused on learning modern graphics.

暂无版本292star22fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/guoriyue/3dgs-warp-scratch.git
cd 3dgs-warp-scratch
pip install warp-lang==1.7.0 numpy==1.26.4 matplotlib==3.9.2 imageio==2.34.1 tqdm==4.66.5 plyfile torch==2.6.0
bash download_example_data.sh
硬件要求按 README 说明

README 称无需 CUDA 环境即可在 CPU 和 GPU 上运行,GPU 训练只需把 config.py 的 DEVICE 改为 "cuda";未说明具体显存需求和支持的 GPU 型号。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

用 NVIDIA Warp 在 Python 里从零实现 3D Gaussian Splatting,代码精简,适合学习可微渲染

用 NVIDIA Warp 和 Python 从零实现 3D 高斯泼溅,代码简洁,CPU/GPU 都能跑,适合边动手边学现代图形学。

核心能力

  • 用 Warp kernel 同一份代码跑 CPU 和 GPU
  • 前向与反向传播用 Python 重写,替代原 CUDA 实现
  • 包含训练循环、Adam 优化器及 densify & prune 逻辑
  • 提供 render.py 渲染脚本,用于验证前向传播正确性
  • 附 NeRF-synthetic Lego 示例数据与训练脚本

容易踩的坑

依赖版本被固定(如 warp-lang==1.7.0、numpy==1.26.4、torch==2.6.0),版本不符可能出问题;训练前需先运行 download_example_data.sh 下载 Lego 数据集;默认在 CPU 上训练,用 GPU 要手动改 config.py 的 DEVICE。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    3D Gaussian Splatting in Python with NVIDIA Warp

    This project reimplements the core ideas of 3D Gaussian Splatting in a clean, minimalist Python codebase using NVIDIA Warp. It runs on both CPU and GPU with no CUDA setup, focuses on clarity and parallelism, and is designed as a practical entry point for learning modern graphics and differentiable rendering.

    Read the walkthrough: from 3D Gaussians to a trainable image · Website version

    Why This Implementation?

    ✅ CPU & GPU with Zero Hassle

    Thanks to Warp, the same kernel code runs seamlessly on both CPU and GPU — no need to deal with CUDA setup, driver issues, or device-specific kernels. Just flip one config line.

    🧠 Learn Modern Graphics the Easy Way

    Explore differentiable rendering and parallel graphics through clean, readable Python — no pricey GPUs, complex toolchains, or heavy C++/CUDA boilerplate needed.

    📦 Minimalist & Educational

    This isn’t another massive codebase. It’s designed for clarity and experimentation. Strips away complexity so you can focus on understanding how Gaussian Splatting really works.

    The training video

    Quick Start

    Installation

    # Clone the repository
    git clone https://github.com/guoriyue/3dgs-warp-scratch.git
    cd 3dgs-warp-scratch
    
    # Install dependencies
    pip install warp-lang==1.7.0 numpy==1.26.4 matplotlib==3.9.2 imageio==2.34.1 tqdm==4.66.5 plyfile torch==2.6.0
    

    Download Example Data

    # Download the Lego dataset
    bash download_example_data.sh
    

    Rendering

    # Render 3 Gaussian points – a minimalist example
    python render.py
    

    You should see 3 Gaussian points like:

    Training

    # Train on Lego dataset (CPU by default)
    # For GPU training, change DEVICE in config.py to "cuda"
    python train.py
    

    Project Structure

    ├── forward.py                # 3DGS: Forward pass (reimplementation of graphdeco-inria/gaussian-splatting)
    ├── backward.py               # 3DGS: Backward pass (reimplementation of graphdeco-inria/gaussian-splatting)
    
    ├── train.py                  # Main training loop
    ├── render.py                 # Rendering script to validate outputs; confirms forward pass correctness
    ├── config.py                 # Configuration and training parameters
    
    
    ├── loss.py                   # Loss functions for training (includes depth loss, though unused in this repo)
    ├── scheduler.py              # Learning rate scheduler
    ├── optimizer.py              # Adam optimizer and densify & prune logic
    
    ├── utils/
    │   ├── camera_utils.py       # Load camera intrinsics and extrinsics from training data
    │   ├── point_cloud_utils.py  # Point cloud I/O utilities (e.g., saving to .ply)
    │   ├── math_utils.py         # General math utilities (e.g., transformation matrices)
    │   └── wp_utils.py           # Warp utilities for math operations and device transfer
    
    └── data/                     # Contains the NeRF-synthetic 'Lego' dataset
    
    

    forward.py and backward.py are based on graphdeco-inria/gaussian-splatting. The original pure CUDA version is now reimplemented in Nvidia Warp, easy to understand, set up, and run.

    Densification and pruning logic is based on yzslab/gaussian-splatting-lightning, but restructured here with minimal data preparation and simplified training logic.

    License

    This project is licensed under the GNU Affero General Public License v3.0.
    See the LICENSE file for details.