Download

Mirroring (horizontal flip) an nDisplay viewport

Hi,

We’re using nDisplay for our (research) driving simulators, and we’re having an issue with car mirrors. In our new setup, mirrors are displayed using a dedicated 7" monitor. Using nDisplay, we’re able to compute the proper view to display, which requires using another camera in the scene, different from the root camera. However, to have the image properly displayed on the monitor, it needs to be mirrored/flip horizontally.

I have attached a screenshot of the issue, showing that with the current nDisplay configuration, the monitor displays the “in” (i.e. car) side of the image to the left, and the “out” (i.e. other lane) side of the image to the right. In real life, it is the opposite.

Our previous simulation tools had the option to mirror/flip a viewport, which is exactly what we needed. However, I have not been able to find such option in the nDisplay configuration file. I have tried several tricks, such as inverting the viewport width (-1024 instead of 1024), but nothing has worked so far.


[viewport] id="vp_mirror" x="1024" y="0" width="-1024" height="600"  projection="proj_simple_mirror"

I also tried to look for external ways (e.g. OS, display driver) of mirroring the image, but there doesn’t appear to be a simple way of doing it, and I’d rather have a built-in solution to this issue.

Can someone suggest a way of obtaining our desired result?

Thanks,

Bertrand

Hi,

have you figured out a way to make this work?
I am having the exact same problem.

I tried adding flip_v=“true” to the config file but nothing changed.

Thanks in advance!

@Zubilaxsch

I just got it to work.

It turns out nDisplay supports some PostProcessing.

With OutputRemap , you can control the way the 2D image, generated by nDisplay, maps to the 2D area of the application window

So I used the example from the article, and the following OBJ as remap

v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000

vt 1.000000 1.000000 0.000000
vt 0.000000 1.000000 0.000000
vt 0.000000 0.000000 0.000000
vt 1.000000 0.000000 0.000000

f 1/1 2/2 4/3 3/4
1 Like

However, I’m pretty sure it won’t work in 4.27. We’ll have to wait for the updated documentation to see how PostProcess now works.

Thank you so much for your reply!

This is definitely something to test out. Hopefully with 4.27 we get this feature implemented with nDisplays added functionality.

Meanwhile, I used a Script called Multi Window Manager, which is included in the Automotive HMI Starter Kit. After I ported the script to my project, I created a render target from the according rearview camera and created a material out of it. Then I created a new Blueprint Widget and dragged the rearview material in there. In the Widget-Editor, you are able to mirror this view. Finally, in the Multi Window Manager, you select the according Widget.

Sadly, the script wasn’t really made for that purpose, so it supports only one display until now. This is caused by the internal naming convention for the window names. E.g., it creates two windows (left and right mirror) but names them both the same, which I guess windows is not able to handle properly…
I did not have any time to improve on this solution yet, but it seems to be kinda promising.

I’ve looked at the source code for 4.27, and the feature is still there, but it’s been moved elsewhere in the code (I was afraid it had been removed completely). However, since the old *.cfg files will be deprecated, we’ll have to wait for the docs to see how to use this feature with the new file format.

I’ve looked in the new nDisplay Editor, but there doesn’t seem to be a UI option for remap post process. I imported my 4.26 *.cfg file (that had a remap PP) into the new 4.27 nDisplay asset, then exported it as new format (*.ndisplay), but there was no entry for the remap PP.

I’ll try to dig into source code to find the new way to specify remap PP in *.display files.

Looking at the code, it seems configuration keywords are the same in 4.27, it’s just that now they’ll be in JSON.

However, it also seems that they added an alternative to OBJ mesh in the form of mesh component! From what I gather, if you attach a Static Mesh Component to your nDisplay root actor, you can pass its name in the config file (under “mesh” keyword) to be used for remap PP.

For UE4.27, the doc is here.