1
$\begingroup$

I need to find some parameter of the stereo camera. In particular I need:

  • The distance of the near and far plane and where are them (for calculate the dimensions, the position of the vertices of the panel, etc.)
  • Where exactly is the volume of the camera situated (the volume you can see if you enable the option in the 3D view generic properties)
  • The formula used to calculate this data in blender (who knows where the file with this formula is?

    import bpy
    
    scene = bpy.context.scene
    cam = scene.camera
    print("convergence_distance: %f" %cam.data.stereo.convergence_distance)
    print("convergence_mode: %r" %cam.data.stereo.convergence_mode) 
    print("interocular_distance: %f" %cam.data.stereo.interocular_distance) 
    print("pivot: %s" %cam.data.stereo.pivot) 
    print("focal_length: %f" %cam.data.lens)
    print("gpu_dof.focal_length: %f" %cam.data.gpu_dof.focal_length)
    print("gpu_dof.focus_distance: %f" %cam.data.gpu_dof.focus_distance)
    print("gpu_dof.is_hq_supported: %s" %cam.data.gpu_dof.is_hq_supported)
    print("lens_unit: %s" %cam.data.lens_unit)
    print("sensor_width: %f" %cam.data.sensor_width) 
    print("clip_end: %f" %cam.data.clip_end) 
    print("rotation_euler: x = {0}, y = {1}, z = {2}".format(*cam.rotation_euler))
    print("location: x = {0}, y = {1}, z = {2}".format(*cam.location)) 
    print("sensor_height: %f" %cam.data.sensor_height) 
    print("sensor_width: %f" %cam.data.sensor_width) 
    print("angle: %f" %cam.data.angle) 
    print("angle_x: %f" %cam.data.angle_x) 
    print("angle_y: %f" %cam.data.angle_y) 
    print("cam.matrix_local")
    print(cam.matrix_local)
    print("cam.matrix_basis")
    print(cam.matrix_basis)
    print("cam.matrix_world")
    print(cam.matrix_world)
    print("cam.calc_matrix_camera(x=1, y=1, scale_x=1.0, scale_y=1.0)")
    print(cam.calc_matrix_camera(x=1, y=1, scale_x=1.0, scale_y=1.0))**
    

with this code i have some camera parameters but i don't know how to find the others.

tips?

$\endgroup$

1 Answer 1

1
$\begingroup$

The code in properties_data_camera.py can give you clues to most of the camera properties.

The volume options for the 3DView are displayed with code in space_view3d.py and use properties within the 3DView data eg. context.space_data.show_stereo_3d_volume.

The volume pyramid drawn for this option is based on a pyramid created from the camera location/rotation, using cam.lens which is shown to the user as focal length and cam.sensor_width (sensor size). The cam.clip_start and cam.clip_end define where the top and bottom of this pyramid are. The actual c-code that does the drawing can be found in drawobject.c

The location of the convergence plane is based on stereo.convergence_distance and looks to use the same calculations as clip_start with the outer edges based on the same volume pyramid.

$\endgroup$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .