Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
molton's avatar
molton
Explorer
11 years ago

SDK rendering in Unity

Hello, I was wondering if anyone had any information on exactly how to integrate SDK rendering into a Unity project rather than using the game engine rendering alternative. They talk about the use and benefits of SDK rendering here

http://www.gdcvault.com/play/1020713/Working-with-the-Latest-Oculus

here is the code example from that presentation

ovrFrame hmdframe = ovrHmd_BeginFrame(hmd);

for (int eyeIndex = 0; eyeIndex < ovrEye_Count; eyeIndex++)
{
ovrEyeType eye = HmdDesc.EyeRenderOrder[eyeIndex];
ovrPosef eyeRenderPose = ovrHmd_BeginEyeRender(hmd, eye);

RenderGameView(RenderViewports[eye], eyeRenderPose);

ovrHmd_EndEyeRender(hmd, eye, &EyeTexture[ye].Texture);
}

//Let OVR do timewarp, distortion rendering, Present and Flush+Sync
ovrHmd_EndFrame(hmd);


It sounds like instead of using the OVRCameraController prefab we would instead use only a camera left and camera right to render the undistorted frames in Unity and pass that to the SDK as textures which will then distort the image and do it in a better way. Honestly, I have not had time to check out the SDK much, I'm not entirely sure how to accomplish this. Does anybody have more info about this? Thanks in advance.

4 Replies

Replies have been turned off for this discussion
  • Good question. This is something we are implementing for an upcoming release. We're planning to keep OVRCameraController, OVRPlayerController, and OVRCamera, but a number of the other scripts will be simplified away.
  • Ok, sweet. Thanks for that :) Would you say performance using SDK rendering will be similar to performance with the minimal distortion of 0.25c? The performance with the Unity Mesh Rendering was making me think I'd have to redesign a bunch of stuff.
  • "molton" wrote:
    Would you say performance using SDK rendering will be similar to performance with the minimal distortion of 0.25c? The performance with the Unity Mesh Rendering was making me think I'd have to redesign a bunch of stuff.


    It's too early to say, but it will use a mesh distortion approach. I would expect that to be faster than pixel distortion in most cases. Are you seeing a slowdown?
  • a pretty dramatic slowdown when the "camera texture" option on the OVRCameraController was enabled. Without it there was still a pretty noticable performance drop though. I went from 60 fps to from 7-30 fps with the camera texture option enabled and about 40-55 fps without it. I imagine cutting out the Unity middleman will improve performance even if the new distortion method doesn't.