Working on integrating the stereoscopic camera into a render addon (appleseed). Thanks to Brecht I figured out how to set the proper view and retrieve the X offset for the camera lens when off-axis mode is used, but I can't figure out how to get the matrices for the two views. None of the camera matrices (world, local) change when the view is changed in the render engine. Is there a matrix that I'm missing or do I have to do the math manually (which would suck)?
Thanks to Brecht (and some bug fixes to Blender), here's the workflow for using stereoscopic rendering in a render addon:
There are three main commands needed, all are part of the RenderEngine:
active_view_set: this is used to set the view to one of the stereo cameras. Use the same name as the view, i.e. if the view is called 'left' the command would be
The camera matrix of this view is retrieved by using
If you use the offset orientation then there is also an x-axis lens shift in one or both cameras. That is retrieved with
For feeding render results into Blender, you need to add the view name to the
begin_results call. Blender expects the render engine to manage the logic of rendering the image twice from the different cameras and feeding the results to the correct view in the render results.
Note: Due to a bug that was fixed after the release of Blender 2.79b,
camera_model_matrix only works correctly if a recent buildbot build of Blender is used.