Howto:Place 3D objects with the UFO: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(added *not* to use google earth like mentioned by alfonsodg)
(Some restructuring prior to inclusion in the FG newsletter.)
Line 1: Line 1:
A very useful tool for placing objects within the scenery, created by Melchior Franz, is available with Flightgear 0.9.10 and later. It is an addon to the [[UFO from the 'White Project' of the UNESCO|UFO]] aircraft which allows a user to place a new (or old) 3D object at any arbitrary location in the scenery with just a few clicks of the mouse.
The [[UFO from the 'White Project' of the UNESCO|UFO]] aircraft is a superb tool for placing a new (or old) 3D object at any arbitrary location in the scenery with just a few clicks of the mouse.
 
Placing objects in the scenery is a really easy way to contribute to the FlightGear project. It doesn't require any programming knowledge, and you can contribute something valuable in 15 minutes.
 
==Choosing your object==
The first thing you need is a 3d model to place in the scenery. The FlightGear Scenery Database ([http://scenemodels.flightgear.org/ http://scenemodels.flightgear.org/]) maintains a huge library of generic models, which will have been included in your FlightGear installation.
 
If you have created your own model you need to save it to somewhere the UFO can find it. The UFO searches for objects under the Flightgear/data/Models/ directory. Let's say you have created a CAT III marker, called catii-iii.xml. In this example, we create a subdirectory called Tabu and save our catii-iii.xml there.
 
If creating your own object, make sure it is the correct size! In Blender, units are meters and the Caliper script may help. Note that you should not use Google Earth to determine the correct size. See [http://flightgear.org/forums/viewtopic.php?f=5&t=3356 here] and [http://flightgear.org/forums/viewtopic.php?f=5&t=3415 here].


==Selecting the ufo==
==Selecting the ufo==
The first thing you need is a 3d model file to place in the scenery; let's say we'll use a catii-iii.xml object. You must save it in a path where this UFO feature can find it. The UFO searches the objects in the Flightgear/data/Models/ directory. In this example, we create a subdirectory called Tabu and save our catii-iii.xml there.


[[Image:Placing_objects_with_UFO_html_m49fbed81.jpg]]
[[Image:Placing_objects_with_UFO_html_m49fbed81.jpg|400px]]


Now start Flightgear, and choose UFO as your aircraft.
Now start Flightgear, and choose UFO as your aircraft.
Line 11: Line 19:
Once Flightgear has been started, fly with the UFO to the place you want the model to be positioned.
Once Flightgear has been started, fly with the UFO to the place you want the model to be positioned.


You must be sure about the size of the object in reference with the scene, it means: try to obtain the right value using some tools.  Particulary, i recommend combine Googleearth and the rule tool and some size definition in the 3D software for obtain the right size, in my case, i have use Blender and the Caliper script. -- Alfonso de la Guarda <BR>
Note that you should not use Google Earth to determine the correct position due to licensing problems. See [http://flightgear.org/forums/viewtopic.php?f=5&t=3356 here] and [http://flightgear.org/forums/viewtopic.php?f=5&t=3415 here].
/!\ Do *not* use GoogleEarth for measuring atm! See [http://flightgear.org/forums/viewtopic.php?f=5&t=3356 here] and [http://flightgear.org/forums/viewtopic.php?f=5&t=3415 here].


[[Image:Placing_objects_with_UFO_html_5fa8d7b1.jpg]]
[[Image:Placing_objects_with_UFO_html_5fa8d7b1.jpg|400px]]


Let's say we want to position the catii-iii.xml object at the end of a taxiway. We stop the UFO just above this intersection and press the space key, a Select Model window will open up where the contents of the Flightgear/data/Models/ directory will be shown. Select your model from this list, then close the window. The selected model path/name will be display in green text at the bottom left of the FlightGear screen.
Let's say we want to position the catii-iii.xml object at the end of a taxiway. We stop the UFO just above this intersection and press the space key, a Select Model window will open up where the contents of the Flightgear/data/Models/ directory will be shown. Select your model from this list, then close the window. The selected model path/name will be display in green text at the bottom left of the FlightGear screen.


[[Image:Placing_objects_with_UFO_html_m184fb381.jpg]]
[[Image:Placing_objects_with_UFO_html_m184fb381.jpg|400px]]


Now you may point the mouse on the scenery ground and left-click again, the CAT II/III ground marking model will be positioned there. Of course, it does not have the correct orientation and it's partly covered by the surrounding terrain, but we can adjust that.
To place the object, simply left-click on the position that you want to place it. By default it is placed completely horizontal and rotated to point North. It will probably not have the correct orientation and it will be partly covered by the surrounding terrain, but we can adjust that.


[[Image:Placing_objects_with_UFO_html_12ee70a1.jpg]]
[[Image:Placing_objects_with_UFO_html_12ee70a1.jpg|400px]]


==Rotating objects==
==Rotating objects==
Line 29: Line 36:
Now press TAB (or Ctrl-I), and use the resulting sliders to adjust the latitude/longitude/elevation/heading of the model.
Now press TAB (or Ctrl-I), and use the resulting sliders to adjust the latitude/longitude/elevation/heading of the model.


[[Image:Placing_objects_with_UFO_html_439816e9.jpg]]
[[Image:Placing_objects_with_UFO_html_439816e9.jpg|400px]]
 
See the [[UFO from the 'White Project' of the UNESCO]] page for more information on the UFO command keys and exported file locations, or press ? while in FlightGear.


==Exporting the result==
==Exporting the result==
Now that the model is correctly positioned, press the D key to dump the model position data to the terminal. A few lines will be printed on the console, providing the necessary orientation data. You will save those coordinates into a scenery objects file in the next step. If you don't do that, next time you run Flightgear it will know nothing about the new object.
Now that the model is correctly positioned, press the D key to dump the model position data to the terminal. A few lines will be printed on the console, providing the necessary orientation data.  


[[Image:Placing_objects_with_UFO_html_m4cf0cbf7.jpg]]
[[Image:Placing_objects_with_UFO_html_m4cf0cbf7.jpg]]


In the terminal window, you get three sections printed out by the UFO with very detailed information about what's going on, we need the line at the end.
The most important lines are the last ones:


e000n50/e008n50/3089154.stg is the secenery object file where this object's coordinates have to be saved. The default place where to find e000n50 directory is inside Flightgear/data/Scenery/Objects/. You just open the 3089154.stg file with any text editor, add the following line and save it the file:
# e000n50/e008n50/3089154.stg  
OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1


OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1
The first line identified the location of the scenery file for the object. The OBJECT_SHARED line indicates the objects name, longitude, latitude,  altitude and orientation. This can be read by FlightGear itself and can be ([http://scenemodels.flightgear.org/contribute.php submitted]) to the FlightGear Scenery Object Database.  


Now you have your object's position saved, and it will appear inside the scenery every time you start Flightgear.
You can also save these coordinates into your own scenery file so that your changes will not be lost the next time you start FlightGear.


==Saving the changes to your scenery==


Alternatively, if you press the E key while developing sceneries with Ufo, fgfs will generate an xml file with the dump of your current work. You can find the above information from the "ufo-model-export.xml" file.
In the terminal window, you get three sections printed out by the UFO with very detailed information about what's going on. We need the lines at the end.
 
As noted above, the UFO helpfully exports the name of the scenery file where the object's coordinates have to be saved. In our example
 
e000n50/e008n50/3089154.stg
 
The default location for scenery files is Flightgear/data/Scenery/Objects/. Simply open the referenced .stg file, add the OBJECT_SHARED line to the bottom and save the file. Now you have your object's position saved, and it will appear inside the scenery every time you start Flightgear!
 
In our example we would open 3089154.stg in Flightgear/data/Scenery/Objects/e000n50/e008n50/ and add the following line.
 
OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1
 
==Saving to XML==
 
Alternatively, if you press the E key while developing scenery with Ufo, fgfs will generate an xml file with the dump of your current work in a "ufo-model-export.xml" file. You can later reload this XML file with --config= command-line parameter:


==Reload a saved session==
If you press the E key while developing sceneries with Ufo, fgfs will generate an xml file with the dump of your current work, this file can be after  reloaded giving the --config=path_to_file parameter.
Example for Linux:
Example for Linux:
  fgfs --config=$HOME/.fgfs/ufo-model-export.xml
  fgfs --config=$HOME/.fgfs/ufo-model-export.xml
==Useful keys and exported file locations==
See the [[UFO from the 'White Project' of the UNESCO]] page for ufo command keys and exported file locations.


[[Category:Howto|Place 3D objects with the UFO]]
[[Category:Howto|Place 3D objects with the UFO]]
[[Category:Scenery enhancement|Place 3D objects with the UFO]]
[[Category:Scenery enhancement|Place 3D objects with the UFO]]

Revision as of 08:10, 20 June 2009

The UFO aircraft is a superb tool for placing a new (or old) 3D object at any arbitrary location in the scenery with just a few clicks of the mouse.

Placing objects in the scenery is a really easy way to contribute to the FlightGear project. It doesn't require any programming knowledge, and you can contribute something valuable in 15 minutes.

Choosing your object

The first thing you need is a 3d model to place in the scenery. The FlightGear Scenery Database (http://scenemodels.flightgear.org/) maintains a huge library of generic models, which will have been included in your FlightGear installation.

If you have created your own model you need to save it to somewhere the UFO can find it. The UFO searches for objects under the Flightgear/data/Models/ directory. Let's say you have created a CAT III marker, called catii-iii.xml. In this example, we create a subdirectory called Tabu and save our catii-iii.xml there.

If creating your own object, make sure it is the correct size! In Blender, units are meters and the Caliper script may help. Note that you should not use Google Earth to determine the correct size. See here and here.

Selecting the ufo

Placing objects with UFO html m49fbed81.jpg

Now start Flightgear, and choose UFO as your aircraft.

Placing objects

Once Flightgear has been started, fly with the UFO to the place you want the model to be positioned.

Note that you should not use Google Earth to determine the correct position due to licensing problems. See here and here.

Placing objects with UFO html 5fa8d7b1.jpg

Let's say we want to position the catii-iii.xml object at the end of a taxiway. We stop the UFO just above this intersection and press the space key, a Select Model window will open up where the contents of the Flightgear/data/Models/ directory will be shown. Select your model from this list, then close the window. The selected model path/name will be display in green text at the bottom left of the FlightGear screen.

Placing objects with UFO html m184fb381.jpg

To place the object, simply left-click on the position that you want to place it. By default it is placed completely horizontal and rotated to point North. It will probably not have the correct orientation and it will be partly covered by the surrounding terrain, but we can adjust that.

Placing objects with UFO html 12ee70a1.jpg

Rotating objects

Fly closer to the ground with the UFO, so that you can see it better.

Now press TAB (or Ctrl-I), and use the resulting sliders to adjust the latitude/longitude/elevation/heading of the model.

Placing objects with UFO html 439816e9.jpg

See the UFO from the 'White Project' of the UNESCO page for more information on the UFO command keys and exported file locations, or press ? while in FlightGear.

Exporting the result

Now that the model is correctly positioned, press the D key to dump the model position data to the terminal. A few lines will be printed on the console, providing the necessary orientation data.

Placing objects with UFO html m4cf0cbf7.jpg

The most important lines are the last ones:

# e000n50/e008n50/3089154.stg 
OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1

The first line identified the location of the scenery file for the object. The OBJECT_SHARED line indicates the objects name, longitude, latitude, altitude and orientation. This can be read by FlightGear itself and can be (submitted) to the FlightGear Scenery Object Database.

You can also save these coordinates into your own scenery file so that your changes will not be lost the next time you start FlightGear.

Saving the changes to your scenery

In the terminal window, you get three sections printed out by the UFO with very detailed information about what's going on. We need the lines at the end.

As noted above, the UFO helpfully exports the name of the scenery file where the object's coordinates have to be saved. In our example

e000n50/e008n50/3089154.stg 

The default location for scenery files is Flightgear/data/Scenery/Objects/. Simply open the referenced .stg file, add the OBJECT_SHARED line to the bottom and save the file. Now you have your object's position saved, and it will appear inside the scenery every time you start Flightgear!

In our example we would open 3089154.stg in Flightgear/data/Scenery/Objects/e000n50/e008n50/ and add the following line.

OBJECT_SHARED Models/Tabu/catii-iii.xml 8.57928135 50.03667992 105.9972 111.1

Saving to XML

Alternatively, if you press the E key while developing scenery with Ufo, fgfs will generate an xml file with the dump of your current work in a "ufo-model-export.xml" file. You can later reload this XML file with --config= command-line parameter:

Example for Linux:

fgfs --config=$HOME/.fgfs/ufo-model-export.xml