Terrain in 93

Well, it's taken half a year to get the results in DirectX that it took me a few weeks to get in Esenthel and XNA (wow, that seems like forever ago). And it'd actually be a lie if I were to say that I'm getting results that are anywhere near as impressive.

Nonetheless, XDX has finally matured enough to support terrain. I'm really, really pleased with how intuitive and slim the engine is turning out to be. The simple demo to which the screenshot below belongs took only 93 lines of code to create. More importantly, it could probably be re-written from scratch in ten or fifteen minutes. There's definitely beauty in the potential for such rapid development!

With any luck, it won't be long now before the sunset demo, terrain demo, and bloom filter from the old XNA files are replaced by lean, mean native DX code in the XDX engine.

Here's a peek at the current state of things (yeah, so it's just a VTF-displaced plane. It still took a lot of work.)

Onward with A New Reality!

Console Window

Recently, I've been trying to trim down the fat in the XDX engine and tighten it up to make agile development a reality. This process entails making sure that all the pieces fit together in an intuitive way, and re-evaluating how necessary each line of code really is. In doing so, I've also discovered and fixed a bunch of bugs. I think I've achieved success, though, considering I can now write a basic 3D application in about 70 lines of code.

I made a quick demo of something I've been wanting to try: text input. This little demo lets the user enter text into a console. Not too fancy, but I still think it's pretty neat.

Procedural Trees as Isosurfaces

To demonstrate the capabilities of the advanced metaballs described in the last post, it seems fitting that I should try to model something not easily modeled with standard metaballs. Trees certainly come to mind. The asymmetric and non-axis-aligned qualities of tree models make them difficult to recreate with isosurfaces.

With the power of advanced metaballs and a few hours of work, I was able to come up with some shapes that resemble alien-like trees. No, they're not perfect evergreens, but they're a start. They're a heck of a lot more interesting than the cylinders with billboarded leaves that you see in many low-budget games. Most importantly, however, they show that complex mesh are possible with metaballs.

Advanced Metaballs

Ever since the successful implementation of Marching Cubes into my engine, I've been experimenting with ways to model things procedurally. Naturally, metaball modeling is the first thing that comes to mind. Unfortunately, metaballs, as described in literature, are somewhat restricted. They usually contain four pieces of information: x, y, z, and radius. The first three control the origin of the metaball's field of influence, and the radius describes how far that field extends.

In an attempt to allow more flexibility, I introduced several new parameters: scale and power. This adds an addition six pieces of information to the metaball (scale and power are each three-dimensional vectors). The scale controls how far an influence field extends in each dimension. The power then controls how quickly the field falls off in each direction. Interestingly, one can achieve completely different primitives just by changing the power: spheres, cylinders, capsules, and even cubes.

Even with these additions, metaballs did not have the power to recreate more complex topologies. For this reason, I began to explore rotation as another parameter of the metaball. After much trial-and-error, brushing up on matrix math, and poking around forums, I was able to get rotation right.

The advanced metaball, as I casually call it, has still four more pieces of information on top of the position, radius, scale, and power information contained in the original. It contains a 3-component vector that specifies a rotation axis, and a scalar rotation angle. Together, these components tell the metaball how to orient itself about an arbitrary axis of rotation.

With the power of rotation now at hand, it remains to be seen just how flexible advanced metaballs will prove to be as tools in implicit surface modeling.