DirectX Stereoscopic Projection Transformation for 3D Perception -
i trying change monocular directx engine into stereoscopy renderengine oculus rift. missing, stereoscopic projection transformation achieve 3d perception.
for now, using still standard monocular projection matrix:
1.50888 0 0 0 0 2.41421 0 0 0 0 1.0001 -0.10001 0 0 1 0 // setup projection matrix. fieldofview = (float)xm_pi / 4.0f; screenaspect = (float)screenwidth / (float)screenheight; // create [monoscope]projection matrix 3d rendering. xmmatrix projectionmatrix_xmmat = xmmatrixperspectivefovlh(fieldofview, screenaspect, screennear, screendepth); xmstorefloat4x4(&projectionmatrix_, projectionmatrix_xmmat); i translating left camera -0.032 creating view matrix, , right eye x_translated 0.032 creating view matrix. problem stereo off-center projection matrix (which think need). guess need somehow: http://paulbourke.net/exhibition/vpac/theory2.gif trying alot of different calculations, got weird results unfortunately ..
already researched alot, people here succeding doing http://www.gamedev.net/topic/597564-view-and-projection-matrices-for-vr-window-using-head-tracking/:
// window size 1200x800, 3:2 // xmfloat3 position = camera_->getposition(); // [method 1] ------------------------------------------------------------ //float left = screennear_ * (-3.f - position.x) / position.z; //float right = screennear_ * (3.f - position.x) / position.z; //float bottom = screennear_ * (-2.f - position.y) / position.z; //float top = screennear_ * (2.f - position.y) / position.z; //xmmatrix stereomatrix = xmmatrixperspectiveoffcenterlh(left, right, bottom, top, screennear_, screendepth_); //xmstorefloat4x4(&stereoprojectionmatrix_, stereomatrix); but method 1 causes weird random effects. moving camera on z-axis visually can go -z-axis -3.f values, camera values < -3.f don't have visual effect.
furthermore, reading through paper: http://www.google.at/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0cckqfjab&url=http%3a%2f%2fwww.marries.nl%2fwp-content%2fuploads%2f2011%2f05%2fapplying-stereoscopic-3d-in-games.pdf&ei=naydvy6bbcl5uobagjgl&usg=afqjcnefhkttlyjynbwf2-lptmcci8btzg&sig2=vokbq9ve0k8nhhta3gxn8g
and reading through nvidia presentation: http://www.google.at/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0cciqfjaa&url=http%3a%2f%2fwww.nvidia.com%2fcontent%2fgtc-2010%2fpdfs%2f2010_gtc2010.pdf&ei=xa2dvze3kyr8umt6g5gl&usg=afqjcngeanxcoryazvmxc1bdmf2itogg0w&sig2=ss2kn5gcyeolsgj66-442a&bvm=bv.96952980,d.d24
but can't figure out how need change monocular projection matrix or how setup 2 off-axis projection matrizes ..
maybe can me that, glad that!
many thanks!
i came here give answer question, it's solved long ago.
i had set stereo projection transformation matrix achieve a 3d projection this:
stereo projection transformation
to code, have set oculushmd instance uses oculus sdk. oculus sdk, it's possible calculate such stereo projection transformation suits hmd perfectly. although it's necessary configure oculus hmd device previously, means configuring eyrenderdesc, screennear , screendepth etc.
void graphicsapi::stereoprojectiontransformation(int camid) { matrix4f proj = ovrmatrix4f_projection(oculushmd::instance()->eyerenderdesc_[camid-1].fov, screennear_, screendepth_, false); stereoprojectionmatrix_._11 = proj.m[0][0]; stereoprojectionmatrix_._21 = proj.m[0][1]; stereoprojectionmatrix_._31 = proj.m[0][2]; stereoprojectionmatrix_._41 = proj.m[0][3]; stereoprojectionmatrix_._12 = proj.m[1][0]; stereoprojectionmatrix_._22 = proj.m[1][1]; stereoprojectionmatrix_._32 = proj.m[1][2]; stereoprojectionmatrix_._42 = proj.m[1][3]; stereoprojectionmatrix_._13 = proj.m[2][0]; stereoprojectionmatrix_._23 = proj.m[2][1]; stereoprojectionmatrix_._33 = proj.m[2][2]; stereoprojectionmatrix_._43 = proj.m[2][3]; stereoprojectionmatrix_._14 = proj.m[3][0]; stereoprojectionmatrix_._24 = proj.m[3][1]; stereoprojectionmatrix_._34 = proj.m[3][2]; stereoprojectionmatrix_._44 = proj.m[3][3]; } all had afterwards copy values of stereoprojectionmatrix - computed oculus sdk in first line - own projection matrix. , nice 3d effect, should :)
cheers,
Comments
Post a Comment