When modelling an aircraft, building or any other 3D model, you are encouraged to follow the modelling guidelines outlined in this article.
Feel free to add/modify. (please leave a comment in the talk page for radical modifications).
- The file with the 3D model.
- Part of the model file. A model can contain several objects or meshes.
- Image file (
.png) that are draped around the model.
- Vertices are free up to a point - use as many as you need.
- Many small (in vertex numbers) objects/meshes have a far worse negative impact on performance than a single object/mesh with very high vertex numbers.
- Combine all different parts of the model into one single object/mesh, with the exception of parts that need to be animated, or of transparent parts.
- Select some objects and press Ctrl+J to join them into one Object. The new object origin/transform/orientation/name will be based on the ones of the last object selected.
- Use different unique names for each of the objects in a model file. Even more so when the different parts need to be animated.
- Make all faces of the objects single sided.
- If you need a part of the model to be visible from both sides, duplicate it in place and flip the normals. The extra geometry overhead is negligible compared to the extra work generated by double-sided faces.
- Separate transparent parts into their own objects.
- Go into edit mode, select the part of the object that you would like to separate and press P.
- Assign to all transparent objects at least the model-transparent effect:
<effect> <inherits-from>Effects/model-transparent</inherits-from> <object-name>Transparent-object1</object-name> <object-name>Transparent-object2</object-name> <object-name>Transparent-object3</object-name> <object-name>other-Transparent-object</object-name> </effect>
- The interior should be a separate model. Having it separate enables delayed loading of such models in multiplayer/AI contexts.
- Only one instance of the tag is allowed for the whole aircraft. Such a model is specified as follows in the XML file:
<model> <usage>interior</usage> <!--make sure to have this tag--> <path>Models/your-interior-model.xml</path> </model>
If your model require an
<offsets> section, you must move the
<offsets> section in the children XML like:
<PropertyList> <path>path/to/model.ac</path> <model> <path>your/aircraft/Models/Interior/model.xml</path> <usage>interior</usage> </model> ... </PropertyList>
<PropertyList> <path>path/to/another/model.ac</path> <offsets> <x-m> -1.91552 </x-m> <y-m> 0.00000 </y-m> <z-m> 0.23706 </z-m> <roll-deg> 40.0 </roll-deg> <pitch-deg> 35.0 </pitch-deg> <heading-deg> 60.0 </heading-deg> </offsets> <model> <path>path/to/another/model.xml</path> </model> ...
- Combine as many parts of a single model to a single texture as you can. The maximum texture size is 4096 x 4096 pixels.
- Do not assign multiple textures to the same object/mesh. The object will be split so as to have a single texture per mesh.
- Do not use different parts of a single texture for different models. Instead, split the texture into smaller parts.
- If using the same texture on multiple models, use a single file, do not make different copies.
- Prefer texture replacing animations to textranslate for models that spend large amounts of their time in one state (day/night animations).
- Avoid transparency like the plague, it kills frame rate like nothing else. Remove the alpha channel from textures if they are non-transparent.
- Go to Layers > Transparency > Remove alpha layer.
- Go to File > Document Properties and set the Background to a non transparent colour (preferably black).
- Hive off transparent parts of textures into their own textures.
- Use power of two dimensions for textures (in essence 2n, for example 256x256, 512x1024). Do not worry if your image would get stretched in the texture, you can fix that with the mapping on the model.
- Do not have textures with the image in one corner and the rest unused.
- Recommended texture format is:
.png. In general any texture format supported by OSG could be used, but be aware of varying cross-platform support for such formats, or of lossy compression.
Multiplayer property usage
When your model is loaded over multiplayer instead of the property tree starting at the top (
/) your model will be loaded with a property tree root of
ai/models/multiplay[#]. It is important that you use the right properties inside your model. This is possibly one of the most commonly misunderstood aspects of the correct way to use properties.
- The general rule is that you must never include a leading
/on any property path.
- The exception to this rule is the few properties that relate to the FlightGear instance on which the model is running. An example of this is the properties related to environmental lighting.
- Writing or modifying an absolute property should never be done.
- All model XML files are loaded such that their property root is correctly adjusted already, and thus
sim/modelwill be either
- Any Nasal code (loaded from the model XML file) needs to use the property root that is passed into the model XML file in cmdarg (you can see this in the model XML file for the F-14 github/Zaretto/fg-aircraft/develop/aircraft/f-14b/Models/f-14b.xml#L25
Developer mailing list threads
- [Flightgear-devel] Scenery Modelling (June 2019) - About scenery model complexity vs. rendering performance.