I’m starting a project soon will require different views of the scene to be displayed by different physical monitors, sometimes with asymmetrical split screens per physical monitor (e.g. 3 camera views in one monitor).
I’ve searched around and found some fragmented info regarding how to go about this (e.g. this thread here), which left me wondering if it is at all feasible with my current UE4 API knowledge (i.e. not great ;)).
Though not shy of these type of challenges, I’d like to know if anyone already implemented that and could at least outline the steps/methods they’ve followed so confused me can avoid some pains.
Hi guys, any more news about this? I am also interested to output multiple cameras to create an imersive environment using beamers in a room. If you found a solution to this, I would appreciate any update.
these days i got an early solution for a seperate window, which acts as a launcher for different maps. It shows a mouse-interactive Widget-Blueprint. (I just have guesses how about showing the 3D world with different camera in it.)
accordingly to the engine’s solution, i looked at the Init() function of UGameEngine to make this. with a minimalistic thought, i got a lot of very different exceptions, so this quite stable version looks a bit overcoded/dirty(?).
This functions are part of a UUserWidget derived class, so in the end, it adds itself to the new viewport. but in principle you can use the code in any uclass:
Because the WorldContext is inaccessable, the UGameInstance is inherited and this function overridden:
void UPXGameInstance::InitializeMainUIContext( AController* controller )
WorldContext = &GetEngine()->CreateNewWorldContext( EWorldType::None );
WorldContext->OwningGameInstance = this;
// create a MainUI world
UWorld* MainUIWorld = UWorld::CreateWorld( EWorldType::None, false, "MainUI" );
MainUIWorld->SetGameInstance( this );
GEngine->DestroyWorldContext( MainUIWorld ); //the world context is not destroyed inside this function, it gets removed from the Engine's World List (to avoid references to this dummy world)
WorldContext->SetCurrentWorld( MainUIWorld );
MainUIWorld->AddController( controller );
In this last function you can see, that a dummy world is created for the new ViewportClient. maybe you can play around with passing the actual game world with a different controller.
Hope this helps.
you should be able to add the first part to a UCLASS of your desire. these are the additional includes: #include “Engine/GameEngine.h” #include “SGameLayerManager.h” #include “Slate/SceneViewport.h” #include “PXGameInstance.h” #include “GameViewportClient.h”
but problems can surely occure since i do not understand the complete engine code
Meanwhile i investigate on the bottleneck that the complete game scene is rendered two times, which even is a desired behaviour if showing a 3D view from each window, but i didnt’ tested this out.
Play with it, i hope i can help
hey, I managed a empty project supporting a separate window, showing a userwidget. you can start a level, control it via the widget and also get a rendertarget streaming to the separate window.
magic happens in the MainUI.cpp, which is managing the slate/window-stuff, and is also derived from userwidget to be the actual displayed widget.
GameManager.cpp is handling the maingame-window, while MainUIGameInstance.cpp is for interaction between the “game”- and “ui”-levels.
the level blueprint of Base_Level brings it all up.
the project works fine at 4.10.4 and also packages and launches quite well on windows at me. input stucks some times a bit. but be aware, until this is not a supported feature of the engine, the solution may get destroyed by the next engine-update.
I am very sorry, I don’t have a clue about your packaging error. maybe you can check the code against the project I uploaded? upgrading from 4.9 to 4.10 required some code adaption. have you set the PrivateDependencyModuleNames in the .Build.cs -file?
the widget itself is set in MainUI.cpp, CreateMainUIWindow():
TSharedPtr<SWidget> UserSlateWidget = TakeWidget();
MainUIViewportClient->AddViewportWidgetContent( ViewportWidget, 10 );
you should be able to pass another widget into the function and replace the TakeWidget()
I’m testing here and found that when I change the parameter values in the new window as the Mouse Click event is initiated the level window enters a state of Pause … nothing happens while I do not finish to modify the parameter in the window HUD … you would know what I can change that when the mouse event occurs in the HUD window the Level not please pause ???
Where I would have to change to instead put a widget inside the window I put a camera somewhere I Level?
I would like to change the parameter of the level object does not enter into a pause state … I think if I put a viewport and then add a HUD interface in the viewport the game not enter into a pause state …
I’m sorry, since i this effect is even appearing in unreal editor (the game is paused during click/drag outside the PIE-viewport), this isn’t fixed easily. referencing to this post, there is a workaround to at least simulate correctly: track the system time during mouse-drag and add it to the next frames delta time. however, this does not unpause the viewport
i assume it is some engine code, configurating the game windows
do you mean, setting up the second window, to show the actual view of a second camera, just like the game-windows does? not just a widget. at the moment, i have no solution for that, but i think it is doable.
the core code of the window creation is taken from [FONT=Courier New]UGameEngine::Init(IEngineLoop* InEngineLoop) and sub-functions. one will take a look here, where the engine is setting the viewport of the actual game-window, and do this accordingly for the new window. maybe another player-controller has do be spawned and passed.
Schlabbermampf, actually I’m trying to create an application within the Unreal Engine … and would need a new window to submit a interface where I could control all objects of Level being loaded … So that part I’ve got making reflect the screen objects by C ++.
What is being harder it is to find a way to extend the windows … I’ve done some tests in multiplayer mode and to work, more the problem is that in multiplayer mode I need to load into memory machine 2 Levels while every window and it would require a lot of processors …
Now I wonder if you could or know someone who could make a Free-Lance just to assemble a window with HUD not to pause the game when a control is changed … I’m in Brazil … and could make payment PayPal … I am a student and also would be willing to pay the amount of $ 115 … what do you think?
i didn’t try but i would try the following: build up your entire screen space from the top left corner: place the first window on (0,0) and size it accordingly to the screeninfo from GetFullScreenInfo(). put the next window on ((previous)WindowSize.X + 1, 0) and scale it by the new info from GetFullScreenInfo() (which gives now the screen info of the second monitor, because the window is placed there). go on like this, until the upper screen row is done and continue with the next screen row.
maybe something like this works xD but be carefull of your frames if rendering that much pixels