PDA

View Full Version : All about city block tiling scripts.



Redrobes
01-31-2009, 06:12 PM
Now that the current challenge is over I wanted to get back to my thatching and other roof type experiments. I have been promising myself that I would thatch a whole city in one go which sounds like a barrel of laughs...maybe.

Instead I thought it would be a better idea to get some tiled textures of city blocks so that I can shove these in and delete out the buildings I dont need with either the eraser tool or by using a mask. So this is an attempt to do that.

What I am looking for is some C&C's about the textures posted and also what sort of roof types and stuff people want. Now I am only going to post the textures with the buildings as done because its taken me all night to make these in 3D. So I have the buildings as a height map and I can render this out with any kind of texture or roof on the top.

So starting with thatching, how do these look ? Do you like the floor and thatch - ill upload these when were all happy as they are 4096 square PNG's which should tile seamlessly.

Edit -- added lightened up version which I think is more representative of thatch.

Vandy
01-31-2009, 06:25 PM
Redrobes,

This is great! I really like the thatching look and the buildings are super! This would be so much easier to use in the Midieval City tutorial than hand-drawing all the streets.

Great work and I look forward to your further posts in this thread.

Regards,

Gary

Redrobes
01-31-2009, 06:35 PM
Thanks Vandy - its giving me grief now trying to upload the updated version so ill post it here. Yeah the idea is just to rub out the area you want filled with thatched houses and then tiled houses and then whatever other types of roof I come up with. Should make the process from being a real pain to a cinch.

To be honest theres not much to do with thatch but do you think the mud is alright and do you think I need a little grass around each house so the mud is down the middle of the gaps only etc. It would be nice to keep the same mud for all the house types then you can mix and match the houses on one map.

I think I have killed the attachments capability on the server.... :?

Vandy
01-31-2009, 06:39 PM
Hey, RR.

I wonder if it would be possible to leave the space between houses transparent? That way, people could create their own layer to use for their "ground" for around the buildings they chose to use.

Just a thought...

Regards,

Gary

Redrobes
01-31-2009, 06:41 PM
Aargh - double posted now - still gives me a chance to answer...

Yes I could do that I think. So create a blank background. Good idea. Ill see to it.

Redrobes
01-31-2009, 07:44 PM
Cool yes that sorts that out doesnt it. Right ill try some more shortly with different roof types and get them all zipped.

Ascension
01-31-2009, 07:57 PM
I'm wondering about the shadows. I could just rotate the pattern to suit my needs for sun placement but I'm thinking that you might want to dump that part as well...no biggie either way. I think a slate or shake-shingle type roof might be cool as well as stone and maybe terra cotta. Up to you, just some ideas. Thanks for these, I'm sure I'll use em.

Redrobes
01-31-2009, 08:14 PM
I can adjust the shadow angle and so on. Its just that in previous maps people have always wanted the shadow. Also I would use tokens for each house but if I rotate them to place them down then I don't get consistent lighting or shadows so a major part of this for me is to get all the houses placed with the same lighting. But I can do one with no shadow if thats what people want.

Right the first one is up. Now its a biggie at about 35Mb so dont all do a gold rush job on my host ;)
Thatched Clear background with shadows. (www.viewing.ltd.uk/Temp/CG/CityBlockTextures/Thatched_ClearBk_Shadow.png)
It ought to load in a browser but might be better to do a 'save target as' on the link.

Let me know if these are good and ill look at tiled, slate and woodblock roofs too.

Redrobes
01-31-2009, 08:24 PM
This is it tiling - its not bad. If you look close you can see the edges in a few places but most of it is seamless. This image is a 3x3 set of them where the middle tile takes up most of the image so the edges of the tile are not all that far from the edges of the image. Good enough for me any way.

Oh I also made the shadows semi transparent so it should show up the ground underneath. Oh well just try it and see how you feel about it and let me know. I can change the transparency, amount, direction or anything. The C&C's are welcome to get this about right before I do them all like it as id like to stick with one style and run with that for all roofs.

Hoel
01-31-2009, 09:54 PM
Hmm.. what software is this? It looks good but how is it done?
*rubs eyes*

