Setting an OGL Perspective Matrix to Match Blender's Camera?

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
flippyneck
Posts: 0
Joined: Thu Jul 31, 2003 10:34 am
Contact:

Setting an OGL Perspective Matrix to Match Blender's Camera?

Post by flippyneck »

Can anyone tell me how to reverse engineer the lens setting of Blender's camera to set the fov for a perspective matrix in Open GL such that the OGL view exactly matches the render from Blender?

In Eaguirre's swf export script he uses:

Code: Select all

cmra = obCamera.getData() 
fovy = (2.0*atan2(34.5/2.0,cmra.lens))*180/pi 
m2 = Perspective(fovy,float(w*ax)/float(h*ay),cmra.clipStart, cmra.clipEnd) 

Unless I'm missing something this does not exactly reproduce Blender's output. The Blender render is a little more 'zoomed in' than the preview in s2flender with matching render settings.

Post Reply