r/GraphicsProgramming • • 7h ago

Made a Monte Carlo ray tracer in MATLab

Post image
52 Upvotes

I sort of followed the wikipedia article on path tracing and ray tracing in one weekend. I made it for a project in a numerical analysis course on Monte Carlo integration and used the rendering equation as an application. Even at 100 samples per pixel it is quite noisy, but I am happy that I managed to get an image out of it. Matlab is not made for this...


r/GraphicsProgramming • • 15h ago

Tips on self studying graphics programming.

22 Upvotes

Hey yall! I just finished school and want to self studying computer graphics to move into that field. While I was in school I was working on a raytracer but didn’t get to finish it. I know Vulkan pretty well, but not the best.

I have a game framework I’m working on with openGL but id like to change it over to Vulkan to use slang and such. Ngl my math is pretty rusty as well.

I’d just like some tips on where to start!


r/GraphicsProgramming • • 19h ago

Source Code Metal PathTracer v4.0.0 public release

Thumbnail gallery
20 Upvotes

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 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

AI disclosure: This post was drafted with the help of Claude, based on the project's changelog, and then reviewed and edited by me. All renders, measurements and validation results come from my own runs of the renderer.

During development I used AI coding assistants (Codex and Claude Code) for parts of the implementation, refactoring and debugging. I directed the work, reviewed the changes, and validated the results against Embree and hardware/software ray tracing parity tests


r/GraphicsProgramming • • 15h ago

Article Graphics Programming weekly - Issue 464 - November 23rd, 2026 | Jendrik Illner

Thumbnail jendrikillner.com
10 Upvotes

r/GraphicsProgramming • • 15h ago

Question not a graphics programmer, but i wanted to know why scratch starts making these crazy patterns when i let whirl and fisheye effects grow exponentially.

Thumbnail gallery
8 Upvotes

https://scratch.mit.edu/projects/1444420354/ < see for yourself, you gotta watch it for a few minutes. removing the changing colors would probably help see it better.

i let the whirl effect grow by 1% of what its at every 0.01 seconds, and when it reaches a certain number, i let the fisheye effect do so alongside it. then eventually, scattering crazy white pixels appear and spread across the sprite, and then stop scattering randomly and start forming a beautiful pattern that's almost like a really crazy rug pattern, and then a circle of no white pixels grows from the middle and erases any white pixels it touches until there's no more, and then white rings start growing from the middle, almost looking like those lines that represent the planets orbiting the sun? and then those rings disappear, and the scattering white pixels appear, and the cycle continues forever. why?????? is this some crazy math stuff, or are the graphics glitching out, or what?


r/GraphicsProgramming • • 10h ago

Article How I enhanced the ThreeJS lighting pipeline in "Slop New York"

0 Upvotes

https://ben3d.ca/blog/enhanced-slop-new-york-lighting. (AI Disclosure per sub-rules: I used claude code in part.)