Camera matching

 From:  Michael Gibson
3644.16 In reply to 3644.12 
Hi PaQ,

> ... but still don't get the math for the angle of view ...

So to start with you'll probably want to do the screencapture with a script like this so you can exactly match the pixel width and height dimensions:

script: /* render view to clipboard */ var v = moi.ui.getActiveViewport(); if ( v != null ) { moi.view.lineWidth = 4; v.renderToClipboard( 2560, 2560 ); moi.view.lineWidth = 1; }

Change the 2560,2560 to your target width,height.



Then for converting a full horizontal angle of view into what MoI uses, try the following script - there are 3 values to substitute:

horiz_angle = 40 replace with your horizontal angle of view
width = 1024 replace with your rendered image pixel width
height = 768 replace with your rendered image pixel height

script: /* match horizontal view angle */ var horiz_angle = 40; var width = 1024; var height = 768; var x = Math.tan( (horiz_angle/2) * (Math.PI/180) ); x *= height / width; var central_angle = Math.atan( x ) * 2 * (180/Math.PI); moi.ui.mainWindow.viewpanel.getViewport('3D').fieldOfViewAngle = central_angle;



Let me know if that doesn't seem to work.

- Michael