12.4TheMultiviewCamera 185
// Attach the components to viewport.
RSys.getViewport(0)->mCamera = &camera;
RSys.getViewport(0)->attachMVCompositor(new MVC_Anaglyph);
RSys.getViewport(0)->attachMVBuffer(new MultiViewBuffer, mvbParams);
Listing 12.1. Setting up a basic multiview rendering pipeline in an application.
12.4TheMultiviewCamera
Multiview rendering requires each of the views to be rendered with view offset
parameters, so that the eyes can receive the correct 3D images. To ease the con-
trol of cameras in multiview configurations, our architecture provides a mul-
tiview camera concept that is integrated into our basic multiview rendering
pipeline.
To be able to easily manipulate cameras within a generic multiview architec-
ture, we define a single interface, the multiview camera. This interface allows for
specialization of different configurations through class inheritance. Implementa-
tions can integrate most of the multiview-specific functionality (e.g., activating a
specific view) in a generic camera class, and single-view cameras can therefore
be treated as simple multiview cameras.
As usual, the camera object is used to identify view and projection transfor-
mation matrices that are applied to 3D mesh vertices. The view matrix depends
on both the camera position and the multiview camera parameters that offset the
view position from a reference camera transformation. The same approach ap-
plies to the projection matrix—both basic intrinsic parameters (such as field of
view, near and far clip plane distances, and aspect ratio) and multiview configu-
ration parameters (such as focal length) can affect the final result.
In our design, a single multiview camera object aims to reflect a group of
perspective-projection cameras. Each view is rendered using perspective projec-
tion, which implies that the multiview camera has the properties of a perspective
camera and can thus inherit from a perspective camera component, as shown in
Listing 12.2. Intuitively, in multiview configurations, one wants to be able to
control a single camera object that would internally calculate all view-specific
parameters with respect to the base camera position and orientation. The view-
specific perspective projection and view transformation are generated using an
active view number, and this active view number needs to be automatically man-
aged by the main renderer. Internal camera parameters are specified by extending
the multiview camera interface and defining the required parameters that affect
the view and projection matrix setup.