Friday, February 7, 2014

Non-procedural Generation

What is the opposite of procedural generation? I would say an image where every pixel was put there by hand.

Whenever I get tired of looking at source code I found good old fashion drawing helps to put things back into perspective.

Since I have shared so many synthetic images here, I thought it would not hurt to post something I had created by hand. These images are rather rough sketches for scenes, characters and environments. I was kind of free-styling in every case and did not pay much attention to detail. I do these to entertain my kids, which often decide what is going on in the scene and what colors I should use (that actually explains a lot).





Tuesday, January 28, 2014

Leveling Lakes

This post will advance the water saga.

You may want to check out the previous post about water. It ended up producing a 2D map of booleans, where true meant there was water in that location of the map. That was great, but we still had a nasty problem ahead. We needed to level the lakes.

It will be easier if we look at some pictures. Imagine this is the tile we need to compute. Initially it is just the terrain height and the sea map (in this case using a sea-level value):


And here you can see the lake and river location phase from the earlier post in pretty pink:


As you can see in the zoomed portion, these lakes often span over very irregular terrain. We knew the shoreline points for the same lake were at similar height. Figuring out the water level from A to B was the problem. We know A-B should be as flat as possible and the same applies to A and any other point in the shoreline. That's a lot of potential points.

If we had all the time in the world, we could try discovering individual lakes in one phase and then do some sort of iterative leveling by relaxation and or filtering. We had only a fraction of a second for this so we knew it had to be hacked.

We tried many different things. (When I say "we", it is not modesty plural. Michael Coates who recently joined Voxel Farm got to implement these desperate things we tried.) Most had to do with rasterization and interpolation, first from shore to shore, then we got looking into water height derivatives. Nothing really worked.

As a last recourse attempt, we tried an approach that involved a Quadtree. The idea was to encode the water bodies in a Quadtree and apply the same leveling algorithms we knew would be too slow if we were operating in individual water samples.

The shorelines produced a lot of small quads, but as we moved inside the lake we started getting larger quads.


We could see that the larger a patch, the more "detached" it was from the shore. That we liked. We could raise or sink those points much more to achieve the level we needed.

Once the water height of the larger patches is decided, we rasterize them into the water heightmap. This is a simple, fast bi-linear interpolation over the quad. Then we do the same for the smaller quads. There is a reason why you need to process all quads of a given size before processing the next level of smaller patches: You need to make sure the small quads match the interpolation values along the edges they share with a larger quad.

This overall process is quite fast. Here is a rendering of the new found water volumes. It is a bit exaggerated, but hopefully you get the idea:


We still need to work out on some of the heuristics, but it looks we are pretty much on our way.

If there is any lesson to be drawn from this, it would be when in despair, apply a Quadtree and everything will be alright.

Tuesday, January 21, 2014

Stop Kickstarter Scams

Kickstarter.com is a beautiful thing. It also has a dark side. It is up to us, the crowd, not only to fund the projects, but to make sure the system is not exploited by scammers and vaporware salesmen.

This campaign called "Praetoria" just came to our attention. The following screenshot is taken from their campaign page:



Without our permission it uses screenshots from Voxel Farm videos to get people to open their wallets. That is not cool. They have not licensed from us, they are not showing any original work. To me that amounts to lying. If you lie to get money, it amounts to stealing.

We have no choice but to point a finger and ask everyone and their friends NOT to contribute to this campaign.

As a rule, we do not allow anyone to raise funds using Voxel Farm. This is to protect funders and the ideal of crowdsourcing in general.

Every week or so we get a request that goes like this: "Dear Voxel Farm: We at Fourcats (or FlyngOx, or whatever) love your Engine. Please let us use your name and artwork to raise funds, then we will be able to afford the license and all will be good." The answer in every case is no. I hope you can see why.

Sunday, January 19, 2014

Realistic Mining

Very often people say to me -- Miguel you should do a Minecraft, but focus on realism, make it hyper-real!

Well, I'm proud to present you guys our very first mine:


I guess realism can be disappointing. No spiders or terrors from the deep here.

But I'm messing with you. This is not for a game. We did this for people who do mining in real life. As it turns out voxels are good at this kind of problem.

Thursday, January 16, 2014

Dragon Hut

We just had a new iteration over the smoothing tool. Now it really acts like sand-paper. It can dissolve an entire object if you apply it long enough. If you apply it just the right amount, it even outs surfaces to the point you like.


This is me sculpting in this video. I did not start with a detailed plan, just a vague idea of what I wanted to do. I knew it would be some kind of bony hut structure.



A few months ago while doing a stone golem I realized the sculpting toolset still needed some work. This new version of the smooth tool already makes a huge difference. I can feel now I am more limited by my imagination and skills than by the tools I'm using. This is a good thing.