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

Vector v BMP questions

Messages
137
Country
us-southcarolina
I'm a newb here and will be posting an introduction post soon but had a couple of quick gauge questions.

I'm making a custom XML HUD for personal use and had a couple of questions about using vector objects (ie polylines, shapes, etc) versus BMP in the moving parts. As an example we'll just talk about the "ladder" used for "Pitch Scale"in a HUD. From the visual stand point the Vector approach is definitely going to give a cleaner/sharper/resolution independent result. While code overhead of the manipulation of the ladder object in either approach would, I assume, be the same, there is a lot of code involved in "drawing" a vector based ladder (not to mention all the other moving elements) v. just calling up an image bitmap. From a performance standpoint I have no idea which approach method is going to take the least amount of system resources and give the best FPS results ??? thoughts or experience ?

Then working with XML vector graphics, can the code for vector object be kept in a "container" in separate XML file or other file type, or declared/defined in some other section of a file and called similarly to the way one would use/call an image BMP object ? I have studied a few examples of vector based object creation and use and noticed that every time and object is used in different places in a gauge that all the code for drawing the object is re-entered. These seems to be a very in-efficient method.

The whole reverse polish notation thing with FSX/ACE drives me nuts, and in my limited experience ACE it is not a very elegant tool for gauge design. I have seen a suggestion here of using the FS9 SDK, that the schema is not as wordy as FSX. Does it use the same reverse polish notation? I normally use Notepad++ to write XML and script code. Detailed documentation, examples for FSX seem hard to come by, even many of the examples from MS have been placed on an archive server at MS that never seems to be online anymore. If I create with FS9 SDK is it going to be fully compatible with FSX? Is a tool like FS Panel Studio of any real use in gauge creation ?

thanks for your input

Joel
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
Hi,

The FS9 schema does almost everything the FSX one does. Yes, it uses the same RPN. I think Bill in a recent thread said you cannot rotate an arc, but there is a workaround. I have not found any of my FS9 gauges to be incompatible with FSX, i.e. no crashing, etc. There are a few things that the FSX XML parser interprets differently than the FS9 one does however. Since I'm working on panels for both FS9 and FSX I detect the sim in use and use the correct logic for that sim. If yours are only for FSX then that problem does not apply.

There are Macros that you can use to reuse code, but I don't know if vector graphic commands can be placed into them. I've only used bitmaps so can't comment on the rest.
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
Vector is far superior in performance than raster.
 

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
Naruto,
In the real world modern HUD's have both vector and raster displays where the raster is used for Video like FLIR and the vector/stroke method draws all the symbols during the raster vertical retrace periods. The two methods are complementary.

But the question was about vector versus bitmap presentation of pitch ladders, not raster and I am not aware of any pure raster implementations in XML or other sim code methods. In my experience, bit maps are faster than vector drawing in XML.
Roy
 
Messages
137
Country
us-southcarolina
Thanks for the replies....

Numbers will be vectors too?
Yes, ie GaugeText

When using a vector based object "Element" I assume the Element as a whole would honor the same attributes, like Scale, Shift and Rotate etc that can be applied to Image Element ?
Can a vector based filled rectangle be use the same way as a "ImageMask"? Would it just be black filled polygon with no line width like an unstroked shape in illustrator or Photoshop ?

Thanks

Joel
 
Messages
1,564
Country
thailand
Yes, ie GaugeText

Then, before you commit totally to a vector solution, I suggest that you experiment some using both a .bmp ladder which already contains the pitch numerals and gauge text to decide if you like the appearance of the rotated text.
 
Last edited:

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
Naruto,
In the real world modern HUD's have both vector and raster displays where the raster is used for Video like FLIR and the vector/stroke method draws all the symbols during the raster vertical retrace periods. The two methods are complementary.

But the question was about vector versus bitmap presentation of pitch ladders, not raster and I am not aware of any pure raster implementations in XML or other sim code methods. In my experience, bit maps are faster than vector drawing in XML.
Roy

I'm aware of that. The reason I say vector is better than bitmap is because bitmaps have a lot of transparent pixels that will always be processed. This is far slower than just the pure shape of a vector drawcall in GDI/GDI+.
 

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
This is far slower than just the pure shape of a vector drawcall in GDI/GDI+.
I'm sure that is quite true, but again it was not the question.
The OP wanted to know about the relative merits of vector vs bitmap pitch scales in XML, not in GDI.
Roy
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
XML script is converted into GDI commands internally by the sim
 
Messages
137
Country
us-southcarolina
Then, before you commit totally to a vector solution, I suggest that you experiment some using both a .bmp ladder which already contains the pitch numerals and gauge text to decide if you like the appearance of the rotated text.

rpmc,

