Simple, heavily commented C# raytracer
Here’s a little educational recursive raytracer I wrote recently to teach a friend the fundamentals.

Read on for full source download.
This simple C# raytracer supports spheres and planes with diffuse and specular shading and reflections. I stopped at that point to keep this as a useful tool for learning the basics.
Only trig and basic vector maths is used, with no matrices, and the maths is kept simple. Almost every line is commented, so if you like learning from source this could be for you.
Download source and binary (20Kb RAR file)







[...] on from my simple C# raytracer, here’s the same codebase adapted as a [...]
Pingback by c o l d c i t y » Simple, educational C# Pathtracer — Nov 7 2009 @ 7:42 pm
Thank you for your sharing your code
Very well commented
Regards
Salvatore
Comment by Salvatore — Dec 2 2010 @ 6:50 pm
Thanks for sharing your source code!
I used it as a test case for my MSIL to JavaScript compiler, and you can see the results here: http://hildr.luminance.org/JSIL/raytracer.html
Comment by Kevin Gadd — Apr 17 2011 @ 3:47 pm
Kevin, you’re very welcome — it’s great to see it being used. And that’s an AMAZING job you’ve done there!! Massively awesome
Comment by Iain — Apr 27 2011 @ 7:54 pm
I am that friend, for whom this was written! I did mine concurrently but in python. Here is the main render loop from mine, I hope it can be useful to someone!
Python ray tracer main render loop: http://pastebin.com/b8yJ99GC
Comment by Seb Clarke — May 26 2011 @ 4:22 pm