13,280
edits
Godarklight (talk | contribs) |
(Small corrections and WIP on summary table so far so far.) |
||
| (14 intermediate revisions by 5 users not shown) | |||
| Line 15: | Line 15: | ||
'''Note for SketchUp users:''' when exporting to AC3D in Sketchup, the .ac file will name the objects in your model to "blah" by default. You need to amend the relevant object names in your .ac file using text edit, so that the xml will work. | '''Note for SketchUp users:''' when exporting to AC3D in Sketchup, the .ac file will name the objects in your model to "blah" by default. You need to amend the relevant object names in your .ac file using text edit, so that the xml will work. | ||
== | == Summary of animations and tags == | ||
{{WIP|Will be adding this over the coming days. /[[User:Johan G|Johan G]]}} | |||
{| class="wikitable" | |||
! colspan="2" | Animation | |||
! colspan="13" | Tags | |||
! rowspan="2" | Comments | |||
|- | |||
! <type> !! Purpose | |||
! <axis> !! <center> !! <condition> !! <expression> !! <factor> !! <interpolation> !! <power> !! <min> !! <max> !! <name> !! <offset> !! <object-name> !! <property> <!-- !! <> --> | |||
|- | |||
| | |||
|} | |||
== Tags used in most animations == | |||
=== Name === | |||
With a name animation, you can group multiple objects. | |||
<source> | |||
<animation> | |||
<name>Collection1</name> | |||
<object-name>Object1</object-name> | |||
<object-name>Object2</object-name> | |||
<object-name>Object3</object-name> | |||
</animation> | |||
</source> | |||
The example above creates a "virtual object" with the name Collection1. In animation, we can animate this group of objects, by using: | |||
<source> | |||
<object-name>Collection1</object-name> | |||
</source> | |||
=== Object-name === | |||
These names are set in the 3D model. Each single object has a unique name; for easy identification it is advised to use descriptive names (LeftElevator, Rudder etc.). Animations are only applied to those objects that are mentioned in an object-name line (one object per line!). Animations lacking those, will be applied to the entire model. | |||
=== Property === | |||
Each animation must be associated with exactly one property from the main FlightGear property tree (remember that the properties in the wrapper file are not part of the main tree), using <code><property></code> to provide the property path: | |||
<source> | |||
<animation> | |||
<type>rotate</type> | |||
<object-name>Rudder</object-name> | |||
<property>controls/rudder</property> | |||
</animation> | |||
</source> | |||
Note the omission of the leading slash '/' when reffering to the property. This assures that when the model is used for AI or multiplayer traffic the animations will follow that of the AI controller instead of that of the user. | |||
=== Axis === | === Axis === | ||
An axis part is required in every animation that involves a rotating or moving thing. | An axis part is required in every animation that involves a rotating or moving thing. | ||
| Line 57: | Line 104: | ||
The axis are similar to the ones of the 3D model, so finding coordinates is easily done in 3D modeling software. | The axis are similar to the ones of the 3D model, so finding coordinates is easily done in 3D modeling software. | ||
== Additional tags that can be used in most animations == | |||
=== Conditions === | === Conditions === | ||
Multiple animations can make use of a conditional. Check <tt>$FGDATA/Docs/README.conditions</tt> for some more details. | Multiple animations can make use of a conditional. Check <tt>$FGDATA/Docs/README.conditions</tt> for some more details. | ||
| Line 163: | Line 211: | ||
You can add as many entries as you need. Interpolation tables are often used for gear animations (eg. to open doors during gear-movements and close them again once the gear is either retracted or fully extended). | You can add as many entries as you need. Interpolation tables are often used for gear animations (eg. to open doors during gear-movements and close them again once the gear is either retracted or fully extended). | ||
=== | === Expressions === | ||
For some animations it is possible to define complex animations by using [[Expressions|Expressions]]. This even allows to drive the animation from multiple properties without the need for additional Nasal scripts. Here is an example for a translate animation depending on two properties and the cosine function: | |||
<syntaxhighlight lang="xml"> | |||
< | |||
<animation> | <animation> | ||
<type>translate</type> | |||
<expression> | |||
<product> | |||
<property>/my/factor-property</property> | |||
<cos> | |||
<deg2rad> | |||
<property>/my/angular-property</property> | |||
</deg2rad> | |||
</cos> | |||
</product> | |||
</expression> | |||
[..]more elements[..] | |||
</animation> | </animation> | ||
</ | </syntaxhighlight> | ||
Animations which can utilize [[Expressions|Expressions]] are: | |||
* [[Howto:Animate_models#Translate|Translate]] | |||
* [[Howto:Animate_models#Rotate|Rotate]] | |||
* [[Howto:Animate_models#Scale|Scale]] | |||
* [[Howto:Animate_models#Range|Range]] | |||
* [[Howto:Animate_models#Blend|Blend]] | |||
See more detailed info at [[Expressions|Expressions]] | |||
== Object animations == | |||
== | |||
=== Alpha-test === | === Alpha-test === | ||
<source> | <source> | ||
| Line 206: | Line 248: | ||
</animation> | </animation> | ||
</source> | </source> | ||
This "animation" is a way to set an alpha test on a model branch. The effect is to avoid depth buffer writing of pixel that are not seen because they are transparent. This is particulary useful when modeling a metallic structure or a tree with a billboard. The threshold of transparency is set with the <alpha-factor> element. See also [[Pixel testing in effects]]. | |||
=== Blend === | === Blend === | ||
| Line 224: | Line 267: | ||
* '''min:''' | * '''min:''' | ||
* '''max:''' | * '''max:''' | ||
* '''[[Howto:Animate_models#Expressions|expression]]:''' is optional. For more details see [[Expressions|Expressions]] | |||
=== Billboard === | === Billboard === | ||
| Line 264: | Line 307: | ||
You can optionally add [[#Center|<center>]] coordinates, to scale the object around that point. | You can optionally add [[#Center|<center>]] coordinates, to scale the object around that point. | ||
=== Flash === | === Flash === | ||
| Line 316: | Line 347: | ||
and this scale factor is applied to the object, from the center specified. It works best if scale is less than 1. Otherwise, there will be clipping issues. | and this scale factor is applied to the object, from the center specified. It works best if scale is less than 1. Otherwise, there will be clipping issues. | ||
=== Noshadow === | === Noshadow === | ||
| Line 432: | Line 355: | ||
</animation> | </animation> | ||
</source> | </source> | ||
=== Range === | === Range === | ||
To prevent objects -like instruments- being drawn when the aircraft is actually too far away for them to be seen anyway, a range animation is used. | To prevent objects -like instruments- being drawn when the aircraft is actually too far away for them to be seen anyway, a range animation is used. | ||
< | <syntaxhighlight lang="xml"> | ||
<animation> | <animation> | ||
<type>range</type> | <type>range</type> | ||
| Line 445: | Line 365: | ||
<max-m>30</max-m> | <max-m>30</max-m> | ||
</animation> | </animation> | ||
</ | </syntaxhighlight> | ||
* '''min-m:''' the shortest distance (in meters) from the object center at which it is visible. | * '''min-m:''' the shortest distance (in meters) from the object center at which it is visible. | ||
| Line 451: | Line 371: | ||
You could also use the generic level of detail (LOD) properties, which can be set by the user through View > Adjust LOD rangers: | You could also use the generic level of detail (LOD) properties, which can be set by the user through View > Adjust LOD rangers: | ||
{| class="wikitable" | |||
! Property | |||
! Description | |||
! Default value | |||
|- | |||
|<tt>/sim/rendering/static-lod/bare</tt> | |||
| only a rough exterior model | |||
| 30,000 m | |||
|- | |||
|<tt>/sim/rendering/static-lod/rough</tt> | |||
| most should be visible | |||
| 9,000 m | |||
|- | |||
|<tt>/sim/rendering/static-lod/detailed</tt> | |||
| all details should be visible | |||
| 1,500 m | |||
|} | |||
The animation code will look like this: | The animation code will look like this: | ||
< | <syntaxhighlight lang="xml"> | ||
<animation> | <animation> | ||
<type>range</type> | <type>range</type> | ||
| Line 462: | Line 396: | ||
<max-property>sim/rendering/static-lod/bare</max-property> | <max-property>sim/rendering/static-lod/bare</max-property> | ||
</animation> | </animation> | ||
</ | </syntaxhighlight> | ||
You can have both ranges (max and min) bound to a property, or just one of them. | You can have both ranges (max and min) bound to a property, or just one of them. | ||
* '''min-property:''' | * '''min-property:''' | ||
* '''max-property:''' | * '''max-property:''' | ||
* '''[[Howto:Animate_models#Expressions|expression]]:''' is optional. For more details see [[Expressions|Expressions]] | |||
=== Rotate === | === Rotate === | ||
| Line 493: | Line 428: | ||
* '''factor:''' is optional. | * '''factor:''' is optional. | ||
* '''offset-deg:''' is optional. Offset in degrees. | * '''offset-deg:''' is optional. Offset in degrees. | ||
* '''[[Howto:Animate_models#Expressions|expression]]:''' is optional. For more details see [[Expressions|Expressions]] | |||
=== Scale === | === Scale === | ||
| Line 524: | Line 460: | ||
* x.offset: the scale factor. | * x.offset: the scale factor. | ||
* '''[[Howto:Animate_models#Expressions|expression]]:''' is optional. For more details see [[Expressions|Expressions]] | |||
=== Select === | === Select === | ||
| Line 577: | Line 514: | ||
* '''factor:''' is optional. | * '''factor:''' is optional. | ||
=== Timed === | === Timed === | ||
| Line 614: | Line 528: | ||
</animation> | </animation> | ||
</source> | </source> | ||
=== Tracking === | |||
The new (in 2.11) [[Tracking animation|'''locked-track animation''']] can do exactly the same thing as the [http://wiki.blender.org/index.php/Doc:2.6/Manual/Constraints/Tracking/Locked_Track Locked Track constraint] available in Blender. However it can also be used to simulate simple inverse kinematic systems consisting of two bones connected with a revolute joint (aka hinge). See [[Tracking animation|detailed explanantion]] | |||
=== Translate === | === Translate === | ||
| Line 649: | Line 566: | ||
* '''factor:''' is optional. | * '''factor:''' is optional. | ||
* '''offset-m:''' is optional. Offset in meters. | * '''offset-m:''' is optional. Offset in meters. | ||
* '''[[Howto:Animate_models#Expressions|expression]]:''' is optional. For more details see [[Expressions|Expressions]] | |||
== Material animation == | |||
An animation type that can be used in various ways. Of course you can combine the below mentiond systems into one (big) animation. | |||
<source> | |||
<animation> | |||
<type>material</type> | |||
<object-name>Object</object-name> | |||
<property-base>sim/model/c172p/material</property-base> | |||
<global type="bool">true</global> <!-- This tag is no longer supported --> | |||
... | |||
lines as mentioned below | |||
... | |||
</animation> | |||
</source> | |||
'''Optional:''' | |||
* '''property-base:''' when using prop(erties), you might want to set a property-base. All props will be relative to this path. | |||
* '''global (depreciated):''' by setting this to <tt>true</tt>, all objects using the same material as the defined object(s) (via <tt><object-name></tt>) will be affected by the animation. This is preferred to listing several objects in <object-name> tags. It's not only faster, but also doesn't break animations by forcing objects together. <span style="color:red; text-decoration: underline;">This tag is no longer supported</span> | |||
'''Notes:''' | |||
* Numbers are clamped to 0.0-1.0, except "shininess", which is clamped to 0-128. | |||
* By appending <tt>-prop</tt> each of the material properties can read its value from another property. | |||
=== Ambient === | |||
<source> | |||
<ambient> | |||
<red>1.0</red> | |||
<green>0.2</green> | |||
<blue>0.0</blue> | |||
</ambient> | |||
</source> | |||
=== Diffuse === | |||
<source> | |||
<diffuse> | |||
<red>1.0</red> | |||
<green>0.2</green> | |||
<blue>0.0</blue> | |||
</diffuse> | |||
</source> | |||
=== Emission === | |||
{{Main article|Howto: Illuminate faces}} | |||
<source> | |||
<emission> | |||
<red>1.0</red> | |||
<green>0.2</green> | |||
<blue>0.0</blue> | |||
<factor-prop>controls/lighting/panel-norm</factor-prop> | |||
</emission> | |||
</source> | |||
Emission colors are multiplied by the factor-prop value. 1 is maximum color intensity, while 0 is the minimum. Colors are calculated according to the [http://en.wikipedia.org/wiki/RGB_color_model RGB color model]. | |||
=== Shininess === | |||
Shininess is clamped to 0-128. | |||
<source> | |||
<shininess>105</shininess> | |||
</source> | |||
=== Specular === | |||
<source> | |||
<specular> | |||
<red>1.0</red> | |||
<green>0.2</green> | |||
<blue>0.0</blue> | |||
</specular> | |||
</source> | |||
=== Texture === | |||
Used for the [[Livery over MP]] system. | |||
<source> | |||
<property-base>sim/model/livery</property-base> | |||
<texture-prop>engine</texture-prop> | |||
<texture>KLM.png</texture> | |||
</source> | |||
=== Transparency === | |||
<source> | |||
<transparency> | |||
<alpha-prop>rotors/tail/rpm</alpha-prop> | |||
<factor>-0.0015</factor> | |||
<offset>1</offset> | |||
</transparency> | |||
</source> | |||
=== Threshold === | |||
<source> | |||
<threshold>0.001</threshold> | |||
</source> | |||
== Texture Animations == | |||
Applying different matrix transformations to the textures of an object. | |||
=== Textranslate === | |||
A very important animation for cockpits! This animation moves textures over a surface. | |||
<source> | |||
<animation> | |||
<type>textranslate</type> | |||
<object-name>Object</object-name> | |||
<property>autopilot/settings/target-speed-kt</property> | |||
<bias>0.0001</bias> | |||
<factor>0.001</factor> | |||
<step>100</step> | |||
<axis> | |||
<x>0</x> | |||
<y>1</y> | |||
</axis> | |||
</animation> | |||
</source> | |||
* '''bias:''' Adds an offset to the property before factor/step. A small value is needed to compensate for [http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems floating point accuracy]. | |||
* '''factor:''' property * factor * texture width/height = the amount of pixels that the texture should be translated. If your texture is 256 pixels, an textranslate of 0.1 will result in the texture moving with 26 pixels, into the direction specified by the axis settings. | |||
* '''step:''' the step size at which the texture is translated. If this is set to 0.1, the texture will only be translated at 0.1, 0.2, 0.3 etc. | |||
* axis: the direction in which the texture is translated. Y is up/down, while X is left/right. | |||
=== Texrotate === | |||
<source> | |||
<animation> | |||
<object-name>Object</object-name> | |||
<type>texrotate</type> | |||
<property>some/property/path</property> | |||
<factor>25</factor> | |||
<offset-deg>25</offset-deg> | |||
<center> | |||
<x>0.5</x> | |||
<y>0.5</y> | |||
<z>0</z> | |||
</center> | |||
<axis> | |||
<x>0</x> | |||
<y>0</y> | |||
<z>1</z> | |||
</axis> | |||
</animation> | |||
</source> | |||
=== Textrapezoid === | |||
<source> | |||
<animation> | |||
<type>textrapezoid</type> | |||
<object-name>HUD.l.canvas</object-name> | |||
<property>/hud/trapezoid-correction</property> | |||
<side>bottom</side> | |||
</animation> | |||
</source> | |||
* '''side''': side of quad which should be scaled (''top'' (default)/''right''/''bottom''/''left'') | |||
=== Texmultiple === | |||
Only one texture matrix can be applied to each object. With ''textmultiple'' multiple texture animations can be combined into a single matrix, applied to the specified object. | |||
<source> | |||
<animation> | |||
<type>texmultiple</type> | |||
<object-name>HUD.l.canvas</object-name> | |||
<transform> | |||
<subtype>textranslate</subtype> | |||
<property>/hud/offset-x</property> | |||
<axis> | |||
<x>1</x> | |||
<y>0</y> | |||
<z>0</z> | |||
</axis> | |||
</transform> | |||
<transform> | |||
<subtype>textranslate</subtype> | |||
<property>/hud/offset-y</property> | |||
<axis> | |||
<x>0</x> | |||
<y>1</y> | |||
<z>0</z> | |||
</axis> | |||
</transform> | |||
<transform> | |||
<subtype>textrapezoid</subtype> | |||
<property>/hud/trapezoid-correction</property> | |||
</transform> | |||
</animation> | |||
</source> | |||
== Object interaction animations == | |||
=== Enable-hot === | |||
Scenery objects are automatically defined as solid by FlightGear, meaning that an aircraft can taxi on them and/or crash when touching. For certain objects (groundmarkings, beacon light-beams etc.) this might be an unwanted feature. The solidness can be disabled with the following animation: | |||
<source> | |||
<animation> | |||
<object-name>Object</object-name> | |||
<enable-hot type="bool">false</enable-hot> | |||
</animation> | |||
</source> | |||
* '''enable-hot:''' can be either true or false. Remember that objects are automatically solid, so it should not be nesecarily to set this at all when wanting solidness. | |||
=== Interactions === | |||
<source> | |||
<animation> | |||
<type>interaction</type> | |||
<object-name>Object</object-name> | |||
<interaction-type>carrier-wire</interaction-type> | |||
</animation> | |||
</source> | |||
* '''interaction-type:''' can have the following values: | |||
** '''carrier-catapult:''' | |||
** '''carrier-wire:''' makes the object act as an arresting wire, as used on [[aircraft carrier]]s. | |||
== Direct manipulation animations == | |||
=== Knob / slider (v. 2.11-) === | |||
{{Main article|Knob / slider animation}} | |||
=== Pick === | |||
{{Main article|Howto: Make a clickable panel#Pick}} | |||
==References== | == References == | ||
{{Appendix|all| | {{Appendix|all| | ||
* {{cite web |url=http://www.opensubscriber.com/message/flightgear-devel@flightgear.org/958955.html |title="material" animation (and the bo105 as an example) |first=Melchior |last=Franz |date=22 March 2005 |work=FlightGear-devel mailinglist }} | * {{cite web |url=http://www.opensubscriber.com/message/flightgear-devel@flightgear.org/958955.html |title="material" animation (and the bo105 as an example) |first=Melchior |last=Franz |date=22 March 2005 |work=FlightGear-devel mailinglist }} | ||