Raytracing and C

<p>So I'm building a raytracer in C and it's pretty difficult. Loads of functions and types that I've never come across before. I'm getting by, but it's pretty difficult. Is it normal for raytracing to be difficult? Or is it supposed to be pretty straight forward? Thanks!</p>

<p>Well the algorithms are complicated and can be quite “involved”. As well as obviously the related vector math. It’s not a surprise that lightning is still an active research field in computer graphics.</p>

<p>It sounds that you’re struggling with C more than the algorithms though. The language ought not make things difficult, but the algorithms themselves and the maths. As a language is only the means of expressing algorithms.</p>

<p>Or if it’s an API that confuses you, then you just haven’t used it enough to become familiar with how it’s meant to be used.</p>

<p>Compared to other languages, C is a notoriously difficult language to read, write and maintain. Don’t feel bad that you’re struggling with C language quirks and intricacies. Just stick with it and it’ll get easier over time.</p>

<p>Ray tracing is inherently pretty tricky, so that should also be expected to take some time.</p>

<p>Ray tracing in C? Yeah, don’t worry about it being hard at first; anybody just starting ray tracing in C who said it wasn’t hard is either a liar, or a dirty liar. Just stick with it and it will become old hat after a while.</p>

<p>Why do you have to write it in C? When I took a rendering course, we used C++ and I get the impression that most ray-tracers are written in C++. I don’t believe object-oriented programming is a panacea, but I do think objects are useful for ray-tracers. I agree with the others who posted before me – I found that rendering course quite challenging.</p>

<p>In the mid-80s, I remember typing a ray-tracing program directly from a magazine into my mighty Amiga. Even then it took several days to get it to work.</p>