Ascension
01-31-2009, 10:34 PM
I hate to say it, because I know how hard this is, but...how would I put streets down with this? I can't find anyplace that lends itself to a street unless I chop out buildings...which is fine, I can do that :) Just a thought, that's all.

Redrobes
02-01-2009, 06:08 AM
Hmm.. what software is this? It looks good but how is it done?
*rubs eyes*The 3D shapes are done in light wave. They are very rough indeed just boxes with pointy roofs. I made about 20 or so the bunched them together then bunched the bunches etc and filled in holes until I had a large area. Then I export the height map of that. To that I tried using blender again but that program is still going downhill in my opinion. Eventually it crashed so I did it in light wave again and it was fine. Blender has a render ortho mode which is better than light waves but the mode is so damned annoying in its parameters that I lost my rag in the end. In both apps to get the height map you render black mist or black fog linear over the 3D object with mist starting at min Z and ending at max Z. To make it seamless I do in 3D what I do in 2D for my seamless tiles tut (http://www.cartographersguild.com/showthread.php?t=1373). It mentions in there that I got the original concept for that from a guy doing the tiling for paving slabs in 3D.

From there I used my GTS prog and run the thatching script over it. Now RobA has tried pertty successfully to do this with Gimp and its all in the thread Thatching for Dummies (http://www.cartographersguild.com/showthread.php?t=1932).


I hate to say it, because I know how hard this is, but...how would I put streets down with this? I can't find anyplace that lends itself to a street unless I chop out buildings...which is fine, I can do that :) Just a thought, that's all.I was just going to drag street lines through it and any building that was partially cut I was going to erase in the same mask then fill in any obvious blank areas with market stalls, crates, a well or some other city furniture. I know its all a botch up but there has to be an easier way to make cities than by placing each house down individually. Whats really needed though I haven't the time to do it is to make a program where it places house 3D models down into areas marked out with a mask so that you draw the city and the house areas and then it fills those areas up with packed in houses. Then render that with the thatch and so on. This is all fairly experimental but I think its better than the patterns done via Voronoi that was used with Gimp/PS etc.

Ascension
02-01-2009, 06:31 AM
I hear ya Red, what I'd like to see is something like take a random noise function but instead of using tiny dots make random blocky shapes. Then the program draws lines from the edge of the shape to a center point (for roof lines).

Redrobes
02-01-2009, 10:56 AM
Got a woodblock tile one done. Its not all that great cos there just isnt enough res to show the tiles to their full detail. Still, its another option. Looks a bit like thatch that is layered !?

Full Image is here (http://www.viewing.ltd.uk/Temp/CG/CityBlockTextures/WoodBlock_ClearBk_Shadow.png) - another 30Mb job.

Will look at a terracotta clay tile next I think.

Ascension
02-01-2009, 11:48 AM
That one looks very Nordic to me, nice job.

Steel General
02-01-2009, 01:05 PM
Cool stuff you have going on here RedRobes!

Redrobes
02-01-2009, 01:25 PM
Thanks and thanks :)

I have another which is clay tiles (http://www.viewing.ltd.uk/Temp/CG/CityBlockTextures/ClayTile_ClearBk_Shadow.png).

This one looks great in some places and not so great in others. Basically where the tiles follow the contour well is where they look good.

Sigurd
02-01-2009, 03:12 PM
If you had a tile with a transparent floor it might be easier to make drop shadows on the buildings in different orientations.


Sigurd

Chgowiz
02-01-2009, 03:28 PM
Any chance you'd be willing to share the tiles themselves as downloadable images? I am thinking that similar to the trees from ZombieNirvana, you'd just have to do some masking/editing when creating streets, but this is fantastic stuff!

Redrobes
02-01-2009, 07:35 PM
If you had a tile with a transparent floor it might be easier to make drop shadows on the buildings in different orientations.


Any chance you'd be willing to share the tiles themselves as downloadable images? I am thinking that similar to the trees from ZombieNirvana, you'd just have to do some masking/editing when creating streets, but this is fantastic stuff!

Sorry guys I don't get either question. These images do have a transparent floors and so far I have uploaded all of the full tiles - 30Mb each (links in the posts above). Do you mean the tiles as in textures of the individual ceramic plates, slates and wood blocks ? The textures all come from CGTextures.com as usual. They have them all in super high res and are free to obtain.

The idea is to take these and use them as fills into city regions by erasing parts of them like borders and roads and remaining half houses and then you have your city buildings. You get lots of tile types or thatch so you can put the textures on different layers and choose between them by erasing all the other types or maybe having an index mask which selects one of the set. At least thats my going idea which I will try out right after I have a full set of them.

Chgowiz
02-02-2009, 10:21 AM
The idea is to take these and use them as fills into city regions by erasing parts of them like borders and roads and remaining half houses and then you have your city buildings. You get lots of tile types or thatch so you can put the textures on different layers and choose between them by erasing all the other types or maybe having an index mask which selects one of the set. At least thats my going idea which I will try out right after I have a full set of them.

Fair enough. I was thinking of smaller tiles than entire screen fillers, but now I see what you were thinking and it makes sense. Thanks for sharing!

Sigurd
02-02-2009, 12:38 PM
Too tired, I saw the webpage background colour.


Sigurd


Thanks for the tiles.

Redrobes
02-02-2009, 01:25 PM
Fair enough. I was thinking of smaller tiles than entire screen fillers...They are only big because of the res. It depends on what size scale your map is. You could resample them half or quarter size no problem but its obviously difficult to go the other way around so they have to be big to start with. If you had a really small scale map then you might have to resample them into quarters and then stitch a few of the tiles back together again to make a big bitmap again. Its also pretty good to have a big bitmap cos if your map is say 2000 pixels wide and you need the shadows for the buildings in a different direction then you need to rotate the image by say 35 degrees. Then you would cut a 2000 px sized rect out of it to use as the texture. So being one big image is much easier than faffing with lots of little tiles that have to be rotated and butted up at 35 degree angles. Most of my maps are about 2000 - 3000 pixels wide so I thought id well cover myself with a 4K set. I don't want to have to do these textures again - I can see all my cities looking similar but at the same time I am lazy and don't have the time to place all the houses down one by one. Its a tradeoff. The aim is to try to generate a script which uses these so that I can splat down a few roads, paint out a few city regions and stuff and it builds a complete city with minimal effort. Its all a bit experimental and I don't know how its going to turn out but I think it ought to work.

Chgowiz
02-03-2009, 09:30 AM
Redrobes, your tiles are fantastic and I wasn't meaning anything bad about my comments. My maps tend to be smallish - 1500x1500 or less, which is why I thought most tiles were < 600x600. Learn something new everyday. :)

RobA
02-03-2009, 02:41 PM
Here I scaled down your pattern, carved some lines through it using a Voronoi pattern then had it delete all buildings that were cut/touched by the Voronoi lines. I'm surprised how many buildings were erased doing this!

9923

It might be necessary to plan road lines better, as some areas (SE) look much better than others.

-Rob A>

Ascension
02-03-2009, 05:17 PM
That looks pretty handy except for that spot in the middle with only one building. Still though, not sure if I can do this in PS but will look into it...got an idea.

Redrobes
02-03-2009, 06:05 PM
Gonna have a play myself shortly but I think I ought to finish off the set. So here's another 60Mb.... Logs cabins (http://www.viewing.ltd.uk/Temp/CG/CityBlockTextures/Logs_ClearBk_Shadow.png) and slate (http://www.viewing.ltd.uk/Temp/CG/CityBlockTextures/Slate_ClearBk_Shadow.png) roofs. I think that's enough to go on with.

Chgowiz - wasnt meaning to be offish - just some factual stuff there about the res. 4K is probably overkill but better too big than too small IMO.

Redrobes
02-03-2009, 06:41 PM
Ahh I told porkies. One more but this one is a utility version to help me plan the roads better.

Outlines Version (http://www.viewing.ltd.uk/Temp/CG/CityBlockTextures/Outline_ClearBk_Shadow.png)

Chgowiz
02-04-2009, 09:53 AM
carved some lines through it using a Voronoi pattern then had it delete all buildings that were cut/touched by the Voronoi lines

How did you do that?

RobA
02-04-2009, 03:18 PM
How did you do that?

Which - made the pattern, or deleted the touching buildings ;)?

I got the Voronoi pattern maker from a site that no longer has it there (it shows the site as "under modification").

BUT if you can get any pattern of road lines (even stroked paths or selected mosaic cracks this will work.

0) Set up a stack: city pattern on the bottom, and a black on white road pattern on top.
1) get rid of the shadows from the city building pattern layer using threshold alpha.
2) duplicate the city building pattern layer.
3) Move it above the road layer.
4) Lock the alpha and fill with black.
5) use the magic wand tool with the "sample merged" option ticked and click on one of the roads. You will get a selection of all roads plus connected buildings.
6) grow the selection 1 pixel
7) on the city building layer hit delete.

