• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Tut: Non-linear gauges and Blender interpolation

Dutcheeseblend

Resource contributor
Messages
1,541
Country
netherlands
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 :D
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?).

NLG_tut_01.PNG



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.

NLG_tut_02.PNG


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.

NLG_tut_03.png


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.

NLG_tut_04.PNG


NLG_tut_05.PNG


Hope this was clear guys, questions are welcome ;)

Regards, Daan
 
Thank you, Thank you, Thank you Mr. Daan!!!!!!!:D:D:D

That helps me a lot! My Video on making 3D gauges was not correct. I will have to re-make that video now.

Thank you, MR. Daan! Very good tutorial.

Kris:)
 
Back
Top