[osg-users] Loading problem, OpenVR integration

Lorenzo Valente oneiros.valente at gmail.com
Wed Nov 2 10:00:18 PDT 2016


Hi,

I'm working on a Virtual Reality project that involves the rendering of a OSG scene in an Oculus Rift CV1 device using the OpenVR library. All these technologies are pretty new to me so everything is as exciting as frustrating :)
My code is based on the Chris Denham "osgopenvrviewer" project (you can find it on Github)

So, my starting point is a osgViewer::View that contains my immersive scene. I managed to render it in the headset display by doing this:


Code:
osg::ref_ptr<OpenVRViewer> vrViewer = new OpenVRViewer(myView, myDevice, myRealizeOperation);
osg::ref_ptr<osg::Node> sceneData = myView->getSceneData();
vrViewer->addChild(sceneData);
myView->setSceneData(vrViewer);



So far so good, the render quality and the stereo effect are perfect.
The problems start when I move my head to look around in the scene: it looks like the objects outside my first view frustum are not ready when the application starts, so I get serious frame drops when I see these objects for the first time. These frame drops are particulary annoying in the headset, where a frame drop freezes the view for a fraction of second multiple times, causing a very ugly effect.

This happens only the first time I look around: after a first "scan" of the scene, everything works smoothly and nice.

The system I'm working on started as a simple desktop application with a single view/camera and I couldn't reproduce these problems in the no-VR version. I can look around very fast using a gamepad without losing any frame.
So, I guess the problem is in the OpenVR integration.

Is there anyone who already had this kind of issues? Do you have an idea on how to manage pre-loading of the entire scene before the realtime simulation starts?

Thank you!

Cheers,
Lorenzo

P.S. I see that many people solved this problem using osgViewer::Renderer->setCompileOnNextDraw(true) but I think it is not enough in my case. I have two RTT slave cameras for VR rendering (left eye and right eye) and I saw that the "setSceneData" method internally calls "setCompileOnNextDraw" on every slave camera in the viewer.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=69205#69205








More information about the osg-users mailing list