|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I've been re-working my old "city buildings" scene from... several years ago(!)
It has not changed much since then, except for some subtle but important
additions and corrections to the code.
There are 650 buildings in this shot, randomly using 34 'real' image_maps for
the building windows (so far!) Those original images have from 1 to 20 or so
windows in them-- precisely cropped, so that the code eventually uses '1 window
unit' as a basic size to apply to each building. (But the entire window-image
tile is used if need be, not just a single window from it.) I also had to
manually make 34 window 'hold-out mattes' in Photoshop to create the window
reflections, applied by a complex texture{image_pattern....} used as a mask.
(See the docs about this.)
The real 'workhorse' code for texturing each building is POV-ray's BOXED
pattern-- and just yesterday, I discovered that I had been misusing it all this
time (for my purposes); I had to re-work a major portion of the code to correct
that flaw. Now each building's size is at strict multiples of the '1-unit
window' size-- along with the random thickness of the added 'concrete edges'.
Btw, the 'concrete' color is an average of each actual window tile-- chosen from
25 random points in each image_map, using eval_pigment(...) in a macro. Plus
some subtle added 'dirt'.
I've also added some more rooftop 'greebles', as well as exterior vertical box
shapes to the outsides of some buildings-- to break up the monotony. (I plan to
experiment some more with that idea.) Now I need to add 'upper stories' to some
of the buildings-- like recessed smaller copies of the main ones. That's how
most tall buildings in New York City are built-- in the past, they had to be
'stepped back', by city ordinance, the taller they got.
Then, some sidewalk trees-- and maybe animated cars in the streets. And
first-floor lobbies/doors, which will be a major task!
The scene so far parses 'reasonably' quickly: For 650 buildings, with AA but no
radiosity yet-- 78 seconds total render time on my old Windows 7 machine (at
1600 X 900). The 'peak memory used' is about 1.1MB.
Still a work-in-progress, but comments, suggestions and nit-pics welcome ;-)
Post a reply to this message
Attachments:
Download 'buildings n sky 9_29_20a.jpg' (861 KB)
Preview of image 'buildings n sky 9_29_20a.jpg'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
And a closer view...
Post a reply to this message
Attachments:
Download 'buildings n sky 9_29_20b.jpg' (868 KB)
Preview of image 'buildings n sky 9_29_20b.jpg'
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Op 30/09/2020 om 00:46 schreef Kenneth:
> And a closer view...
>
That is a net improvement to the previous version I should say. The only
thing that rankles my perception are the smaller buildings. Should they
be just dwarf copies of the taller ones, with just less floors? I wonder
if they would not look better if they were of a completely different
design focussed on their lower elevation (sorry, more work for you).
Architecturally, that would be more consistent I guess.
You have also provided for future city expansion, airport runways and F1
racing (or a combination) it seems ;-)
--
Thomas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thomas de Groot <tho### [at] degrootorg> wrote:
> Op 30/09/2020 om 00:46 schreef Kenneth:
> > And a closer view...
> >
>
> That is a net improvement to the previous version I should say.
Thanks!
> The only
> thing that rankles my perception are the smaller buildings. Should they
> be just dwarf copies of the taller ones, with just less floors? I wonder
> if they would not look better if they were of a completely different
> design focussed on their lower elevation (sorry, more work for you).
> Architecturally, that would be more consistent I guess.
That's an intriguing thought, and didn't occur to me. (Simply getting to *this*
point was a brain-twisting chore, ha.) I'm not quite sure what you have in mind;
but I will take a closer look at my collection of real New York aerial photos
(downloaded from the 'net), to see how shorter buildings might differ in
appearance and construction. I have to admit that, currently, the buildings
lack... 'individual personality'... a result of the box-y procedural technique
that I'm using. I hope to keep the code mostly procedural though, rather than
adding a lot of 'one-off' buildings and details; but that has its limits and
shortcomings, obviously. I suppose that a few *circular* buildings would be
appropriate too, and should be relatively easy to add.
Btw, I don't know if it's noticable in these renders, but I made no attempt
(yet) to 'correctly' place the greebles on the building roofs; they are just
randomly placed, and most likely intersect each other. I have to admit that I
still don't know the algorithm or technique for placing randomly-located objects
that don't overlap, each object having its own space. It is a long-standing
mystery to me. I know it has been discussed in the newsgroups from time to time.
>
> You have also provided for future city expansion, airport runways and F1
> racing (or a combination) it seems ;-)
Ha! Actually, the 'ground' is currently a simple plane, with the roadway texture
running off to...infinity! I hope to come up with some other visual scheme for
the 'suburbs'-- or else *always* restrict the camera view to just the city
itself. OR, I could make a cylindrical fake 'billboard' of city-building images,
to surround the entire city like a movie-studio backdrop!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
These are great. More please!
They make me want to return to my own (probably forever) unfinished city
project... but I must resist! I'm doing something else at the moment and I
really want to draw a line under that first :)
Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Kenneth" <kdw### [at] gmailcom> wrote:
[snip]
> Btw, I don't know if it's noticable in these renders, but I made no attempt
> (yet) to 'correctly' place the greebles on the building roofs; they are just
> randomly placed, and most likely intersect each other. I have to admit that I
> still don't know the algorithm or technique for placing randomly-located objects
> that don't overlap, each object having its own space. It is a long-standing
> mystery to me. I know it has been discussed in the newsgroups from time to time.
You can store objects in an array, and check each new one against existing
positions and bounds, for example in dodgy pseudocode:
Declare array of N objects
Loop for N
Make new object
Loop until new object is ok
Make location
Loop over existing objects
Check new location + bounds against existing object location + bounds
If collision, new object not ok
If no collisions were found, new object is ok
Store new object in array
Using spheres for bounds testing is easiest.
Alternatively, you can subdivide your region of interest, then pick a single
random location in each sub-region. This has the advantage of not requiring
extensive looping and testing, although subdivision might be non-trivial. For
rectangles it's not too bad.
If your objects are all roughly the same sort of size, you can lay a grid down,
perturb the grid positions by some distance smaller than the grid spacing, then
place objects at the perturbed grid positions. Using only a subset of the grid
positions makes it look more random.
There are surely other possibilities!
Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I remember of your work and even wondered sometime if you were still working on
it cause I really liked it. Well, now I know you do and I like it even more! :-)
The buildings seems tightly packed. Simply "forgetting" to place some of them
would help breaking the monotony too, as there would be spaces for parking lot,
park, place, etc... in a real city.
Looking forward the next improvement :-)
"Kenneth" <kdw### [at] gmailcom> wrote:
> I've been re-working my old "city buildings" scene from... several years ago(!)
> It has not changed much since then, except for some subtle but important
> additions and corrections to the code.
>
> There are 650 buildings in this shot, randomly using 34 'real' image_maps for
> the building windows (so far!) Those original images have from 1 to 20 or so
> windows in them-- precisely cropped, so that the code eventually uses '1 window
> unit' as a basic size to apply to each building. (But the entire window-image
> tile is used if need be, not just a single window from it.) I also had to
> manually make 34 window 'hold-out mattes' in Photoshop to create the window
> reflections, applied by a complex texture{image_pattern....} used as a mask.
> (See the docs about this.)
>
> The real 'workhorse' code for texturing each building is POV-ray's BOXED
> pattern-- and just yesterday, I discovered that I had been misusing it all this
> time (for my purposes); I had to re-work a major portion of the code to correct
> that flaw. Now each building's size is at strict multiples of the '1-unit
> window' size-- along with the random thickness of the added 'concrete edges'.
> Btw, the 'concrete' color is an average of each actual window tile-- chosen from
> 25 random points in each image_map, using eval_pigment(...) in a macro. Plus
> some subtle added 'dirt'.
>
> I've also added some more rooftop 'greebles', as well as exterior vertical box
> shapes to the outsides of some buildings-- to break up the monotony. (I plan to
> experiment some more with that idea.) Now I need to add 'upper stories' to some
> of the buildings-- like recessed smaller copies of the main ones. That's how
> most tall buildings in New York City are built-- in the past, they had to be
> 'stepped back', by city ordinance, the taller they got.
>
> Then, some sidewalk trees-- and maybe animated cars in the streets. And
> first-floor lobbies/doors, which will be a major task!
>
> The scene so far parses 'reasonably' quickly: For 650 buildings, with AA but no
> radiosity yet-- 78 seconds total render time on my old Windows 7 machine (at
> 1600 X 900). The 'peak memory used' is about 1.1MB.
>
> Still a work-in-progress, but comments, suggestions and nit-pics welcome ;-)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
You may find some useful resource for collision detection here:
https://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169
In your case, the objects are axis-aligned as far as I can see, so AABB
collision detection may even be sufficient. Have a look here too:
https://manbeardgames.com/tutorials/aabb-2d-collision-checks/
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> "Kenneth" <kdw### [at] gmailcom> wrote:
> [snip]
> > Btw, I don't know if it's noticable in these renders, but I made no attempt
> > (yet) to 'correctly' place the greebles on the building roofs; they are just
> > randomly placed, and most likely intersect each other. I have to admit that I
> > still don't know the algorithm or technique for placing randomly-located objects
> > that don't overlap, each object having its own space. It is a long-standing
> > mystery to me. I know it has been discussed in the newsgroups from time to time.
>
> You can store objects in an array, and check each new one against existing
> positions and bounds, for example in dodgy pseudocode:
> Declare array of N objects
> Loop for N
> Make new object
> Loop until new object is ok
> Make location
> Loop over existing objects
> Check new location + bounds against existing object location + bounds
> If collision, new object not ok
> If no collisions were found, new object is ok
> Store new object in array
>
> Using spheres for bounds testing is easiest.
>
> Alternatively, you can subdivide your region of interest, then pick a single
> random location in each sub-region. This has the advantage of not requiring
> extensive looping and testing, although subdivision might be non-trivial. For
> rectangles it's not too bad.
>
> If your objects are all roughly the same sort of size, you can lay a grid down,
> perturb the grid positions by some distance smaller than the grid spacing, then
> place objects at the perturbed grid positions. Using only a subset of the grid
> positions makes it look more random.
>
> There are surely other possibilities!
>
> Bill
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"BayashiPascal" <Pas### [at] BayashiInJapannet> wrote:
> The buildings seems tightly packed. Simply "forgetting" to place some of them
> would help breaking the monotony too, as there would be spaces for
> parking lot, park, etc... in a real city.
That's a great idea, thanks! It did not even occur to me to leave some 'space'
for other things, and you are correct-- even in New York City, with its
EXPENSIVE real-estate values, there are humble parking lots here and there. (At
one time long ago, I lived and worked in NYC for about a year-- well, I lived
way off in the less-expensive suburbs, ha.) And small parks would be good too,
to add some much-needed color and 'humanity' to the city. (At one point, I
thought of putting small 'gardens' on the ROOFS of some of the buildings; I
might do that as well.)
Good ideas!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> These are great. More please!
Thanks, Bill!
>
> They make me want to return to my own (probably forever) unfinished city
> project... but I must resist! I'm doing something else at the moment and I
> really want to draw a line under that first :)
At the rate I'm going, my *own* city may forever remain unfinished, ha. Ideas
beget more ideas, etc. etc. But great fun nevertheless-- and a useful learning
process, as always.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|