Skip to content

poorwym/WebGPU-3DGS-Renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebGPU 3DGS Renderer

assets/example.png

A desktop 3D Gaussian Splatting renderer written in Rust with wgpu, winit, and egui.

The renderer loads a PLY Gaussian scene, computes per-frame camera-space depth on the GPU, sorts splats with a GPU radix sorter, and draws the result through a WebGPU render pipeline. A small egui overlay exposes camera controls and live performance information.

Features

  • Native desktop window powered by winit
  • WebGPU rendering through wgpu
  • 3D Gaussian Splatting draw path with spherical harmonic color coefficients
  • GPU depth computation and GPU radix sorting for back-to-front splat rendering
  • PLY loader for:
    • 3DGS-style PLY files with f_dc_*, optional f_rest_*, opacity, scale_*, and rot_* properties
    • Basic point cloud PLY files with x, y, z, and optional RGB color properties
  • Interactive camera movement
  • egui panels for camera position/rotation and performance stats

Requirements

  • Rust toolchain with edition 2024 support
  • A GPU and graphics driver supported by wgpu
  • macOS, Windows, or Linux with the platform dependencies required by wgpu/winit

Getting Started

Clone the repository, then run the app from the project root:

cargo run

The current default scene is loaded from:

resource/Raspberry/scene.ply

To use a different scene, change the path passed to load_gaussians_from_ply in src/renderer.rs.

Controls

  • W: move forward
  • S: move backward
  • A: move left
  • D: move right
  • Hold left mouse button and drag: look around
  • Camera panel: edit position and rotation directly
  • Reset button: restore the default camera

Development

Run the test suite:

cargo test

Check compilation without running the app:

cargo check

Project Structure

src/
  main.rs                  Application entry point
  app.rs                   winit application lifecycle
  app_state.rs             Window, egui, renderer, and frame orchestration
  wgpu_context.rs          wgpu surface/device/queue setup
  renderer.rs              Main renderer, GPU resources, input, and render loop
  renderer/
    camera.rs              Camera math and uniform layout
    gaussian.rs            Gaussian data model and GPU storage layout
  resource/
    ply_loader.rs          ASCII and binary little-endian PLY loader
  ui/                      egui widgets and performance overlay
shaders/
  gaussian.wgsl            Gaussian splat rendering shader
  gaussian_depth.wgsl      Depth compute shader
third_party/wgpu_sort/     Local GPU radix sort dependency
resource/                  Sample PLY scenes and licenses

PLY Input Notes

The loader requires vertex positions named x, y, and z.

For full 3D Gaussian Splatting data, the loader expects:

  • DC color coefficients: f_dc_0, f_dc_1, f_dc_2
  • Optional higher-order SH coefficients: f_rest_0 through f_rest_44
  • Opacity: opacity
  • Log scale: scale_0, scale_1, scale_2
  • Quaternion rotation: rot_0, rot_1, rot_2, rot_3

For basic point clouds, RGB properties can be named either red/green/blue or r/g/b. If no color is present, points are rendered white with a small default scale.

Supported PLY formats:

  • ascii 1.0
  • binary_little_endian 1.0

Troubleshooting

  • If the app fails to start with an adapter or surface error, verify that your GPU driver supports the backend selected by wgpu.
  • If scene loading fails, confirm that the PLY file exists at the configured path and includes x, y, and z vertex properties.
  • Large scenes may require a GPU with sufficient storage buffer limits. The renderer requests adapter limits for large buffers during device creation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages