Skip to content

Commit 06e9f7e

Browse files
committed
Added an option to set depthStencilFormat in MixedRealityCaptureController
1 parent 2ec8341 commit 06e9f7e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Packages/webxr-interactions/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased]
88

9+
### Added
10+
- An option to set depthStencilFormat in MixedRealityCaptureController.
11+
912
### Changed
1013
- XR Interaction Toolkit sample XR Rig now use 1 camera instead of cameras group.
1114
- SceneHitTest now looks for Main Camera if there's no WebXRCamera component in scene.

Packages/webxr-interactions/Runtime/Scripts/MixedRealityCaptureController.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ private enum ControllerState
4747
Ended
4848
}
4949

50+
public enum DepthStencilFormats
51+
{
52+
None = 0,
53+
Depth = 16,
54+
DepthAndStencil = 24
55+
}
56+
5057
private const float WEBCAM_DISTANCE_CALIBRATION = 0.5f;
5158
private const float WEBCAM_SIZE_CALIBRATION = 0.25f;
5259
private const float WEBCAM_MIN_SIZE = 0.001f;
@@ -126,6 +133,8 @@ private enum ControllerState
126133
#endif
127134
[SerializeField]
128135
private int webcamFramesDelaySize = 0;
136+
[SerializeField, Tooltip("The depth buffer or depth and stencil format of the Background and Foreground RenderTextures")]
137+
private DepthStencilFormats depthStencilFormat = DepthStencilFormats.DepthAndStencil;
129138

130139
private ControllerState state = ControllerState.None;
131140
private float webcamBaseSize = 1f;
@@ -540,7 +549,7 @@ private void CreateRenderTextures()
540549
backgroundStack = new RenderTexture[webcamFramesDelaySize];
541550
foregroundStack = new RenderTexture[webcamFramesDelaySize];
542551
webcamStack = new RenderTexture[webcamFramesDelaySize];
543-
RenderTextureDescriptor envDesc = new RenderTextureDescriptor(Screen.width, Screen.height, RenderTextureFormat.Default, 16);
552+
RenderTextureDescriptor envDesc = new RenderTextureDescriptor(Screen.width, Screen.height, RenderTextureFormat.Default, (int)depthStencilFormat);
544553
RenderTextureDescriptor webcamDesc = new RenderTextureDescriptor(Mathf.RoundToInt(100 * webcam.transform.localScale.x), 100, RenderTextureFormat.Default);
545554
for (int i = 0; i < webcamFramesDelaySize; i++)
546555
{

0 commit comments

Comments
 (0)