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

FSX Direct2D Gauges

cheangjc

Resource contributor
Messages
111
Country
singapore
Hi,

I recently began experimenting with using Direct2D for my gauge drawing, this is what I have achieved so far (Ignore the diagonal cutting line which displaces the image, its a ATI thing):

ECAMD2D.png


However, the drawing is not as good as I expected it to be, its crisp but not as smooth (Anti-Alias issues) as I hope it to be.

Anyone who uses this drawing method have any tips on how to improve the image/rendering quality? There is mention of MSAA on the Direct2D SDK, but it requires interop with Direct X 10/11 which I have little knowledge of now. Any help appreciated :)
 
I haven't used D2D for a while now (switched to D3D10/11 but unfortunately due to company regulations I am forbidden from sharing the details on that for a while yet).

Did you try calling SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); (its a method in your render target object) right after binding it to your DC?
 
Hi,

Yes, I did use that antialias mode after binding DC and before BeginDraw.
 
http://xboxforums.create.msdn.com/forums/t/61448.aspx

I think you should only have to do it once after setting the render target though.

Looked up the MSAA part though and IMO I think it would end up being more trouble than it is worth. I would sooner go with D3D10/11 only instead of trying to mix D2D and D3D.
 
Last edited:
I just tried the same exact code in P3Dv2, and the results is 10 folds better:

better.png


I do not know the reason for this, but the graphics are what I expect now.... Maybe mixing DX9 and D3D is not that good idea.

Although, I guess I will have to pick up D3D11 and learn the hooking basics soon if I want something much more advanced.
 
There aren't really any problems with using D2D/D3D10/11 in FSX gauges because the results always get drawn to a device independent bitmap totally outside of the graphics engine. That bitmap is then blitted to the textures in the graphics engine.

I think the reason why it looks so much better in P3D v2 is because they are probably performing their own anti aliasing on the texture once it gets in to the graphics engine while FSX does not. Chances are if you looked at the raw bitmap before it got into the sim you would still see the same unsmoothed lines.

Looks good though. If I may ask, which airbus addon is that?
 
Last edited:
Makes Sense. I think FSX does that too, maybe one of my settings, not sure.

Anyways, now I am working on a way to store geometry once for each instance of the gauge, so that there is no need to Create Path Geometry every frame as it can get pretty costly.
 
Last edited:
Looks good. Glad I could help out there. Just watch out for memory consumption. It might be a good idea to release some of those geometries when they aren't being used.
 
There aren't really any problems with using D2D/D3D10/11 in FSX gauges because the results always get drawn to a device independent bitmap totally outside of the graphics engine. That bitmap is then blitted to the textures in the graphics engine.

Indeed. Nice thing that.

I wonder if it were possible to render to a texture, not just a gauge. Especially in case of scenery (as is apparently possible in P3D2)
 
If your scenery has a texture with a $ in the name and the name matches that of the $ texture in your aircraft then what you see in the pit will appear in the scenery. Unfortunately, this will only work if the aircraft you are flying has a texture with that $ name....From what I can tell P3D is not panel dependent though.
 
Back
Top