Raxo

Raxo is a work-in-progress real-time raster­iz­ing soft­ware renderer with a highly flex­i­ble, full-preci­sion float­ing-point pipeline. This means that it draws animated objects and scenes using soft­ware running on the CPU instead of with hard­ware on the graph­ics card.

Raxo is writ­ten in templated C++, and I am work­ing on using just-in-time (JIT) compi­la­tion of assem­bly routines to accel­er­ate render­ing, by elim­i­nat­ing costly condi­tion­als in inner loops.

If you can animate a ball, you can render a wrench photo­re­al­is­ti­cally at inter­ac­tive rates (à la Dodge­ball).

Raxo, currently in heavy devel­op­ment, is a contin­u­a­tion of my work for Stuyvesant’s ML6: Computer Graph­ics course, taught by Michael Zaman­sky. While I may later write games or demos with it, it is currently a way for me to fully explore both the “clas­si­cal” and novel render­ing tech­niques used by and devel­oped by computer graph­ics researchers and game program­mers. I will do so by imple­ment­ing those tech­niques myself, in the most badass, impres­sive, mind-numb­ingly fast ways I can devise.

Goals

Raxo is, above all, a learn­ing tool for myself. It’ll prob­a­bly become the biggest project I’ve worked on alone. Though this is a rewrite of a bigger group project and I’ve worked on much bigger soft­ware projects outside of an acad­e­mic setting, I have to say that design and archi­tec­ture is hard.

This is how it’ll work: I’m going to learn what it is I’m trying to learn (still figur­ing this out) by deriv­ing and imple­ment­ing. I’ll gobble up blog posts, research papers, and text­books, but in the end I have to turn it into code.

It’s got to be fast. What is computer graph­ics research if not a never-ending expe­di­ent trade­off between speed and trick­ery of the eye?

It’s going to be done right; more right (err, rightly?) than the hard­ware we have now. I want proper fill rules, subpixel preci­sion where needed, a full float­ing-point pipeline (that’s right, textures, color buffers, lights—all 128-bit color), the whole works.

I want to explore tech­niques published in papers but never imple­mented in modern hard. I have a flex-func­tion pipeline and no need to release a prod­uct, so why not go ahead and play with irreg­u­lar Z-buffers for shadow mapping or silhou­ette maps?

Implemented features

A sensi­ble C++ archi­tec­ture and pipeline. Raxo is a library; it’s a collec­tion of loosely-linked classes that form a render­ing pipeline, like OpenGL or Direct3D. It takes in geomet­ric data and draws it, but with­out an anima­tion appli­ca­tion or 3D models, it can’t do much

Coor­di­nate systems with homo­ge­neous coor­di­nates

4×4 Matri­ces and trans­for­ma­tions (includ­ing a SSE/SSE2 imple­men­ta­tion with an amor­tized cost of about 17 instruc­tion cycles per vector on modern Intel CPUs)

Full coor­di­nate trans­for­ma­tion pipeline as in the OpenGL fixed-func­tion pipeline, from eye space coor­di­nates to view­port coor­di­nates

Quater­nion repre­sen­ta­tion of rota­tions, includ­ing conver­sions to and from rota­tion matri­ces, linear inter­po­la­tion in spher­i­cal space, and linear inter­po­la­tion in linear space with normal­iza­tion

Arbi­trary vertex and pixel shaders, with arbi­trary number of inter­polants (spec­i­fied at compile time with template para­me­ters)

OpenGL-style materials/lighting prop­er­ties

I really hate this sphere now. Its render screw-ups has become a blooper reel for my life.

AsmJit – Terrific runtime assem­bler. Gener­ates executable func­tions from assem­bly, and does higher-level things too, like regis­ter allocation/memory spilling for vari­ables. Since the death of Soft­Wire, this is the best choice for JIT assem­bly. Google Chromes’s V8 and Safari’s Squir­relFish Extreme JavaScript engines have JIT compo­nents as well that can be extracted for use, but of course they are not designed for the same tasks.

ompf.org forum – Commu­nity for real-time ray trac­ing enthu­si­asts. Full of wizardry in assem­bly, approx­i­ma­tions, hard­ware hacks and of course, float­ing point color.

Raster­i­za­tion on Larrabee – Read­ing Mike Abrash (author of the Black Book, devel­oper for Quake and Pixo­matic) is always inspi­ra­tional and a bit humbling. Even when he talks about doing things you’ve no desire of ever trying, you can appre­ci­ate the effort and inge­nu­ity that goes into it all. Also, Larrabee. Sweet.