浏览代码

Merge branch 'latest-preview' into public-latest-preview

/4.1
Todd Stinson 4 年前
当前提交
8c52554c
共有 12 个文件被更改,包括 221 次插入1113 次删除
  1. 229
      Assets/Scenes/ARFoundationMenu/Menu.unity
  2. 6
      Assets/Scenes/Depth/DepthImages.unity
  3. 953
      Assets/Scenes/Depth/SimpleOcclusion.unity
  4. 2
      Assets/Scenes/HumanTracking/HumanBodyTracking3D.unity
  5. 7
      Assets/Scripts/TestDepthImage.cs
  6. 29
      Assets/Scripts/UX/ARSceneSelectUI.cs
  7. 2
      Assets/Scripts/UX/ActiveMenu.cs
  8. 33
      Assets/Scripts/UX/CheckAvailableFeatures.cs
  9. 8
      Packages/manifest.json
  10. 3
      .github/pull_request_template.md
  11. 51
      Assets/Scripts/UX/CheckRuntimeDepth.cs
  12. 11
      Assets/Scripts/UX/CheckRuntimeDepth.cs.meta

229
Assets/Scenes/ARFoundationMenu/Menu.unity


m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 774532498}
m_MethodName: HumanSegmentation3DButtonPressed
m_MethodName: BodyTracking3DButtonPressed
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

m_EditorClassIdentifier:
m_AllMenu: {fileID: 1569808630}
m_FaceTrackingMenu: {fileID: 881193863}
m_HumanSegmentationMenu: {fileID: 1468820548}
m_BodyTrackingMenu: {fileID: 1468820548}
m_PlaneDetectionMenu: {fileID: 881169046}
m_MeshingMenu: {fileID: 2008080040}
m_DepthMenu: {fileID: 1017732099}

m_FaceTracking: {fileID: 1116959538}
m_FaceBlendShapes: {fileID: 507951178}
m_FaceRegions: {fileID: 876148839}
m_HumanSegmentation: {fileID: 2111581279}
m_BodyTracking: {fileID: 2111581279}
m_LightEstimation: {fileID: 11739801}
m_PlaneDetection: {fileID: 1172329691}
m_PlaneClassification: {fileID: 988159692}

m_Name:
m_EditorClassIdentifier:
m_Tooltip: {fileID: 2094799242}
--- !u!1 &855858568
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 855858569}
- component: {fileID: 855858571}
- component: {fileID: 855858570}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &855858569
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 855858568}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1441317956}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &855858570
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 855858568}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Images
--- !u!222 &855858571
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 855858568}
m_CullTransparentMesh: 0
--- !u!1 &876148837
GameObject:
m_ObjectHideFlags: 0

m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Segmentation
m_Text: Body Tracking
--- !u!222 &880896171
CanvasRenderer:
m_ObjectHideFlags: 0

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 774532498}
m_MethodName: HumanSegmentation2DButtonPressed
m_MethodName: BodyTracking2DButtonPressed
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1441317955
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1441317956}
- component: {fileID: 1441317959}
- component: {fileID: 1441317958}
- component: {fileID: 1441317957}
m_Layer: 5
m_Name: HumanSegmentationImages
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1441317956
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1441317955}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 2.8957999, y: 2.8957999, z: 2.8957999}
m_Children:
- {fileID: 855858569}
m_Father: {fileID: 1468820549}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -125}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1441317957
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1441317955}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1441317958}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 774532498}
m_MethodName: HumanSegmentationImagesButtonPressed
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1441317958
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1441317955}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &1441317959
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1441317955}
m_CullTransparentMesh: 0
--- !u!1 &1459382204
GameObject:
m_ObjectHideFlags: 0

m_Component:
- component: {fileID: 1468820549}
m_Layer: 5
m_Name: HumanSegmentationScenes
m_Name: BodyTrackingScenes
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

- {fileID: 1909022301}
- {fileID: 1356389282}
- {fileID: 368937169}
- {fileID: 1441317956}
m_Father: {fileID: 1413559114}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_TargetGraphic: {fileID: 1130901186}
m_HandleRect: {fileID: 1130901185}
m_Direction: 2
m_Value: 0.99999946
m_Size: 0.80272716
m_Value: 1
m_Size: 0.8027273
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:

- component: {fileID: 2111581279}
- component: {fileID: 2111581282}
m_Layer: 5
m_Name: HumanSegmentation
m_Name: BodyTracking
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0

m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 774532498}
m_MethodName: HumanSegmentationMenuButtonPressed
m_MethodName: BodyTrackingMenuButtonPressed
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}

6
Assets/Scenes/Depth/DepthImages.unity


m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 600, y: 120}
m_SizeDelta: {x: 900, y: 120}
m_Pivot: {x: 0, y: 0}
--- !u!114 &642201224
MonoBehaviour:

m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 60
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3

m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 60
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3

953
Assets/Scenes/Depth/SimpleOcclusion.unity
文件差异内容过多而无法显示
查看文件

2
Assets/Scenes/HumanTracking/HumanBodyTracking3D.unity


m_EditorClassIdentifier:
m_Pose2D: 0
m_Pose3D: 1
m_Pose3DScaleEstimation: 1
m_Pose3DScaleEstimation: 0
m_HumanBodyPrefab: {fileID: 0}
--- !u!1 &1427795752
GameObject:

7
Assets/Scripts/TestDepthImage.cs


void Update()
{
Debug.Assert(m_OcclusionManager != null, "no occlusion manager");
var subsystem = m_OcclusionManager.subsystem;
if (subsystem == null)
if ((m_OcclusionManager.descriptor?.supportsHumanSegmentationStencilImage == false)
&& (m_OcclusionManager.descriptor?.supportsHumanSegmentationDepthImage == false)
&& (m_OcclusionManager.descriptor?.supportsEnvironmentDepthImage == false))
m_ImageInfo.text = "Human Segmentation not supported.";
m_ImageInfo.text = "Depth functionality is not supported on this device.";
}
return;
}

29
Assets/Scripts/UX/ARSceneSelectUI.cs


}
[SerializeField]
GameObject m_HumanSegmentationMenu;
public GameObject humanSegmentationMenu
GameObject m_BodyTrackingMenu;
public GameObject bodyTrackingMenu
get { return m_HumanSegmentationMenu; }
set { m_HumanSegmentationMenu = value; }
get { return m_BodyTrackingMenu; }
set { m_BodyTrackingMenu = value; }
}
[SerializeField]

m_PlaneDetectionMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
else if(ActiveMenu.currentMenu == MenuType.HumanSegmentation)
else if(ActiveMenu.currentMenu == MenuType.BodyTracking)
m_HumanSegmentationMenu.SetActive(true);
m_BodyTrackingMenu.SetActive(true);
m_AllMenu.SetActive(false);
}
else if(ActiveMenu.currentMenu == MenuType.Meshing)

LoadScene("WorldCameraWithUserFacingFaceTracking");
}
public void HumanSegmentationMenuButtonPressed()
public void BodyTrackingMenuButtonPressed()
ActiveMenu.currentMenu = MenuType.HumanSegmentation;
m_HumanSegmentationMenu.SetActive(true);
ActiveMenu.currentMenu = MenuType.BodyTracking;
m_BodyTrackingMenu.SetActive(true);
public void HumanSegmentation2DButtonPressed()
public void BodyTracking2DButtonPressed()
public void HumanSegmentation3DButtonPressed()
public void BodyTracking3DButtonPressed()
}
public void HumanSegmentationImagesButtonPressed()
{
LoadScene("HumanSegmentationImages");
}
public void LightEstimationButtonPressed()

ActiveMenu.currentMenu = MenuType.Main;
m_FaceTrackingMenu.SetActive(false);
m_PlaneDetectionMenu.SetActive(false);
m_HumanSegmentationMenu.SetActive(false);
m_BodyTrackingMenu.SetActive(false);
m_MeshingMenu.SetActive(false);
m_DepthMenu.SetActive(false);
m_AllMenu.SetActive(true);

2
Assets/Scripts/UX/ActiveMenu.cs


Main,
FaceTracking,
PlaneDetection,
HumanSegmentation,
BodyTracking,
Meshing,
Depth
}

33
Assets/Scripts/UX/CheckAvailableFeatures.cs


}
[SerializeField]
Button m_HumanSegmentation;
public Button humanSegmentation
Button m_BodyTracking;
public Button bodyTracking
get { return m_HumanSegmentation; }
set { m_HumanSegmentation = value; }
get { return m_BodyTracking; }
set { m_BodyTracking = value; }
}
[SerializeField]

var sessionDescriptors = new List<XRSessionSubsystemDescriptor>();
SubsystemManager.GetSubsystemDescriptors<XRSessionSubsystemDescriptor>(sessionDescriptors);
var bodyTrackingDescriptors = new List<XRHumanBodySubsystemDescriptor>();
SubsystemManager.GetSubsystemDescriptors<XRHumanBodySubsystemDescriptor>(bodyTrackingDescriptors);
if(planeDescriptors.Count > 0 && rayCastDescriptors.Count > 0)
{
m_SimpleAR.interactable = true;

{
foreach(var occlusionDescriptor in occlusionDescriptors)
{
if(occlusionDescriptor.supportsHumanSegmentationDepthImage && occlusionDescriptor.supportsHumanSegmentationStencilImage)
#if UNITY_IOS
if(occlusionDescriptor.supportsEnvironmentDepthImage
|| occlusionDescriptor.supportsHumanSegmentationDepthImage
|| occlusionDescriptor.supportsHumanSegmentationStencilImage)
m_HumanSegmentation.interactable = true;
m_Depth.interactable = true;
if(occlusionDescriptor.supportsEnvironmentDepthImage)
#endif
#if UNITY_ANDROID
m_Depth.interactable = true;
#endif
}
}
if(bodyTrackingDescriptors.Count > 0)
{
foreach(var bodyTrackingDescriptor in bodyTrackingDescriptors)
{
if(bodyTrackingDescriptor.supportsHumanBody2D || bodyTrackingDescriptor.supportsHumanBody3D)
m_Depth.interactable = true;
m_BodyTracking.interactable = true;
}
}
}

8
Packages/manifest.json


"com.unity.test-framework": "1.1.14",
"com.unity.textmeshpro": "2.0.1",
"com.unity.ugui": "1.0.0",
"com.unity.xr.arcore": "4.0.3",
"com.unity.xr.arfoundation": "4.1.0-preview.1",
"com.unity.xr.arkit": "4.1.0-preview.1",
"com.unity.xr.arkit-face-tracking": "4.1.0-preview.1",
"com.unity.xr.arcore": "4.1.0-preview.2",
"com.unity.xr.arfoundation": "4.1.0-preview.2",
"com.unity.xr.arkit": "4.1.0-preview.2",
"com.unity.xr.arkit-face-tracking": "4.1.0-preview.2",
"com.unity.xr.interaction.toolkit": "0.9.4-preview",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",

3
.github/pull_request_template.md


# Please create an issue instead
Hi there! Thanks for your input; however, we are not accepting pull requests at this time. If you have a suggestion or think you've found a bug, please create an [issue](https://github.com/Unity-Technologies/arfoundation-samples/issues/new/choose) instead.

51
Assets/Scripts/UX/CheckRuntimeDepth.cs


using System;
using System.Text;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR.ARFoundation;
using UnityEngine.XR.ARSubsystems;
namespace UnityEngine.XR.ARFoundation.Samples
{
/// <summary>
/// This component tests for depth functionality and enables/disables
/// a text message on the screen reporting that depth is not suppoted.
/// </summary>
public class CheckRuntimeDepth : MonoBehaviour
{
[SerializeField]
[Tooltip("The AROcclusionManager which will manage depth functionality.")]
AROcclusionManager m_OcclusionManager;
/// <summary>
/// Get or set the <c>AROcclusionManager</c>.
/// </summary>
public AROcclusionManager occlusionManager
{
get { return m_OcclusionManager; }
set { m_OcclusionManager = value; }
}
[SerializeField]
Text m_DepthAvailabilityInfo;
/// <summary>
/// The UI Text used to display information about the availability of depth functionality.
/// </summary>
public Text depthAvailabilityInfo
{
get { return m_DepthAvailabilityInfo; }
set { m_DepthAvailabilityInfo = value; }
}
void Update()
{
Debug.Assert(m_OcclusionManager != null, "no occlusion manager");
Debug.Assert(m_DepthAvailabilityInfo != null, "no text box");
m_DepthAvailabilityInfo.enabled = ((m_OcclusionManager.descriptor?.supportsHumanSegmentationStencilImage == false)
&& (m_OcclusionManager.descriptor?.supportsHumanSegmentationDepthImage == false)
&& (m_OcclusionManager.descriptor?.supportsEnvironmentDepthImage == false));
}
}
}

11
Assets/Scripts/UX/CheckRuntimeDepth.cs.meta


fileFormatVersion: 2
guid: 3604c16c635de4e029b7ec13aed43bee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存