AC3D file format

From FlightGear wiki
Jump to navigation Jump to search

Ac files (extension .ac) are the basis of all scenery and aircraft models in FlightGear. Knowing how to read and change an AC file can be useful sometimes, e.g. when you quickly want to change a color or use another texture. This article shows you how to modify the material and texture entries.

Materials

rgb 1 1 0
amb 0.72 0.64 1
emis 1 0 0
spec 0 1 0
trans 0.5

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 0 is black, rgb 1 1 1 is 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 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.
Most common 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:
1. Change the colors to rgb 1 1 1 after export. That means that you have to change them every time you export the model.
2. Or you can set the color of the texture to rgb 1 1 1 already 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 CVS, the amb setting should duplicate 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 reflection of light that comes from the viewer, i.e. the color of light that comes from you and goes back to you. In other wprds, here you set the color for mirror-like reflections. In the example, specular is set to full green.

shi 128

Shi seems to stand for shininess, but with that I'm not sure, sorry. Try yourself (no example, of course).

trans 0

With transparency it get really interesting again. Make things transparent, even without using a texture.

Textures

Texture lines are found anywhere throughout the AC file and look like this:

texture "livery.rgb"

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 texture "thenewtexture.rgb". See also here.