Thanks for the tip. I will compare. I get the feeling that you've seen both and have an opinion ? In other HUDs that I've studied I have noticed that many use vectors for many of the elements but use a BMP ladder. From what I can tell the stock F-18 uses a vector ladder and i used that in my LotusSim L-39 and didn't have a pronlem with that. It's either vector or the raster ladder image is encoded in the dll as i can't find any separate ladder BMP for it (or any of the F-18 gauges). ? My plan is to use a digital looking font thru out (Glass Gauge) so some distortion on rotate hopefuly won't be an issue. I already have a BMP ladder design that I will be using as a map to get all my vector points so i should be able to test that aspect fairly soon.

Joel
 
Messages
1,564
Country
thailand
Hi Joel,

It's a suggestion having to do with appearance of text starting in FSX where anti-aliasing is applied. Consider the following image and the XML behind it:

upload_2017-2-27_8-4-13.jpeg

Code:
<Element Name="BACKGROUND RECTANGLE">
   <Position X="0" Y="0"/><Rectangle Width="110" Height="90" FillColor="skyblue" Bright="Yes" />
</Element>

<Element Name="LONGITUDE">
   <Position X="4" Y="10"/>
   <FormattedText X="102" Y="9" Font="courier new" FontSize="8" LineSpacing="8" Color="white" BackgroundColor="darkblue" Bright="Yes" Align="Right">
       <String>%((A:PLANE LONGITUDE, degrees))%!10.5f! :LONGITUDE</String>
   </FormattedText>
</Element>

<Element Name="LONGITUDE">
   <Position X="4" Y="25"/>
   <FormattedText X="102" Y="9" Font="courier new" FontSize="8" LineSpacing="8" Color="white" Bright="Yes" Align="Right">
       <String>%((A:PLANE LONGITUDE, degrees))%!10.5f! :LONGITUDE</String>
   </FormattedText>
</Element>

<Element Name="LONGITUDE">
   <Position X="4" Y="40"/>
   <FormattedText X="102" Y="9" Font="courier new" FontSize="8" LineSpacing="8" Color="tan" BackgroundColor="0xfafafa" Bright="Yes" Align="Right">
       <String>%((A:PLANE LONGITUDE, degrees))%!10.5f! :LONGITUDE</String>
   </FormattedText><
/Element>

<Element Name="LONGITUDE">
   <Position X="4" Y="55"/>
   <FormattedText X="102" Y="9" Font="courier new" FontSize="8" LineSpacing="8" Color="lime" BackgroundColor="0x010101" Bright="Yes" Align="Right">
       <String>%((A:PLANE LONGITUDE, degrees))%!10.5f! :LONGITUDE</String>
   </FormattedText>
</Element>

<Element Name="LONGITUDE">
   <Position X="4" Y="70"/>
   <FormattedText X="102" Y="9" Font="courier new" FontSize="8" LineSpacing="8" Color="white" BackgroundColor="0x000000" Bright="Yes" Align="Right">
       <String>%((A:PLANE LONGITUDE, degrees))%!10.5f! :LONGITUDE</String>
   </FormattedText>
</Element>

<Element>
   <Position X="4" Y="80"/>
       <Text Bright="Yes" X="112" Y="8" Length="25" Fixed="Yes" Font="courier new" Color="white">
           <String>%((A:PLANE LONGITUDE, degrees))%!10.5f! :LONGITUDE</String>
       </Text>
</Element>

You can see the effects of FSX's (I'm running FSXA) anti-aliasing on lines 2, 4, 5, and 6 where BackgroundColor has been omitted or a non-opaque BackgroundColor has been applied. Applying an opaque BackgroundColor in <Text> or <FormattedText> is the only way I know of to get the text to appear more like a crisp bitmap - like it was in FS9, and as one would want in a HUD display using rotated gauge text. As the text size shrinks, as it likely does in a HUD display, the anti-alias ghosting is even more noticeable, IMHO.

On the other hand, if you apply an opaque BackgroundColor for the pitch numbers, it will ruin the HUD display.

For that reason, I suggested that you experiment with gauge text to see if you like the results, and if not, then a .bmp image of the ladder may be more appealing to the eye.

If others reviewing this response have a way around this or a different idea of any sort, then I would be very grateful to know all about it. Perhaps these are artifacts of my monitors or graphics card? Additionally, I don't know what happens in P3D as I have not looked into that.

