Friday, July 25, 2008

L-Systems in 3D (lines)

It's been WAY too long since I updated this, I'd like to say I've been doing more important things like saving the world or something, but nope, nothing.  I've spent most of my free time addicted to a game called Oblivion, it's a great game.  I guess you could say I have been doing some good by saving the good citizens of Cyrodiil.  Although... that's not strictly true, I murdered a good few of them.  To make it seem like I wasn't just playing a game all the time let's just say I was doing research...

I'll be away from the XBox while I'm back in Ireland so I decided to pick up where I left off so I migrated the L-System stuff I had in the WPF test project over to my DirectX project.  It was pretty easy, here's the fractal plant in 2D but in the DirectX app.

lsystemFractalPlantInDX

I then wrote a turtle-graphics class that would traverse the L-System's result and draw in 3D.  The result is still pretty flat because it's just lines and a picture doesn't really do it justice, so I uploaded a video to show what it looks like:

I'm not sure what I should do next... but I think I'll have a go at making the 3D turtle graphics construct a polygon model from the L-System output instead of a line-model.  It doesn't get me any closer to procedural cities but it'd be cool to have procedural trees.