SketchUp to AC3D exporter

From FlightGear wiki
(Redirected from Modeling SketchUp)
Jump to navigation Jump to search
This article or section contains out-of-date information

Please help improve this article by updating it. There may be additional information on the talk page.

Cleanup.png This article may require cleanup to meet the quality standards of the wiki. Please improve this article if you can.
SketchUp to AC3D exporter
Developed by James Turner and others
Initial release 0.1 (1 September 2008)
Written in Ruby
Development status Not under active development as of 05/2016
Type SketchUp extension
License GNU General Public License

With the SketchUp to AC3D exporter, developed by James Turner and improved by others, you are able to export SketchUp models to the AC3D file format. The script works in both SketchUp Make and Pro.

Installation

You can download the script from this link. Then, follow the extension installation instuctions here. Then restart SketchUp and the script should be visible through the via PluginsExport to AC3D, or ExtensionsExport to AC3D in SketchUp 2015 or later.

Note  In Sketchup 8, users are able to export as a .dae file, and AC3D is able to import .dae files, meaning no conversions are necessary if texturing in AC3D.

A note about textures

The AC3D exporter is set to export textures to the PNG format by standard. That means that for FlightGear to be able to display your model correctly, you will have to provide your textures in the .png format.

So if you have a texture in a format other than PNG, you'll have to transform it into PNG. One free program capable of this conversion is ImageMagick. You can download it from http://www.imagemagick.org/script/binary-releases.php

See also AC files: Textures and SketchUp: Correct display of texture colors in the AC file.

Other notes

Unfortunately, when using SketchUp, the SketchUp to AC3D exporter will name every object the same:

OBJECT poly
name "blah"

Here is how you can find an object you are looking for: Every part of the model with a unique material is defined as a new OBJECT poly. 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 material "default":

MATERIAL "default" rgb ...
MATERIAL "Color_A07" rgb ... This is mat 1
MATERIAL "Color_D01" rgb ... This is mat 2
MATERIAL "Color_F01" rgb ... This is mat 3

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

OBJECT poly
name "Roof"
numvert 4
-5.245000 10.550000 -0.010000
5.245000 0.060000 -0.010000
-5.245000 0.060000 -0.010000
5.245000 10.550000 -0.010000
numsurf 2
SURF 0x30
mat 2
refs 3
0 0 0
1 0 0
2 0 0
SURF 0x30
mat 2
refs 3
1 0 0
0 0 0
3 0 0
kids 0

As you can see, mat 2 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 define a new texture in SketchUp, you can give it a name. Imagine that we use the texture roof1.png and that we name the texture Roof. 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:

MATERIAL "Roof" rgb

OBJECT poly
name "blah"
texture "roof1.png"

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 ensure that you can identify one part of it later in the AC file, simply give it a unique color or texture that is not used anywhere else in the AC file. An exception to this method exists where you want your object to be invisible until the .xml file animates it (as with some lighting effects) - in that case you MUST use a unique texture. Failure to use a unique texture in these cases will result in your object not showing in FlightGear.

Development

The script is still in development at the moment. The current progress as of 12 September 2008 is:

Done:

  • Geometry export
  • Texture export

Known Issues:

  • Texture scaling on the model may appear wrong, further testing required
  • Material properties are guessed, so may appear different from Blender defaults. SketchUp has very limited material controls, so manual editing may be required.

To do:

  • Conversion of latitude and longitude locations.

Development update July 2011

SketchUp models which are completed using the existing SketchUp to AC3D exporter are rendered in FlightGear with double sided faces.

Though there is nothing wrong with double sided faces, there is a considerable saving in FG processing if single faces can be used. This affects fps (frames per second) and is particularly noticeable when entering an area which is heavily inhabited with buildings/models.

It is possible to export SketchUp models with single faces by using a new version of the exporter (adapted by VicMar & i4dnf).

The new version is named "ac3dS_export.rb" and is available for download from http://vicmar.weebly.com/downloads.html

The "ac3dS_export.rb" file should be placed in the same folder/directory as the existing exporter. In the SketchUp Plugins/Exentsions menu, it will appear as "Export to AC3D (Single_Faced)" and should appear with the existing exporter. Do NOT remove the existing exporter.

The new version is recommended for use with SketchUp models which do NOT have any see through textures. It is also not recommended if your model has apertures like open hangar doors, which allow a view inside the building, as the opposite walls will be invisible.

There is a work around for models which have see-through textures, but it is a chore to do, so it is recommended you use the existing exporter for such models.