Tuesday, December 28, 2010

Fwoosh

Holy crap, two posts in one day. Anyway, I think I need to write some matrix transformation algorithms so that all my images don't start in the lower left and end in the upper right. Such is the difficulty of writing curves out by hand.



This is a Coons' patch made of simple one segment Bezier curves. With the new framework it was actually fairly simple to adapt the patch description and shade semi-interestlingly, and it should be possible to generically insert new curves. But the intresting part is that this is the first thing that I've really treated as a 2-dimensional surface and will probably form more of a basis for the things I want to render. I'm pretty close to being able to actually introduce some new tricks that I've been thinking of for doing some interesting shading techniques, but I really may have to start looking at performance.

Seaweed



So, what's not apparent about this image is the amount of work that went into refactoring my image rasterization framework to essentially be able to handle arbitrary C++ types as vertices and to now be able to use arbitrary function objects which can shade meshes composed of said vertices. I also did some refactoring so that I could take arbitrary one dimesional curves and two dimensional surfaces and subdivide them to feed them to the rasterization algorithm.

Most of the new work is apparent as the repeated gradient texture on the Beziers that make up this image, which wouldn't be possible without the ability to write an arbitrary shader. It turns out the hardest part of doing this was that I wanted to treat each little quadrilateral that the subdivision algorithm spits out as a tiny rationally bilinearly interpolated patch, which then interpolate the vertex values that get fed into the shader, but working out the mathematics to figure out how to correlate sample indices to actual parameter values on that patch in a numerically stable way was pretty tricky.

My next step is to try and get arbitrary shaders working on Coons' patches. I actually had them worked out but could only shade them with a solid color, which was fairly uninteresting. Performance has already degraded a bit though, so I think that might actually be what I have to take a look at next.