UDKOSC and Oculus Rift

From CCRMA Wiki
Jump to: navigation, search

DefaultSystemSettings.ini / UDKSystemSettings.ini

ScreenPercentage=150.000000
MaxAnisotropy=16
MaxMultiSamples=8
ResY=800

UDKEngine.ini

[Engine.Stereo3D]
bEnabled=True
EyeDistance=0.064000

Gamasutra article describing Oculus integration for Unreal Engine 4's Elemental:

http://gamasutra.com/blogs/NickWhiting/20130611/194007/Integrating_the_Oculus_Rift_into_Unreal_Engine_4.php

Developer blog about HMD tracking:

http://www.oculusvr.com/blog/sensor-fusion-keeping-it-simple/

Quick diff between 2013-02 and Rift 2013-03 directories:

diff -r ./2013-02/Development/ ./UDK-2013-03-Oculus/Development/ > ~/Desktop/diff_output.txt

https://developer.oculusvr.com/forums/viewtopic.php?f=44&t=1308#p17228


Head bone HMD tracking example from https://developer.oculusvr.com/forums/viewtopic.php?f=44&t=936

/* 
GetViewRotation
always match the camera to the rotation of the eye socket
*/ 
simulated event rotator GetViewRotation()
{
    local vector out_Loc;
    local rotator out_Rot;

    if (EyeSocket == )
        return Super.GetViewRotation();

    Mesh.GetSocketWorldLocationAndRotation(EyeSocket, out_Loc, out_Rot);

    return out_Rot;
} 

//function to aim the head where the player looks
exec function LookAt(int p, int y, int r)
{ 
local SkelControlSingleBone HeadControl;
local Rotator APlace;

APlace.Pitch = p;
APlace.Yaw = y;
APlace.Roll = r;

HeadControl = SkelControlSingleBone(Mesh.FindSkelControl('HeadControl'));
HeadControl.bApplyRotation = true;
HeadControl.SetSkelControlStrength(1.0, 0.5);
HeadControl.BlendInTime = 5.0;
HeadControl.bAddRotation = true;
HeadControl.BoneRotation = APlace;
}


Installation basics:

1) Download the new UDK from the Oculus Developer site.
2) Go to the folder C:\UDK\UDK-2013-03\UDKGame\Config\ and edit the UDKEngine.ini, (back it up first of course)
3) In the [Engine.Stereo3D] section, change the bEnabled parameter = True
4) Optional: in the [Engine.Oculus] section, change the bEnableHud parameter = False, (as the hud is kind of messed up right now).
5) Run the UDKGame program that installed with the UDK, (should be an icon on your desktop).

More:

http://3dvision-blog.com/forum/viewtopic.php?f=11&t=2874

If you already have the Oculus Rift development kit, you should register at https://developer.oculusvr.com/ and download the Rift SDKs among which is the new UDK (Unreal development Kit) with support for the Oculus Rift dev kit. In order to enable and get the best results out of the UDK demos and your custom code on the  Rift make sure you do the following:

- Make sure to install the UDK in an easy location such as the default one in C:\UDK\
- Go to C:\UDK\UDK-2013-03\UDKGame\Config\ and open the file UDKEngine.ini with Notepad or other text editor
- Navigate to the [Engine.Stereo3D] section and set the bEnabled=True (the default value should be False)
- Open up a demo map and play it on PC (it will run via the UDKGame, next time you can directly start the UDKGame), Oculus Rift is not yet supported directly it he UDK editor
- If the UDKGame does not run in full screen just press ALT + Enter to make it fullscreen

- Brig the console up by pressing the ~ key and execute the following two command to enable stereo 3D and the Oculus Rift distortion of the image:
stereo on
hmdwarp on

- You need to enable AA filtering to compensate for the lower resolution of the Rift, to do that go to C:\UDK\UDK-2013-03\UDKGame\Config and open the UDKSystemSettings.ini with Notepad or another text editor
- Make sure you set the following lines to the values below, this will enable 16x AF and 8xAA:
MaxAnisotropy=16
MaxMultiSamples=8
bAllowD3D9MSAA=True