Download

Render 16:9 from headset/HMD

Hey,
Mostly been posting to the answer hub, but find that I don’t get answer there as often so I try to post here.

My question is mostly in the tile, and its about trying to render out a nice 16:9 video instead of the one that is shown by default, which is with black bars on the side. Doesn’t look good at all.
What makes this even more frustrating is that I see tons of Youtuber’s playing VR games, has them rendered out in proper format. Might be the game that fixes it for them, but I don’t know if that’s a third party program or what.
Mainly I wan’t to do it in the editor, as I wan’t to get out video for a trailer.

The tedious way I’m trying now is with downloading from github the latest version, and using this as a guide to change the code of the engine to help some UE4 + HTC Vive Fullscreen VR Tutorial - YouTube
I even saw this which made me quite upset Updates to VR Editor | Feature Highlight | Unreal Engine - YouTube I think its UE4.16 or something like that as I can’t find the same command in my current version. Also its for Oculus, so if that’s a Rift exclusive thing that isn’t for Vive then sad days.
My other thought, and a thing I’m curious with either way, is to get a second camera (that potentially could be placed anywhere) and have that be the render to my monitor.

So yes my question, is it possible with 4.15 to get a 16:9 aspect ratio view in the Engine as is, or is it only possible with custom c++ code?

Yes, it’s 100% possible and I recently got 16:9 aspect ratio working with the Vive. You have to modify the engine source code, so if you’re using a release build, it’s not going to work.

Here’s a reddit post which shows how to do this:
https://www.reddit.com/r/Vive/comments/5259ue/psa_unreal_engine_4_devs_how_to_get_rid_of_the/

Here are the super simple steps:

  1. Open up “SteamVRRender.cpp” located in: \Engine\Plugins\Runtime\Steam\SteamVR\Source\SteamVR\Private\SteamVRRender.cpp
  2. You’re looking for the function “void FSteamVRHMD::RenderTexture_RenderThread(FRHICommandListImmediate& RHICmdList, FTexture2DRHIParamRef BackBuffer, FTexture2DRHIParamRef SrcTexture) const” on line 20.
  3. Right around line 58, you’ll want to copy and paste this code section:


if (WindowMirrorMode == 1)
		{
			// need to clear when rendering only one eye since the borders won't be touched by the DrawRect below
			RHICmdList.ClearColorTexture(BackBuffer, FLinearColor::Black, FIntRect());

			/*RendererModule->DrawRectangle(
				RHICmdList,
				ViewportWidth / 4, 0,
				ViewportWidth / 2, ViewportHeight,
				0.1f, 0.2f,
				0.3f, 0.6f,
				FIntPoint(ViewportWidth, ViewportHeight),
				FIntPoint(1, 1),
				*VertexShader,
				EDRF_Default);*/

			RendererModule->DrawRectangle(
				RHICmdList,
				0, 0,
				ViewportWidth,
				ViewportHeight, 
				0.0f, 0.3f, 
				0.4f, 0.4f, 
				FIntPoint(ViewportWidth, ViewportHeight), 
				FIntPoint(1, 1), 
				*VertexShader, 
				EDRF_Default);
		}


  1. Recompile the engine, package your game, play!

If you wanted to be hard core, you could add in a new window mirroring mode which draws full screen 16:9 aspect ratio, which would then let you send in console commands to switch between mirroring modes.

Note #2 - A small note of caution: I am using an NVidia GTX 970 and when I do game play video capture with VR in 16:9 full screen, my video card has crashed twice. I think I have overheated it.

From discussions on Unreal Slackers I think the correct 16:9 values you are looking for are

0.006f, 0.2825f,
0.44f, 0.4425f,

I did see that yea, as I mentioned was the only solution I found.
But I have a second problem if I’m gonna have to do it that way, and that is that I’m using the Victory/Rama plugin. And it just fails every time I try to open my project with it in.
I really don’t know enough about how the plugins work, but I just get a generic error saying it failed to load and I have to disable it to continue.
The only thing I changed when following a tutorial, was that code. So I have no idea why it wont work.

Thanks anyway.

Edit: I was just stupid with that. When trying to run the engine, it said there was something that needed to be built. I did think I tried building those twice, but tried again today and it seems to work
Thanks again ^^