Board index FlightGear Development Scenery

Procedural buildings in OSM before part of Scenery

Questions and discussion about enhancing and populating the FlightGear world.

Re: Procedural buildings in OSM before part of Scenery

Postby Soitanen » Mon Nov 26, 2012 5:19 pm

Gijs wrote in Mon Nov 26, 2012 5:15 pm:I like the idea, will add it as an option to the original script.

In Russia most building have simple horizontal roof. So I decided to limit sloped roofs.

About bugs - on post office building roof consists only of 1 triangle. Where another triangle is missing? Can it be bug of script?
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 7:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Procedural buildings in OSM before part of Scenery

Postby Gijs » Mon Nov 26, 2012 5:24 pm

Yes, those unclosed roofs are mostly bugs. I fixed some non-closing roof issue with round buildings, but apparently broke the rectangular roofs. I'll have a closer look at it tonight.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9544
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Procedural buildings in OSM before part of Scenery

Postby Soitanen » Mon Nov 26, 2012 6:06 pm

Thanks, will wait new version.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 7:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Procedural buildings in OSM before part of Scenery

Postby Soitanen » Tue Nov 27, 2012 10:31 am

Gijs, found one thing, that buildings are seen as from outside, as from inside. Is it possible to make normals, that walls will be visible only from outside? I think, that this can give rise of performance.
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 7:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Procedural buildings in OSM before part of Scenery

Postby vanosten » Tue Feb 12, 2013 8:21 pm

Hi

I finally got bob.pl working using a custom Java program, which also reads the height to place the buildings (I will share the java program once it works outside Eclipse without hassle). Basically I now have 9000 objects around LSZR at the lake of Constance in Switzerland. See following image (which looks good, but which I think still shows a case for intelligently generating all those buildings, which are not yet in OSM datasource).
Image

9000 objects means 9000 *.ac files - a lot of which could be reduced to a few, if objects would be intelligently replaced by shared objects (e.g. for residential houses, not so much for other buildings). Which leads to the following questions:
  • Right now startup is very slow due to scenery loading. Would the startup be significantly (linearily) be faster, if e.g. 60-70% of the buildings were shared buildings?
  • At night all the buildings generated by bob.pl are without lights. Could that be changed or would that again be a case for using shared buildings?
  • bob.pl is written in Perl FG is written in C++. Is there a policy against writing some of the scenery tools in e.g. Java, if one would like to contribute?
  • A previous post by Soitanen in this thread used OBJECT_STATIC_AGL to dynamically get the height over sea level for the buildings. However I guess that precalculating during scenery generation is worth the hassle in order to reduce CPU?
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 540
Joined: Sat Sep 25, 2010 6:38 pm
Location: Denmark - but I am Swiss
Pronouns: he/his
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: Procedural buildings in OSM before part of Scenery

Postby Soitanen » Tue Feb 12, 2013 8:48 pm

Yes, using OBJECT_STATIC_AGL gives big slowdown in FG working. So precalculation is much better. How you program gets elevation? Does it use the same data, as TerraGear use for terrain generation?
Boeing 737-300. Reworked cockpit, FDM, autopilot and much more. WIP.
Boeing 737-800. WIP. Canvas PFD and ND.
Antonov An-24B. Made from scratch. Very good FDM. 3D model by Adrian. WIP.
Project Russia (some cities, based on OSM with custom objects).
Soitanen
 
Posts: 489
Joined: Sat Jun 16, 2012 7:50 am
Location: Saint-Petersburg, Russia
Version: git
OS: Linux Mint 17

Re: Procedural buildings in OSM before part of Scenery

Postby vanosten » Tue Feb 12, 2013 9:45 pm

Please have a look at http://wiki.flightgear.org/Howto:Calculate_elevations. Instead of the referred to Perl script (which can be found in FGFS source flightgear/scripts/perl/examples) I use a Java library flightgear/scripts/java/FGClient.

In my program I first let bob.pl generate all *.ac files and *stg entries. Then I parse the *.stg files for lines starting with OBJECT_STATIC, get out the lat and long, set the properties, wait 1 second and then get /position/ground-elev-m, which I write back to the file (instead of -9999). In order to be sure to get the properties back in time, I run FG using most of the minimal profile as specified in http://wiki.flightgear.org/Howto:Debugging_FlightGear_Crashes.
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 540
Joined: Sat Sep 25, 2010 6:38 pm
Location: Denmark - but I am Swiss
Pronouns: he/his
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Re: Procedural buildings in OSM before part of Scenery

Postby Hooray » Wed Feb 13, 2013 7:20 am

