G3D support

From MegaGlest
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
The G3D support entry as it appears in the addons menu.

Glest and its forks currently are restricted to the G3D modeling format. Currently an up-to-date importer and exporter only exist for Blender, requiring that Blender is used for modeling or at least converting imported models. This is done with the G3D support python script, which allows Blender to both import and export G3D models.

Download

The script to use depends entirely on the version of Blender used. It is strongly recommended to use the g3d_support.py from the "blender" directory in your game installation.

If this does not fit try MegaGlests most recent: Download

Installation

  1. In the info window, under the file option, choose "user preferences".
  2. In this new window, switch to the addons tab and click the "install add-on" button at the bottom.
  3. Open the python file you just downloaded.
    • Alternatively, it's possible to manually install the script by placing it in the Blender scripts folder. The location varies depending on where you told the installer to create this folder, and could be in the installation directory or a user directory (such as the home folder or the AppData folder).
  4. The addon will now be found in this window, in the import-export category, under the name "G3D Mesh Import/Export". Tick the checkbox beside it to enable it.
  5. Note that in order to be able to export in future sessions, you must save the user preferences with Ctrl + U.

Limitations

  • All faces must be triangulated (the 2.6x exporter automatically converts them to triangles before export). Faces can be converted to triangles by selecting all faces and using the hotkey ctrl + T.
  • ( In old versions, the axis differs in G3D, which might make some trouble with old models. In old versions the Y axis was height, X axis was length, and Z axis was width.)

Model preparation

The G3D support panel in the latest version of the script.
  • The start and end animation frame should be set appropriately. A large number of frames causes a massive filesize. G3D interposition of frames is considerably smoother than viewed in Blender, so models should rarely require more than 30 frames. If the model is unanimated, the start aand end frame should be set to 1 in the timeline window.
  • The texture of the model must be properly linked in order for it to appear on the exported G3D model. To link the texture, in the properties window, under the textures tab, with the model selected, set the type to "Image or movie" and open the image.
  • In the G3D support panel, under Object Data in the properties window, the g3d object properties can be set:
    • double sided Controls whether or not the object can only be viewed from both sides
    • teamcolor Controls if team colour or transparency is used. Transparent parts ( alpha ) in the texture will be replaced with team colour.
    • non-selectable Non-selectable objects can't be clicked on to select the unit, such as the pebbles that scatter when a worker is mining.
    • fully opaque which makes the model invisible, but its still selectable!! ( Help to make small units easier to select, such as snakes spiders ... )
    • glow this lets the object glow the way MG's particles "glow".
  • To make a material partially transparent (for use such as transparent teamcolor), in the materials tab of the properties window, check the transparency box and under Z transparency, adjust the alpha slider.

Exporting

The option to export as G3D appearing in the export menu.

To export a model to G3D, in object mode, select the meshes you want to export (if nothing is selected, everything will be exported, then open the file menu of the info window, choose export, and select "Glest 3D File (g3d)". Choose a file location and all objects will be exported to G3D (non-compatible objects such as bones, cameras, or lights will not be exported).

Importing

To import a model from G3D, open the file menu of the info window, choose import, and select "Glest 3D File (g3d)". Choose the file to load and it will be loaded at the origin. Note that animations cannot be imported, only the meshes and UV (texture) coordinates.

Troubleshooting

  • White model - The texture was not properly linked to the object (detailed above).
  • Model is sideways - Model not orientated properly. The Z(blue) axis is height, the X axis is width, and the Y axis is depth, like Blender's defaults.(Warning: Orientation is different in older versions of the script!)

See also