Jump to content

XP Scenery Generator [WIP]


tonywob

Recommended Posts

The application itself is written in Java, so that it will run on all three platforms. I kept it as such, so that users could run the tool theirselves without installing anything fancy (apart from a JRE). It's been a pain sometimes, but the simplicity it gives with debugging and distribution will hopefully make it worthwhile.

 

In regards to libraries, one of the most useful for me has been JTS (http://www.vividsolutions.com/jts/JTSHome.htm), which gives a decent toolset to perform geometric calculations. I also make use of the native java 2D toolset for drawing facades.  I also use the Apache FastMath 3 library, as surprisingly, the native Java math library is incredibly slow.

 

The largest dataset I've used so far is the OSM file for Poland, which is around 600MB. Obviously the more rules you have, the longer it takes to process, but Poland took me about 40 minutes to generate. I can generate Brandenburg in about 7 minutes. The issue is the actual file size, and since the data isn't by default indexable, the entire file has to be initially parsed so I can get information on relations and nodes, etc. If the system finds it is running out of memory, it will switch to a disk-based cache, which is slower, but stops it running out of memory. An SSD and lots of memory hugely help here :-)

 

In regards to efficiently detecting collisions, a while ago I wrote an Objective-C application for Mac OS and iOS which read an OSM file and created a custom-quadtree file with the data you needed. The quadtree was extremely quick, so I could very easily do collision checks or draw just specific areas of a very large data file.. I then rendered the map using vector graphics, and it was suprisingly quick.  I may just port the quadtree idea and put it into the tile processor, so that collisions can be detected. Of course, the ideal solution would be to take the entire OSM file, and preprocess it into a quadtree before actually using it, but it requires quite a lot of disk space.

Link to comment
Share on other sites

Aah, the indexing problem ... well, that is one of the very big pluses on the PostGIS side ... You get geometry indexing (GIST indexes) out of the box (otherwise it wouldn't qualify to call itself a GIS database :D). But again, even though using PostGIS is nice, it ads some administrative overhead, which is not necessarily for the faint hearted (at least not for users who don't know much  about databases).

Link to comment
Share on other sites

Development has been a bit slow because of something that is causing X-Plane to randomally crash without warning, but in the meanwhile I've added some more advanced rules, that can be used, e.g. To place random cranes on building sites, and to place random objects along ways and line, which can be used, e.g. To place trees along a way or farm (There are also forest rules which can do this, much more efficiently).

 

Additionally, in the screenshots, real object tanks have been placed instead of circular facades, which looks much better in large works sites.

post-7938-0-83893400-1391541408_thumb.jp

post-7938-0-77516900-1391541413_thumb.jp

  • Upvote 1
Link to comment
Share on other sites

Thank you everybody for following along with this thread and getting involved. I've uploaded Brandenburg for testing available here:

 


 

Please however, read the following carefully before using or downloading:

 

1) It requires the R2 (http://xplane.cz/en/category/down/vfr-cr-soucasti/) and FF (http://forums.x-plane.org/index.php?app=downloads&showfile=12708) libraries for the European buildings, and X-Plane 10.25. Without these, the scenery will crash. If it does crash, open the X-Plane log file, and see if it tells you why, and post the reason here.

 

2) It isn't optimised and all LODs are the same, so you may see framerates go down around the centre of Berlin. This is something that still needs to be worked on. 

 

3) Some buildings will flicker, this is because many complex buildings are made up of parts. The program doesn't yet detect collisions, so I'm aware of these. 

 

4) Although not required, it looks best when used with photo sceneries. I use Simheaven's Berlin City area scenery. Without photoscenery, the buildings and forests won't fit the textures on the ground and it might look a bit odd. (I'd be interested in people's thoughts on this if they use it without photoscenery, I didn't like it)

 

5) It should sit on top of the photoscenery and HD mesh etc in your scenery order file, but below any custom airports. If you have Simheaven's OSM scenery available in this area, please temporarily remove it to avoid conflicts.

 

6) In my last development, the custom facades have been merged into individial sheets, which didn't turn out too well (so some of the custom facades might look weird close up). I will revert the change I did, and get it back to individual sheets (or fix the issue)

 

