POV-Ray : Newsgroups : povray.binaries.images : city building generator WIP : city building generator WIP Server Time
25 Apr 2024 05:44:56 EDT (-0400)
  city building generator WIP  
From: Kenneth
Date: 21 Jul 2017 15:10:01
Message: <web.59724f15a32fe9a2883fb31c0@news.povray.org>
I've been working on a 'city building generator'-- part of my earlier post re:
'green gas cloud.' I put aside the media cloud for now...

Currently, the buildings are just randomly placed. I've made no attempt to put
them into a 'street grid' yet. (Perhaps real-world real-estate prices will be so
high in the future that buildings will NEED to be overlapped by economic
necessity, ha!)

The buildings' facades and windows are from photos I got off the 'net-- then
re-worked in Photoshop to be small 'tiles' that can be repeated. Then I took the
same tiles and made 'reflection hold-out mattes', for the windows themselves.
(That took a lot of manual labor.) The two different images are combined in the
many textures' image_pattern {...} blocks, so that reflections only show up in
the glass windows. The 'image_pattern' feature is great for creating 'texture
masks'.

The photo tiles (I've used only eleven so far, randomly repeated) are all in
different shapes and resolutions. I *could* have re-made them to be the same rez
and shape (more or less) in PS-- but it was more fun to write SDL code to take
care of that, using 3.7xx's new max_extent feature for finding the X/Y rez of an
image.

Applying image_maps to all four sides of a box shape would seem to be a simple
procedure (and it is, if that's all that's required.) But I decided to 'enclose'
the image tiles in POV-Ray's 'boxed' pattern-- to create a thin 'concrete
outline' around the (four) faces of each building, with a larger one at the top.
I didn't want the buildings' window images to go all the way to the side edges;
that would look odd and unrealistic. This extra step took most of the coding
effort-- making sure that it worked at all building scales, while also keeping
all the buildings' windows at the SAME relative scale. (Obviously, each floor of
each building should be the same height!)

I made an interesting discovery with the windows: The raw photos already showed
natural reflections there-- which didn't look correct when applying 'extra'
reflection in POV-Ray. In real life, windows in buildings are very dark (when
NOT reflecting anything) because the room interiors behind them are dark,
*compared to* the buildings' bright sunlit exteriors. SO, I had to darken the
window areas in all the photos to remove that reflected look, then add it back
in in POV-ray.

Instead of using real photos for this, it would be interesting
to try and create some sort of 'window/facade' generator, using procedural
textures in POV-Ray instead. As a guess, it might be done with a combination of
the 'boxed' pattern, the 'cells' pattern, and warp{repeat...} in some kind of
combination, along with random variations of all the elements. (BTW, I haven't
yet looked at any of the building generator .inc files or macros that are
available; I first wanted to see how far I could go, before I needed help!)

Still to do: Figuring out a way for each building's width and height to be
strict multiples of its image_map tile size-- so that a building's edge doesn't
end in the middle of a window! (Which is currently what happens, as the
buildings are just randomly sized.) I may have to rewrite a good chunk of my
code to do that :-/

Another way to make a building would be with *heightfields* for the faces, to
show their natural 3-D appearance (balconies, recessed windows, etc.) I'm
working on that too-- I've already made HF image_maps from most of the image
tiles-- but it's a tedious Photoshop procedure (and involves rewriting my
code yet again.)


Post a reply to this message


Attachments:
Download 'buildings 1 kenw.png' (1686 KB)

Preview of image 'buildings 1 kenw.png'
buildings 1 kenw.png


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.