HologramCamera.cs
The Hologram Camera component is the main method to capture 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
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 applications that only want the visuals to appear on the Looking Glass or setups with more than one 2D monitor. For applications that require window-context-specific raycasting or UI events, and that have a single 2D monitor with the Looking Glass, this can be toggled off.
DisplayTarget TargetDisplay
The Unity display that the LKG device associated with this component will render to. This will be overwritten to always be display 1 if "Force Display Index" is toggled on.
DeviceType EmulatedDevice
The type of device that is being emulated right now. Only appears in editor if there are no LKG devices plugged in or recognized, otherwise the value is overwritten by the calibration.
bool Preview2D
Allows you to preview your content in 2D instead of 3D. This can be useful for debugging.
bool ShowHologramPreview
Does this camera show 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 inspection).
bool UseCustomRenderSettings
Toggles whether or not custom render settings will be used.
int CustomRenderSettings.quiltWidth
The width (in pixels) of the entire quilt.
int CustomRenderSettings.quiltHeight
The height (in pixels) of the entire quilt.
int CustomRenderSettings.viewColumns
The number of columns in the quilt.
int CustomRenderSettings.viewRows
The number of rows in the quilt.
int CustomRenderSettings.numViews
The number of total views in quilt.
Usually this is Rows * Columns, 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.
float CustomRenderSettings.aspect
Aspect ratio for the output image. For your reference:
Portrait: 0.75
32โ and 65โ Looking Glass: 1.778
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
โsSize
and TransformโslocalScale
values do not update automatically based on one another.Size Sets Scale โ Updating
HologramCamera
'sSize
automatically updates the TransformlocalScale
's xyz values to match.Scale Sets Size โ Updating Transform
localScale
automatically updatesHologramCamera
'sSize
to match the largest value of thelocalScale
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 background
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.UseOcculsionCulling
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.AllowHDR
When true, enables high dynamic range.
bool CameraProperties.AllowMSAA
When true, enables multisample 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 HologramCamera
'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 HologramCamera
โ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 noise, 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 HologramCamera 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.
float Aspect
The final aspect ratio value used for rendering. This value is always greater than zero. Returns RenderSettings's aspect value if it is greater than zero, or the UnmodifiedCalibration's aspect value otherwise.
static HologramCamera Instance
The most-recently enabled HologramCamera component, or null if there is none.
HologramCameraDebugging Debugging
A container for Hologram Camera Optimization Properties.
OptimizationProperties Optimization
A container for Hologram Camera Optimization Properties.
HologramCameraEvents Events
A container for Hologram Camera Events.
HologramCameraProperties CameraProperties
Contains a set of fields that correspond to fields on a Unity Camera, with some extra hologramCamera fields.
HologramRenderSettings CustomRenderSettings
A container for custom render settings.
HologramCameraGizmos Gizmos
A container for Unity Gizmo settings.
Camera SingleViewCamera
Renders individual views of the scene, where each view may be composited into the LookingGlass 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 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