Board index FlightGear Development Scenery

FenceMaker

Questions and discussion about enhancing and populating the FlightGear world.

FenceMaker

Postby VaLeo » Sun Dec 07, 2014 12:06 am

The short story.
Few years ago I flew in VATSIM with MSFS. There are a lot of good freeware sceneries for airport. The most impressions I got from fences near runway. They make altitude feel stronger and more real feel of flight. Taxiing along fence is more better than along forest. So I decide that for my local FG airport I make fences. And I made it with UFO. That was really annoying – move, rotate and pitch pieces of fence 10 meters long. Runway ends of UKDD located at steep hill.

So I decide make my own tool for build fence, thinking that it would be handy for other scenery makers. Later I add some features, so it can build not only fences.
I coded it with no human interface. All preferences was hardcoded. Even Soitaten can't use it. So I didn't share it. But recently I need some rest and fun, and I write GUI for it. And share it with you.

What it can do:
Between markers, that you place with UFO, at certain intervals it takes altitudes and export they into the xml file.
Then in Blender you prepare 3d-model, open that xml file and your model cloned at that points, and string for stg-file is displayed.

Some examples:

- power line small
ImageImage

- power line big
ImageImage

- alley
ImageImage

- bush
ImageImage

- cars at road
ImageImage ImageImage

- cars at parking
ImageImage

- fence
ImageImage

- road
ImageImage ImageImage Image

- serpentine
ImageImage ImageImage

- China wall
ImageImage ImageImage

- lights along road and taxiway
- railway power line
- ski lifter
- hangars in ruler lane
- ends of bridge
- etc

In difference to usual UFO-placed objects, thats above is one big object. AFAIK experts says, that its more better to load one big object than a lot of small. That object takes one line in stg file, loads at once and in best case use one drawcall. So it very fps-friendly. It is can be even better, if all that object join into another big one.
For a more natural view, script can randomly choice and rotate source models.

How to use it:
Actually, it is not a script. This is tool with two parts: one is nasal for UFO and second is addon for Blender.
You can take it here.
Place ufo folder over fgdata/Aircraft/ufo and put fencemaker.py into blender/2.xy/scripts/addons, then register it in Blender' preferences-addon-object.

ImageImage

Flightgear
So, let's launch $ fgfs –aircraft=ufo-fencemaker, take off and place markers alongside future fence, alley, road whenever. Then press hotkey f and enter length (and width) of model.

ImageImage

Script can change length a bit to get integral models between markers. If interval between markers too small, model can be jammed.

If you want that one side of your object not dive into the ground at steep hill, you should enter width for it.
That option added after I drive Isle of Man race track. For usual narrow fences and trees better left width as 0.

When you are ready, hit ctrl-f and script export ufo-fenceplan-export-HxW.xml to ~.fgfs folder. I recommend immediately rename it.
Now you can change length and export once more (for example, for bushes between trees; ChinaWall was exported with 40m for walls and 200m for towers with same markers). You can export markers with UFO's e export to load it later with fgfs --pref= and continue work.

Blender
Now time to launch Blender. You can left FlightGear running, and place generated object into first marker place to quickly observe your work.

At the bottom of the Objects tab, you can find FG-fencemaker panel.
I prepare .blend file with example models for you, to help you figure out.
Object will be build in the 1st layer, so leave it empty and create your model in any other layer.

Model can be two types - fence or pole.

Fence should begin from positive X axis, and ends at Origin. Lenght of model (and width for wide ones) should be same as you enter in ufo-fencemaker menu.

Poles oriented from +X to -X too, but centered at Origin. Poles will placed at elevation taken from the file, evenly distributed between and at UFO markers, rotate along and don't stretch. For trees and bushes you can check RandomRotate checkbox.

Origin of model can be in any place. If it not at (0,0,0), then script move it there. That made for randomize object. You can make one model, then copy it, move to free space. Then change its texture, slightly shift vertexes etc. You can make a lot of that models. If you select few of them, script when build object will be randomly take models from that selection. If you want to increase probability of certain model, just make more copies of it.

Fences can be place in two ways, which defines by Shear checkbox.
If it unchecked, fence placed between poles horizontally. Its looks like a ladder.