There's nothing wrong about Java, and it's probably easier to port it to C++ - just saying that, because there's an increasing trend to generate scenery stuff at runtime and make things runtime configurable (i.e. see random building). Also, some developers talked recently about doing airport generation at runtime eventually:

Subject: Scenery Draping

zakalawe wrote:The trick is to make an OSG 'loader' which creates the airport geometry from the apt.dat definitions, which of course is exactly what genapts does - this is why I was working with Chris to make it fast enough to run inside the loader thread, in FG.


Subject: Scenery Draping

psadro_gm wrote:I'd love to fully generate the apts at runtime. LEMD is probably the most complex layout, and genapt currently takes about 2.5 seconds to generate. I imagine it could be generated in 2 stages for LOD. 1 for runways and taxiways, which are really quick, the 2nd stage for the line data which is slower.


Overall, procedural buildings should almost certainly leverage Stuart's existing subsystem and hook right into it: http://wiki.flightgear.org/Random_Buildings

Regarding use of OBJECT_STATIC_AGL please see: http://www.mail-archive.com/flightgear- ... 38134.html
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Procedural buildings in OSM before part of Scenery

Postby psadro_gm » Wed Feb 13, 2013 4:27 pm

Although I haven't written a line of code in SimGear for draping, yet - I'm getting a pretty good idea on how it will work. I think we could speed up the OBJECT_STATIC_AGL using the envisioned draping code.

Currently, when a tile loads, it first gathers the type of objects in the tile. If there is a draped object, I plan on keeping raw btg data (nodes and triangles) around. I need the Geodetic nodes, unfortunately for proper draping, so I'm going to have to create a parallel node list Cartesian ->Geodetic. The triangles are all index based anyway, so we'll just refer to the Geodetic nodes when using these triangles.

A draped object's 2D bounding box will be used to quickly find the relevant triangles (using the geodetic nodes long/lat) that need to be considered, then I plan to use barycentric interpolation to find node heights at specific lat/long coordinates. This node will then be converted back to Cartesian space.

My development time is severely limited at the moment - I've been working on this more at work than at home :)

I hope to have a proof of concept ready in a couple months.

Here's the simgear repo I'll be checking into - It's at least up to data - just no changes, yet...

https://www.gitorious.org/~psadro/fg/psadros-simgear
8.50 airport parser, textured roads and streams...
psadro_gm
 
Posts: 751
Joined: Thu Aug 25, 2011 3:23 am
Location: Atlanta, GA USA
IRC name: psadro_*
Version: git
OS: Fedora 21

Re: Procedural buildings in OSM before part of Scenery

Postby radi » Thu Feb 14, 2013 12:44 am

I wrote a similar script recently, using python. Got Dresden (EDDC) area populated with some 20,000 buildings from OSM. There is some frame rate impact, but I still get ~20fps on an i5-2500k/GeForce 650TI/Ubuntu.

I put all buildings in one .ac file. Loading time is pretty quick, maybe some 5 seconds more than the default scenery. I pre-calculate the elevation: I extract the elevation on a rectangular grid (10m step size) from FG in the relevant area once using a slightly modified version of http://wiki.flightgear.org/Howto:Get_a_number_of_elevation_offsets_for_a_number_of_objects. Then the script loads the elevation data, and linearly interpolates elevation at the buildings positions.

Some facade texturing is also done. Roof geometry and texturing is still work in progress, I'll post pictures once I'm back from vacation.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 659
Joined: Mon Aug 25, 2008 5:24 pm
Location: YMML, EDDC

Re: Procedural buildings in OSM before part of Scenery

Postby falafel » Sun Jan 15, 2017 3:53 pm

Hi Radi,
Are you back from vacations? :)
I wonder what is the status of merging latest OSM data to FG today ( +3years since this last post)
falafel
 
Posts: 73
Joined: Mon Nov 09, 2009 11:42 am
Callsign: falafel
Version: 2
OS: Linux

Re: Procedural buildings in OSM before part of Scenery

Postby vanosten » Sun Jan 15, 2017 4:45 pm

I guess you should follow viewtopic.php?f=5&t=22809&start=630
Maintaining osm2city. Contributing with ground attack stuff to the OPRF FlightGear military-simulation community.
vanosten
 
Posts: 540
Joined: Sat Sep 25, 2010 6:38 pm
Location: Denmark - but I am Swiss
Pronouns: he/his
Callsign: HB-VANO
Version: latest
OS: Win 10 and Ubuntu

Previous

Return to Scenery

Who is online

Users browsing this forum: No registered users and 9 guests