Oculus Rift DK2 - SDK distortion

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Brainsaw
Posts: 1241
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Oculus Rift DK2 - SDK distortion

Post by Brainsaw »

Hi,

some days ago I received my Oculus Rift Development Kit 2 :D (http://www.oculusvr.com/dk2/), and I tried to make an Irrlicht integration last weekend. Now I have a problem: using the SDK distortion mode would be nice (according to the documentation this is "the way to go"), but I need to render the scene to a texture between the calls to the SDK functions "ovrHmd_BeginFrame" and "ovrHmd_EndFrame". In these functions the DirectX handling (I think it was "beginScene" and "present") is called, so I must make sure Irrlicht doesn't call these functions. If I simply leave out beginScene and endScene the rendered texture is empty. As my knowledge of DirectX and of the Irrlicht internals is .. ahem .. limited I wonder if anyone of you has an idea how I can achieve this. Thanx.

Btw: if I call "beginScene" and "endScene" from the video driver the console just gets flooded with "direct3Dendscene failed" messages.

Btw2: I made a hack to the CD3D9Texture to obtain the DirectX texture (IDirect3DTexture9* getRenderTargetTexture() { return Texture; }). Maybe the problem comes from here?
Image
Dustbin::Games on the web: https://www.dustbin-online.de/
Suvi
Competition winner
Posts: 45
Joined: Mon Oct 01, 2007 11:24 am
Location: Finland
Contact:

Re: Oculus Rift DK2 - SDK distortion

Post by Suvi »

I gave up on trying to get the SDK distortion working myself since it seemed like they were still doing everything the same way anyways.

However, I did notice that the SDK's BeginFrame just seems to initialize the frame timing but not exactly call the BeginScene of DirectX. Also the SDK's distortion rendering function calls both Begin and EndScene-functions.

Did you call video driver's endScene before or after the Oculus SDK's EndFrame? I'm guessing you may need to call Irrlicht's endScene first and only then pass the RTT(s) to Oculus.

You may also need to define somewhere that Oculus SDK uses DirectX 9 instead of 11.
Brainsaw
Posts: 1241
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: Oculus Rift DK2 - SDK distortion

Post by Brainsaw »

I switched the oculus SDK zu to DirectX 9. I think I'll try the applications distortion first, the SDK contains nice examples for that approach AS well ;)
Image
Dustbin::Games on the web: https://www.dustbin-online.de/
Suvi
Competition winner
Posts: 45
Joined: Mon Oct 01, 2007 11:24 am
Location: Finland
Contact:

Re: Oculus Rift DK2 - SDK distortion

Post by Suvi »

Yea the application distortion works pretty well. I posted an integration here a while ago as well:
http://irrlicht.sourceforge.net/forum/v ... =9&t=50140
Post Reply