7) Disk space is being offered by a generous user Manuel on the avsim forum. Please only download this file if you are willing to offer feedback and understand the basics of OSM and scenery. It's alpha/beta quality scenery, and should be treated as such. To install, just unzip the folder using 7zip, and place it into your custom scenery folder. Please don't shout at me if it blows up your computer :-)

 

8) If you notice an issue in the scenery, please first check the area in OSM. If a building is missing or forest, but it's present in OSM, I want to hear about this. If the building or forest also isn't in OSM, then you can add the building or forest, and it will be there in the next test ;-)

 

9) The buildings placed from the R2 and FF library aren't origin aligned, which means that large buildings sometimes cut into a road or each other. This is why we need our own buildings creating which are origin aligned. 

 

10) And finally, remember this is based on data available in OSM, so in some cases it looks good, others it doesn't. If you have suggestions on how to improve something, then please let me know

 

From the scenery, you should get an idea of how real objects are placed, and also get an idea of objects that are lacking. e.g. In villages, you'll see that there isn't a huge range of houses, and there are still many facade style buildings that need objects creating.
  • Upvote 2
Link to comment
Share on other sites

I really think that finding a working routine to add scattered trees around detached houses  would be a must to enhace realism but I know that you're working on a collision detection routine.

From a fast flight around Berlin i just saw a couple of overlapping building/facade near the tower but I'm downloading the photoscenery before submitting any detailed report.

Edited by Leporello
Link to comment
Share on other sites

The problem with this approach is that there is no way of knowing which is the front of the house, and which part is meant as the garden. Houses in OSM contain only the actual building, and not the entire property including the garden, so there is no way of knowing where to put the tree, except for some intelligent guessing.

 

There are two possible ways I see of doing this.

 

  1. Add a few random trees to areas tagged as landuse=residential, and do a collision detect so the tree doesn't appear inside another house. This would slow down the processor a bit, but is quite doable. However, it relies on the landuse=residential tag being used and also not being placed lazily (i.e. Only actually including residential). This approach may still put a tree in the middle of the road, but it might be a compromise we have to take. After all, it's a flight sim, not a driving sim.
  2. For each house, find where the nearest road is, and then the back of the house can be found. Place a tree or two in the back garden or around the side, doing a collision detection. Some houses are actually tagged with the road they are part of, which makes this easier, but the whole thing is really difficult to do, not to mention it would require lots of geometric tests and indexed data which would slow down the generator considerably.
Link to comment
Share on other sites

quote name='Tom Knudsen' timestamp='1391635490' post='69126']

Osm had some major downsides, one beeing performance, second beeing facades, how are you to counteract this sir, btw looks great

 

Sorry for not getting back sooner. Performance is something that's a problem in big cities, and at the moment I'm experimenting with different LODs for different building sizes. This should help somewhat. But I'm open to ideas if anyone has any :-).

 

In regards to facades, the program places real objects where they fit, and I have an effort going for the community to join in and create models.

 

Here are a few that I've done so far:

 

post-7938-0-56595900-1391763557_thumb.pn

 

post-7938-0-89420400-1391763564_thumb.pn

 

If the models are sized and centred correctly, then they will be placed into a matching footprint from OSM. So, in my examples, if you have a building tagged as a supermarket, and it matches the size of the model more-or-less (based on rules), it will rotate the model and fit it into the place.

 

If anyone wants to join in on the contribution of models, then please do. I have created a google shared drive, so send me a PM with your email address, and I can you to the contributors list.

Edited by tonywob
Link to comment
Share on other sites

 

Sorry for not getting back sooner. Performance is something that's a problem in big cities, and at the moment I'm experimenting with different LODs for different building sizes. This should help somewhat. But I'm open to ideas if anyone has any :-).

 

LOD will do it, at least if you get it down to about 10-15000 feet

Building exclusion is also something to look at, not every facade is worth having shown, such as billboards ads, etc.

Link to comment
Share on other sites

Here are a few that I've done so far:

 

attachicon.giflidl.png

 

attachicon.gifScreen Shot 2014-02-06 at 22.04.55.png

 

