Basic Raymarcher - Rendering 3D on an Arduboy

This is a relatively basic 3D renderer written for the Arduboy. It takes about 30 seconds to finish. It uses raymarching instead of raytracing. Although raytracing is faster, raymarching uses much simpler math.

Really Good Raymarching Explanation


This is very cool … I have been playing with the line pos = vec3(0, 0, -3); and getting some interesting results.

1 Like

Thought it would be fun to swap out all the floats for some fixed points:

I had to cheat with sqrt because I haven’t got round to making one of those, but the result is pretty interesting: as far as I can tell it’s exactly the same.

Have you timed the two or worked out the potential savings?

Can’t work out the savings until I write a sqrtFixed, but I could time it.

Right … could you be bothered?

It takes a long time for each run and I wanted to do one or two runs to be sure.

The fixed points took around 5 seconds longer (~36388 vs ~31325).

I have just noticed that doubles were being used in places I didn’t spot (double literals), so that could also have had an effect.

Those brought it down to ~36122.
My guess is that Arduino’s 32 bit integer multiplication is slower than whatever multiplying a float involves.