Now you will have to remake shadows, and fill in backgrounds/roads as desired.

-Rob A>

Chgowiz
02-05-2009, 10:59 AM
@RobA - wow. Thanks! I'm going to have to give that a go. You answered exactly what I wanted to know. (I'd love to know what a Voronoi pattern maker is)

Redrobes
02-05-2009, 01:56 PM
I'd love to know what a Voronoi pattern maker isYou should try some web pages on it as some people have written little java applets which allow you to drop points down and it draws the voronoi pattern out of them.

The Voronoi pattern is basically regions around points such that all the area in each region is the closest to the point it surrounds. So if you have just two points in space then the pattern is merely a line dividing the region in two midway between them perpendicular to a line joining the two points. As you drop more in then it fractures more into the triangles and polygons.

Natural examples of Voronoi patterns are created with bubbles so that looking down onto a dish of bubbles that are all packed together is a perfect pattern. The bubbles all try to form the least amount of surface tension. Since all the bubbles are made out of the same stuff then they pull on each other until it equalizes to that pattern which is optimal. When one bubble bursts then they all jiggle about and reform the new pattern.

There is an opposite space cutting pattern which is called the Delaunay pattern and it has lines which join up the dots. Actually all the shapes are triangles in this pattern. They use this algorithm to make 3D models from point clouds. You can use it in terrain models by specifying a few height points, stitching it all up with Delaunay and then it has triangles covering the area so it has a complete surface instead of just a few points. I.e. Its really useful !

