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

P3D v4 Views in a MFD gauge

Roy Holmes

Resource contributor
Messages
1,805
Country
us-virginia
Is there a way to have a view such as the IR or NVG displayed within a gauge like a MFD?
Roy
 
Hi Roy

I have a working FLIR in VC and 2D panels using the following learnt from the Tacpack SDK.

Aircraft.cfg entry:
Code:
[CameraDefinition.N]
Title = "VRSTP FLIR"
Guid = {make-your-own-guid-for-use-here}
Origin = Center
Category=Aircraft
MomentumEffect = FALSE
SnapPbhAdjust = Swivel
SnapPbhReturn = FALSE
PanPbhAdjust = Swivel
PanPbhReturn = FALSE
Track = None
ShowAxis = TRUE
AllowZoom = TRUE
InitialZoom = 0.50
SmoothZoomTime = 2.0
ZoomPanScalar = 1.0
ShowWeather = TRUE
XyzAdjust = TRUE
ShowLensFlare=FALSE
PitchPanRate=30
HeadingPanRate=70
PanAcceleratorTime=0
CycleHidden=Yes
MenuHidden=Yes
InitialXyz=0.0, 0.0, 0.0
InitialPbh=0.0, 0.0,0.0

Then I use the following in the panel:
XML:
<Element>
  <Visible>(C:VRSTP_Util:FLIRShow, bool)</Visible>
  <Texture Name="VRSTP_FLIR_VIDEO_TEXTURE" Width="185" Height="185"/>
</Element>

I think you can replace the texture name with whatever camera you have setup in the aircraft.cfg. I also had to add the following lines to the panel.cfg in the applicable windowXX:

textures_below_panel=1
textures_use_additive_blend=1


Hope you get it working.
 
Hi Mike
This is for Portal 1 of an F-35 MFD which is the left side of the left two portal display. With this I would have a choice of 6 displays in that portal, and I think it should work, Wil try it and let you know. It is the P3D native white hot IR display which I will try to use, No Tacpac in this bird.
Thanks
Roy
 
Without TACPACK, you would need to write your own PDK dll to link the texture name with a camera window.
 
Thanks, I believe there is a sample in the SDK that would get me started on that.
Roy
 
Close but not quite. One thing that is undocumented is getting the camera views and depth stencils. You have to create a Window plugin to handle the camera, and set it to render to texture mode. Then in your Render plugin Render call, you need to call pRenderData->GetTexture("WindowName"); which returns the ID3D11ShaderResourceView pointer for the actual display, and pRenderData->GetTexture("WindowNameDepth"); for the depth stencil if you are going to unproject any pixels. And on that note, the depth stencil needs to be loaded into a Texture2DMS<float2> object in your shader because the depth stencil is multi sampled. The x value of the returned pixel when you read the depth buffer is the depth value, the y is the stencil value.
 
Why would I need to consider shaders if I am using a standard post process?
Roy
 
Because fitting camera views into only a portion of a texture requires use of DirectX draw calls which can't be done without at least a vertex shader and a pixel shader.
 
Suppose I had the texture divided in two, each half with a different name, how would that play?
Roy
 
Well...if your textures are texture objects in an XML gauge where you have control over their visibility and location without using a shader, you could get away then with getting the ID3D11Texture2D object for the target texture using the ID3D11RenderTargetView::GetResource method, (The ID3D11ShaderResourceView object for the source texture has the same method), and then just use the ID3D11DeviceContext::CopyResource call to copy from one to the other, provided that they are of the same dimensions and pixel formats.

P.S. You could call me spoiled :) . I enjoy the control I have over rendering with shaders too much lol
 
In the F-35, the left half of the big MFD can be a single screen. The texture is set up that way. I’ll start with that scenario and see how good that looks. This is a jump for me and I would like to ask for help, but only when I am completely stumped, if that is OK by you.
Roy
 
By all means. I would recommend you use the invisible systems gauge template in the resources section with the v4 gauges.h and the query_pdk function to replace the sample's method of obtaining the PDK via a dll loaded via the dll.xml. If you need help converting the template to x64 I will see what I can toss up.
 
Looking closer at what I have to work with, it is a texture object which is also used for the Tacpack TFLIR (when Tacpack is in use, not the case here) There is one available for each portal so I do not have to worry about splitting textures. So I'm assuming I can use the method you outlined in post 10 above. However I have no idea how to find ID3D11RenderTargetView::GetResource method let alone use it if I located the details! Ditto ID3D11DeviceContext::CopyResource !
Roy
 
In the SDK, Camera configuration section, Sensor and Post Processing view options it says about IR or NVG options:
" Either view type can be combined with RenderToTexture settings to create a glass-cockpit display showing a sensorized or post processed view. "
and
Render To Texture Options
Views can be configured to render the scene into a virtual texture. These textures can be used in the same way that VCockpit panel textures are used to map the output onto a polygon in the virtual cockpit.
RenderToTexture False/True. Enables or disables render-to-texture functionality. These views are not selectable in the view menu and are only displayed if embedded in a panel, virtual cockpit, etc.

The SDK includes several example files that you can use to observe how changes to camera configuration settings affect behavior. Copy the .FXML files to the %USERPROFILE%\Documents\Prepar3D v4 Files folder and then load them in Prepar3D.

All of which suggests I do not need PDK to display an "IR" image on a texture object. Since these are not Custom views I should not need FXML file either.

Has anyone tried this?
Roy
 
Not sure if that will work with texture objects defined in XML gauges though. But worth a try.
 
I have seen it work as advertised and it seems to do all that I need. The process is as Mike Standen described it.
Roy
 
I have it at a field of view of 25 by 25 degrees, pointing straight ahead with an attitude HUD style display overlaid, conformal with the scene, that includes an accurate velocity vector. This greatly improves low altitude flight ops at night as well as things like the set up for air to air refueling at night.
So you can do it without Tacpack or PDK using stock sensors and standard XML.
Roy
 
I have it at a field of view of 25 by 25 degrees, pointing straight ahead with an attitude HUD style display overlaid, conformal with the scene, that includes an accurate velocity vector. This greatly improves low altitude flight ops at night as well as things like the set up for air to air refueling at night.
So you can do it without Tacpack or PDK using stock sensors and standard XML.
Roy

Hi Roy, could I ask how it was that you found a way to call the camera image into an XML gauge script? I was trying to do the same thing to create a simple, "quasi" FLIR camera in one of my F-18's MFD displays. I can see that it works in the same way as the creation of working rear-view mirrors, but can't figure out how to call the camera / view.
 
Hi Deano,
I have it working as two of eight selectable displays on the F-35 Portal 4. The only remaining issue is how to record what it displays separately from the normal forward view.
Roy
 
Back
Top