You don't even need a canvas.
You could simulate pixels with divs if that's all you had. Or you could create an image in memory and save to file. You could write the text for it and save as SVG.
For a CPU based ray tracer, you don't need any output capability at all(unless you want it to be interactive, which school assignment raytracers usually don't have to).