This document outlines the basics of getting started utilizing the Leia Unity Plugin.
Supported Versions: 2017, 2018, 2019 & 2020 LTS versions
Grab the latest version of the Leia Unity Plugin here.
Import the Leia Unity SDK .unitypackage into your Unity project.
While Unity is running, double-click the .unitypackage or
Drag and drop the .unitypackage into your Unity project's Assets folder in the Unity editor Project window
Assets -> Import Package -> Custom Package and select the .unitypackage
Attach a LeiaCamera component to the main camera in the scene. This component controls visual parameters such as convergence distance and depth. Adding a LeiaCamera will also automatically add a LeiaDisplay game object in the scene, which can be used for controlling rendering aspects of the Leia Display such as switching between 2D and Lightfield Mode, anti-aliasing, and Parallax Auto Rotation. (Note: Parallax Auto Rotation support has been dropped in 6.18 but will be re-added in a forthcoming release).
Notice after adding a LeiaCamera component to the camera that a new volume is now rendered in the editor scene view. This is called the Leia frustum. For optimal depth, aesthetics, and viewer comfort on LitbyLeia displays, it’s essential to know how to properly manipulate the Leia frustum.
The convergence plane of the LeiaCamera, represented by the blue plane, represents what part of the scene is in focus and appears at the depth of the surface of the display. It is also known as the zero disparity plane, or ZDP, because objects rendered at that distance will have zero disparity on the display. Objects which are closer to the camera than the convergence plane will appear to be popping out of the display, and objects which are further from the camera than the convergence plane will appear to be recessed into the display. It is recommended to adjust the convergence distance such that it is positioned near where the viewer should be focusing their attention, such as on the player character, or whatever the main game objects are in the scene, so that they are the most visually in focus. It is also recommended to have any text or detailed imagery as close to the ZDP as possible to maximize viewer readability and comfort.
The baseline scaling determines the distance between the generated LeiaView cameras, and how much depth the scene will have. A higher baseline scaling will result in more depth, while a lower one will result in more flattened imagery.
Adjusting the baseline will result in the Leia frustum changing in size, with a higher baseline resulting in a narrower frustum and a lower one resulting in a wider frustum.
The Leia frustum represents the safe disparity zone: the volume within which objects can be placed such that they will have a comfortable level of disparity on the display for a viewer of the app. Objects too far in front of this safe disparity zone will possibly have an uncomfortable amount of depth or no depth at all and just hurt viewers eyes, so it is recommended to keep content inside the safe disparity zone.
Ideally, the baseline scaling should be set to a value such that the Leia frustum is tightly encompassing all the objects visible in the scene to maximize depth.
Anti aliasing needs to be performed differently for apps when rendering in lightfield mode, because rather than applying the effect to the final image rendered to the display, it needs to be performed on each separate view before interlacing occurs. Because of this, the LeiaDisplay component has an option to choose what level of anti aliasing to use.
Leia Remote is an app that connects to Unity Remote 5 and allows previewing of lightfield content in Unity on LitbyLeia displays.
Install LeiaRemote.apk on your LitbyLeia device
LeiaRemote.apk is located in the LeiaUnitySDK folder you downloaded from https://developer.leialoft.com/main/documentation
Install Unity Remote 5 on your LitbyLeia device
When you open LeiaRemote.apk on your device, it will walk you through this.
Set Unity Editor Game Window resolution to device resolution
2560 x 1600 for Lume Pad landscape
1600 x 2650 for Lume Pad Portrait
2560 x 1440 for Hydrogen One landscape
1440 x 2560 for Hydrogen One portrait
Set the following settings in Edit -> Project Settings -> Editor
Device: Any Android Device
Attach LeiaRemote.cs to a game object in the scene
Press play and Unity Remote 5 will open automatically
To develop content for Leia displays, it is helpful to understand how the display works.
A Leia display enables lightfield content with depth by projecting multiple images in different spatial directions.
As a result, it is possible to trick the brain into perceiving depth in images by projecting the light in a similar fashion to how it is dispersed in reality. For example, your left eye will see a little bit more of the left side of an object whereas your right eye will see more towards the right.
Leia displays such as those found on the Red Hydrogen One and Lume Pad have 4 separate views. The 4 views enable both stereoscopic depth perception as well as a look around effect that allows viewers to see around virtual objects by moving their heads left or right.
The views repeat from left to right, enabling multiple viewers to look at the display and experience the lightfield effects simultaneously.
The volume representing the safe disparity zone within which content should be placed, represented by the white area in the scene editor view shown below:
Objects here will ..
Too far in front of Leia frustum
be blurred and visually uncomfortable
In front of Convergence Plane
appear to pop out of the screen
appear in focus and directly in the screen
Behind Convergence Plane
appear recessed into the screen
Too far behind Leia frustum
be blurred and visually uncomfortable
The zero disparity plane, (ZDP), also known as the focus plane, or convergence plane, is the virtual plane within the unity scene where the depth relative to the device screen plane is 0. Objects on this plane will appear at the level of the screen and be the most in focus because they will be rendered the same in every view, excepting for any directionally based lighting or other shader effects. Think of it as the “zero depth plane”. Objects closer to the camera than the ZDP will appear to pop out of the screen, while objects behind it will be recessed into the screen.
When a Leia display is rendering in lightfield mode, it is taking the entire screen resolution and dividing it into multiple views, which are projected in different directions depending on the pixel. These pixels repeat from left to right in a pattern (on a 4 view display): 1, 2, 3, 4, 1, 2, 3, 4, ect.
The views are interlaced together such that pixel 1 shows view 1, pixel 2 shows view 2, pixel 3 shows view 3, ect. repeating in sets of fours. Disparity is a measurement of how far apart the same point on a rendered object is between any two of these views.
Formula for disparity: Disparity = X2 - X1
Where: X1= the horizontal pixel position of a point P on an object in view 1
and: X2 = the horizontal pixel position of that same point P in view 2 (the view immediately to the right of view 1)
A positive disparity results in objects appearing to pop out in front of the display.
A negative disparity makes objects appear recessed into the screen.
A disparity of zero results in objects appearing directly on the screen plane.
A depth violation occurs when an object is positioned in 3d space in front of another object, but is rendered as if it is behind it. It is common for developers coming from 2D app development to have this issue when porting their apps to work on light field displays, because the problem is not noticeable on a 2D display where there is no depth to the content.
Take this cube for example, which looks like it’s corner should be popping out of the display, however these UI elements, which are on the convergence plane, are rendered on top:
Objects which are far from the convergence plane and have high contrast may result in a “ghosting” effect where high crosstalk is visible between views. In other words, view 1 leaking significantly into view 2, view 2 into view 3, ect… The result will be a double image effect resulting in multiple visible edges of the same object at different positions.
To mitigate this effect, it is recommended to have objects further in front of the convergence plane fade out to transparent the further out they are. This will also give objects more of a holographic 3d effect which looks great on the display.
For objects behind the convergence plane, a bokeh effect is recommended, blurring out the hard edges that cause crosstalk to be more visible. This will also help redirect viewers' attention to what is on the focus plane, which is where the primary imagery the player is to be looking at should be placed.
Anti Crosstalk (ACT) based ghosting may also occur for high disparity, high contrast edges - such as white against black. This is the anti crosstalk algorithm trying to make the edge have less crosstalk on the display. Generally speaking, it’s best to avoid high disparity, high contrast edges and you won’t have this issue.
Make sure your text is on the convergence plane for optimal readability. Note that since in lightfield mode the resolution of the display is divided by 4 and projected as 4 different images in 4 different directions, text will appear as though it is 1/4th the resolution. To compensate for this, make text larger so it is easier to read.