miniRT
by bhagenlo
written for version 7.1
Okay. Let's take a step back for a moment. Remember what we initially said?
What would that look like for miniRT? What would that look like for a ray tracer in general?
Well, let's find out. But it's certainly gonna involve some math.
Ray tracing is a technique to render images. The general idea is that you have a camera from which you shoot rays, those rays hit things, and from those hitpoints you trace new rays into the lights of your scene. And depending on whether/how you hit objects along the ray, you display a color for this particular pixel (of your viewport).
Sounds good? Well, let's begin!
With that, you should be able to start. If it's been some time since you last did math, and/or you did not take any math classes at university, it might be helpful if you do those as well:#Prerequisites
parse_double()
(and test it).
The nice thing about those graphics projects is that you can immediately see when something went wrong. Don't waste this advantage – get youself a working output as soon as possible! Also, you might want to ensure to work with a freely positionable camera as early as possible. In addition to that: Ah, and please: Do youself the favor to do every calculation on the stack. It's just so much faster.#During
Get yourself some example scenes, and test with them :) In case you're field of view is rotated in any way: That's probably just your camera. And its orientation is not specified by the subject. And make sure to name your executable #Cleaning Up
miniRT
.
And the choice of the tool matters. If you want to become an expert programmer (in anything, really), you not only should know how to use a tool, but also when to use which one: You should know your toolkit. Up until now, if you didn't have any prior programming experience, you know only one such tool to solve the job: C. But let us, for a moment, imagine you were such an expert (that knows what other tools looked like, and now wants to evaluate how C fits into his toolkit). Feel free to use these questions for inspiration: I encourage you to write those answers down. On your journey to becoming an expert, they will change. And whenever they'll do, you then know you learned something not only about your tool, but also about your toolkit. Let's see what the answers look like after you create something bigger in another language. C++ awaits ;)#Aftercare
You just completed the last project that you had to code in C. What is C like, and when would you want to use it?
Huh. And with that: Goodbye, C, and welcome, C++.
#Pointers