AC3D file format: Difference between revisions

Jump to navigation Jump to search
m
Fixed a typo, fixed formatting, replaced obselete <tt> tags with <code>
(Add note about incompatibilities with FlightGear)
m (Fixed a typo, fixed formatting, replaced obselete <tt> tags with <code>)
Line 1: Line 1:
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 [https://web.archive.org/web/20180814212703/http://www.inivis.com/ac3d/man/ac3dfileformat.html|online] 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.
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 [https://web.archive.org/web/20180814212703/http://www.inivis.com/ac3d/man/ac3dfileformat.html|online] 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 FlightGear ==
{{note| Not all version of the AC3D file format are compatible with FlightGear. It is suggested to stick with version 12 of the format, known as <code>AC3Db</code>.}}
The AC3D file format is one of the best supported file formats for 3D models in FlightGear, and it is often used for modelling [[aircraft]], and [[scenery]] models.


== Usage with other applications ==
== Usage with other applications ==
Line 13: Line 7:
{{main article|Working with the AC3D file format in Blender}}
{{main article|Working with the AC3D file format in Blender}}


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 addo-ons have been developed to maintain support for the file format.  
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 ===
=== Open Scenegraph Library ===
The <tt>osgviewer</tt> demo in the [http://www.openscenegraph.org/ Open Scenegraph Library] is very useful for quickly looking at models.
The <code>osgviewer</code> demo in the [http://www.openscenegraph.org/ Open Scenegraph Library] is very useful for quickly looking at models.


=== PrettyPoly ===
=== PrettyPoly ===
Line 22: Line 16:


=== threedconvert ===
=== threedconvert ===
This is a converter for all plib supported 3D formats and comes with FlightGear (see utils/Modeller/3dconvert.cxx). It can read and write <tt>*.ac</tt> files, but a written file may lack UV mapping or have other defects.
This is a converter for all plib supported 3D formats and comes with FlightGear (see <code>utils/Modeller/3dconvert.cxx</code>). It can read and write <code>*.ac</code> files, but a written file may lack UV mapping or have other defects.




Line 30: Line 24:
When you open an AC file in a text editor, you will see a number of material lines like this:
When you open an AC file in a text editor, you will see a number of material lines like this:


<tt>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</tt>
<code>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</code>


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]].
This line defines the material ''default'' for all poly structures that use this material. It is the default color of <code>.ac</code> files produced by the [[SketchUp to AC3D exporter]].


We will now go through that line bit by bit:
We will now go through that line bit by bit:


<tt>rgb 0.5 0.5 0.5</tt>  
<code>rgb 0.5 0.5 0.5</code>  
: Color: This material is medium grey. Red Green Blue (of which the color is composed) are all medium strong. <tt>rgb 0 0 0</tt> is black, <tt>rgb 1 1 1</tt> is white. Mix to your needs. In the example to the right, red and green make yellow. (More examples [http://web.njit.edu/~walsh/rgb.html here]. Those RGB values can go from 0 to 255, so divide by 255 to get the value appropriate for AC files.)  
: Color: This material is medium grey. Red Green Blue (of which the color is composed) are all medium strong. <code>rgb 0 0 0</code> is black, <code>rgb 1 1 1</code> is white. Mix to your needs. In the example to the right, red and green make yellow. (More examples [http://web.njit.edu/~walsh/rgb.html 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 [[MBB Bo 105|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:  
: The examples on the right have been made with the [[MBB Bo 105|Bo105]] material dialog (when using the model, press {{key press|Ctrl|Y}} to open it). Of course you can make them in the AC file as well: <code>Open > Edit > Save</code>, done.


: 1. Change the colors to <tt>rgb 1 1 1</tt> after export. That means that you have to change them every time you export the model.  
: The suggested RGB setting for textures is <code>1 1 1</code>, 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:
: 2. Or you can set the color of the texture to <tt>rgb 1 1 1</tt> already in SketchUp. You will see the textures whiteish in SketchUp, but correctly after export ([[Textures & Texture Maps in SketchUp#Correct display of texture colors in the AC file|Correct display of texture colors in the AC file]]).
# Change the colors to <code>rgb 1 1 1</code> after 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 <code>rgb 1 1 1</code> already in SketchUp. You will see the textures whiteish in SketchUp, but correctly after export ([[Textures & Texture Maps in SketchUp#Correct display of texture colors in the AC file|Correct display of texture colors in the AC file]]).


<tt>amb 0.4 0.4 0.4</tt>
<code>amb 0.4 0.4 0.4</code>
: Ambient: The [http://en.wikipedia.org/wiki/Ambient_light 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.
: Ambient: The [http://en.wikipedia.org/wiki/Ambient_light 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.
: 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.


<tt>emis 0 0 0</tt>
<code>emis 0 0 0</code>
: 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]].
: 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]].


<tt>spec 0.2 0.2 0.2</tt>
<code>spec 0.2 0.2 0.2</code>
: [https://en.wikipedia.org/wiki/Specular_highlight 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.
: [https://en.wikipedia.org/wiki/Specular_highlight 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.


<tt>shi 128</tt>
<code>shi 128</code>
: 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.
: 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.


<tt>trans 0</tt>
<code>trans 0</code>
: With transparency it get really interesting again. Make things transparent, even without using a [[Textures & Texture Maps in SketchUp|texture]].
: With transparency it get really interesting again. Make things transparent, even without using a [[Textures & Texture Maps in SketchUp|texture]].


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


<tt>texture "livery.rgb"</tt>
<code>texture "livery.rgb"</code>
: 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 <tt>texture "livery.png"</tt>. If you want to use a different texture altogether, give it the respective name like <tt>texture "thenewtexture.rgb"</tt>.
: 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 <code>texture "livery.png"</code>. If you want to use a different texture altogether, give it the respective name like <code>texture "thenewtexture.rgb"</code>.




Line 75: Line 68:
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.
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_RED". You can load the model and set the object's name in XML like this:
For example, you might want to load a beacon. Let's say that it is in a file named <code>beacon.ac</code>. Inside the <code>.ac</code> file, the object's name is <code>Beacon_REDM</code>. You can load the model and set the object's name in XML like this:


<small>
<small>
Line 120: Line 113:




The above code might be stored in an XML file named beacon-object.xml. Another XML file would load it using code like this:
The above code might be stored in an XML file named <code>beacon-object.xml</code>. Another XML file would load it using code like this:


<small>
<small>
Line 143: Line 136:
</syntaxhighlight>
</syntaxhighlight>


<!-- The next part to be added should show how to load an .ac file that has multiple objects named in it and how to access those objects individually. -->
<!-- The next part to be added should show how to load an <code>.ac</code> file that has multiple objects named in it and how to access those objects individually. -->




149

edits

Navigation menu