So, I’ve been ray tracing, as a hobby, for a few years now, primarily using POV-Ray. More recently, I decide that I might try to build one.
My initial thoughts:
C# – Moderately portable, if considerations are made for Mono or Dot-GNU. At least on Windows has decent support for multi-threading, I have not sufficiently investigated Mono or Dot-GNU. Support for generics will be useful, and if Linq is used, data structures can easily be queried. Windows Communication Foundation may ease ability to do distributed rendering, but will be limited to the MS platforms. This might be solved with serialization and the http classes that from research on forums seems stable on Mono.
Java – Reasonably portable, would run anywhere JRE would run. Has similar benefits as C#, but will need to be more careful with circular references due to the garbage collector. Good threading and web services support.
C++ – If standard c++, excellent portability if OS specific code is isolated. Excellent support for generic types and functions in the form of templates. I am to understand that gcc and Visual C++ supports lambdas now, so that would be worth investigating. I could go with CLI C++, I can maintain some cross-compatibility with Mono (if no native code or P/Invoke), and gain access to a few of the libraries, however, I doubt the cost vs. benefit would be worth it (too many restrictions)
C – Similar portability to C++, although I lose the benefits (and pitfalls) of object oriented classes as well as templates. If well written, it can have a smaller memory footprint than C++, although compilers get better everyday. With the features I wish to have available, it may end up being a more complex code base before all is done.
Before I can actually choose my language, I need to have a better idea of what features I want to have, and how soon. Sure, long term, I may wish to support all the features of products such as POV-Ray, YafaRay, Maya, or Cinema 4D; however, such a task is unreasonable. As such, to avoid overwhelming myself, I need to outline for myself a general plan of features for short-term, mid-term, and long(er)-term. First of all to make the initial design decisions, then in order to plan my development so that I do not have too much scope creep.
Very Short term:
- Basic 3D geometry/math support
- Scalar Operations, such as dot products, scalar multiplication, etc
- Matrix Operations, such as transposing, matrix multiplication, etc
- Ray casting – Ray caster is to ray tracer as bicycle is to motorcycle, they have some similarities, but one is more complex than the other
- Basic multi-threading support – Explicit threads
- Goal: A sphere or cube over a checkered plane
- Remainder of 3D geometry/math support
- Foundations for CSG
- Foundations for Bounding boxes
- Foundations for memory structures (will need to decide among different structures)
- Basic lighting model
- Goal: Randomly generated primitives, possibly CSG, over a checkered plane
- Flesh out Bounding boxes, CSG, and memory structures
- At least one more lighting model
- Basic UI
- Front-end and Back-end should be separate
- Goal: Scene generated from script
- Surface Normals
- Textures and Materials
- All major geometry types (2D and 3D primitives, surface maps, possibly isosurfaces, optimized mesh support)
- Goal: Improved scene generated from script
Nice to have:
- Photon mapping
- Procedural scene changes and physics
- Media effects
- Spectral rendering
Definitely a lofty project, but persistence will pay off: after all Romulas may have drawn his line in the sand in a few minutes, but Rome itself wasn’t built in a day.
Next time, on this topic, I will have my decision and how I match the requirements to it, and my basic plans.