Voxel Space: Comanche's terrain rendering in less than 20 lines of code (2020)
I don't think in Comanche they painted back to front, or at least I hope they didn't. It's best to render front to back, tracking the highest (in screen space) pixel you have drawn, and as you move further back, only drawing lines from that height. That "max height" is a zbuffer of sorts for each ray. [edit: I just read further down and they mention this]Also, you want to render each ray/vertical screen line one at a time, rather than running each single step of the ray for all rays/vertical lines.Once you are rendering each ray at once, it's easy to do a circular rather than flat projection, which feels a lot more stable when you rotate and admits higher fields of view without distortion.