On Wed, Sep 18, 2013 at 4:16 PM, Stuart Buchanan wrote:
This is to give a heads up on some changes that I'm planning for
Random Buildings for the V3.0 release, and to allow for
comments/suggestions/ideas.
I've now got the new system broadly working on a private build:
http://www.nanjika.co.uk/flightgear/buildings.jpg
I've managed to minimize apparent tiling by randomly choosing between
building sizes and random objects at each point (subject to dimension
restrictions).
I need to sort out the random objects which need to be rotated by 90
degrees (see the bottom left where an orange school building goes
across the road).
As expected, the downside is that creating the object masks takes
quite a bit longer. It's taken me about 4 hours to generate the mask
used here for the city1.png texture. Generating the buildings at
runtime is also a bit slower so I expect to implement the PagedLoD
next.
-Stuart
In 2.12.0 the algorithm for the placement of random buildings is a
rather scattergun approach. materials.xml sets a building density
(amongst other building attributes) which is used to generate a number
of random points on each triangle that makes up the scenery.
These random points are checked against a mask to ensure they aren't
being placed in the middle of roads, and then rotated to the correct
orientation to match the texture (using the red channel of the mask).
This broadly works, but the placement is fairly unrealistic:
- The mask is quite broad, and some buildings quite large, so they can
still stick out into the roads, and generally don't line right up
against the street.
- The spacing of buildings has to be quite conservative.
So, in V3.0 I plan to change this. Instead of using a scatter-gun
approach to placement and a mask, random building location will be
read directly from the mask, defined by a single pixel. The color
(actually blue value from 0-255) will define the size of building
(small medium, large), and the red channel the rotation.
So instead of a material designer blocking out a large area for random
buildings to be placed within, they will define the specific location
for each random building.
Creating masks is going to require quite a bit more work in the new
world, but the end result should be better.
There is an open question of how to handle random object placement,
which also use the blue channel of the object mask:
- For areas that don't use random buildings, I'm tempted just to
leave it as-is for the moment, as it reduces the number of object
masks that need to be re-created.
- For areas with both random buildings and random objects I'm planning
to make groups of objects to specific blue values. So, a blue value
of 234 might equate to placing a silo or a farmhouse, while a blue
value of 233 might place a church, or tower block. The mapping will
be defined in the materials.xml file.
Command, questions and offers of help to update some object masks are
all welcome :)
-Stuart
--
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60134071iu=/4140/ostg.clktrk
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel