Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simulator Viewport Rotation setting has no effect #767

Closed
2 of 5 tasks
michaelosthege opened this issue Oct 8, 2023 · 11 comments
Closed
2 of 5 tasks

Simulator Viewport Rotation setting has no effect #767

michaelosthege opened this issue Oct 8, 2023 · 11 comments
Assignees
Labels
bug Something isn't working Delivered Code for this issue is in a generally available Helios Release fixed Code is complete, waiting for release

Comments

@michaelosthege
Copy link


Describe the Helios Issue

Using v1.6.602 (the latest right now) I'm trying to rotate my left MFD by 180°.

After setting Rotation="180° Turn", clicking the Configure button in the DCS Monitor Setup has no effect and the button does not disappear.

When setting a 90° rotation, I can save the monitor setup by clicking Configure, but ingame the viewport was still in its original orientation.

Steps to Reproduce the problem

Steps to reproduce the behaviour:

  1. Place an FA-18 MFD viewport on a 2nd monitor
  2. Set its rotation to 90° or 180°
  3. Try to apply the monitor configuration

Expected behavior

I expected the "Rotation" setting to rotate a viewport around its center.

Screenshots

image

Fig 1.: MFD Viewport with 180° rotation setting

image

Fig 2.: "Configure" button doesn't execute

Please complete the following information:

  • Helios Version v1.6.602
  • DCS Version Open Beta 2.8.8.43704

The problem happened while using

(place an 'x' between the square brackets for all that apply)

  • Profile Editor
  • Control Center
  • Keypress Receiver
  • Something else (remember to tell us what it is)

Additional context

Just started using Helios today, because I couldn't rotate the MDF viewport in pure DCS monitor config.
Even though my MFD is still upside down, I'm very impressed by Helios so far!

This is the monitor configuration from the profile, with the ROT180 edited by hand:

    <Monitor>
      <Location>3840,10</Location>
      <Size>800,600</Size>
      <Hidden>False</Hidden>
      <Orientation>DMDO_DEFAULT</Orientation>
      <AlwaysOnTop>True</AlwaysOnTop>
      <Background />
      <Children>
        <Control TypeIdentifier="Helios.Base.ViewportExtent" Name="F/A18C LEFT_MFCD" SnapTarget="True" Locked="False">
          <FillBackground>True</FillBackground>
          <BackgroundColor>#8081D42F</BackgroundColor>
          <FontColor>#FFFFFFFF</FontColor>
          <Font>
            <FontFamily>Franklin Gothic</FontFamily>
            <FontStyle>Normal</FontStyle>
            <FontWeight>Normal</FontWeight>
            <FontSize>24.9646302250805</FontSize>
            <HorizontalAlignment>Center</HorizontalAlignment>
            <VerticalAlignment>Center</VerticalAlignment>
            <Padding>
              <Left>0</Left>
              <Top>0</Top>
              <Right>0</Right>
              <Bottom>0</Bottom>
            </Padding>
          </Font>
          <Text>FA_18C_LEFT_MFCD</Text>
          <ScalingMode>Height</ScalingMode>
          <Location>82,0</Location>
          <Size>647,610</Size>
          <Rotation>ROT180</Rotation>
          <Hidden>False</Hidden>
          <ViewportName>FA_18C_LEFT_MFCD</ViewportName>
          <RequiresPatches>True</RequiresPatches>
          <Children />
        </Control>
      </Children>
    </Monitor>

I found the Configure method in MonitorSetupViewModel.cs#L386. Maybe the callbacks passed as installationDialogs don't work? Because I never saw any dialogs, but the installation apparently failed.

And what's the matter with the DisplayOrientation enum which is in the XML but not in the GUI?

Oh and of course I tried to rotate the screen in Windows, but the damn thing just ignores that.

@michaelosthege michaelosthege added the New Issue Label given to issues which have not yet been triaged label Oct 8, 2023
@BlueFinBima BlueFinBima added bug Something isn't working and removed New Issue Label given to issues which have not yet been triaged labels Oct 9, 2023
@BlueFinBima
Copy link

BlueFinBima commented Oct 9, 2023

@michaelosthege Thanks for bringing this to my attention. Rotating a viewport makes absolutely no logical sense since the viewport is rendered by DCS and Helios does not have the ability to influence the orientation. The layout editor for the viewport should not provide the option.

@BlueFinBima
Copy link

@michaelosthege If you want to rotate the exported MFD viewport within Helios, then the "Screen Replicator" in the "Special Controls" category will allow you to take viewport rendered somewhere inconsequential, and then rotate it when Helios renders it.

BlueFinBima added a commit that referenced this issue Oct 9, 2023
@BlueFinBima BlueFinBima added fixed Code is complete, waiting for release Awaiting Delivery Fixed and awaiting shipment in a new release labels Oct 9, 2023
@BlueFinBima BlueFinBima self-assigned this Oct 9, 2023
BlueFinBima added a commit that referenced this issue Oct 9, 2023
@BlueFinBima
Copy link

image

@BlueFinBima BlueFinBima added Delivered Code for this issue is in a generally available Helios Release and removed Awaiting Delivery Fixed and awaiting shipment in a new release labels Oct 10, 2023
@BlueFinBima
Copy link

Shipped in 1.6.6030.1

@michaelosthege
Copy link
Author

michaelosthege commented Oct 10, 2023

@michaelosthege If you want to rotate the exported MFD viewport within Helios, then the "Screen Replicator" in the "Special Controls" category will allow you to take viewport rendered somewhere inconsequential, and then rotate it when Helios renders it.

Thanks for this pointer!

With the Screen Replicator I'm getting closer to a solution. I tried to place the viewport just outside the small screen, but within the render area:

image

(The left red rectangle is the left MFDC viewport.)

An in-game screenshot confirms that the viewport is there:

image

However, it looks like the screenshot only captures the screen are, not the render area:
If I place the center of the screenshot area on the top right corner of the bottom-left screen, the screenshot contains half the content rendered on the screen and remains transparent in the area where the viewport is located.

It will probably work to add another monitor just for displaying the viewports, but this would almost double the total render area 🤔

Do you have an alternative idea? How hard would it be to make the screen replicator also capture off-screen render area?

EDIT: Maybe this https://stackoverflow.com/questions/891345/get-a-screenshot-of-a-specific-application

@michaelosthege
Copy link
Author

michaelosthege commented Oct 11, 2023

I tried the screen replicator, but it maxed out at a couple of FPS with considerable lag. I think this is because its capturing the whole screen, which in my case is 7680x2760.

So I searched for alternatives that might be more efficient and found this: https://github.com/justinstenning/Direct3DHook

This hooks into Direct3D 9/10/11 and gets the frame data from the "back buffer", actually just copying the region of interest.

I tested their "TestScreenshot" app with DCS and it managed to screenshot the off-screen region at about 7 fps.
And this was in a way that only triggered the next screenshot once the previous one got displayed in the Windows Forms app, so with some refactoring towards a one-way pipeline it should give enough FPS to look good.

@BlueFinBima
Copy link

BlueFinBima commented Oct 12, 2023

Without knowing a little more detail, my current thinking is:

  1. If the two MFD monitors are sitting on generic HDMI controllers, there will be a way for the controller to rotate the image. The question will be whether it is accessible. Sometimes there is a jumper or solder link. Sometimes, it needs to be done in software/firmware. Worth taking a look at the circuit board.
  2. Reexamine the possibility for the physical monitors to be rotated so the image does not need to be rotated.
  3. Try the Adjustable Screen Replicator in 1.6.603. It captures the screen image differently. Might be better, might be worse.
  4. Have you tried asking on the DCS Forum... someone might know a way to patch the Lua for the viewport so that it is rotated when rendered.
  5. Monitor configurations - I'm making many assumptions here... I think you have a 7680x4320 monitor and the monitor is set to halve the vertical resolution (but I don't understand the aspect ratio shown in your attached image - it looks wrong). You then have two 600x600 screens for the MFDs. If the assumptions are correct (or close), then I would configure like
    image
    Monitor 2 is a 600x1200 screen created and defined using https://www.amyuni.com/downloads/usbmmidd_v2.zip . This has the two 600x600 viewports rendered to it. Monitors 3 & 4 are the two 600x600 real screens.
    Unfortunately, I can 't simulate this configuration in DCS Monitor Setup Interface due to a bug, but in the Monitor Layout
    section of the interface, for the "In-Game View", monitor 1 should be blue and ticked, monitor 2 should be white and ticked, monitors 3 & 4 should be unticked and white.

How hard would it be to make the screen replicator also capture off-screen render area?

Have you tried it? The capture location for the Screen replicator does not have to be a location on the current monitor, and it can take a negative offset.

Thanks for the links however the Screen Replicator is so niche that I don't know that anyone uses it (other than you) so completely changing the screen capture is unlikely to ever have sufficient priority to get implemented. I'm happy to consider a PR if you want to submit it ;-)

@michaelosthege
Copy link
Author

Currently at work, so I can't take a screenshot, but this is my monitor configuration:

grafik

For the tests I expanded the green box to cover all monitors (I know, not the most efficient), but eventually I'd like to keep the right 4K monitor deactivated because only the left one and the small ones are attached to my simpit.

  1. [...] Worth taking a look at the circuit board. 👉 Thanks, I'll take a look!
  2. Reexamine the possibility for the physical monitors to be rotated so the image does not need to be rotated. 👉 I did, but the issue comes from the horizontal polarization of the LCD, and because its going to be an MFD/UFC/MFD setup, I can't rotate it..
  3. Adjustable Screen Replicator 👉 Thanks I'll try!
  4. asking on the DCS Forum 👉 yes, in this thread but no solution

Have you tried it? The capture location for the Screen replicator does not have to be a location on the current monitor, and it can take a negative offset.

Yes I tried that, and the screenshots it took were partially transparent, right in the off-screen area. That's why I'm excited about the Direct3D thing.


In your 5. proposal, are you suggesting to create a "virtual monitor" using this usbmmidd thing and then screenshot-replicating from those virtual monitors to the real ones?

@BlueFinBima
Copy link

BlueFinBima commented Oct 12, 2023

screenshots it took were partially transparent

Not sure I understand why some viewports get exported with no background and some have a black background, however the setup in 5. causes Monitor 2 to be black so if the viewport is transparent, the capture is not.

I am suggesting creating a virtual monitor and have it operate as you describe.

@michaelosthege
Copy link
Author

Got it working: https://github.com/michaelosthege/ViewportReplicator

Details and screenshots are in the README.


I looked up the PCB800099 manual, but there was no documentation about hardware settings, and I didn't want to disassemble it again..

I also didn't try the Adjustable Screen Replicator, but from the way how it takes screenshots, it would probably require placing the viewport in a different position too, while my solution via Direct3DHook doesn't require the viewport to be visible in the foreground.

@BlueFinBima
Copy link

@michaelosthege Many thanks for documenting what you've investigated and accomplished. I'll take a look at your repo, and hopefully there will be options for a wider audience for your code. Thanks for sharing.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Delivered Code for this issue is in a generally available Helios Release fixed Code is complete, waiting for release
Projects
None yet
Development

No branches or pull requests

2 participants