Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3508 Members - Latest Member: PienueDut

26. May 2012, 10:50:53 am
Xith3D CommunityGeneral CategorySupport (Moderator: Marvin Fröhlich)Arbitrary frustrum matrix
Pages: [1]
Print
Author Topic: Arbitrary frustrum matrix  (Read 990 times)
KyroMaster
Just dropped in

Offline Offline

Posts: 10


View Profile Email
« on: 17. March 2009, 12:17:31 pm »

I work for an university project which is using java3d, and we'll like to switch to another engine because j3d sucks  Grin
I'd like to use xith as I want to get into this engine for my own projects, too.
The problem is, we use a head tracker, and therefor we need to set an arbitrary frustrum ("view") matrix for the projection. Is this possible in xith? And if it is, will overlays still work correctly. In j3d, you have to go into a "compatibility mode" when setting a custom frustrum matrix, and then overlays stop to work.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 17. March 2009, 02:38:24 pm »

Are you really sure, you want to modify the projection matrix? I assume you actually want to modify the camera (view matrix). And this is perfectly possible in Xith3D and it won't affect overlays or the HUD in any way.

Marvin
Logged
KyroMaster
Just dropped in

Offline Offline

Posts: 10


View Profile Email
« Reply #2 on: 17. March 2009, 02:54:36 pm »

Are you really sure, you want to modify the projection matrix?

Yes, unfortunately  Roll Eyes
We do augmented reality (aka "Heads-Up-Display") and we use a calibration algorithm which gives us the raw projection matrix. AFAIK in general 3D engines do this

glMatrixMode( GL_PROJECTION );
glFrustrum(left, right, bottom, top, near, far)

which calculated a standard perspective projection matrix and we'd need to use

glMatrixMode( GL_PROJECTION );
glLoadMatrixf( &customMatrix);

do you think this could work in xith? Does xith support orthogonal projection together with HUD, because if it does it should be no problem and I could just try to implement it  Smiley

Thanks for your help!
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 17. March 2009, 03:27:17 pm »

Yes, unfortunately  Roll Eyes
We do augmented reality (aka "Heads-Up-Display") and we use a calibration algorithm which gives us the raw projection matrix. AFAIK in general 3D engines do this

glMatrixMode( GL_PROJECTION );
glFrustrum(left, right, bottom, top, near, far)

which calculated a standard perspective projection matrix and we'd need to use

glMatrixMode( GL_PROJECTION );
glLoadMatrixf( &customMatrix);

do you think this could work in xith?

Well, I guess, you could simply use a little trick. Just compose the view matrix with the inverse of the projection matrix (from the left). This should neutralize the projection matrix and you could use your own custom projection matrix as the regular view matrix. I guess, this should work. But we could also provide the possibility to apply a custom projection matrix. But I would need to check, what would have to be done.

I guess, the simplest solution would be to setup the view and the canvas/viewport in a way, that the automatic internal calculation does exactly, what you need.

In any case, it is possible.

Does xith support orthogonal projection together with HUD, because if it does it should be no problem and I could just try to implement it  Smiley

Yes. Definitely. Xith supports orthogonal or perspective projection for each RenderPass separately. It also has a complete HUD implementation ready to be used out of the box. And it of can course be rendered on top of anything without being affected by it.

Marvin
Logged
'n ddrylliog
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #4 on: 19. March 2009, 04:45:51 pm »

I don't see the point of forcing users to circumvent high-level APIs with computing tricks in order to access low-level ones. What is simpler than allowing setting the raw matrix ?  Shocked Am I missing something here ?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #5 on: 19. March 2009, 08:08:13 pm »

I don't see the point of forcing users to circumvent high-level APIs with computing tricks in order to access low-level ones. What is simpler than allowing setting the raw matrix ?  Shocked Am I missing something here ?

I said, that is is abolutely possible. I just wan't sure, if this really was, what he wanted. Allowing to set the raw matrix is simple and can be done.

Marvin
Logged
KyroMaster
Just dropped in

Offline Offline

Posts: 10


View Profile Email
« Reply #6 on: 19. March 2009, 11:11:31 pm »

If it would be possible and simple to implement, it would be very cool, for sure  Smiley
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #7 on: 22. March 2009, 07:05:55 pm »

Please update from SVN and use View.setProjection().

Enjoy.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic