AC3D file format: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 45: Line 45:
<tt>texture "livery.rgb"</tt>
<tt>texture "livery.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 <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>. See also [[SketchUp to AC3D exporter#PNG adaption|here]].
: 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>. See also [[SketchUp to AC3D exporter#PNG adaption|here]].
===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.
Unfortunately, when using SketchUp, the [[SketchUp to AC3D exporter]] will name every object the same:
<tt>OBJECT poly<br>
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>:
<tt>MATERIAL "default" rgb ...</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_F01" rgb ...</tt>    This is <tt>mat 3</tt><br>
Now we will look for the object that has <tt>mat 2</tt> further below in the AC file. It is this one:
<tt>
OBJECT poly<br>
name "Roof"<br>
numvert 4<br>
-5.245000 10.550000 -0.010000<br>
5.245000 0.060000 -0.010000<br>
-5.245000 0.060000 -0.010000<br>
5.245000 10.550000 -0.010000<br>
numsurf 2<br>
SURF 0x30<br>
mat 2<br>
refs 3<br>
0 0 0<br>
1 0 0<br>
2 0 0<br>
SURF 0x30<br>
mat 2<br>
refs 3<br>
1 0 0<br>
0 0 0<br>
3 0 0<br>
kids 0
</tt>
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:
<tt>MATERIAL "Roof" rgb<br><br>
OBJECT poly<br>
name "blah"<br>
texture "roof1.png"</tt>
The name of the material does not matter at all, it could be anything. The object name is the important thing for reference from XML. Only after renaming the object you will be able to address it from the XML file. (Or, of course, you can refer to the object "blah", if this is the only object with that name in the AC file.)
When you are modelling in SketchUp and you want to insure that you can identify it later in the AC file, simply give it a unique color or texture that is not used anywhere else in the AC file.
[[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]]
248

edits

Navigation menu