Renee's Tumblelog

5784-render-1

An SVG based perspective projection renderer.

The following image is an SVG render of the 3488 tri version of the Utah Teapot (538KB).

A 3488 tri SVG render of the Utah Teapot
You can see the render of the more detailed 19480 tri teapot here (3MB).

At the very least this means I didn't spend my summer doing nothing! I accomplished one (1) goal from my last post here!

Background and References

I'm not super knowledgeable in the field of computer graphics. My (possibly incorrect) understanding of the Z-buffering/Z-culling algorithms is that they require pixels. Since we're in vector-land, we can't use it! The naive solution would be to use the Painter's algorithm, but that algorithm has a lot of problems. Luckily, a solution which solves many of those issues was published in 1972. Newell, M. E., Newell, R. G., and Sancha, T. L. proposed a solution to the hidden surface problem, which you can view at https://doi.org/10.1145/800193.569954.

Could I have used literally any other algorithm? Probably, but I didn't spend that much time researching before diving in. After I spent a few hours debugging it, I'm astounded by what I'm seeing.

Efficiency and Unimplemented Culling

I am not currently implementing viewing-frustum culling or back-face culling. This means there are some lovely visual artifacts if the camera isn't entirely outside of the object being rendered, and the render probably takes twice as long because every single face is in that SVG!

The 3488 tri teapot takes ~130ms to render, while the 19480 tri teapot takes ~1477ms to render. (Intel Core i5-10500).

It's a work in progress

I'd be too embarrassed to display the code behind this renderer online, so I'm going to take some time to clean it up before I even think about publishing it to GitHub.

Besides, it currently can only open the custom filetype I developed for easily storing faces; it does not in fact fully implement Newell's Algorithm because I skipped out on getting face splitting to work properly; and shading is at the bare minimum. I guess stay tuned because I'll probably keep working on this.