POV-Ray : Newsgroups : povray.binaries.images : city buildings as height_field faces-- WIP 2.3.7? : city buildings as height_field faces-- WIP 2.3.7? Server Time
19 Apr 2024 00:07:17 EDT (-0400)
  city buildings as height_field faces-- WIP 2.3.7?  
From: Kenneth
Date: 2 Sep 2018 14:10:06
Message: <web.5b8c270739c4ac4a47873e10@news.povray.org>
I've continued to work on my city buildings scheme (from about a year ago!),
taking my leisurely time.

My current overall idea is to use vertical height_fields for the *faces* of the
buildings, to get some interesting 3D detail there, rather than featureless
slabs.

This is just a concept test, using a CSG-differencing scheme (from a simple box
shape) to produce 'solid' buildings, with four  faces and a rooftop-- solid so
that I can subsequently difference-away an indent in the TOP surface for the
roof area, or for other interesting things. Height_fields are just thin shells
by themselves, but I don't want a 'hollow' building.(The test here uses a HF for
the top as well, just for visual interest; plus a sphere, to show that the
result is truly solid.)

(I'll also post an animation at p.b. animations.)

This CSG scheme may look deceptively simple-- but there's a complicating factor
(requiring some tricky coding), due to the way I'm making my original HF art.
Instead of the grayscale art's  'height_field base plane' corresponding to the
usual black color, it's actually at 50% gray. This way, I can make both indents
AND protrusions in the HF building faces (using true black and white for
those)--for recessed windows, protruding ledges, etc.  The middle 'base plane'
level of 50% then corresponds to the typical 'flat surface' of each building
face, always.

But that complicates things-- the mid-plane location depends on the (horizontal)
HF's original height scale (which will probably change for each individual city
building): as the scale increases, the mid-plane *moves*, as do the indents and
outer protrusions of the HF. When flipped vertically, the  'mid-plane' levels of
the four HFs need to always be kept in the same relative locations-- so that
those 'flat' surfaces always meet at the edges and corners of the building (and
so that the building itself remains the same size.) That was one part of the
challenge.

Then, as the four HF height scales change, the main CSG box object has to change
size as well(!). Otherwise, as the building-face protrusions jut out further
from the (50%) base-plane level, the protrusions would go *past* the BOX's
surface-- thus no CSG there. But increasing the box object size (while keeping
the individual HF sizes the same) produced a NEW problem: The CSG resulted in a
leftover 'surrounding' cage-like object, outside the edges of the building-- a
natural consequence of differencing the 'fixed' HF size from the now-larger box
object. Those extra parts had to be differenced away as well.

The finishing touch was to code everthing so that any change to the HFs' height
scale would auomatically compensate everything else. (The final object also has
a manually-added bounding box, which automatically changes size too.)

To make all of this stuff work without even *more* coding-- like adding
inverses, negative scalings etc--I simply reversed the colors of the HF art:
black becomes white, etc (but the linear 50% level stays the same.)

The next challenge is to add code to allow any size building, not just a square
1-unit box!


Post a reply to this message


Attachments:
Download 'box_and_hf_difference.jpg' (270 KB)

Preview of image 'box_and_hf_difference.jpg'
box_and_hf_difference.jpg


 

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