1

This is a followup to Matt's previous question about camera orientation. I'm working with him on a javascript interface for a python analysis code for 3D hydro simulations.

We've successfully used xtk to build a 3D model of the mesh structure in our simulation. The resulting demo looks a lot like the simple cube demo on the xtk website so your advice based on that demo should be readily portable to our use case.

We were able to infer the view matrix at runtime from the XTK camera object. After a lot of poking and some trial and error, we figured out that the view matrix is really (in openGL nomenclature) the model-view matrix - it combines the camera's view and translation with the orientation and translation of the model the camera is looking at.

We are trying to infer the orientation of the camera relative to the (from our point of view) fixed model as we click, drag, and zoom with respect to the model. In the end, we'd like to save a set of keyframes from which we can generate a camera path that will eventually be exported to python to make a 3D volume rendering movie of the simulation data. We've tried a bunch of things but have been unable to invert the model-view matrix to infer the camera's orientation with respect to the model.

Do you have any insight into how this might be done? Is our inference about the view matrix correct or is it actually tracking something different from what I described above?

From our point of view it would be really great if xtk kept track of the camera's up, look, and position vectors with respect to the model so that we could just query for and use the values directly.

Thanks very much for your help with this and for making your visualization toolkit freely available.

ngoldbaum
  • 5,430
  • 3
  • 28
  • 35
  • Yes, I think you are right with the model view matrix. Also, feel free to extend the camera mechanism or optimize it. – haehn Jun 26 '12 at 12:54
  • Told you my opinion in your mate's post. If you need help to add some things in xtk tell me, after tonight I'll have a bit of free time. – Ricola3D Jun 27 '12 at 10:18
  • Thanks a lot @Ricola3D. I can't get back to this for another week or two but I'm interested in patching xtk (says the programmer who has never written a line of javascript ;). – ngoldbaum Jun 27 '12 at 19:04
  • Don't worry I was the same 3 months ago :) I just wrote some Javascript & Java to share 3D movements between 2 clients with multiviews vizualisation (it was harsh^^), and here are a few things I noticied : (1) XTK emits rotate & pan events too often to send them all on the network without laggs, you have to buffer them (it was a bit difficult to find how to have something pleasant). (2) If some message is lost (no matter why) the errors are summing, so I added a function to share the view matrix when the clients want. – Ricola3D Jun 28 '12 at 10:51

1 Answers1

0

This page might be useful as long as I'm understanding your needs http://3dgep.com/?p=1700 . It gives a very well understanding of the View Matrix which i needed myself and about half-way down the page might be a bit of info you could use http://3dgep.com/?p=1700#Converting_between_Camera_Transformation_and_View_Matrix .

Karijuana
  • 314
  • 1
  • 2
  • 13