AC3D file format
The AC3D file format is the native file format used by the AC3D modelling software, and is the best supported file format for 3D models in FlightGear. The file format specification has been made available  by the software developer. These files contain meshes, UV-mappings, texture paths and material definitions. It's ASCII text and easy to edit via scripts or, to some extent, by hand.
Usage with other applications
See Howto: Working with the AC3D file format in Blender for the main article about this subject.
Blender is a free and powerful 3D editor. While Blender dropped built-in support for the AC3D file format after version 2.5, third-party add-ons have been developed to maintain support for the file format.
Open Scenegraph Library
osgviewer demo in the Open Scenegraph Library is very useful for quickly looking at models.
PrettyPoly (ppe) is an unmaintained object editor that uses the same graphics library as FlightGear (plib). This has the advantage that objects look very much like in FlightGear (minus shader effects and shadows). Compiling ppe may be a challenge, though, and it's only useful for viewing, but hardly for editing objects.
This is a converter for all plib supported 3D formats and comes with FlightGear (see
utils/Modeller/3dconvert.cxx). It can read and write
*.ac files, but a written file may lack UV mapping or have other defects.
When you open an AC file in a text editor, you will see a number of material lines like this:
MATERIAL "default" rgb 0.5 0.5 0.5 amb 0.4 0.4 0.4 emis 0 0 0 spec 0.2 0.2 0.2 shi 128 trans 0
This line defines the material default for all poly structures that use this material. It is the default color of
.ac files produced by the SketchUp to AC3D exporter.
We will now go through that line bit by bit:
rgb 0.5 0.5 0.5
- Color: This material is medium grey. Red Green Blue (of which the color is composed) are all medium strong.
rgb 0 0 0is black,
rgb 1 1 1is white. Mix to your needs. In the example to the right, red and green make yellow. (More examples here. Those RGB values can go from 0 to 255, so divide by 255 to get the value appropriate for AC files.)
- The examples on the right have been made with the Bo105 material dialog (when using the model, press Ctrl+Y to open it). Of course you can make them in the AC file as well:
Open > Edit > Save, done.
- The suggested RGB setting for textures is
1 1 1, which shows the colors on the texture excactly as they were drawn. This is a problem with SketchUp resp. the SketchUp to AC3D exporter. There are two solutions to this:
- Change the colors to
rgb 1 1 1after export. That means that you have to change them every time you export the model.
- Or you can set the color of the texture to
rgb 1 1 1already in SketchUp. You will see the textures whiteish in SketchUp, but correctly after export (Correct display of texture colors in the AC file).
amb 0.4 0.4 0.4
- Ambient: The ambient is the color of the light that falls indirectly onto the material, i.e. the reflection of sunlight is (almost) not affected. In the example to the right, I have changed the ambient (not the color) to full blue.
- As of FlightGear 2.0, the amb setting should duplicate the rgb one. If you leave it at amb 0.4 0.4 0.4 after exporting it with the SketchUp to AC3D exporter, the surface will be all grey when the sun does not shine directly on it. So in our example, the amb value should be 0.5 0.5 0.5, just like the rgb one.
emis 0 0 0
- Emission makes things glow. Here, I have set the emission to full red and nothing else. In total dark, the model shines red only, in light it is yellow and red. Also see Howto: Illuminate faces.
spec 0.2 0.2 0.2
- Specular means the direct reflection of light from sun/moon to the surface of the object and then to the viewer. When you view the object that will form a specular spot on the object, the color of the specular spot is what is set here. In the example, specular is set to full green.
- Shi stands for shininess, it determines the size of the specular spot. 0 means large spot, 128 means tiny spot. In general highly polished materials would have higher number, while for example rubber or textile would have lower number.
- With transparency it get really interesting again. Make things transparent, even without using a texture.
Texture lines are found anywhere throughout the AC file and look like this:
- If you have defined this texture and now you are unhappy with it, simply change the file name and the model will use the new texture. For example, if you now want to use a PNG version of this texture, change the line into
texture "livery.png". If you want to use a different texture altogether, give it the respective name like
Identifying an object
If you write an XML file for your AC model (which you always should), you might want to refer from the XML file to certain objects in the AC file. This is necessary when you want to make certain objects rotate or change their size or illuminate them after nightfall or anything like that.
For example, you might want to load a beacon. Let's say that it is in a file named
beacon.ac. Inside the
.ac file, the object's name is
Beacon_REDM. You can load the model and set the object's name in XML like this:
<?xml version="1.0"?> <PropertyList> <model> <!-- load and name the object model --> <path>Lights/Models/beacon.ac</path> <nopreview/> <object-name>Beacon_RED</object-name> </model> <animation> <!-- set the size of the object model --> <type>scale</type> <object-name>Beacon_RED</object-name> <x-offset>2.0</x-offset> <y-offset>2.0</y-offset> <z-offset>2.0</z-offset> </animation> <animation> <!-- set the size of the object model based on distance --> <!-- at "ind" units (meters?) distance, the size of the object will be multiplied by "dep" --> <type>dist-scale</type> <object-name>Beacon_Red</object-name> <interpolation> <entry><ind> 0</ind><dep> 1</dep></entry> <entry><ind> 300</ind><dep> 4</dep></entry> <entry><ind> 1500</ind><dep> 8</dep></entry> </interpolation> </animation> <effect> <inherits-from>Lights/Effects/beacon</inherits-from> <object-name>Beacon_RED</object-name> </effect> </PropertyList>
The above code might be stored in an XML file named
beacon-object.xml. Another XML file would load it using code like this:
<?xml version="1.0"?> <PropertyList> <!-- Load and position the Beacon Light model --> <!-- Position is in meters from model's center coordinates, 0,0,0 --> <model> <path>Lights/beacon-object.xml</path> <offsets> <x-m> 0.0000</x-m> <y-m> 0.0000</y-m> <z-m> 4.9500</z-m> </offsets> </model> </PropertyList>