Text, Transparency, and Tonemapping

December 7, 2010 Algorithmic Art 0 Comments

Since I don't have class this week and I'm putting off studying for finals, I've had a lot of time to make improvements to the engine.

First, the shader library (XSL) has been restructured. Previously, it was just too spread out to keep track of. Each shader had its own header file that contained only a few lines of code. Now, all shaders are kept in a set of anonymous structures that make for extremely easy access. Shaders can be access with the convenient dot-notation ("shaderLibrary.Draw.Pretransformed") and are automatically loaded and managed by the shader library class. This makes adding new shaders much, much easier than before. I've also created some macros that allow some of the larger shaders (read: Perlin noise shaders) to be disabled completely for the sake of executable size.

Second, I've implemented render-to-surface capabilities, so that the geometry is now rendered to a texture, which is later rendered to the backbuffer. Postprocessing can occur in between by using the ping-pong, double backbuffer technique.

Third, text now renders correctly with a transparent background and customizable coloring.  This hinges on a new option for alpha-blending in the device.

Finally, I wrote a little pilot postprocessing shader that performs simple tonemapping on the input using power functions.

Add it all together, and here's what you get:

Not bad at all.