The Road Less Travelled
I knew from the start that I wanted to be able to use vector based graphics to generate long smooth roads in a way that I could then inject into more traditional landscape materials. I also knew who was to blame for this stubborn belief that this would be a better way to try and do road networks in Eden, it was this chap (more specifically this video he made):
I’d already spent a number of years pushing standard landscape materials as hard as I could (and then some), and I knew that I simply wouldn’t be able to emulate what Eric had achieved here with a non vector graphic based set of tools. All those crisp, sharp details just screamed vector graphics.
So I spent literally years learning how to integrate a vector graphics library called “Antigrain Geometry” into Unreal Engine. I chose Antigrain because the only other option I could find was the Cairo library and it was nowhere near fast enough for what I wanted to do. It took ages to get all this going because, well, I’m ok in C++, but I’m not amazing. And the code in Antigrain is (at least for me) sadistically convoluted.
For example, here is the UML diagram I built out of blood, sweat and swears that let me (finally) figure out how to render a pattern on a path:
To add to the complication, I found out last year that the poor fellow who’d written the library had unfortunately passed away.
But, eventually, Captain Ahab that I am, I finally managed to get to a point where I could do what I wanted easily with a couple of lines of code:
I know, I know, it’s pretty rough at the moment. But cleaning up the edges is just loose ends at this point.
The functionality that this system unlocks though, has a value for Eden that is hard to understate.
If you’re not familiar with those color patterns on the left, they basically represent a value of 0 to 1 across the width of the path in one color channel, and a value of 0 to 1 (repeating) along the length of the path in another color channel of the dynamic texture that Antigrain is helping me generate.
The great trick here is that you can feed this texture into a material, then use it as the actual uv coordinates for another texture. Then bada bing bada boom: roads, rivers and who knows what else… Probably a bunch of stuff I haven’t even thought of yet. But even if that was all it did, it’s a huge monkey off my back.
For the record, this was a critical requirement for being able to implement the Metropolis system I’ve planned out for city generation in Eden.