Modelling guidelines

From FlightGear wiki
Jump to navigation Jump to search
Merge-arrows.gif
It has been suggested that this article or section be merged with Modeling - Getting Started#Improving models for best FlightGear performance.

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).

Definitions

  • Model = the file.
  • Object/Mesh = part of the Model file. The Model can contain several Objects.
  • Texture = image file (.rgb, .png).

Modelling guidelines

  • 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.
    • Blender: 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.
  • Split transparent parts into their own objects.
    • Blender: Go into Edit Mode, select the part of the object that you would like to split 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> you must create a proxy XML like:

your/aircraft/Models/aircraft.xml:

  <model>
    <path>your/aircraft/Models/Interior/model-proxy.xml</path>
    <usage>interior</usage>
  </model>

your/aircraft/Models/Interior/model-proxy.xml:

<model>
    <path>your/aircraft/Models/Interior/model.xml</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>

Texturing guidelines

  • 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/Mesh.
  • Do not use different parts of a single texture for different models. Split the texture into smaller parts then.
  • 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.
    • GIMP: Go to Layers > Transparency > Remove alpha layer.
    • Inkscape: 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 (2n, e.g. 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.