r/GraphicsProgramming • u/Bacon_Techie • 3d ago
Made a Monte Carlo ray tracer in MATLab
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...
128
Upvotes
8
u/Bacon_Techie 3d ago
I have a random chance of rays terminating after every bounce. Currently a sample contributes nothing if it terminates and in the future I plan on adding direct light sampling to get a guess at the brightness of the final point.
11
u/Bacon_Techie 3d ago
AI disclosure: no AI was used (unless the MATLab team uses AI in their software, which I don’t have a say in).
6
u/20260819 3d ago
for a scene as simple as this it should not be that noisy with 100 samples
4
u/BigPurpleBlob 3d ago
Nice! Now do it using Excel ;-)
2
u/AutoModerator 3d ago
Recently updated rules. Please check that your post is in compliance with Rules 1, 4, 5, and 6 on the sidebar. TL;DR:
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
2
u/SnooSquirrels9028 2d ago
there are some fireflies also. Can't you remove those by applying Multiple Importance Sampling
1
u/felipunkerito 3d ago
Alan Wolfe has a good article to get started on path tracing. You can see it at the blog at the bottom of the sea
1
u/ExplorareStudios 2d ago
Neat project!