In another case (Shear enabled) fence stretched from one pole to next. Roads makes with that method.

So, select model(s) of fence, check checkboxes and press Build button. Then select 1st layer and check that you got.
North is at the -X, East at +Y. You can join it in one object to use it in LOD animation separate from poles. Apply RemoveDoubles (0.2 suits well). Repeat same for poles.

In console script wrote line for *.stg file.
Export model, switch to running FG and place model at your first marker to check is everything is ok.

Further development:
- Generate object relative to center of tile, so you can join several objects in one.
- Make fine-turn for roads.

Worst thing:
Nasal script use .course_to() function, which imprecise relative to SimGear's SGGeodesy::courseDeg(). So long as runway length fences rotates a bit, and position of end misplaced up to 2 meters.
If someone can expose SimGear's geodesy functions to nasal, it would be possible to make absolutely precise fences; and also some of my another scenery tools become usable.

Cheers.
Last edited by VaLeo on Sat Oct 03, 2015 8:18 pm, edited 1 time in total.
VaLeo
 
Posts: 186
Joined: Wed Nov 29, 2006 10:00 am
Location: Ukraine, Dnipropetrovsk
Version: GIT
OS: Debian 7

Re: FenceMaker

Postby LesterBoffo » Sun Dec 07, 2014 7:07 pm

I like the idea, I'm not sure if the program's end result, at least in making roads that can be driven on in FG, is as good as the roads Marc made for Isle of Man. Some sort of longitudinal averaging so they don't look (and are driven on..) like roller-coasters, would be better.
User avatar
LesterBoffo
 
Posts: 1970
Joined: Sun Oct 02, 2011 4:02 pm
Location: Western USA
Callsign: LesBof
Version: 2016.1
OS: WinXP 32 bit

Re: FenceMaker

Postby Hooray » Sun Dec 07, 2014 7:45 pm

I think this can/should be ported to be running natively in FlightGear, e.g. using Nasal instead of external scripts - placing these fences using the ufo sounds tedious, it would seem straightforward to generalize the underlying Nasal code and procedurally add fences whereever you desire, without having to manually place anything - as long as you provide a bunch of coordinates and fence-models.
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: 10672
Joined: Tue Mar 25, 2008 8:40 am

Re: FenceMaker

Postby LesterBoffo » Sun Dec 07, 2014 7:53 pm

My concern is how far backwards compatible is the Python script for older Blender installs? I'm using 2.45 because of there's no Metasequoia importer/exporter available after 2.45.

Using the UFO isn't that tedious, and as I see it this script saves a few steps when doing long, straight runs of roadway. Having a way to just source the .ac 3D files to the Fencemaker through the UFO without opening Blender would save a lot of extra work.
User avatar
LesterBoffo
 
Posts: 1970
Joined: Sun Oct 02, 2011 4:02 pm
Location: Western USA
Callsign: LesBof
Version: 2016.1
OS: WinXP 32 bit

Re: FenceMaker

Postby hvengel » Sun Dec 07, 2014 8:00 pm

