Quantcast
Channel: Adobe Community: Message List - Acrobat SDK
Viewing all articles
Browse latest Browse all 10848

Re: Camera To World(C2W) Transformation Matrix to set Views

$
0
0

Hi,

 

I've just figured it out myself so I will share while I'm on the topic

 

Let's take a system, where:

Y is vertical axis, X&Z are horizontal axes.

 

We want to look in XY plane towards Z axis.

 

     Y

X-- |    and Z axis is going from monitor into the monitor

 

Now, let's take the matrix

 

`left' is a directional vector lying in the plane of the camera chip and pointing to the left, - in our case X is also looking left so we will set it to 1 (1,0,0);

`up' is a directional vector lying in the plane of the camera chip and pointing upwards, - Y is looking up so (0,1,0)

`view' is a directional vector perpendicular to the camera chip plane pointing into the view direction - view direction is positive Z so (0,0,1);

`trans' is a position vector specifying the displacement of the camera chip centre from the World origin. - in my case, I'm putting here X,Y coordinates of the center of the model, and Z is equal to the (bRadius / (float)Math.Tan((Math.PI * 15) / 180)) + bRadius, where bRadius is the absolute maximum of X,Y coordinates from model (to see the entire model). 15 is half of the FOV value.

 

The matrix should be consistent, so if you want to look from Z direction (from monitor out of monitor), X will look right now, so first row of the matrix will change to (-1,0,0) and 3rd row will change to (0,0,-1).

 

Currently I don't need perspective views, so I wont post anything. I might do this in the future. You should get the idea from this example. In addition to this I recommend clicking on "camera" icon within 3D object and check how values are changing when you play with the camera.

 

Hope this will help.

Regards,

Bartosz.


Viewing all articles
Browse latest Browse all 10848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>