Showing posts with label Procedural City. Show all posts
Showing posts with label Procedural City. Show all posts

Saturday, November 15, 2014

Cantor City

The Cantor set (or how you obtain it) is probably one of the simplest fractals out there. It was one of the first examples I encountered and it helped me greatly understanding whatever came after. Here is how I like to explain it:

1. We start with a horizontal segment.
2. We divide the segment into three equally sized segments.
3. We remove the segment in the middle
4. Repeat from step (2) for the two remaining segments



This produces a set of segments that puzzled mathematicians for a while. I am more interested in the fractal properties of the whole construct. It shows how a simple rule operating at multiple scales can generate complex structures. This set is too primitive to be used for realistic content, but it is the seed of many techniques you will require to achieve that.

This is how you would code the Cantor set using our grammars:

This is the real world so we need to make sure it stops. An easy way would be to add another definition of "cantordust" for when the size is small enough. This definition would do nothing, thus stopping any further subdivision:


Here you can see the output:


Let's make it more interesting. First let's add depth to it. Instead of segments we will use 3D boxes:


This already looks like we were growing little towers. We can make the towers taller if there is enough room:



Let's add a random element. We will not split into three equal spaces anymore, instead we will pick a random value for each iteration:


For a microsecond this image can fool you into thinking you have seen a city. I think that is pretty cool if you consider it is only a few lines of grammar code.

Of course this is not a replacement for a city or buildings. The cantor grammars are probably the simplest you can have. You will need a lot of more code to produce somethings that can pass as a city. But odds are it will be mostly variations of the Cantor dust.

Friday, August 17, 2012

More Grammar Screenshots

Here is another series of screenshots. These are also from the Canyon City grammar.






I really need to improve the lighting in this preview. I normally export the final mesh to 3ds max and render it with nice global illumination. The meshes I get out of this are so large 3ds max cannot deal with them anymore.

The mesh complexity is a problem only at this stage of the grammar edition. Once this is voxelized and optimized back to polygons, it will be fast enough even for realtime rendering.

Over the weekend I will see if I can load this into 3ds max to produce better previews and share them with you.


Saturday, February 5, 2011

The Missionaries Arrived

I have done my first render of some architecture. Here you can see the results:


It is some kind of Romanesque church. It is all made of voxels, so it is pretty much the same as the terrain and the trees I have shown before.

This church is entirely procedural. It was created by an L-System based on a series of grammar rules. The rules can be evaluated in many different ways, producing churches with many different layouts and sizes. Many of the rules can be used for other things than churches. For instance, the same towers could appear in a castle as well.

Artistic input is still required, but at a very generic level. The artist creates the basic building blocks like doors, windows and ornaments. Then they are procedurally recombined by the grammar. This way a few assets can spawn a large number of very different looking buildings.

The base assets are in polygonal form. This is so it is easier for the artist to create them. For this reason the architecture L-System outputs polygonal meshes. The meshes are then voxelized and blended with the rest of the terrain so it benefits from all the advantages of the voxel engine.

I have still a very long way to go regarding architecture. First I need to improve the grammars so I can also represent interior spaces. The interior of this church is not very good for instance. It has practically nothing inside. I also need to port the voxelization to OpenCL. I'm still running a CPU-bound prototype.

And one building is just the beginning. I want a complex network of interconnected cities. These doodles illustrate what I'm going for:




At this point I feel like the man who was carrying a brick so other people could imagine how his house was. But hopefully you will get the idea.

I will post soon about the L-System and architecture grammars. It was very interesting for me and it was one of the tasks in this project I enjoyed the most.