Hi,

I'm trying to implement VR application where head tracking will be used to 
create the 3D illusion by changing the perspective in 3D scene.

The idea is very similar to the one implemented by Johny Lee in his 'Head 
Tracking for Desktop VR Displays' project using WiiRemote.

The head tracking part works fine, I have got the 3D point corresponding to my 
head's position, the problem is when I move my head in horizontal or vertical 
direction it behaves ok, apart from the fact that objects - in my case cubes, 
are stretched in the z-axis. Secondly when I move my head in the z-axis in 
other words - closer to and further away from the screen I can see the back 
wall of my virtual room moves but the objects seem to be fixed and they do not 
change in size at all when I get closer to the screen.

Below are 3 images:

First one, head is in the original position.

[Image: http://obrazki.elektroda.pl/6286372200_1333477477_thumb.jpg ] 
(http://obrazki.elektroda.pl/6286372200_1333477477.png)

Second one, I moved my head right so I can see more of the left side of the 
room.
[Image: http://obrazki.elektroda.pl/6130984900_1333477478_thumb.jpg ] 
(http://obrazki.elektroda.pl/6130984900_1333477478.png) 

Third one, I moved closer to the screen, but objects did not change their sizes 
but the back wall is closer now.

[Image: http://obrazki.elektroda.pl/1229996500_1333477477_thumb.jpg ] 
(http://obrazki.elektroda.pl/1229996500_1333477477.png)

I'm using the following code to render my scene:

Code:

...
float nearPlane = 0.0f;
float farPlane = 20.0f;
mOsgViewer.getCamera()->setProjectionMatrixAsFrustum(
-0.5 + x,
0.5 + x,
-0.5 + y,
0.5 + y,
nearPlane - z, farPlane);

osg::Matrixd cameraTrans;
cameraTrans.makeTranslate(x, y, z);
mOsgViewer.getCamera()->setViewMatrix(cameraTrans);
mOsgViewer.frame();
...




I've created a widget in Qt which inherits from QGLWidget, to render my OSG 
scene. I added all cubes and room inside the constructor and in paintGL() I'm 
setting up glFrustum using the above code.

I'm not using any camera manipulators.

Is anyone familiar with VR displays. What should be the behaviour of a 3D scene 
rendered in such a way?

I'm not sure if I'm doing this the right way.
There are numerous projects using OpenGL and where glFrustum is set in the same 
way and then the head's movement is compensated with glTranslate.

I will be very happy if someone could give me some hints as I think I'm doing 
something wrong.

Thank you!

Cheers,
Chris
Code:




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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to