class LightshipOcclusionExtension
(Niantic.Lightship.AR.Occlusion.LightshipOcclusionExtension)
Overview
This component allows configuration of the additional functionality available in Lightship's implementation of XROcclusionSubsystem.
class LightshipOcclusionExtension: MonoBehaviour {
public:
enumOptimalOcclusionDistanceMode;
// fields
static const string DefaultShaderName = "Lightship/OcclusionExtension";
// properties
uint TargetFrameRate;
bool Visualization;
bool PreferSmoothEdges;
Matrix4x4? LatestIntrinsicsMatrix;
OptimalOcclusionDistanceMode Mode;
bool IsOcclusionSuppressionEnabled;
bool IsOcclusionStabilizationEnabled;
float StabilizationThreshold;
bool IsRenderingActive;
bool BypassOcclusionManagerUpdates;
Texture2D? DepthTexture;
Matrix4x4 DepthTransform;
bool UseCustomBackgroundMaterial;
Material CustomBackgroundMaterial;
Material? BackgroundMaterial;
// methods
bool AddSemanticSuppressionChannel(string channelName);
void RemoveSemanticSuppressionChannel(string channelName);
bool TryGetDepth(int screenX, int screenY, out float depth);
void TrackOccludee(Renderer occludee);
};
Detailed Documentation
This component allows configuration of the additional functionality available in Lightship's implementation of XROcclusionSubsystem.
Fields
DefaultShaderName
static const string DefaultShaderName = "Lightship/OcclusionExtension"
Name of the default Lightship Occlusion Extension shader.
Properties
TargetFrameRate
uint TargetFrameRate
Get or set the frame rate that depth inference will aim to run at
Visualization
bool Visualization
When enabled, the component displays the depth image used for occlusions. Note that visualization can only be used if a custom occlusion feature is active, e.g. suppression or stabilization.
PreferSmoothEdges
bool PreferSmoothEdges
When enabled, the depth image will be sampled bilinearly during rendering.
LatestIntrinsicsMatrix
Matrix4x4? LatestIntrinsicsMatrix
Returns the intrinsics matrix of the most recent semantic segmentation prediction. Contains values for the camera's focal length and principal point. Converts between 2D image pixel coordinates and 3D world coordinates relative to the camera.
The intrinsics matrix.
Parameters:
System.NotSupportedException
- Thrown if getting intrinsics matrix is not supported.
Mode
OptimalOcclusionDistanceMode Mode
Get or set the current mode in use for determining the distance at which occlusions will have the best visual quality.
IsOcclusionSuppressionEnabled
bool IsOcclusionSuppressionEnabled
Get or set whether semantic segmentation based occlusion suppression is enabled.
IsOcclusionStabilizationEnabled
bool IsOcclusionStabilizationEnabled
Get or set whether meshing based occlusion stabilization is enabled.
StabilizationThreshold
float StabilizationThreshold
Whether to prefer per-frame (0) or fused depth (1) during stabilization.
IsRenderingActive
bool IsRenderingActive
Whether the second pass of background rendering is active to satisfy custom occlusion features.
BypassOcclusionManagerUpdates
bool BypassOcclusionManagerUpdates
Whether to disable automatically updating the depth texture of the occlusion manager. This feature can be used to avoid redundant texture operations since depth is ultimately going to be overriden by the Lightship Occlusion Extension anyway. Not using this setting may result in undesired synchronization with the rendering thread that impacts performance.
DepthTexture
Texture2D? DepthTexture
Returns the depth texture used to render occlusions.
DepthTransform
Matrix4x4 DepthTransform
Returns a transform for converting between normalized image coordinates and a coordinate space appropriate for rendering the depth texture onscreen.
UseCustomBackgroundMaterial
bool UseCustomBackgroundMaterial
Get or set whether to use the custom material for processing the AR background depth buffer.
CustomBackgroundMaterial
Material CustomBackgroundMaterial
Get or set the custom material used for processing the AR background depth buffer.
BackgroundMaterial
Material? BackgroundMaterial
The background rendering material in use.
Parameters:
InvalidOperationException
- Thrown if the the background shader resource cannot be found.
Methods
AddSemanticSuppressionChannel
bool AddSemanticSuppressionChannel(string channelName)
Adds a semantic segmentation channel to the collection of channels that are suppressed in the depth buffer.
Parameters:
channelName
- Semantic segmentation channel to add
Returns:
True if the channel was successfully added.
RemoveSemanticSuppressionChannel
void RemoveSemanticSuppressionChannel(string channelName)
Removes a semantic segmentation channel, if it exists, from the collection of channels that are suppressed in the depth buffer.
Parameters:
channelName
- Semantic segmentation channel to remove
TryGetDepth
bool TryGetDepth(int screenX, int screenY, out float depth)
Returns the metric eye depth at the specified pixel coordinates.
Parameters:
screenX
- The x position on the screen.
screenY
- The y position on the screen.
depth
- The resulting depth value.
Returns:
Whether retrieving the depth value was successful.
TrackOccludee
void TrackOccludee(Renderer occludee)
Sets the principal virtual object being occluded in the SpecifiedGameObject occlusion mode
.. note::
This method changes the optimal occlusion distance mode setting.