AC3D file format: Difference between revisions

Jump to navigation Jump to search
m
Robot: Cosmetic changes
No edit summary
m (Robot: Cosmetic changes)
Line 1: Line 1:
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.
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===
=== Materials ===
[[Image:AC_color.jpg|thumb|rgb 1 1 0]][[Image:AC_ambient.jpg|thumb|amb 0.72 0.64 1]][[Image:AC_emission.jpg|thumb|emis 1 0 0]][[Image:AC_spec.jpg|thumb|spec 0 1 0]][[Image:AC_trans.jpg|thumb|trans 0.5]]
[[File:AC_color.jpg|thumb|rgb 1 1 0]][[File:AC_ambient.jpg|thumb|amb 0.72 0.64 1]][[File:AC_emission.jpg|thumb|emis 1 0 0]][[File:AC_spec.jpg|thumb|spec 0 1 0]][[File:AC_trans.jpg|thumb|trans 0.5]]


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:
Line 23: Line 23:


<tt>amb 0.4 0.4 0.4</tt>
<tt>amb 0.4 0.4 0.4</tt>
: 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.
Line 39: Line 39:
: 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]].


===Textures===
=== Textures ===


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:
Line 47: Line 47:




===Identifying an object===
=== 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.
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.
Line 53: Line 53:
Unfortunately, when using SketchUp, the [[SketchUp to AC3D exporter]] will name every object the same:
Unfortunately, when using SketchUp, the [[SketchUp to AC3D exporter]] will name every object the same:


<tt>OBJECT poly<br>
<tt>OBJECT poly<br />
name "blah"</tt>
name "blah"</tt>


Here is how you can find an object you are looking for: Every part of the model with a unique <tt>material</tt> is defined as a new <tt>OBJECT poly</tt>. This means that you only have to know which material an object uses to find it in the body of the AC file. Every material is given a number, starting from the '''first material after''' <tt>material "default"</tt>:
Here is how you can find an object you are looking for: Every part of the model with a unique <tt>material</tt> is defined as a new <tt>OBJECT poly</tt>. This means that you only have to know which material an object uses to find it in the body of the AC file. Every material is given a number, starting from the '''first material after''' <tt>material "default"</tt>:


<tt>MATERIAL "default" rgb ...</tt><br>
<tt>MATERIAL "default" rgb ...</tt><br />
<tt>MATERIAL "Color_A07" rgb ...</tt>   This is <tt>mat 1</tt><br>
<tt>MATERIAL "Color_A07" rgb ...</tt> This is <tt>mat 1</tt><br />
<tt>MATERIAL "Color_D01" rgb ...</tt>   This is <tt>mat 2</tt><br>
<tt>MATERIAL "Color_D01" rgb ...</tt> This is <tt>mat 2</tt><br />
<tt>MATERIAL "Color_F01" rgb ...</tt>   This is <tt>mat 3</tt><br>
<tt>MATERIAL "Color_F01" rgb ...</tt> This is <tt>mat 3</tt><br />


Now we will look for the object further below in the AC file that uses <tt>mat 2</tt>. It is this one:
Now we will look for the object further below in the AC file that uses <tt>mat 2</tt>. It is this one:


<tt>
<tt>
OBJECT poly<br>
OBJECT poly<br />
name "Roof"<br>
name "Roof"<br />
numvert 4<br>
numvert 4<br />
-5.245000 10.550000 -0.010000<br>
-5.245000 10.550000 -0.010000<br />
5.245000 0.060000 -0.010000<br>
5.245000 0.060000 -0.010000<br />
-5.245000 0.060000 -0.010000<br>
-5.245000 0.060000 -0.010000<br />
5.245000 10.550000 -0.010000<br>
5.245000 10.550000 -0.010000<br />
numsurf 2<br>
numsurf 2<br />
SURF 0x30<br>
SURF 0x30<br />
mat 2<br>
mat 2<br />
refs 3<br>
refs 3<br />
0 0 0<br>
0 0 0<br />
1 0 0<br>
1 0 0<br />
2 0 0<br>
2 0 0<br />
SURF 0x30<br>
SURF 0x30<br />
mat 2<br>
mat 2<br />
refs 3<br>
refs 3<br />
1 0 0<br>
1 0 0<br />
0 0 0<br>
0 0 0<br />
3 0 0<br>
3 0 0<br />
kids 0
kids 0
</tt>
</tt>
Line 91: Line 91:
As you can see, <tt>mat 2</tt> is used in this object. Let's imagine that we know that it is a roof. So now that we have named it ''Roof'' we can refer to it from the XML file. Voilà!
As you can see, <tt>mat 2</tt> is used in this object. Let's imagine that we know that it is a roof. So now that we have named it ''Roof'' we can refer to it from the XML file. Voilà!


Note: When you [[Textures & Texture_Maps_in_SketchUp#Loading_your_texture_into_SketchUp|define a new texture in SketchUp]], you can give it a name. Imagine that we use the texture <tt>roof1.png</tt> and that we name the texture <tt>Roof</tt>. The name and the texture filename will appear in the AC file. Yet you will still have to rename the object. The [[SketchUp to AC3D exporter]] will give you this:
Note: When you [[Textures & Texture Maps in SketchUp#Loading your texture into SketchUp|define a new texture in SketchUp]], you can give it a name. Imagine that we use the texture <tt>roof1.png</tt> and that we name the texture <tt>Roof</tt>. The name and the texture filename will appear in the AC file. Yet you will still have to rename the object. The [[SketchUp to AC3D exporter]] will give you this:


<tt>MATERIAL "Roof" rgb<br><br>
<tt>MATERIAL "Roof" rgb<br /><br />
OBJECT poly<br>
OBJECT poly<br />
name "blah"<br>
name "blah"<br />
texture "roof1.png"</tt>
texture "roof1.png"</tt>


Line 104: Line 104:
[[Category:Howto|AC files: Understanding and changing .ac code]]
[[Category:Howto|AC files: Understanding and changing .ac code]]
[[Category:Scenery enhancement|AC files: Understanding and changing .ac code]]
[[Category:Scenery enhancement|AC files: Understanding and changing .ac code]]
[[Category:Howto|AC files: Understanding and changing .ac code]]
[[Category:Howto|AC files: Understanding and changing .ac code]]
[[Category:Scenery enhancement|AC files: Understanding and changing .ac code]]
[[Category:Scenery enhancement|AC files: Understanding and changing .ac code]]

Navigation menu