Driver supported camera-based headtracking?
Vuzix Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Driver supported camera-based headtracking?Expand / Collapse
Author
Message
Posted 9/23/2009 5:08:31 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 12/18/2009 6:05:08 PM
Posts: 8, Visits: 49
Hey Devs....

I wanted to ask why head tracking cannot be supported in the same fashion as the custom S3D drivers?
It looks to me like your current method causes the game to load up your custom d3d9.dll from the project
folder since LoadLibrary looks there first, then that dynamically links to the real d3d9.dll and wraps
all the API calls. Most calls probably just pass right through to the correct DLL, but you can selectively
grab information on the way in and back out as needed. And perform fancy end-of-frame code in the Present call.

So I'm guessing you guys just tack on transform matrices to change the fov, and offset to the left and right,
calling the real present inbetween and then notifying the HMD that the specified frame is being drawn. If that's
the case, it seems like you could just tack on the rotation ( and translation would be nice to
have access to through the API so we could add on support for Wiimote positional tracking, just leave it as the identity
matrix for now )

I'm sure it's way more complex than this because you have to deal with different present call orders, some may even be
ahead of time to render to cubemaps etc... and you have to skip those... But pretend that doesn't need to be handled
and this is sortof how I'd see it working:


// Pseudo VR920 wrapped version of IDirect3DDevice9:resent
HRESULT IDirect3DDevice9:resent( CONST RECT * pSourceRect
, CONST RECT * pDestRect
, HWND hDestWindowOverride
, CONST RGNDATA * pDirtyRegion )
{
HRESULT hr;
D3DXMATRIX mViewOld;
pD3D->GetTransform( D3DTS_VIEW, &mViewOld );

D3DXMATRIX mViewNew1, mViewNew2;
D3DXMatrixMultiply( &mViewNew1, &mViewOld, g_mHMDRotate ); // Rotate the world to view by global HMD rotation matrix
D3DXMatrixMultiply( &mViewNew2, &mViewNew1, g_mHMDTrans ); // Offset the world to view by global HMD translation matrix

D3DXMATRIX mLeft, mRight, mTrans;
D3DXMatrixMultiply( &mLeft, &mViewNew2, D3DXMatrixTranslation( &mTrans, -g_fIPD, 0.f, 0.f ) ); // mLeft = mViewOld * Left Eye Translation Matrix
D3DXMatrixMultiply( &mRight, &mViewNew2, D3DXMatrixTranslation( &mTrans, g_fIPD, 0.f, 0.f ) ); // mRight = mViewOld * Right Eye Translation Matrix

// Render the left eye
hr = g_pD3D->SetTransform( D3DTS_VIEW, &mLeft );
if( !SUCCEEDED( hr ) ) return hr;
hr = g_pD3D->Present( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion );
if( !SUCCEEDED( hr ) ) return hr;

// Notify device and block
IWRSTEREO_WaitForAck( g_StereoHandle, LEFT_EYE );

// Render the right eye
hr = g_pD3D->SetTransform( D3DTS_VIEW, &mRight );
if( !SUCCEEDED( hr ) ) return hr;
hr = g_pD3D->Present( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion );
if( !SUCCEEDED( hr ) ) return hr;

// Notify device and block
IWRSTEREO_WaitForAck( g_StereoHandle, RIGHT_EYE );

return hr;
}


Any chance something like this could be supported in the future?
I think this kind of an implementation would be far superior and standard than say how WoW is currently handled by just offsetting the follow-camera angle with some Lua code. If I'm floating behind my character I want to be able to look around from THAT point, in all directions.

Thanks for taking the time to read this!

Jack
Post #4515
Posted 12/18/2009 5:49:13 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 2/7/2010 11:57:49 PM
Posts: 31, Visits: 36
Well, most games use renderculling, so anything not in your regular viewport just... wouldn't be there.
Post #4684
Posted 12/18/2009 6:07:51 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 12/18/2009 6:05:08 PM
Posts: 8, Visits: 49
Ahh yeah, I didn't think about that.
Post #4685
Posted 12/20/2009 11:57:10 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 2/7/2010 11:57:49 PM
Posts: 31, Visits: 36
You know, that's a problem with the IZ3d drivers as well, just less noticeable. When you peek around a corner and your eye is far enough to one side that it usually wouldn't render the wall around the corner, the wall is transparent. Though, this is the distance between your eye and your nose, so in that context it's not terribly noticeable.
Post #4691
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: TechSupport, Daddo, Tech_Support

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 6:42pm

Powered By InstantForum.NET v4.1.4 © 2010
Execution: 0.078. 11 queries. Compression Enabled.