What is multi_tracer, Multi-Tracer P. 1

I've had this idea in my head for a long time to write a multi-dimensional raytracer in C++. Of course, a 3-dimensional one is pretty common to find on the Internet and a 2-dimensional one is simpler, but more useless. But what about higher dimensions?
First, I wrote a 3-dimensional raytracer in C# in 2017.


I wrote a simple math library for vectors and used it throughout. It was bare-bones, but it worked well enough and I was satisfied. What I wasn't satisfied with, was the render speed. It was horrible.

Then I decided to move on to C++. I took someones code from GitHub and modified it to work with the Eigen library for math. I've also broken the render process down into chunks and parallelized it using enkiTS.


The result was much nicer, but ran far worse than my C# code. It was because of the graphics fidelity.
Third time is the charm, perhaps?

My goals

My main goal is to create a multi-dimensional raytracer with the following features:
  • Decide number of dimensions N during compile (likely) or run (not likely) time.
  • Set up a scene with multiple static N-dimensional meshes, lights and cameras (at least one).
  • Render the scene into a (N-1)-dimensional binary file.
  • Make a 2-d slice of the file and display it as an image.
This all sounds really interesting, but during my second attempt I started bumping into math problems a lot for porting the raytracer to higher dimensions, so I know that the rendering part would be the most difficult.

My stack

I've decided to use everything I know to make a change in performance. To get the question, that was floating in the air for all this time, out of the way: I won't use my GPU to do it. Firstly, I'm not yet comfortable with writing compute code. Secondly, I want to be able to prototype quickly and I don't want to spend a lot of time fixing bugs on the GPU-GPU or GPU-CPU side of things. Lastly, there are no pre-made math operations in higher dimensions on the GPU, so there will be a lot of manual work in that department too. Maybe I'll get to it if I ever finish the CPU version, but definitely not now.
What I will use, however, are these libraries:
  • Marl for multitasking using fibers.
  • Eigen for math.
  • (Optional) SDL2 for displaying.
I'll try to keep this list up-to-date, but keep in mind that you can always visit the repo of this project here on GitHub.

Comments