RobA
02-05-2009, 02:12 PM
RR-

I just read about a really cool way to create a Voronoi mesh using 3d graphic cards. center a 45 degree cone of the same hight as your image space on each point, giving each a colour.

Render it orthagonally from the top down with no shading.

Every separate colour will be a Voronoi cell, so running an edge detect alco with give you the mesh!

It is funny how it is can be faster to model a mathematical problem in a GPU rather than solving the math in the main processor!

-Rob A>

Redrobes
02-05-2009, 02:19 PM
Yeah thats a well known way of doing it and its true that can be super fast too. You don't have to use 45 deg cones - any cones will do as long as they are all the same angle and you can also grab the image data from the depth buffer instead of faffing with sorting out all the color too if your just after which was the closest region. I think that with the new cards you might be able to write a shader kind script to run on the card and process the result into the normal lines version. Is there an equally nifty way of doing that with Delaunay in 2D ? I haven't heard of anyone doing that and yet the two patterns are kind of transposes of each other.

Chgowiz
02-06-2009, 12:07 PM
@Redrobes - wow, great explanation, thanks! Repped!

Redrobes
02-06-2009, 07:05 PM
Thanks for the rep :)

I have been playing a little with the textures now. Just started really so a WIP is in order. Just shows that I will combine them all into blocks. What I think I need to do is lay out the roads and then modify them based on where the houses are. Need thinner roads for a start. Its alright but it needs to be much better than this.

Onwards...

