Particle City

Particle City

A few simple building meshes assembled into a slightly larger number of city "blocks". Add particle array and voila, instant city.
 

Attachments

  • city from above.jpg
    city from above.jpg
    84.7 KB · Views: 1,548
  • city from above 2.jpg
    city from above 2.jpg
    114.4 KB · Views: 1,504
  • skyline.jpg
    skyline.jpg
    85.5 KB · Views: 1,500
  • street level.jpg
    street level.jpg
    55.8 KB · Views: 1,499
I was thinking cars, overhead rail, street lights, people, and fire escapes. Windows are a little hard owing to not being able to quantize offsets (so floors might be fractional).

It occurs to me that the correct way to do this might be a custom JavaScript (or JavaScripts) that could do similar things to the particle array but also do things like controlled rotation and offsets select tiles based on connectivity (allowing roads and rail, for example, to be correctly placed). It's very easy to imagine the polygon counts getting prohibitive VERY fast though.

I assume you've all seen this:

http://flowingdata.com/2009/05/14/pixel-city-computer-generated-city/

(He even tries to randomly generate fake interiors behind each window.)

And this:

http://www.procedural.com/cityengine/features.html

You could get these kind of effects in C3D by establishing a naming convention for your building parts (e.g. ground_floor, iterating_floor_6_15_0.12 (for 6-15 stories of height 0.12), top_floor) and then using a window material. A script would dynamically generate instances of the buildings and then look for quads assigned to the window material and randomly set UVs (the window material would be an array of images of lit and unlit interiors).

Just thinking out loud. It seems like a pretty interesting way to approach content generation for Unity, but then writing software that simply builds OBJs is probably just as easy.
 
the window material seems the best approach to me too...

very interesting link you posted, specially the first one. I knew this script for blender instead, but never gave it a try.

cheers,
A
 
... and then using a window material.

so here is an attempt at a window material for glass paneled buildings in the evening.
the amount of bright windows is controlled by the gradient, there is a reflection blur that slows down rendering (but makes neat reflections) with fresnel that may create noise, both can be disabled.
it was difficult to make the windows shedding light on the street, a second render with radiosity strength at 25 and 10 000 samples without skylight was needed and blended in in photoshop.

View attachment citylights3.jas.zip

citylights3.jpg
 
Take a third and fourth building with lights off or just on a couple of floors and make the material not glass into your particle mesh and it will look more realistic.
 
Take a third and fourth building with lights off or just on a couple of floors and make the material not glass into your particle mesh and it will look more realistic.

yeah i have been thinking on how to have more diversity without using too many nodes.
i think there is potential in the new particle node but i need martin's explanation. :rolleyes:
i had it already in position but then with instancing switched off it was no more necessary...

thanks everyone,

- archie
 
Thanks Archie.

The first image shows a "city" generated from my current set of buildings using a simple bitmap-based texture.

I spent a bit of time tweaking Archie's material...

The second image shows the tweaked material (which uses UV1 and eliminate the noise-driven bumpmap -- not sure why that's there) side-by-side with the image-based material.

The third image shows a far more tweaked material (including corrected scale). One thing I'm finding very frustrating is that I'd like to use the UVs to drive the material BUT randomly offset them using the instance node (so each building will look unique) but I can't seem to get that to work.

It would be very helpful to have stripes and grid texture nodes (although creating suitable bitmaps is easy enough). The brick texture with an adjustable row offset would give us a useful grid. It would also be nice to have procedural non-square grids (e.g. triangles and hexagons). Again, producing bitmaps isn't too hard.

It would also be very helpful to be able to replace material A with material B without needing to reassign materials to every object in a scene.

Right now, using the checkboard to generate stripes is a hack, and doesn't let us (for example) make the non-window areas thinner or thicker. The lack of a useful grid prevents making other common kinds of facades (as well as making things like bathroom tiles require bitmap inputs -- or way more math nodes than you'd like).

Notes

The new particle nodes give you a random-value-per-instance which lets you do things like pick a color randomly from a gradient to give each instance a random tint. Unfortunately this isn't going to do any good one a single building where, for example, we might not want every light to look the same (although buildings tend to have fairly uniform looking lights).
 

Attachments

  • bitmaps in action.jpg
    bitmaps in action.jpg
    130.5 KB · Views: 538
  • procedural vs bitmaps.jpg
    procedural vs bitmaps.jpg
    101.8 KB · Views: 576
  • fair comparison.jpg
    fair comparison.jpg
    112.1 KB · Views: 534
Maybe something like this, Pod? :smile:
 

Attachments

  • stock-photo-windows-in-a-high-rise-tower-block-or-skyscraper-at-night-8905072.jpg
    stock-photo-windows-in-a-high-rise-tower-block-or-skyscraper-at-night-8905072.jpg
    83.3 KB · Views: 555
... the noise-driven bumpmap -- not sure why that's there

hey pod, impressive progress.

i added the cellnoise to noise to bump because i wanted fractured reflections assuming each glass panel would be a little bit tilted, so when looking from an angle the facade would not look like one single giant mirror.
and i totally agree to the need of a simple grid node which i'm missing all the time.

@terry:

oops - now i don't like my solution any more, will see if i can improve ...
:smile:

- archie
 
Last edited:
Terry -- that's exactly the kind of thing I'd love to be able to do procedurally, but it's probably not possible right now. What we really need is a grid "sample" -- i.e. a gizmo that takes multiple inputs and then assigns them to squares on a grid.

Archie -- yeah I figured out that's why you had the noise in there later. I ended up putting noise back in, but just making it continuous. (Some glass buildings seem to look like they're a solid block of not-quite-flat glass, while others look like a bunch of panes -- either way without a good grid it's very hard to achieve. It was also very tricky getting the "dots" to correspond to the tile pattern (2.4/2.0 vs 3.0/2.5... for some reason).
 
Last edited:
I think I see what you mean, Pod. Although that kind of material would be impossible to create. no? I think this looks cool just as a rough, but I can see the huge problems if it were a real project.
 

Attachments

  • ss.jpg
    ss.jpg
    121.2 KB · Views: 546
Looks cool for a close up though. Of course redoing the mat in Photoshop would take a while.
 

Attachments

  • ss2.jpg
    ss2.jpg
    121.9 KB · Views: 521
I've replaced the particle array with a scripted particle system.

I've posted the new scripting widget here.

@Terry -- actually the guy who did the pixel city demo randomly generated bitmap textures with similar kinds of qualities (gradients, random bright spots, blinds) so it's quite viable given a sufficiently robust material system.
 

Attachments

  • particle city distant.jpg
    particle city distant.jpg
    89.3 KB · Views: 536
  • particle-city.jpg
    particle-city.jpg
    134 KB · Views: 527
Back
Top