PDA

View Full Version : Sand city: An experiment



Alfar
08-21-2009, 04:01 AM
I tried a little something here, using a dissolving radial gradient to decide placement of buildings.

While fiddling around with making the roads, all of a sudden I had this. I thought it looked like tracks in the sand, so after just a bit of cleanup, I made it a city in the sand.

Alfar
08-21-2009, 09:46 AM
Some more experimentation with this technique. This time I used a dimpled gradient to place houses tighter the farther from the walls I get. I think with a little more work, I can get something at least somewhat useful.

Is this the right place for these experiments, btw? I'd like to write up an explanation of what I'm doing, and then get suggestions on improving the method, I suppose :)

Or someone should just tell me to stop it and move on if it's an entire waste of time.

ravells
08-21-2009, 09:50 AM
Noooo! Don't stop!

This is looking really promising! I really like the sand-tracks. Is there some way you can rotate the buildings so they're not all pointing in the same direction? Ideally a lot of them should be rotated so that on side is parallel to the street they are nearest to.

Alfar
08-21-2009, 10:02 AM
I suppose I could make multiple dissolved point maps and rotate them after growing them.

The main problem with what you're asking is that I'm generating the streets after the houses, though I do suppose they might actually align along the sides of the houses reasonably well... ;)

Edit: Quick sample... I think they did align rather well... you?

ravells
08-21-2009, 10:22 AM
I think that looks a lot better, but can you post a larger image?

Steel General
08-21-2009, 10:34 AM
This is really some neat stuff you're doing here Alfar.

Alfar
08-21-2009, 04:05 PM
Well, that's kinda the problem ravs, I've no idea how it scales ;)

My first attempt at scaling it up failed miserably, will have to try again tomorrow... bah.

ravells
08-22-2009, 07:38 AM
I'm sure you'll be able to sort it out!

Alfar
08-22-2009, 03:36 PM
Well, not sure I really sorted it out, but I think with fewer dots, I can allow the individual houses to become bigger. Anyway, I've written instructions on how I did this...

I'll post that, and maybe some of our clever heads around here will help us improve on it :)

Alfar
08-22-2009, 03:38 PM
Make a new image, 1000x1000
Add a layer, transparent background, name it "Dissolve".
Set the Dissolve layer to dissolve mode, 10% opacity
Set the gradient tool to Normal mode, Gradient FG to transparent, Shape radial.
Set the foreground color to black, background color to white.
Make a gradient on the Dissolve layer from the center to a bit from the edge.
Add a layer below the Dissolve layer, transparent background, name it "Points"
Merge the Dissolve layer down.
The points layer now has a bunch of black dots. (Image 1)

Scale the image to 3000x3000.
Using the select by color tool, select all the black dots.
Grow the selection by 1 pixel. Twice.
Add a layer, transparent background, name it "Buildings".
Fill the selection with black on the Buildings layer.
The buildings layer now has a bunch of orthogonal buildings (Image 2)

(Insert stuff to distort the buildings, turn them at different angles and such)

Alpha to selection on the buildings layer.
Grow the selection 10 pixels.
Invert the selection
Using the select by color tool in subtract mode (hold ctrl), unselect all the black dots.
Add a new layer, BG color background, name it "Streets".
Set the gradient tool to Normal mode, Gradient FG to BG, Reverse (so it's white to black), Shape Shaped (dimpled).
Use the gradient tool on the Streets layer.
The streets layer now has a gradient between all houses. (Image 3)

Set the foreground color to 50% gray.
Add a layer, foreground color background, name it "Streets bump".
Bump map the streets bump layer with the streets layer. Azimut 135, elevation 45, depth 65, ambient 0 (Image 4)

Use the edge filter on the streets bump layer, Algorithm Laplace, amount 2,7.
Gaussian blur the streets bump layer, size 6,0
Normalize the streets bump layer (Colors|Auto|Normalize)
Add a layer mask to the streets bump layer, using a grayscale copy of the layer
Fill the streets bump layer with the Slate pattern
You now have some pretty nice streets between the houses (Image 5)

Alfar
08-22-2009, 03:39 PM
Alpha to selection on the buildings layer.
Set the foreground color to black.
Add a new layer, FG color background, name it "Houses bump".
Set the gradient tool to Normal mode, Gradient FG to BG, Reverse (so it's white to black), Shape Shaped (dimpled).
Use the gradient tool on the Houses bump layer.

Set the foreground color to 50% gray.
Add a layer, foreground color background, name it "House roofs".
Bump map the house roofs layer with the Houses bump layer. Azimut 135, elevation 45, depth 65.
Set the House roofs layer to overlay mode.
Make the Houses bump layer invisible.
Duplicate the buildings layer.
Add a layer mask to the buildings copy layer, Transfer the layer's alpha channel.
Fill the buildings copy layer with the Wood #1 pattern
Rename the buildings layer to "House shadows"
Offset the layer 1px in both x and y directions.
Gaussian blur the House shadows layer, size 2px
Set the house shadows layer to multiply mode, opacity 80

You now have houses with roofs and shadows. (Image 6)

The streets at the edges of the city are pretty crummy, I know. I'd probably cut some of it off at some point and introduce a city wall.

ravells
08-22-2009, 05:21 PM
Oh my word! I thought that was done in some seperate programme thingy....It's.....huge!

Alfar
08-23-2009, 01:30 AM
Nope, just gimp. ;)

Alfar
08-23-2009, 03:40 PM
Eh... does the fact that it's made with Gimp make it less interesting?

Is huge a problem? I'm pretty sure I can do smaller, 3000x3000 was pretty rough on my lappy.

Also, if the number of steps involved is scaring you, I'm pretty sure I can script more or less all of it.

Gandwarf
08-23-2009, 03:43 PM
That last image looks quite hopeful... it's a bit random though. I am curious if we will ever find something that mimicks a realistic city.

ravells
08-24-2009, 03:21 AM
No huge is definitely good!

Alfar
08-24-2009, 11:06 AM
Had to play some more with this - here's whirl city, where I whirled the blocks before working them into a city... or something like one, at least.

I imagine one could fill in the empty spots with parks, special buildings, wells, and the houses that stand alone could have walled gardens and such.

RobA
08-25-2009, 04:01 PM
Had to play some more with this - here's whirl city, where I whirled the blocks before working them into a city... or something like one, at least.

I imagine one could fill in the empty spots with parks, special buildings, wells, and the houses that stand alone could have walled gardens and such.

Interestingly enough, the whirled version seems to immediately add an element of "this is planned" when I look at it! You should try a radial displacement map on a repeating B&W conical gradient as an alternative to whirl... might give some primary road structure to the layout.

-Rob A>

Alfar
08-26-2009, 03:10 AM
Thanks RobA! Exactly the kind of suggestion I was hoping for. Sounds like a fun thing to try out for sure. Will let you know how it works out ;)