LODs don't work with Oculus

I’ve set up a mesh with very different materials on each LOD, so I can clearly see where the LODs are switching.

If I launch the game with -emulatestereo, with or without an HMD connected, I see the LODs switching normally. Of course playing in non-stereo, the LODs work fine as well.

If I launch the game without -emulatestereo and with an HMD connected, ie: real stereo, I only ever see the highest LOD, and performance is extremely bad.

So I’ve narrowed it down to only a real HMD causing LOD determination to break.

Has anyone seen this before? Is there a fix in the works?

Thanks a lot.

Hey zgit -

We are aware of this issue and are currently working on a solution. Thank you for your information though.

-Eric Ketchum

Thanks for the prompt answer! Any tips before I go digging into the source? Need to get this working today.

Thanks again.

Steve

Here’s a quick and dirty fix:

bool ULocalPlayer::GetProjectionData(FViewport* Viewport, EStereoscopicPass StereoPass, FSceneViewProjectionData& ProjectionData)
{
...
	// Get the viewpoint.
	FMinimalViewInfo ViewInfo;
	GetViewPoint(/*out*/ ViewInfo);

	float FOVDegrees = ViewInfo.FOV; /**/

	// If stereo rendering is enabled, update the size and offset appropriately for this pass
	const bool bNeedStereo = GEngine->IsStereoscopic3D() && (StereoPass != eSSP_FULL);
	if( bNeedStereo )
	{
		GEngine->StereoRenderingDevice->AdjustViewRect(StereoPass, X, Y, SizeX, SizeY);

		FOVDegrees = FMath::RadiansToDegrees(ViewInfo.FOV); /**/
	}

	// scale distances for cull distance purposes by the ratio of our current FOV to the default FOV
	PlayerController->LocalPlayerCachedLODDistanceFactor = FOVDegrees / FMath::Max<float>(0.01f, (PlayerController->PlayerCameraManager != NULL) ? PlayerController->PlayerCameraManager->DefaultFOV : 90.f); /**/

Ie: need to convert the HMD FOV to degrees in this particular spot. Modified lines are marked with /**/.

The FOV related code (and view code in general) is a bit of a mess, so a proper fix would take more work, but this should get people going if they run into this problem.