Dutcheeseblend
Resource contributor
- Messages
- 1,541
- Country

Hi there,
In order to clarify anything about non-linear gauges, I offered to make a small tutorial on this. I found a little bit of time tonight, so there it is
I want to emphasize that this is not a specific Blender2FSX issue, developers using any Max should have this ‘issue’ as well. It isn’t an issue at all, by the way.
Now, here’s the Airspeed Indicator for my Fokker D.21, the Kollsman 157-010 airspeed indicator. Clearly, it is non-linear. FSX doesn’t support built-in non-linear (eg. logarithmic) interpolation between keyframes, so we have to approximate this nonlinearity in a linear way (right?).
Because FSX doesn’t like non-linear, we have to set the interpolation in Blender to Linear. In order to do so, go to the Animation workspace (not necessarily by the way) through the drop-down as in the figure below.
In the Animation workspace, you can find the Dope Sheet, top left pane. Locate the Key menu, find Interpolation and select linear. I’m sorry but I can’t recall whether you need to this for every animation in the scene, or just once for the complete scene. Anyway, you will see the result in the Graph Editor (below the Dope Sheet), where the curves between the keyframes are linear. Simply.
Now a little bit XML-programming. If making a 3D gauge, you need to both define and code the animation for this gauge (the movement of the needle in a lot of cases). So locate your modeldef.xml with which the B2X (and every other FSX toolset) works with:
C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X SDK\SDK\Environment Kit\Modeling SDK\bin
There, add a line in the top of the document, reading something like this:
Note: more on this can be found in the FSX SDK, Creating XML Gauges, IIRC.
Now, scroll downward and add the following section:
XML code is a kind of formula that has the keyframe position as the dependent variable (output), with the A/L/whatever-variable as independent variable (input). So, in math language it would be:
Y = 2x + 3
In XML, we do:
Keyframe = scale*variable + bias
Mind: this has to be written in reverse Polish notation! More on this can be found in the FSX SDK.
In my example, the code reads that it has to multiply the IAS (in km/h) with a factor of 0.1 in order to go the correct keyframe. So, if I’m flying at 100 km/h, FSX has to put the animation at keyframe 10. Right? Ok, we go on
Now back to Blender. I first choose the labelled tick marks, with in memory the code multiplication. So, I went to frame 0, put the needle at that location (thanks to Alt+Z in texture mode) and hit I, Rotation.
Then, 150 km/h is next, so I go to frame 15, rotate the needle until it hits this tick mark and again insert a rotation keyframe. For 250 km/h, I went to frame 25 and rotated the needle to the 250 tick mark, same for 350 (fr. 35), 450 (fr. 45), 550 (fr. 55), 650 (fr. 65) and the free part of the gauge, somewhere (fr. 80).
Playing this, gives bad results. The needle now will indicate on the gauge, when flying 190 km/h, only 185 or something alike. So, for every tick mark, correct the needle by rotating it at the right tick mark and insert a Rotation keyframe. I had keyframes at 0, 3, 15, 17, 19, 21, 23, 25, 27, 29, 35, 37, 39, 41, 45, 55, 65 and 80. You can see that the largest deviation of non-linear from linear was in the lower speeds range.
You need to check it as follows: choose any speed, multiply it by the scale in you XML code and see if the needle comes at that keyframe for that very speed. If not, correct it and insert a keyframe.
You can see that in the following images. In the first image, the needle SHOULD indicate 450 km/h, since FSX has to put it on frame 45 because of the XML coding. But it doesn’t, since the gauge itself isn’t linear interpolated between 350 and 550. So, in the second picture, you see how I added a keyframe at frame 45 after having put the needle there.
Hope this was clear guys, questions are welcome
Regards, Daan
In order to clarify anything about non-linear gauges, I offered to make a small tutorial on this. I found a little bit of time tonight, so there it is
I want to emphasize that this is not a specific Blender2FSX issue, developers using any Max should have this ‘issue’ as well. It isn’t an issue at all, by the way.
Now, here’s the Airspeed Indicator for my Fokker D.21, the Kollsman 157-010 airspeed indicator. Clearly, it is non-linear. FSX doesn’t support built-in non-linear (eg. logarithmic) interpolation between keyframes, so we have to approximate this nonlinearity in a linear way (right?).
Because FSX doesn’t like non-linear, we have to set the interpolation in Blender to Linear. In order to do so, go to the Animation workspace (not necessarily by the way) through the drop-down as in the figure below.
In the Animation workspace, you can find the Dope Sheet, top left pane. Locate the Key menu, find Interpolation and select linear. I’m sorry but I can’t recall whether you need to this for every animation in the scene, or just once for the complete scene. Anyway, you will see the result in the Graph Editor (below the Dope Sheet), where the curves between the keyframes are linear. Simply.
Now a little bit XML-programming. If making a 3D gauge, you need to both define and code the animation for this gauge (the movement of the needle in a lot of cases). So locate your modeldef.xml with which the B2X (and every other FSX toolset) works with:
C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X SDK\SDK\Environment Kit\Modeling SDK\bin
There, add a line in the top of the document, reading something like this:
Code:
<Animation name="IAS_Kollsman157-010" guid="8B6EDA50-CC79-4436-B539-0134B4FFA9D4" type="Sim" typeParam="AutoPlay" length="80" typeParam2="IAS_Kollsman157-010" />
Note: more on this can be found in the FSX SDK, Creating XML Gauges, IIRC.
Now, scroll downward and add the following section:
Code:
<PartInfo>
<Name>IAS_Kollsman157-010</Name>
<AnimLength>80</AnimLength>
<Animation>
<Parameter>
<Code>
(A:AIRSPEED INDICATED,kilometers/hour) 0.1 *
</Code>
</Parameter>
</Animation>
</PartInfo>
XML code is a kind of formula that has the keyframe position as the dependent variable (output), with the A/L/whatever-variable as independent variable (input). So, in math language it would be:
Y = 2x + 3
In XML, we do:
Keyframe = scale*variable + bias
Mind: this has to be written in reverse Polish notation! More on this can be found in the FSX SDK.
In my example, the code reads that it has to multiply the IAS (in km/h) with a factor of 0.1 in order to go the correct keyframe. So, if I’m flying at 100 km/h, FSX has to put the animation at keyframe 10. Right? Ok, we go on
Now back to Blender. I first choose the labelled tick marks, with in memory the code multiplication. So, I went to frame 0, put the needle at that location (thanks to Alt+Z in texture mode) and hit I, Rotation.
Then, 150 km/h is next, so I go to frame 15, rotate the needle until it hits this tick mark and again insert a rotation keyframe. For 250 km/h, I went to frame 25 and rotated the needle to the 250 tick mark, same for 350 (fr. 35), 450 (fr. 45), 550 (fr. 55), 650 (fr. 65) and the free part of the gauge, somewhere (fr. 80).
Playing this, gives bad results. The needle now will indicate on the gauge, when flying 190 km/h, only 185 or something alike. So, for every tick mark, correct the needle by rotating it at the right tick mark and insert a Rotation keyframe. I had keyframes at 0, 3, 15, 17, 19, 21, 23, 25, 27, 29, 35, 37, 39, 41, 45, 55, 65 and 80. You can see that the largest deviation of non-linear from linear was in the lower speeds range.
You need to check it as follows: choose any speed, multiply it by the scale in you XML code and see if the needle comes at that keyframe for that very speed. If not, correct it and insert a keyframe.
You can see that in the following images. In the first image, the needle SHOULD indicate 450 km/h, since FSX has to put it on frame 45 because of the XML coding. But it doesn’t, since the gauge itself isn’t linear interpolated between 350 and 550. So, in the second picture, you see how I added a keyframe at frame 45 after having put the needle there.
Hope this was clear guys, questions are welcome
Regards, Daan