I like your project and the idea to rotate and shift vectors instead of using the fall-back .bmp ladder, and I hope it turns out well for you. However, I agree with Roy (#5) who indicates that the XML HUD examples out there use a .bmp ladder.

BTW, you are correct that you can Shift and rotate text in an Element.

Bob
 
Last edited:

taguilo

Resource contributor
Messages
1,585
Country
argentina
AFAIK XML <Element> structures display bitmaps, which can be constructed by loaded .bmp images (<Image>) or by gauge defined areas following a hierarchy (<Gauge>,<Size>,<Rectangle>,etc).

There is no actual vector drawings. Structures like Pie, Rectangle, Polygon, etc. build geometric figures only once when the gauge loads, then they are converted into internal bitmaps and refreshed depending on their controlling scripts. So, for example, displaying/rotating/scaling an image performs the same whether it comes from a .bmp file of 10 x 3 pix or a "vector" of the same size.

When using "vector" figures instead of .bmp files, FS applies antialiasing algorithms between the foreground and background objects.

In case of Text images, I believe True Type fonts like Courier New, Glass Gauge, etc, are obtained directly from Windows OS and projected against a background defined on the same Text line. When that background is transparent, FS cannot apply antialiasing for obvious reasons, so the distortion shown by Bob is product of the semitransparent pixels of the vector objects converted to black by FS interpreter.
Instead, if ms sans serif is used the problem dissapears, because that is a raster (bitmap) font, and it seems to be projected onto any background present on the gauge, not only the one of its own Text line.

Tom
 
Last edited:
Messages
1,564
Country
thailand
AFAIK <Element> structures display bitmaps, which can be constructed by loaded .bmp images (<Image>) or by gauge defined areas following a hierarchy (<Gauge>,<Size>,<Rectangle>,etc).

There is no actual vector drawings. Structures like Pie, Rectangle, Polygon, etc. build geometric figures only once when the gauge loads, then they are converted into internal bitmaps and refreshed depending on their controlling scripts. So, for example, displaying/rotating/scaling an image performs the same whether it comes from a .bmp file of 10 x 3 pix or a "vector" of the same size.

When using "vector" figures instead of .bmp files, FS applies antialiasing algorithms between the foreground and background objects.

In case of Text images, I believe True Type fonts like Courier New, Glass Gauge, etc, are obtained directly from Windows OS and projected against a background defined on the same Text line. When that background is transparent, FS cannot apply antialiasing for obvious reasons, so the distortion shown by Bob is product of the semitransparent pixels of the vector objects converted to black by FS interpreter.
Instead, if ms sans serif is used the problem dissapears, because that is a raster (bitmap) font, and it seems to be projected onto any background present on the gauge, not only the one of its own Text line.

Tom
Thanks so much Tom! That problem has bugged me ever since FSX was introduced. I wonder, is there a monospace equivalent of ms sans serif? I've downloaded "bmp" fonts in the past, but with no success in FSX.

Bob
 
Messages
137
Country
us-southcarolina
AFAIK XML <Element> structures display bitmaps, which can be constructed by loaded .bmp images (<Image>) or by gauge defined areas following a hierarchy (<Gauge>,<Size>,<Rectangle>,etc).

There is no actual vector drawings. Structures like Pie, Rectangle, Polygon, etc. build geometric figures only once when the gauge loads, then they are converted into internal bitmaps and refreshed depending on their controlling scripts. So, for example, displaying/rotating/scaling an image performs the same whether it comes from a .bmp file of 10 x 3 pix or a "vector" of the same size.

When using "vector" figures instead of .bmp files, FS applies antialiasing algorithms between the foreground and background objects.

In case of Text images, I believe True Type fonts like Courier New, Glass Gauge, etc, are obtained directly from Windows OS and projected against a background defined on the same Text line. When that background is transparent, FS cannot apply antialiasing for obvious reasons, so the distortion shown by Bob is product of the semitransparent pixels of the vector objects converted to black by FS interpreter.
Instead, if ms sans serif is used the problem dissapears, because that is a raster (bitmap) font, and it seems to be projected onto any background present on the gauge, not only the one of its own Text line.

Tom

Tom,

thanks for the explanation. So by what I gather from what you said I guess that kind of settles the Vector v BMP performance question. If the Vectors are going to be converted to internal BMPs then it's all the same and it's a hell of a lot easier to design, create, load, manipulate a BMP than a "container" with a collection of vectors be it shapes, lines, text etc. The vector version might load quicker but after that it's all a wash.

thanks
Joel
 
Messages
137
Country
us-southcarolina
Bob, Tom, et al,

I would like to re-visit the font rendering issue that Bob brought up in his earlier post. It is very noticeable, and annoying. In some cases I have gone to using BMP strips for numbers that could very easily be done with text rendering just to get a clean, easy to read look. I have tried using BMP fonts as Tom suggested and can see no difference. Below shows render and a close-up of a airspeed display box using <Text> and MS San Serif font and you can still see the effects of anti aliasing being rendered as black. Compare with the numbers from a BMP strip.

Text example.jpg


This was also done with anti-aliasing turned off in FSX with the same results. It seams as though even though the "font" is a BMP font it's still trying to blend it with the transparent BG.

if anyone has found a that will render clean one transparent HUD please let me know.

I have found that using a semi-transparent "Tinted Glass" behind the HUD helps mask this problem it doesn't change anything about how it renders, just makes it less noticeable.

Thanks
Joel
 
Top