Page 4 of 5 FirstFirst 12345 LastLast
Results 31 to 40 of 50

Thread: All about city block tiling scripts.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    Quote Originally Posted by Chgowiz View Post
    I'd love to know what a Voronoi pattern maker is
    You 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 !

  2. #2

    Default

    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>

  3. #3
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    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.

  4. #4
    Guild Member Chgowiz's Avatar
    Join Date
    Apr 2008
    Location
    Northern Chicago Suburbs
    Posts
    68

    Default

    @Redrobes - wow, great explanation, thanks! Repped!

  5. #5
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    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...

  6. #6
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    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.

  7. #7
    Community Leader Facebook Connected Steel General's Avatar
    Join Date
    Jun 2008
    Location
    Ft. Wayne, IN
    Posts
    9,531

    Default

    Cool stuff going on here RR!
    My Finished Maps | My Challenge Maps | Still poking around occasionally...

    Unless otherwise stated by me in the post, all work is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.



  8. #8
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,245
    Blog Entries
    8

    Post

    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 ?
    Last edited by Redrobes; 02-07-2009 at 05:07 PM.

  9. #9

    Post

    Quote Originally Posted by Redrobes View Post
    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>

  10. #10

    Post

    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.
    Attached Images Attached Images

Page 4 of 5 FirstFirst 12345 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •