Random Buildings

From FlightGear wiki
Revision as of 21:17, 26 January 2013 by Hooray (talk | contribs)
Jump to navigation Jump to search
Random Buildings

As of 05/2012, FlightGear support "random buildings", which are generated at runtime and placed in Urban and Town areas. In v2.8.0 these take up a lot of memory, but in subsequent releases this has been improved significantly.

Building generation is configurable through materials.xml, and documented in $FG_ROOT/Docs/README.materials . It is designed to be flexible enough that we can have different types of cities in Europe compared with the USA, or Africa. The current texture used for the buildings is a proof of concept, and we are looking for people with artistic abilities to contribute improved textures. If anyone is interested in creating a better texture, please get in touch with User:Stuart on the mailing list or forums.

At a functional level, there are three different size of buildings (small, medium, large), with slightly different constraints (small and medium buildings are never deeper than they are wide, small buildings may have pitched roofs). Various parameters can be set in the materials.xml file, such as the proportion of each building size, the texture file (which is shared across all buildings), and the range of sizes of each building. The actual buildings are then generated by FG itself directly as OSG primitives.

The buildings (including the texture to use) are defined in materials.xml, and you can assign different building sizes and distributions to different material types. You can already see that in the difference between Urban and Town/Suburban areas.

We already have the ability to select a terrain material based on a <condition> statement, which is evaluated when the tile is loaded, so it is a very easy job to create a new material definition for a given region using a condition statement that checks /position/latitude-deg and /position/longitude-deg

The new lightmap texture parameter is called <building-lightmap>) but the rest of the parameters are documented in data/Docs/README.materials if you want to have a play.


For those interested, the technical background is as follows: - a Quadtree is used to ensure very fast culling of the buildings - based on the work that Tim Moore did for the forests. - a single 1024x1024 texture is used for all the buildings, minimizing the number of state changes on the GPU

There's also support for emissive lighting, at present, this only works with rembrandt and the skydome switched off.

You'll need generic shaders switched on.

You can switch the log on and grep it on Linux by running:

 fgfs --log-level=debug --log-class=terrain 2>&1 | grep "Total random buildings"


Related