Hi Tony,

 

they look good ... BUT! I immediately see, that you "ignored" one of my advices: always give your buildings "deep" basements (they don't need to be detailed, just some "concrete" / "brick" walled box, stretching down 5-10m). This way, when the objects are placed on sloped terrain, they don't immediately look like they "halfway" float in the air. They look much more plausible that way .... I did this with all of my objects in the NZ Pro scenery and the "treelines and farms scenery" farm buildings (you can check them as "reference").

Link to comment
Share on other sites

Looks much better!

And its a good idea to make it "deep" (I usually go to 8-10m) .... it makes you safe even on steeper terrain (and you never lnow in advance, where those OSM objects end up in the X-Plane mesh world  :D ). And the wider the object is, the deeper the basement should be (just plain trigonometry: the longer the "overhang", the higher it "floats").

Edited by alpilotx
Link to comment
Share on other sites

Sorry for not getting back sooner. Performance is something that's a problem in big cities, and at the moment I'm experimenting with different LODs for different building sizes. This should help somewhat. But I'm open to ideas if anyone has any :-).

 

XP 10.0 supports hardware instancing for objects .

That extremely lower the drawing-costs of heavily repeated objects.

 

http://developer.x-plane.com/2012/03/whats-new-in-objects/

This means an instanced object has to be free of animation, attributes, and a few other features.

 

Use 'global attributes' if necessary.

Since i don't use Sketchup , i don't know if this a problem with your objects actually .

But surely one thing to keep in mind.

Link to comment
Share on other sites

Looks much better!

And its a good idea to make it "deep" (I usually go to 8-10m) .... it makes you safe even on steeper terrain (and you never lnow in advance, where those OSM objects end up in the X-Plane mesh world :D ). And the wider the object is, the deeper the basement should be (just plain trigonometry: the longer the "overhang", the higher it "floats").

Will this be affected near airports when fatten is used?

Link to comment
Share on other sites

Will this be affected near airports when fatten is used?

I don't exactly understand what you are asking about? What shall be affected by flatten?

 

The "basement" of buildings is there to make them look more natural (and not seem like floating partly in the air), when parts of them would hang in the air because of sloped terrain. That works everywhere ... what ever the reason of sloping under them would be.

Link to comment
Share on other sites

I don't exactly understand what you are asking about? What shall be affected by flatten?

The "basement" of buildings is there to make them look more natural (and not seem like floating partly in the air), when parts of them would hang in the air because of sloped terrain. That works everywhere ... what ever the reason of sloping under them would be.

Well that explained it, thx

Link to comment
Share on other sites

A progess update

 

I've implemented basic collision detection and also something I call area-tracking. With area tracking, you can tell the generator to track and record areas such as residential/industrial inside OSM, and then change your logic based on these. These are demostrated in the following two rules: the first rule records residential areas and stores it as "residential", and the second places trees in residential areas using collision detection: 

<rule type="area-track">    <filter type="key-value">        landuse=residential    </filter>    <identifier>residential</identifier>    <pass-through>true</pass-through></rule><rule type="random">   <filter type="key-value">        landuse=residential   </filter>   <density>2</density>   <collision-test>true</collision-test>   <pass-through>true</pass-through>   <objects>	<object>lib/g10/forests/autogen_tree_any.obj</object>   </objects></rule>

The following rule places buildings which are tagged as generic "yes", which are inside the residential zones defined earlier, and simplifies the object, and gives it a sloped-residential facade. This can also work for object placements, as well as all the other rules:

<rule type="building">   <filter type="key-value">                building=yes                building=house                buliding=residential    </filter>    <max-area>20</max-area>    <min-height>4</min-height>    <max-height>9</max-height>    <simple>true</simple>    <area-type>sloped-residential</area-type>    <area-tracker>residential</area-tracker></rule>

This gives us a lot of power, since now it's possible to identify generically tagged buildings i.e. (building=yes), and give them facades and objects based on not only where they are, but whether they are in a residential, commercial or industrial zone

 

post-7938-0-52929000-1391973660_thumb.jp

 

post-7938-0-11013700-1391973664_thumb.jp

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...