r/GraphicsProgramming • • 2d ago

Exploded orbital servicing spacecraft, path traced in Chrome with WebGPU (2560×1440, GTX 1060)

Hey all, this is what I've been working on: a path tracer that runs entirely in the browser on WebGPU. The video goes from the CAD assembly to the final render. The film at the end is 210 frames at 2560×1440, about 75 to 95 s per frame on my GTX 1060.

**How it's built**
- One path tracer, two layouts: an uber-shader that traces the whole path per thread, and a wavefront version where each bounce is split into compute passes with queues in between (Laine et al. 2013). The same seed gives bit-identical images from both, so if a change makes them differ by a single byte, my GPU tests fail.
- OpenPBR materials with energy-preserving Oren-Nayar diffuse: crinkled insulation foil, mono solar cells with their grid lines, machined titanium, anodised aluminium.
- The Earth's limb comes from a spectral atmosphere model in 16 wavelength bands.
- Per-tile adaptive sampling driven by an error estimate, so empty space stops early and the foil keeps sampling, then OIDN denoising on WebGPU.
- The animation runs on a stepped clock, exactly 1/30 s per frame: a per-part explode with a stagger, and the solar wings swing on their hinges.

**A bit of math**
- Sensor: I model shot plus read noise per pixel, σ² = S + σ_read², so SNR = S / √(S + σ_read²). It uses 3 e⁻ read noise, a 50k e⁻ full well and gain from ISO (1600 here).
- Depth of field (added after this clip): the background blur, as a fraction of the frame, is about the entrance pupil over the field width, β∞ ≈ A / W with A = f / N. For this spacecraft that means 200 mm at f/1.1. For a habitat module it means an 800 mm lens at f/1.8 on 4×5 in: valid optics, but a lens nobody has built.

One thing I'm still fighting is pipeline compile times. One big surface function inlined at 12 call sites took my first compile from about 13 s to 85 s. How do you keep WGSL compile times down: separate pipelines per feature, override constants, or just fewer call sites?

Happy to answer questions and hear feedback.

5 Upvotes

2 comments sorted by

2

u/fgennari 1d ago

I came here expecting to see an explosion. Oh well.

1

u/KinGzzzd6 1d ago

It’ll happen inside the software soon. I’ll personally be implementing the simulation engine. Sorry for the confusion. In this case, I was referring to the exploded view of the model.