OSM already has data for where most of these features should be placed. So for things like roads, rail roads, fences and power lines OSM has placement info. There are others who are working on using OSM (see http://wiki.flightgear.org/Osm2city.py) for placing things like roads, rail roads, buildings, bridges and power lines. My understanding is that those working on the FG scenery and core teams are seriously considering using the osm2city algorithms to either create these elements on the fly in FG or to populate the static scenery. Fences and car/trucks on roads and parking lots seems like a natural extension to the Osm2city work. Perhaps you should consider working with the osm2city devs?
hvengel
Retired
 
Posts: 1128
Joined: Sun Dec 24, 2006 4:35 am
Location: Minden Nevada

Re: FenceMaker

Postby LesterBoffo » Sun Dec 07, 2014 8:11 pm

When OSM surface structures and feature generation becomes integrated into FG as a GUI operable in the Menu, doesn't require a huge Python install, and doesn't require 64 bit OS to function is when it will seem average user accessible, at least for me. For now it's little programs like this that advance end user scenery additions.
User avatar
LesterBoffo
 
Posts: 1970
Joined: Sun Oct 02, 2011 4:02 pm
Location: Western USA
Callsign: LesBof
Version: 2016.1
OS: WinXP 32 bit

Re: FenceMaker

Postby Hooray » Sun Dec 07, 2014 8:21 pm

coordination with the OSM/python folks would definitely seem to make sense, even regardless of any Nasal-related additions
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: 10672
Joined: Tue Mar 25, 2008 8:40 am

Re: FenceMaker

Postby hvengel » Sun Dec 07, 2014 11:24 pm

LesterBoffo,

Note that I didn't write anything about Python or using Osm2city as a final solution but rather I wrote "the FG scenery and core teams are seriously considering using the osm2city algorithms" which implies that the algorithms developed with the current effort in Python will end up being translated into either Nasal or into the C++ FG core or a combination of these. I also agree that in the long run these kinds of features need to be integrated into FG and need to be configurable by the user in a friendly way. So for example users with limited hardware resources (IE. 32 bit OS) can turn these feature off (or down) as needed to get OK frame rates and memory usage.

My intent was to focus this on the longer term. IE. what will FG be like in 2, 3 or 4 years and how could the subject of this thread be leveraged to maximum effect over that longer term. I personally don't think things like Osm2city or the software that is the subject of this thread are very useful to many end users as they currently function. These efforts are more like experiments looking into what might be possible at some point down the road.

The overwhelming majority of users today are running a 64 bit OS and 32 bit computing is fast becoming a thing of the past. So "average users" are already equipped to handle something that needs a 64 bit OS. 32 bit users are now the exception and in a few years will be an endangered species. After all many of us, including myself, have been running a 64 bit OS since late 2004 or early 2005. I know Microsoft was late to the 64 bit party when they started supporting 64 bit hardware in 2006 (at which point the vast majority of Linux users were on full 64 bit platforms) and it was not until 2009 that Windows 7 64 bit became a more or less default install OS for new computers. At this point hardware has to be at least 5 years old to not have been delivered with a 64 bit OS (with rare exceptions) and as I pointed many of us have been full 64 bit for 9 or 10 years. Also the vast majority of 32 bit Windows users are actually running 64 bit hardware now days and can upgrade their OS if they want to run software that requires 64 bit capabilities. My main point is we shouldn't let the 32 bit tail wag the dog when looking out into the distant future (IE. more than 2 years). I should add that I have NEVER run FG on anything other than a 64 bit platform and I have been using it since version 0.9.9.

I don't think it is wise to be fixated on long term support of current end of life hardware. Most users with older hardware will likely replace this old hardware in the next 2 to 3 years with much more capable hardware. Some will do it sooner than that. My last computer, which I replaced a little over a year ago, was early high end 64 bit hardware (from 2004 mostly). It still runs but when I replaced it was definitely obsolete even though it still ran FG although with most of the eye candy turned off to get decent frame rates. Like many I have a tendency to hang onto hardware long after I really should so I understand why many users are reluctant to replace hardware. After all even though it is obsolete it still runs most of the software the user needs/wants. I also understand that this hardware is not cheap to replace and that many of those with older hardware will struggle to do an upgrade. I know from reading your posts that you are one of those users with an older system but like everyone else at some point you will be replacing it (no matter what happens with FG) and hopefully this will happen soon enough that you can continue to run current versions of FG.
hvengel
Retired
 
Posts: 1128
Joined: Sun Dec 24, 2006 4:35 am
Location: Minden Nevada

Re: FenceMaker

Postby VaLeo » Sun Dec 07, 2014 11:27 pm

Well, osm2city and FenceMaker have a differnt usecase.

FM suited for quick-and-dirty placment of short linear objects, in addition to ufo's default point object place. Fence between (or around) hangars, powerline at hill as landmark - you quickly get half-stuff for that handmade object. It is more addon for blender than tool for FG; helper for 3d-modellers who build terminals&hangars for osm-buildinged world.

But I agree that I need be in keep-in-touch with osm2city guys. The first things, that we both need - is reveal SGGeodesy to python (and nasal). They also use unprecise flat-Earth approximation in coordinates.py.
VaLeo
 
Posts: 186
Joined: Wed Nov 29, 2006 10:00 am
Location: Ukraine, Dnipropetrovsk
Version: GIT
OS: Debian 7

Re: FenceMaker

Postby Hooray » Mon Dec 08, 2014 3:25 am

SGGeod* can be trivially exposed to Nasal using the tutorial available at: http://wiki.flightgear.org/Nasal/CppBind

For an example, refer to the flight path extension function that exposes the flight path/history as a vector of lat/lon coordinates.
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: 10672
Joined: Tue Mar 25, 2008 8:40 am

Re: FenceMaker

Postby radi » Mon Dec 08, 2014 6:12 am

The first things, that we both need - is reveal SGGeodesy to python (and nasal). They also use unprecise flat-Earth approximation in coordinates.py.

Luckily, because we really adjust the flat-earth approximation every couple of kilometers, errors don't become that obvious.
OSM buildings for LOWI, EDDC
Custom scenery for VHXX YMML
Edit .stg via the FG Object Placement Tool
radi
 
Posts: 613
Joined: Mon Aug 25, 2008 4:24 pm
Location: YMML, EDDC

Re: FenceMaker

Postby Catalanoic » Mon Dec 08, 2014 8:22 pm

"And I made it with UFO. That was really annoying – move, rotate and pitch pieces of fence 10 meters long" --> Totally agree!
We need an upgrade of UFO placing tool, I lost too much time positioning repetitive single objects that are not in OSM data (yet).
User avatar
Catalanoic
 
Posts: 881
Joined: Mon Mar 05, 2012 12:33 am
Location: Barcelona (LEBL)
Callsign: Catalanoic
Version: 2016.2
OS: Lubuntu/Windows 7

Re: FenceMaker

Postby jarl.arntzen » Mon Dec 08, 2014 8:52 pm

Catalanoic wrote in Mon Dec 08, 2014 8:22 pm:"And I made it with UFO. That was really annoying – move, rotate and pitch pieces of fence 10 meters long" --> Totally agree!
We need an upgrade of UFO placing tool, I lost too much time positioning repetitive single objects that are not in OSM data (yet).


Just another "+1 / me too", here. I've been furnishing my local airport with buildings, aircraft and lamp posts over the last weekend and while I did stumbe across some mouse shortcuts (hold mouse scroll + mouse back button to move camera sideways) that did somewhat improve on the efficiency, it's still pretty awkward to chain up anything but completely straight fences. Of course, different coordinate reference points adds up to the difficulty - some longer fence sections have the origin at the center (hard to align) some shorter fence sections happily rotate around one end, which is a lot easier.

That said, I'm pretty happy with the result and even got to try out using a PNG export from OSM displayed on a 2000x2000 meter quad 10 m above the airport surface. Looking at this from straight above, it was a doodle to place buildings and elements and the only drawback was that I didn't realise the objects would actually treat the semi-transparent plane as ground and all ended up 10 m too high, so I had to fly around and fix that for individual objects since ENCN is a little slanted.

(Image taken before placing objects)
Image
Frequent Flyer. Occasional Lander.
jarl.arntzen
 
Posts: 103
Joined: Thu Jan 03, 2013 9:43 pm
IRC name: Jarl Arntzen
Version: 2017.1.1
OS: Ubuntu 14.04

Re: FenceMaker

Postby SE-HK » Tue Dec 09, 2014 2:16 am

In short term adding fences etc this way may improve your area, but in long term I personally think things like power towers, fences, walls should be generated from OSM data. OSM have, if I remember correctly, over 1 million registered users, how many FG users contribute to the scenary?
FG scenery would benefit a lot from all OSM contributors. I've not tried the osm2city scripts myself but I think this way is the future.
Regarding your walls, fence and pylons, those tags are already used in OSM. why not add such things in your area and contribute to OSM users as well?
SE-HK
 
Posts: 27
Joined: Wed Sep 02, 2009 1:16 pm
Location: Stockholm, Sweden
Version: 1.9
OS: Mac

Re: FenceMaker

Postby Hooray » Tue Dec 09, 2014 2:35 am

you only need to know very little about Nasal/Canvas and GUI scripting in order to improve the placement tool
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: 10672
Joined: Tue Mar 25, 2008 8:40 am

Next

Return to Scenery

Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests