HologramCamera.cs

The Hologram Camera captures scenes for Looking Glass displays. It is intended to replace Unityโ€™s default camera for Looking Glass applications.

The Hologram Camera objectโ€™s main interface is the HologramCamera.cs script. It exposes variables and functions to control how your scene is captured.

Fields & Properties

bool ForceDisplayIndex

Force the Hologram Camera to render to the first display, and use Unity's SetParams method to move the window to the Looking Glass display.

This is useful for single-window applications that only want the visuals to appear on the Looking Glass or setups with more than one 2D monitor. For 2-window applications that require window-context-specific raycasting or UI events, and that have a single 2D monitor with the Looking Glass, this should be toggled off.

DisplayTarget TargetDisplay

The Unity display that this camera will render to. This will be overwritten to always be display 1 if "Force Display Index" is toggled on.

LookingGlass.Toolkit.LKGDeviceType EmulatedDevice

The type of device that is being emulated. Only appears in the inspector if there are no Looking Glass displays plugged in or recognized, otherwise the Hologram Camera will target device settings from one of the connected LKG devices.

LookingGlass.Toolkit.LKGDeviceType DeviceType

The type of Looking Glass display that is being emulated or targeted (currently identified based on its Calibration serial field).

LookingGlass.Toolkit.Calibration Calibration

Contains Looking Glass display-specific data required for accurately rendering to a given display.

If you are emulating a display, a default template calibration is returned.

float Calibration.ScreenAspect

The display's native aspect ratio, calculated using Calibration.screenW / Calibration.screenH.

Because quilts may not always be able to achieve this exact aspect ratio for each of the quilt tiles, QuiltSettings store this value at the time of capturing the quilt into the QuiltSettings.renderAspect variable, so that the quilt may be re-rendered later with the correct squishing or stretching to match the display's aspect ratio again when rendering the quilt.

This value is always greater than zero.

LookingGlass.Toolkit.Display DisplayInfo

Returns a copy of the Display info of the currently connected and targeted Looking Glass display, if any, or null if the Hologram Camera is not targeting a connected display and is emulating a display instead.

bool Preview2D

Allows you to preview your content in 2D instead of 3D. This can be useful for debugging.

bool ShowHologramPreview

Toggles on and off a hologram preview in the inspector and scene view. Note that this only has an effect in the Unity editor, not in builds.

RenderTexture QuiltTexture

The realtime quilt rendered by this Hologram Camera.

bool UseQuiltAsset

If set to true, QuiltTexture will save to an asset in your project (useful for debugging).

bool AutomaticQuiltPreset

Determines whether or not to use automatic/default quilt settings for the current targeted Looking Glass display or use custom arbitrary quilt settings instead.

To change this programmatically, use one the following:

  • void UseAutomaticQuiltSettings()

  • void UseCustomQuiltSettings(QuiltSettings settings)

  • void SetQuiltPreset(bool automaticQuiltPreset, QuiltPreset quiltPreset)

QuiltPreset QuiltPreset

Same as QuiltSettings, but has extra fields to determine if the quilt settings are the default for the targeted or emulated device, or if they are arbitrary, custom settings.

LookingGlass.Toolkit.QuiltSettings

Defines the resolution and layout of the quilt texture that this camera is rendering to as output.

int QuiltSettings.quiltWidth

The width (in pixels) of the entire quilt.

int QuiltSettings.quiltHeight

The height (in pixels) of the entire quilt.

int QuiltSettings.columns

The number of columns in the quilt.

int QuiltSettings.rows

The number of rows in the quilt.

int QuiltSettings.tileCount

The number of total tiles in the quilt. Each tile in the quilt corresponds to a single view rendered by the singleViewCamera.

Usually this is columns * rows, but it doesn't get set automatically to allow for customization. If itโ€™s fewer, empty views in the top right corner of quilt will be black. The quilt tiles used start from the bottom-left, as shown in Quilts:

float QuiltSettings.renderAspect

The aspect ratio of the camera or source image, when this quilt was originally rendered.

If you are rendering new quilts from a 3D scene, full-screen to a Looking Glass display, this should be set to the aspect ratio of your Looking Glass display's native screen resolution (Calibration.screenW / Calibration.screenH).

This aspect ratio is NOT necessarily equal to the aspect ratio of each tile's (width / height).

For your reference:

  • LKG Go, 16" Portrait, and 32" Portrait: 0.5625

  • LKG Portrait: 0.75

  • LKG 16" Landscape, 32" Landscape and 65โ€: 1.77778

RenderStack RenderStack

Defines a sequence of rendering commands that can be mixed together in the form of quilt textures. This can be useful, for example, if you wish to mix 2D cameras, pre-rendered quilts, or quilt videos with the Looking Glassโ€™s realtime renderer.

TransformMode CameraProperties.TransformMode

Defines how the transform controls the shape of the viewing volume.

  • In Volume mode, the transform position defines the focal plane.

  • In Camera mode, the transform position defines the central camera position.

float CameraProperties.NearClipFactor

Scales the nearClipPlane away from the focal plane.

The relationship can be mathematically written as the following: nearClipPlane = max(0.01, focalPlane - size * nearClipFactor * depthiness)

float CameraProperties.FarClipFactor

Scales the farClipPlane away from the focal plane.

The relationship can be mathematically written as the following: farClipPlane = max(0.01, focalPlane + size * farClipFactor * depthiness)

float CameraProperties.size

Defines half of the height of the camera frustum at the focal plane.

When using nearClipFactor and farClipFactor, this value also scales the nearClipPlane and farClipPlane away from the focal plane. NOTE: This is not the same as Unity's Camera.orthographicSize property.

Only appears when "Transform Mode" is set to TransformMode.Volume.

SizeMode CameraProperties.sizeMode

Sets the relationship between HologramCameraโ€™s Size value and the Transformโ€™s localScale value.

  • Manual - HologramCameraโ€™s Size and Transformโ€™s localScale values do not update automatically based on one another.

  • Size Sets Scale โ€” Updating HologramCamera's Size automatically updates the Transform localScale's xyz values to match.

  • Scale Sets Size โ€” Updating Transform localScale automatically updates HologramCamera's Size to match the largest value of the localScale xyz values.

Only appears when "Transform Mode" is set to TransformMode.Volume.

CameraClearFlags CameraProperties.ClearFlags

Determines how the camera clears the render target's background each frame.

Color CameraProperties.BackgroundColor

The background color of the render target when using Solid Color clear flags. NOTE: Unlike Unity's camera background color, the alpha channel is used to blend with any render steps in the stack that come before the current Looking Glass step.

LayerMask CameraProperties.CullingMask

Determines which layers the camera renders.

float CameraProperties.FieldOfView

The vertical field of view of the camera in degrees.

float CameraProperties.Depth

Sets the finalScreenCamera's depth, which determines the rendering order (relative to all other cameras in the scene) of the final HologramCamera rendering result.

RenderingPath CameraProperties.RenderingPath

The rendering path to use for rendering each of the single views. You may choose to use the player settings, or explicitly use deferred or forward rendering.

bool CameraProperties.UseOcclusionCulling

Whether or not the Hologram Camera will use occlusion culling during rendering.

bool CameraProperties.AllowHDR

When true, enables high dynamic range.

bool CameraProperties.AllowMSAA

When true, enables multi-sample anti-aliasing.

bool CameraProperties.AllowDynamicResolution

When true, enables dynamic resolution.

bool CameraProperties.UseFrustumTarget

Determines whether or not the frustum target will be used.

Transform CameraProperties.FrustumTarget

Automatically modifies Hologram Camera's settings to center capture volume on an object placed at this transformโ€™s position.

float CameraProperties.CenterOffset

Offsets the cycle of horizontal views based on the observer's viewing angle, represented as a percentage on a scale of [-0.5, 0.5]. Only applies in the Unity editor as it is typically used to correct for center distortion from the taskbar being visible, ignored in builds. The default value is 0.

float CameraProperties.HorizontalFrustumOffset

Degrees of hologram cameraโ€™s horizontal offset.

float CameraProperties.VerticalFrustumOffset

Degrees of hologram cameraโ€™s vertical offset.

float CameraProperties.Depthiness

Scales the z-axis between the view and projection matrices. This is useful when the scene has too much depth, creating an apparent blur due to large discrepancies in the interlaced images. Scaling Z down maintains parallax and relational depth, but adds visual clarity to near and far objects at the cost of geometric accuracy. Default value is 1.

bool Gizmos.DrawHandles

Toggles whether to show draggable handles on the gizmo.

Color Gizmos.FrustumColor

Color of the Hologram Camera's frustum gizmos in the Scene view.

Color Gizmos.MiddlePlaneColor

Color of Focal Plane identifier gizmo in the Scene view.

Color Gizmos.HandleColor

Color of handles in the Scene view.

ViewRenderEvent Events.OnViewRendered

A callback that gets called before each individual view is rendered. This is called with viewIndex values ranging within [0, numViews]. Note that the upper bound is inclusive, for an extra callback in case cleanup is needed.

HologramViewInterpolation Optimization.ViewInterpolation

View interpolation allows you to render only a subset of views instead of rendering all views (controllable by quiltPreset setting), by relying on a depthmap-based algorithm to fill in intermediate views. This significantly enhances performance, but may result in visual artifacts, depending on the scene being rendered.

bool Optimization.ReduceFlicker

View interpolation sometimes result in a visual artifact where pixels flicker between different color values. This setting reduceFlicker to true helps mitigate that.

Apply only when needed as it significantly reduces performance.

bool Optimization.FillGaps

View interpolation sometimes result in a visual artifact where surfaces have missing pixels, or gaps. Setting fillGaps to true helps mitigate that.

Apply only when needed as it reduces performance.

bool Optimization.BlendViews

View interpolation sometimes results in stark and unblended color differences on surfaces of objects. Setting blendViews to true helps mitigate that. Using this may increase the amount of flicker, so it may be wise to use this with reduceFlicker.

bool Debugging.ShowAllObjects

When set to true, this reveals hidden objects used by this Hologram Camera component, such as the cameras used for rendering.

int Debugging.OnlyShowView

Forces the rendering of only one view in the quilt, where this value represents the single-view's view index.

bool Debugging.OnlyRenderOneView

When onlyShowView is set to a valid index, this does the following:

  • When set to true, this causes the single view to only render to its tile in the quilt; the rest of the quilt will remain empty.

  • When set to false, the single view will be copied into every tile in the quilt. This does nothing when onlyShowView is -1.

string TargetLKGName

The name of the Looking Glass (LKG) device that this component is connected with.

int TargetLKGIndex

The index of the Looking Glass (LKG) device that this component is connected with.

static HologramCamera Instance

The most-recently enabled HologramCamera component, or null if there is none.


HologramCameraProperties CameraProperties

Contains a set of fields that correspond to fields on a Unity Camera, with some extra hologramCamera fields.

HologramCameraGizmos Gizmos

A container for Unity Gizmo settings.

HologramCameraEvents Events

A container for Hologram Camera Events.

OptimizationProperties Optimization

A container for Hologram Camera Optimization Properties.

HologramCameraDebugging Debugging

A container for Hologram Camera Optimization Properties.

QuiltSettings CustomQuiltSettings

A container for custom render settings.

Camera SingleViewCamera

Renders individual views of the scene, where each view may be composited into the quilt. When in 2D preview mode, only 1 view is rendered directly to the screen. This camera is not directly used for rendering to the screen. The results of its renders are used as intermediate steps in the rendering process.

Camera PostProcessCamera

The Camera used to apply final post-processing to a single view of the scene, or a quilt of the scene. This camera is not directly used for rendering to the screen. It is only used for applying graphical changes in internal RenderTextures.

Last updated