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.

GitHub project: http://github.com/GHF/Raxo (git source repos­i­tory)

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.

Work-in-progress

  • A “default” raster­izer that supports most of the features in OpenGL
  • Clas­si­cal Blinn-Phong light­ing, with point, direc­tional, and spot lights
  • Geom­e­try gener­a­tors and file load­ers (I’ve been star­ing at the same darn spin­ning tesse­lated sphere for more than a year now as a refer­ence model)
  • Run-time spec­i­fied render buffers—Raxo can render to screen using Pixel­Toaster, to file, or to a null target for head­less test­ing
  • Convert­ing some inner loops to assem­bly so they can be gener­ated by AsmJit
  • Hand-coded SSE/SSE2/SSE3/SSSE3/SSE4.1 (list would be longer if I had a newer computer) intrin­sics to accel­er­ate some key parts
  • Camera system

Planned features

  • Perspec­tive correc­tion for inter­polants
  • Shadow maps and shadow volumes
  • Exter­nal asset load­ing from files
  • Differ­ent mesh stor­age meth­ods
  • Precom­puted mapped ambi­ent occlu­sion
  • Screen space ambi­ent occlu­sion
  • Tone mapping and gamma correc­tion of output image onto screen
  • Depth of field

And beyond…

  • Post­pro­cess­ing filters (also JIT compiled)
  • Image qual­ity (multi-sampling, texture filter­ing, etc.)
  • Things I find in research papers
  • ???
  • PROFIT! (maybe this will help me find a job?)

See my blog post on Raxo for an expla­na­tion for some of my choices in creat­ing Raxo.

Links

  • Chris Hecker’s perspec­tive texture mapping arti­cles – Great for learn­ing proper raster­i­za­tion rules, subpixel and subtexel preci­sion, linear inter­po­la­tion of vari­ables, and of course, perspec­tive-correct textur­ing.
  • 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.
  • Pixel­Toaster – Cross-plat­form frame­buffer library of cham­pi­ons.
  • 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.
  • Real Time Render­ing – Nice book to have.
  • Fast­Flow – Inter­est­ing C++ paral­lel program­ming library with differ­ent abstrac­tion layers for describ­ing comput­ing prob­lems and solv­ing each in paral­lel.
  • Brown CS123 slides – Slides from course taught by van Dam of Foley and van Dam. The 2009 course suppos­edly uses an unpub­lished version of said book.
  • SSE Idioms