Wednesday, December 29, 2010

Finished my Raytracer!

Snowy Night
15K faces, includes reflection and phong normal interpolation
Above you can see the splash screen for my raytracer! Just handed it in, and overall I'm proud of myself (many thanks to my partner, the guru behind most of the lighting!). The code is very optmized (as much optimized as I can get without starting to write unreadable code).

Overall, I would summarize this assignment as something which I learned from - not only about graphics, but mainly about, how to optimize code (changing several lines for example made everything 3 times faster), how to debug properly and about writing larger scale programs (4000 lines is not gigantic, but it's bigger than anything I dealt with in the past, in which I knew what every line does).

The interesting part was writing the Octal Tree, aka Octree (Blender users should know what this is!). This was my first attempt at developing a high-performance data structure on my own, without any reference (there are many on google, but I used none). On the way I developed several optimization tricks (to make the tree less deep, to reduce the penalty of empty areas, and to overcome some other non-optimal meshes).

I really enjoyed most of this assignment (except for the part in which some of the reference renders had mistakes in them - wasting 6 hours because they have a mistake is NOT fun...) and developing most of the fast calculations for the geometry (not for the lighting) was fun.

The document describing the math which I used will be released later this week (as a starting point for people who want to write ray tracers), along with a list of annoying and potentially common bugs when writing a raytracer. Also an update about StructureGraphic - still waiting for the answer from the proffessor about hosting it the university. If he won't answer soon, I'll host it externally (any suggestions for code hosting sites or tips for choosing between github, launchpad, etc. ?). BTW, The next project in the course is writing a simple 3D game engine in OpenGL, and then writing a game with it :D


  1. יפה יפה מתי אנחנו נוכל כבר לראות את זה?
    נשמע מעניין במיוחד.
    זה מגיע בתוכנה עצמה או כתוסף?
    עדיין מתרגש...

  2. Writing a raytracer is a really cool experience ! I'm sure you learned a lot. You just level up in my list of "cool dev".

    By the way, github is really cool.