At the beginning initialization part of the scene, your application will need to fill a LeiaCameraData object, which the rest of the library uses. Any time the camera parameters get updated, this object needs to be updated appropriately. In order to initialize this data the first time, a LeiaCameraData object should be passed into leiaInitializeCameraData, using the below function:

void leiaInitializeCameraData(LeiaCameraData * data,
                              int num_horizontal_views,
                              int num_vertical_views,
                              float system_disparity_in_pixels,
                              float baseline_scaling,
                              float convergence_distance,
                              float vertical_field_of_view_degrees,
                              float near, float far,
                              int view_resolution_x_pixels,
                              int view_resolution_y_pixels);

data:​ get filled with a number of useful values used to compute the perspective matrices.

num_horizontal_views​ and ​num_vertical_views:​ give the library an idea of how many cameras will be used during rendering.

system_disparity_in_pixels: ​ a value retrieved from the Leia System Service.

baseline_scaling:​ this is a scalar for how far beyond the system disparity you would like. For example, by setting ​baseline_scaling​ to 2.0, you will double the amount of disparity compared to if you set baseline_scaling​ to 1.0. The larger the value, the more objects will appear to pop out or into the screen, but larger values may cause you to lose the effect altogether.

convergence_distance:​ In world space, this is the location where an object looks exactly the same from all views. This value should fall between ​near​ and ​far​. Objects between ​near​ and convergence_distance​ (but not AT ​convergence_distance​) will appear to pop out of the screen, while objects between ​convergence_distance​ and ​far​ will appear to fall into the screen.

vertical_field_of_view_degrees​: The number of degrees vertically of the field of view, which is a standard value used for creating a perspective matrix.

near​ and ​far​: the near and far planes of the main camera frustum.

view_resolution_x_pixels​ and ​view_resolution_y_pixels​: the size of each view the Leia Camera will render into. These values can be retrieved from Android using ​SimpleDisplayQuery​, and are a value smaller than the resolution of the screen based on orientation.

Last updated

Copyright © 2023 Leia Inc. All Rights Reserved