Redrobes
02-07-2009, 03:28 PM
Got a bit more figured out. I cant do it totally automatically but its a three stage process. You draw some rough roads, it generates a mask that you edit to put the roads in better positions. Then run it some more and it generates an image with the roads and the houses on it in black and white and you just flood fill out the houses which go right over roads. Then run the final bit and it generates the city render. If I had a command line app of flood fill then I could skip that middle bit but I think I still need to put the road positions down manually and modify them with some (limited heh) intelligence unless I could write something to automatically put down roads which I think is not a goer.

You can also set a houses types index image which looks up the type of house from the set as in the previous post but in this case I have just gone with slate tile. Might try to generate a types mask which is a whole mix of types and see the whole city rendered like that.

So the cutting edge pics so far.

Steel General
02-07-2009, 03:34 PM
Cool stuff going on here RR!

Redrobes
02-07-2009, 04:03 PM
Cheers Steel, Got one more before I go for a cuppa and quit while I think of what else I can lever into it.

Actually I think it looks better with one style of roof... Hmmm it looks like how I wanted it to but its not much like a city is it ?

RobA
02-07-2009, 05:53 PM
Hmmm it looks like how I wanted it to but its not much like a city is it ?

Looks like a jumble of buildings rather than a city. I guess the difference would be that a city has more connectivity and cohesion.

This is more like a subdivision in the suburbs with scattered houses.

-Rob A>

ravells
02-08-2009, 03:36 AM
When we were coming in to land in Dubai, the houses there looked like they had been built by a CD3 noob, or that they had come out of sim city or something...check out the google earth pic.

Asharad
02-08-2009, 09:29 AM
I know this is off topic, but I'm astonished at the number of swimming pools and grassy lawns in that desert!

Steel General
02-08-2009, 11:43 AM
If they can engineer an indoor ski slope, swimming pools have got to be a breeze. :)

ravells
02-08-2009, 02:09 PM
I just thought it was one of the most soulless bits of town planning I'd ever seen /threadjack.

Redrobes
02-08-2009, 02:29 PM
Its not really a thread jack. As I have mentioned, my map didnt look like a city at all. So theres something about a city in its house grouping and linkage that must be present that makes it look like a city. Of course cities around the world look different and your right this is pretty soulless but then the aim of Dubai planning has a lot of conformity - like the palm and so on. I am a fan of Syd Mead and he has been out there helping to design it and getting the skyscrapers to look like some futuristic vista. I am sure it will work out but despite liking his work theres more to a skyline than it looking aesthetically pleasing - it has to be functional and inspiring and so on. I guess out of downtown they have plumped for super functional and to hell with any inspirational stuff. Dubai is a bit of a veneer of luxury which will fall apart very quickly.

So if my script had produced that then you would have all said how trash it was and you would have been right. So the question is... what makes one of those archetypal medieval cities so very not soulless ? How can that effect get scripted would be the next question too ;)

On a side note, has anyone been to "The Palm" - does it look better from the ground ?

ravells
02-08-2009, 04:50 PM
Have a look at the link in my sig on city design which may give you some ideas...I must get on with chapter 2.

Redrobes
02-08-2009, 05:24 PM
Cool thanks, - thats a very thorough set of notes to have a browse through and see if I can see what I can do about this city scripting business.

RobA
02-08-2009, 08:24 PM
I think a city generation algorithm would have to grow more organically, possibly some varient of an L system.

I'll dig up an old link http://www.cartographersguild.com/showthread.php?t=920 where I was playing with such a system using the processing language. I was focusing on streets, not buildings, but such an approach might work best in the long run.

I reference this site: http://www.complexification.net/gallery/machines/substrate/index.php which has an applet of the script I modified. click on the demo to see what looks like a city "grow" before your eyes ;)

-Rob A>

Steel General
02-09-2009, 07:20 AM
I reference this site: http://www.complexification.net/gallery/machines/substrate/index.php which has an applet of the script I modified. click on the demo to see what looks like a city "grow" before your eyes ;)

-Rob A>

That is really cool stuff..thanks for posting.

SeerBlue
02-09-2009, 09:46 AM
Thanks for the link RobA, now I want a huge digital picture frame that just runs variations of that,,,,SeerBlue