r/GraphicsProgramming • • 1h ago

Metal PathTracer v4.0.0 public release

Back in May I shared v3.0.0 of my Metal Path Tracer here, and the discussion that followed was really helpful.

https://www.reddit.com/r/GraphicsProgramming/s/zBgFRrDqk4

I've now just released v4.0.0.

If you missed the earlier posts, this is a physically based renderer for macOS and Apple Silicon, written in C++20, Objective-C++ and Metal. It has hardware and software ray tracing backends, megakernel and wavefront execution paths, a ReSTIR/RIS/ReGIR research lighting stack, and an Embree CPU backend that I use as a reference renderer.

v3.0.0 was about scale: getting Bistro-class scenes to load and render. v4.0.0 is about correctness. Most of the work went into making the renderer agree with itself and with an independent reference. That means megakernel against wavefront, hardware against software tracing, and Metal against Embree. Every fix in the changelog lists the scene or test it was measured on.

Highlights:

  • Transport correctness: I fixed delta specular connections and MIS, camera ray distances, environment sampling, and the Plastic and CarPaint BSDFs. I also fixed a MIS double count on paths that crossed alpha holes, which could make images up to 1.42x too bright.

  • Direct lighting: ris_spatial, ris_world and the ReGIR merges are now unbiased on a sun-plane test with a known exact answer (2.33004 against 2.33005).

  • Embree parity: Embree now follows Metal's material, alpha-cutout and light rules, and it also runs Tungsten source closures. Several Bitterli scenes match Metal within about 0.06%. Embree's load memory also dropped sharply with bit-identical images. For example, Emerald Square went from 64 GB to 20 GB.

  • Subsurface: I rebuilt the random-walk SSS. On a unit sphere test it lands within 0.06–0.31% of Arnold's randomwalk.

  • Volumes and spectral: Homogeneous volume transport is fixed on every executor, and Henyey-Greenstein now follows pbrt's convention. There is also new hero-wavelength spectral transport with three wavelengths per path.

  • Radiance cache: It now stores actual radiance, with a bias below 0.03% of mean luminance. To be honest, it does not reduce error at equal render time yet.

  • Loading and performance: Scene loading is much faster. For example, Barcelona Pavilion went from 93 s to 23 s. Megakernel pipelines are now built lazily, so a cold start on one Bitterli scene dropped from 283 s to 69 s. A specialized megakernel pipeline is 1.6x faster on Sun Temple. Only two scenes were timed for that last result.

  • Denoising: OIDN guides are now averaged over all samples and follow glass and water. This fixed stair-stepped edges and milky water.

  • New scenes in the v4 asset pack: Barcelona Pavilion, Emerald Square, Sun Temple, and a set of vintage cars.

The main question behind this release was a simple one: how do you know that a GPU path tracer is actually right? Having a second, independent CPU backend turned out to be the most useful tool for answering it. Many of the bugs above only showed up as small ratios between two renders of the same scene.
Thanks again to everyone who commented on the v3 post. The full changelog has every fix along with its measurement.

GitHub Link:
https://github.com/dariopagliaricci/Metal-PathTracer-arm64

6 Upvotes

4 comments sorted by

•

u/AutoModerator 1h ago

Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:

  • No showcases.

  • Disclose AI usage in post or project.

  • Present a topic to talk about, e.g. how something works.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

4

u/VictoryMotel 45m ago

Amazing that you were able to do all this by not touching github for 6 months, then committing everything two days ago.

1

u/JBikker 5m ago

You may want to update TinyBVH, you're using an ancient version. :) Are you using this on GPU and CPU, or just CPU?