Hi, very new to UE. hoping there’s someone with a good knowledge of the UE4 rendering system who can help us.
We are in the process of migrating to UE4 and need to add Nvidia’s 3DVision stereoscopic 3D support. There seems to be a good amount of stereo support but nothing complete yet for frame sequential stereo or Nvidia’s stereo api.
We know how to set it up in a generic DX c++ app but obviously have no idea where to put/access everything in Unreal.
This post https://forums.unrealengine.com/showthread.php?4950-VR-for-projection-environments&highlight=stereoscopic has some good starting tips but I wanted to see if anyone could get more specific to speed us along.
The steps are as follows, any suggestions most appreciated:
- Firstly, on start up and before the D3D renderwindow is created (if stereo is requested) we need to initialise the NVapi stereo system something like this:
NvAPI_Status nvStatus = NvAPI_Initialize();
if (NVAPI_OK == nvStatus)
nvStatus = NvAPI_Stereo_SetDriverMode(NVAPI_STEREO_DRIVER_MODE_DIRECT);
if (NVAPI_OK == nvStatus)
{
NvAPI_ShortString nvapiStatusMessage;
NvAPI_GetErrorMessage(nvStatus, nvapiStatusMessage);
mIsNvapiInitialized = true;
NvAPI_Status nvStatus = NvAPI_Stereo_SetDriverMode(NVAPI_STEREO_DRIVER_MODE_DIRECT);
nvStatus = NvAPI_Stereo_IsEnabled(&mStereoEnabled);
}
So the question is where does this best go?
- Next we need to link the D3D render window to the stereo driver like:
NvAPI_Status nvStatus = NvAPI_Stereo_CreateHandleFromIUnknown(IDirect3DDevice9*, &nvapiStereoHandle);
if (logErrorMessage(nvStatus))
nvStatus = NvAPI_Stereo_IsActivated(nvapiStereoHandle, bIsStereoOn);
The trick here is we need to access the D3D render context which was created by Unreal… question, where and how?
- Now once stereo is activated on the designated window, we need to specify the left, right or centre eye position before rendering the view as:
nvStatus = NvAPI_Stereo_SetActiveEye(nvapiStereoHandle,_bufferTarget);
where _bufferTarget can be either: NVAPI_STEREO_EYE_MONO, NVAPI_STEREO_EYE_LEFT or NVAPI_STEREO_EYE_RIGHT
However, this requires the view to be rendered twice, either as two separate cameras or by moving the camera’s position and view frustum between each render pass
The linked post has a good start:
What I wasn’t completely sure of by the way this is described is if this ultimately does a full scene update (physics etc.) for each eye, rather than triggering two render passes?
So wasn’t 100% sure if
was what that refers to?
Mainly I could do with knowing if FFakeStereoRenderingDevice is everything I need to build on to get dual render contexts which I can channel independently to back left/ back right on the fly?
- Finally, we need to manually set the view frustum on each camera as it is asymmetrical and will be calculated manually based on a head-tracked position
I think that was fully answered by:
but I thought I’d still throw it in in case anyone what’s to elaborate.
Huge thanks for any guidance!
Ally