From 7af6cab0c2ee624090a65b329c8ba076ce63832e Mon Sep 17 00:00:00 2001 From: Jon Hogins Date: Wed, 8 Apr 2020 08:17:43 -0700 Subject: [PATCH] Initial commit --- .gitattributes | 15 + .github/pull_request_template.md | 17 + .gitignore | 37 + .gitmodules | 0 .npmignore | 14 + .yamato/promotion.yml | 79 ++ .yamato/upm-ci-full.yml | 143 +++ .yamato/upm-ci-testprojects.yml | 115 +++ CONTRIBUTING.md | 9 + CONTRIBUTING.md.meta | 7 + README.md | 35 + TestProjects/PerceptionHDRP/Assets.meta | 3 + .../Assets/HDRenderPipelineAsset.asset | 316 ++++++ .../Assets/HDRenderPipelineAsset.asset.meta | 8 + .../Assets/LabelingConfiguration.asset | 21 + .../Assets/LabelingConfiguration.asset.meta | 8 + TestProjects/PerceptionHDRP/Assets/Rotator.cs | 15 + .../PerceptionHDRP/Assets/Rotator.cs.meta | 11 + .../PerceptionHDRP/Assets/Scenes.meta | 8 + .../Assets/Scenes/SampleScene.unity | 931 ++++++++++++++++++ .../Assets/Scenes/SampleScene.unity.meta | 7 + .../PerceptionHDRP/Packages/manifest.json | 51 + .../ProjectSettings/AudioManager.asset | 19 + .../BurstAotSettings_StandaloneLinux64.json | 11 + .../BurstAotSettings_StandaloneOSX.json | 11 + .../BurstAotSettings_StandaloneWindows.json | 11 + .../ProjectSettings/ClusterInputManager.asset | 6 + .../ProjectSettings/DynamicsManager.asset | 34 + .../ProjectSettings/EditorBuildSettings.asset | 8 + ...t~6f5b6cb06b253baf30333594f2fc40616d3dc6f7 | 26 + .../ProjectSettings/EditorSettings.asset | 35 + .../ProjectSettings/GraphicsSettings.asset | 61 ++ .../ProjectSettings/HDRPProjectSettings.asset | 21 + .../ProjectSettings/InputManager.asset | 487 +++++++++ .../ProjectSettings/NavMeshAreas.asset | 91 ++ .../ProjectSettings/Physics2DSettings.asset | 56 ++ .../ProjectSettings/PresetManager.asset | 7 + .../ProjectSettings/ProjectSettings.asset | 620 ++++++++++++ .../ProjectSettings/ProjectVersion.txt | 2 + .../ProjectSettings/QualitySettings.asset | 236 +++++ .../ProjectSettings/TagManager.asset | 43 + .../ProjectSettings/TimeManager.asset | 9 + .../UnityConnectSettings.asset | 34 + .../ProjectSettings/VFXManager.asset | 12 + .../VersionControlSettings.asset | 8 + .../ProjectSettings/XRSettings.asset | 10 + .../PerceptionHDRP/TestRunnerOptions.json | 3 + .../Assets/ExampleLabelingConfiguration.asset | 21 + .../ExampleLabelingConfiguration.asset.meta | 8 + TestProjects/PerceptionURP/Assets/Rotator.cs | 15 + .../PerceptionURP/Assets/Rotator.cs.meta | 11 + TestProjects/PerceptionURP/Assets/Scenes.meta | 8 + .../Assets/Scenes/SampleScene.unity | 765 ++++++++++++++ .../Assets/Scenes/SampleScene.unity.meta | 7 + .../PerceptionURP/Assets/Settings.meta | 8 + .../Assets/Settings/ForwardRenderer.asset | 49 + .../Settings/ForwardRenderer.asset.meta | 8 + .../Assets/Settings/SampleSceneProfile.asset | 118 +++ .../Settings/SampleSceneProfile.asset.meta | 8 + .../Settings/UniversalRP-HighQuality.asset | 54 + .../UniversalRP-HighQuality.asset.meta | 8 + .../PerceptionURP/Packages/manifest.json | 49 + .../ProjectSettings/AudioManager.asset | 19 + .../BurstAotSettings_StandaloneLinux64.json | 11 + .../BurstAotSettings_StandaloneWindows.json | 11 + .../ProjectSettings/ClusterInputManager.asset | 6 + .../ProjectSettings/DynamicsManager.asset | 36 + .../ProjectSettings/EditorBuildSettings.asset | 8 + .../ProjectSettings/EditorSettings.asset | 35 + .../ProjectSettings/GraphicsSettings.asset | 68 ++ .../ProjectSettings/InputManager.asset | 487 +++++++++ .../ProjectSettings/NavMeshAreas.asset | 91 ++ .../ProjectSettings/Physics2DSettings.asset | 56 ++ .../ProjectSettings/PresetManager.asset | 27 + .../ProjectSettings/ProjectSettings.asset | 671 +++++++++++++ .../ProjectSettings/ProjectVersion.txt | 2 + .../ProjectSettings/QualitySettings.asset | 131 +++ .../ProjectSettings/TagManager.asset | 43 + .../ProjectSettings/TimeManager.asset | 9 + .../UnityConnectSettings.asset | 34 + .../ProjectSettings/VFXManager.asset | 11 + .../ProjectSettings/XRSettings.asset | 10 + .../PerceptionURP/TestRunnerOptions.json | 3 + com.unity.perception/.editorconfig | 75 ++ com.unity.perception/.npmignore | 26 + com.unity.perception/CHANGELOG.md | 19 + com.unity.perception/CHANGELOG.md.meta | 7 + .../Documentation~/GroundTruth-Custom.md | 4 + .../Documentation~/GroundTruth-Labeling.md | 34 + .../Documentation~/GroundTruth-Overview.md | 18 + .../Documentation~/ScenarioManager.md | 4 + com.unity.perception/Documentation~/index.md | 19 + com.unity.perception/Editor.meta | 8 + com.unity.perception/Editor/AssemblyInfo.cs | 4 + .../Editor/AssemblyInfo.cs.meta | 3 + com.unity.perception/Editor/GroundTruth.meta | 8 + .../Editor/GroundTruth/AssemblyInfo.cs | 4 + .../Editor/GroundTruth/AssemblyInfo.cs.meta | 11 + .../GroundTruth/BaseCustomPassDrawer.cs | 42 + .../GroundTruth/BaseCustomPassDrawer.cs.meta | 11 + .../InstanceSegmentationPassEditor.cs | 23 + .../InstanceSegmentationPassEditor.cs.meta | 11 + .../LabelingConfigurationEditor.cs | 56 ++ .../LabelingConfigurationEditor.cs.meta | 3 + .../Editor/GroundTruth/LabelingEditor.cs | 53 + .../Editor/GroundTruth/LabelingEditor.cs.meta | 3 + .../Editor/GroundTruth/LabelingPassEditor.cs | 22 + .../GroundTruth/LabelingPassEditor.cs.meta | 11 + .../GroundTruth/ObjectCountPassEditor.cs | 22 + .../GroundTruth/ObjectCountPassEditor.cs.meta | 11 + .../Editor/Unity.Perception.Editor.asmdef | 31 + .../Unity.Perception.Editor.asmdef.meta | 7 + com.unity.perception/LICENSE.md | 3 + com.unity.perception/LICENSE.md.meta | 7 + com.unity.perception/QAReport.md | 26 + com.unity.perception/QAReport.md.meta | 7 + com.unity.perception/Runtime.meta | 8 + com.unity.perception/Runtime/AssemblyInfo.cs | 10 + .../Runtime/AssemblyInfo.cs.meta | 11 + com.unity.perception/Runtime/GroundTruth.meta | 8 + .../Runtime/GroundTruth/BoundingBoxOrigin.cs | 18 + .../GroundTruth/BoundingBoxOrigin.cs.meta | 11 + .../Runtime/GroundTruth/DatasetJsonUtility.cs | 76 ++ .../GroundTruth/DatasetJsonUtility.cs.meta | 11 + .../Runtime/GroundTruth/EgoMarker.cs | 31 + .../Runtime/GroundTruth/EgoMarker.cs.meta | 11 + .../GroundTruthCrossPipelinePass.cs | 107 ++ .../GroundTruthCrossPipelinePass.cs.meta | 11 + .../Runtime/GroundTruth/GroundTruthInfo.cs | 9 + .../GroundTruth/GroundTruthInfo.cs.meta | 11 + .../GroundTruthLabelSetupSystem.cs | 92 ++ .../GroundTruthLabelSetupSystem.cs.meta | 11 + .../Runtime/GroundTruth/GroundTruthPass.cs | 95 ++ .../GroundTruth/GroundTruthPass.cs.meta | 11 + .../GroundTruth/GroundTruthRendererFeature.cs | 71 ++ .../GroundTruthRendererFeature.cs.meta | 11 + .../GroundTruth/IGroundTruthGenerator.cs | 6 + .../GroundTruth/IGroundTruthGenerator.cs.meta | 3 + .../InstanceSegmentationCrossPipelinePass.cs | 87 ++ ...tanceSegmentationCrossPipelinePass.cs.meta | 11 + .../GroundTruth/InstanceSegmentationPass.cs | 51 + .../InstanceSegmentationPass.cs.meta | 11 + .../Runtime/GroundTruth/Labeling.meta | 8 + .../Runtime/GroundTruth/Labeling/Labeling.cs | 28 + .../GroundTruth/Labeling/Labeling.cs.meta | 11 + .../Labeling/LabelingConfiguration.cs | 43 + .../Labeling/LabelingConfiguration.cs.meta | 11 + .../Runtime/GroundTruth/MetricData.cs | 135 +++ .../Runtime/GroundTruth/MetricData.cs.meta | 11 + .../Runtime/GroundTruth/ObjectCountPass.cs | 208 ++++ .../GroundTruth/ObjectCountPass.cs.meta | 11 + .../Runtime/GroundTruth/PerceptionCamera.cs | 702 +++++++++++++ .../GroundTruth/PerceptionCamera.cs.meta | 11 + .../GroundTruth/RenderTextureReader.cs | 156 +++ .../GroundTruth/RenderTextureReader.cs.meta | 11 + .../Runtime/GroundTruth/RenderedObjectInfo.cs | 39 + .../GroundTruth/RenderedObjectInfo.cs.meta | 3 + .../RenderedObjectInfoGenerator.cs | 248 +++++ .../RenderedObjectInfoGenerator.cs.meta | 3 + .../Runtime/GroundTruth/Resources.meta | 8 + .../Resources/InstanceSegmentation.shader | 49 + .../InstanceSegmentation.shader.meta | 9 + .../Resources/LabeledObjectHistogram.compute | 78 ++ .../LabeledObjectHistogram.compute.meta | 8 + .../Resources/SemanticSegmentation.shader | 70 ++ .../SemanticSegmentation.shader.meta | 9 + .../SemanticSegmentationCrossPipelinePass.cs | 64 ++ ...anticSegmentationCrossPipelinePass.cs.meta | 11 + .../GroundTruth/SemanticSegmentationPass.cs | 55 ++ .../SemanticSegmentationPass.cs.meta | 11 + .../SimulationManagementComponentSystem.cs | 13 + ...imulationManagementComponentSystem.cs.meta | 11 + .../Runtime/GroundTruth/SimulationManager.cs | 759 ++++++++++++++ .../GroundTruth/SimulationManager.cs.meta | 11 + .../Runtime/GroundTruth/SimulationState.cs | 707 +++++++++++++ .../GroundTruth/SimulationState.cs.meta | 11 + .../GroundTruth/SimulationState_Json.cs | 344 +++++++ .../GroundTruth/SimulationState_Json.cs.meta | 11 + .../Runtime/Unity.Perception.Runtime.asmdef | 39 + .../Unity.Perception.Runtime.asmdef.meta | 7 + com.unity.perception/Tests.meta | 8 + com.unity.perception/Tests/.tests.json | 3 + com.unity.perception/Tests/Editor.meta | 8 + .../Tests/Editor/BuildPerceptionPlayer.cs | 124 +++ .../Editor/BuildPerceptionPlayer.cs.meta | 11 + .../Editor/Unity.SimViz.Editor.Tests.asmdef | 27 + .../Unity.SimViz.Editor.Tests.asmdef.meta | 7 + com.unity.perception/Tests/Runtime.meta | 8 + .../Tests/Runtime/GroundTruthTests.meta | 8 + .../GroundTruthTests/BoundingBox2DTests.cs | 163 +++ .../BoundingBox2DTests.cs.meta | 3 + .../DatasetJsonUtilityTests.cs | 90 ++ .../DatasetJsonUtilityTests.cs.meta | 11 + .../GroundTruthTests/Main Camera.prefab | 253 +++++ .../GroundTruthTests/Main Camera.prefab.meta | 7 + .../GroundTruthTests/ObjectCountTests.cs | 151 +++ .../GroundTruthTests/ObjectCountTests.cs.meta | 11 + .../Runtime/GroundTruthTests/PassTestBase.cs | 31 + .../GroundTruthTests/PassTestBase.cs.meta | 3 + .../GroundTruthTests/SegmentationPassTests.cs | 193 ++++ .../SegmentationPassTests.cs.meta | 11 + .../SimulationManagerTests.cs | 891 +++++++++++++++++ .../SimulationManagerTests.cs.meta | 3 + ...SimulationManager_SensorSchedulingTests.cs | 177 ++++ ...ationManager_SensorSchedulingTests.cs.meta | 3 + .../Runtime/GroundTruthTests/TestHelper.cs | 29 + .../GroundTruthTests/TestHelper.cs.meta | 11 + .../Runtime/Unity.SimViz.Runtime.Tests.asmdef | 40 + .../Unity.SimViz.Runtime.Tests.asmdef.meta | 7 + com.unity.perception/Third Party Notices.md | 71 ++ .../Third Party Notices.md.meta | 7 + com.unity.perception/package.json | 14 + com.unity.perception/package.json.meta | 7 + 213 files changed, 14318 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/pull_request_template.md create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .npmignore create mode 100644 .yamato/promotion.yml create mode 100644 .yamato/upm-ci-full.yml create mode 100644 .yamato/upm-ci-testprojects.yml create mode 100644 CONTRIBUTING.md create mode 100644 CONTRIBUTING.md.meta create mode 100644 README.md create mode 100644 TestProjects/PerceptionHDRP/Assets.meta create mode 100644 TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset create mode 100644 TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset.meta create mode 100644 TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset create mode 100644 TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset.meta create mode 100644 TestProjects/PerceptionHDRP/Assets/Rotator.cs create mode 100644 TestProjects/PerceptionHDRP/Assets/Rotator.cs.meta create mode 100644 TestProjects/PerceptionHDRP/Assets/Scenes.meta create mode 100644 TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity create mode 100644 TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity.meta create mode 100644 TestProjects/PerceptionHDRP/Packages/manifest.json create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/AudioManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneOSX.json create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneWindows.json create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/ClusterInputManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/DynamicsManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset~6f5b6cb06b253baf30333594f2fc40616d3dc6f7 create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/EditorSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/GraphicsSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/HDRPProjectSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/InputManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/NavMeshAreas.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/Physics2DSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/PresetManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/ProjectSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/ProjectVersion.txt create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/QualitySettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/TagManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/TimeManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/UnityConnectSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/VFXManager.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/VersionControlSettings.asset create mode 100644 TestProjects/PerceptionHDRP/ProjectSettings/XRSettings.asset create mode 100644 TestProjects/PerceptionHDRP/TestRunnerOptions.json create mode 100644 TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset create mode 100644 TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset.meta create mode 100644 TestProjects/PerceptionURP/Assets/Rotator.cs create mode 100644 TestProjects/PerceptionURP/Assets/Rotator.cs.meta create mode 100644 TestProjects/PerceptionURP/Assets/Scenes.meta create mode 100644 TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity create mode 100644 TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity.meta create mode 100644 TestProjects/PerceptionURP/Assets/Settings.meta create mode 100644 TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset create mode 100644 TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset.meta create mode 100644 TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset create mode 100644 TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset.meta create mode 100644 TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset create mode 100644 TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset.meta create mode 100644 TestProjects/PerceptionURP/Packages/manifest.json create mode 100644 TestProjects/PerceptionURP/ProjectSettings/AudioManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json create mode 100644 TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneWindows.json create mode 100644 TestProjects/PerceptionURP/ProjectSettings/ClusterInputManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/DynamicsManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/EditorBuildSettings.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/EditorSettings.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/GraphicsSettings.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/InputManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/NavMeshAreas.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/Physics2DSettings.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/PresetManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/ProjectSettings.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt create mode 100644 TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/TagManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/TimeManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/UnityConnectSettings.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/VFXManager.asset create mode 100644 TestProjects/PerceptionURP/ProjectSettings/XRSettings.asset create mode 100644 TestProjects/PerceptionURP/TestRunnerOptions.json create mode 100644 com.unity.perception/.editorconfig create mode 100644 com.unity.perception/.npmignore create mode 100644 com.unity.perception/CHANGELOG.md create mode 100644 com.unity.perception/CHANGELOG.md.meta create mode 100644 com.unity.perception/Documentation~/GroundTruth-Custom.md create mode 100644 com.unity.perception/Documentation~/GroundTruth-Labeling.md create mode 100644 com.unity.perception/Documentation~/GroundTruth-Overview.md create mode 100644 com.unity.perception/Documentation~/ScenarioManager.md create mode 100644 com.unity.perception/Documentation~/index.md create mode 100644 com.unity.perception/Editor.meta create mode 100644 com.unity.perception/Editor/AssemblyInfo.cs create mode 100644 com.unity.perception/Editor/AssemblyInfo.cs.meta create mode 100644 com.unity.perception/Editor/GroundTruth.meta create mode 100644 com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs create mode 100644 com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs.meta create mode 100644 com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs create mode 100644 com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs.meta create mode 100644 com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs create mode 100644 com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs.meta create mode 100644 com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs create mode 100644 com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs.meta create mode 100644 com.unity.perception/Editor/GroundTruth/LabelingEditor.cs create mode 100644 com.unity.perception/Editor/GroundTruth/LabelingEditor.cs.meta create mode 100644 com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs create mode 100644 com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs.meta create mode 100644 com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs create mode 100644 com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs.meta create mode 100644 com.unity.perception/Editor/Unity.Perception.Editor.asmdef create mode 100644 com.unity.perception/Editor/Unity.Perception.Editor.asmdef.meta create mode 100644 com.unity.perception/LICENSE.md create mode 100644 com.unity.perception/LICENSE.md.meta create mode 100644 com.unity.perception/QAReport.md create mode 100644 com.unity.perception/QAReport.md.meta create mode 100644 com.unity.perception/Runtime.meta create mode 100644 com.unity.perception/Runtime/AssemblyInfo.cs create mode 100644 com.unity.perception/Runtime/AssemblyInfo.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/EgoMarker.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/EgoMarker.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/Labeling.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/MetricData.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/MetricData.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/Resources.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader create mode 100644 com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute create mode 100644 com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader create mode 100644 com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationManager.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationManager.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationState.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationState.cs.meta create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs create mode 100644 com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs.meta create mode 100644 com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef create mode 100644 com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef.meta create mode 100644 com.unity.perception/Tests.meta create mode 100644 com.unity.perception/Tests/.tests.json create mode 100644 com.unity.perception/Tests/Editor.meta create mode 100644 com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs create mode 100644 com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs.meta create mode 100644 com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef create mode 100644 com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef.meta create mode 100644 com.unity.perception/Tests/Runtime.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs create mode 100644 com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs.meta create mode 100644 com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef create mode 100644 com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef.meta create mode 100644 com.unity.perception/Third Party Notices.md create mode 100644 com.unity.perception/Third Party Notices.md.meta create mode 100644 com.unity.perception/package.json create mode 100644 com.unity.perception/package.json.meta diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..e92db4fb1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,15 @@ +*.manifest text !filter !merge !diff +*.css text !filter !merge !diff +*.js text !filter !merge !diff +*.yml text !filter !merge !diff +*.txt text !filter !merge !diff +*.json text !filter !merge !diff +*.hlsl text !filter !merge !diff +*.asmdef text !filter !merge !diff +*.npmignore text !filter !merge !diff +*.md text !filter !merge !diff +*.cginc text !filter !merge !diff +*.shader text !filter !merge !diff +*.compute text !filter !merge !diff +*.cs text !filter !merge !diff +*.meta text !filter !merge !diff diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..79e288827 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,17 @@ +# Peer Review Information: +Information on any code, feature, documentation changes here + +## Editor / Package versioning: +**Editor Version Target (i.e. 19.3, 20.1)**: 2019.3 + +## Dev Testing: +**Tests Added**: +
+**Package Tests (Pass/Fail)**: +[X] - Make sure automation passes +
+**Core Scenario Tested**: +
+**At Risk Areas**: +
+**Notes + Expectations**: diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..72d74b99b --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +artifacts/** +build/** +**/.vs/** +.build_script/** +node_modules/** +**/Temp/**/* +**/obj/**/* +**/Library/**/* +**/TestProjects/Public/Logs/** +**/TestProjects/PerceptionTest/utr +**/TestProjects/PerceptionTest/Build +**/*Results/** +**/Logs/** +**/.vscode/** +**/.idea/** +.DS_Store +.npmrc +!Documentation~ +!.Documentation +npm-debug.log +build.sh.meta +build.bat.meta +.idea/ +.Editor/* +upm-ci~/* + +*.csproj +*.sln + +*.lib* +*.pdb* +**/.Editor +**/upm-ci~ +**/.bin +CodeCoverage +/.download +/TestProjects/PerceptionURP/Build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..e69de29bb diff --git a/.npmignore b/.npmignore new file mode 100644 index 000000000..8ebdf5ce0 --- /dev/null +++ b/.npmignore @@ -0,0 +1,14 @@ +artifacts/** +build/** +.build_script/** +node_modules/** +TestProjects/** +.DS_Store +.npmrc +.npmignore +.gitignore +.gitlab-ci.yml +build.sh +build.sh.meta +build.bat +build.bat.meta diff --git a/.yamato/promotion.yml b/.yamato/promotion.yml new file mode 100644 index 000000000..ff6406d85 --- /dev/null +++ b/.yamato/promotion.yml @@ -0,0 +1,79 @@ +# The Yamato build step `publish` will publish the com.unity.perception package to the `upm-candidates` registry. To see which versions of the package have been published, see +# * https://artifactory.prd.cds.internal.unity3d.com/artifactory/webapp/#/artifacts/browse/tree/General/upm-candidates/com.unity.perception +# * https://bintray.com/unity +#test_editors: +# - version: 2019.1 +#test_platforms: +# - name: win +# type: Unity::VM +# image: package-ci/win10:stable +# flavor: b1.large +#--- +#{% for editor in test_editors %} +#{% for platform in test_platforms %} +#promotion_test_{{ platform.name }}_{{ editor.version }}: +# name : Promotion Test {{ editor.version }} on {{ platform.name }} +# agent: +# type: {{ platform.type }} +# image: {{ platform.image }} +# flavor: {{ platform.flavor}} +# variables: +# UPMCI_PROMOTION: 1 +# commands: +# - npm install upm-ci-utils@latest -g --registry https://api.bintray.com/npm/unity/unity-npm +# - upm-ci package test --unity-version {{ editor.version }} +# artifacts: +# logs: +# paths: +# - "upm-ci~/test-results/**/*" +# dependencies: +# - .yamato/upm-ci.yml#pack +#{% endfor %} +#{% endfor %} +# +#promotion_test_trigger: +# name: Promotion Tests Trigger +# agent: +# type: Unity::VM +# image: package-ci/win10:stable +# flavor: b1.large +# artifacts: +# logs: +# paths: +# - "upm-ci~/test-results/**/*" +# packages: +# paths: +# - "upm-ci~/packages/**/*" +# dependencies: +#{% for editor in test_editors %} +#{% for platform in test_platforms %} +# - .yamato/promotion.yml#promotion_test_{{platform.name}}_{{editor.version}} +#{% endfor %} +#{% endfor %} +# +#promote: +# name: Promote to Production +# agent: +# type: Unity::VM +# image: package-ci/win10:stable +# flavor: b1.large +# variables: +# UPMCI_PROMOTION: 1 +# commands: +# - npm install upm-ci-utils@latest -g --registry https://api.bintray.com/npm/unity/unity-npm +# - upm-ci package promote +# triggers: +# tags: +# only: +# - /^(r|R)elease-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/ +# artifacts: +# artifacts: +# paths: +# - "upm-ci~/packages/*.tgz" +# dependencies: +# - .yamato/upm-ci.yml#pack +#{% for editor in test_editors %} +#{% for platform in test_platforms %} +# - .yamato/promotion.yml#promotion_test_{{ platform.name }}_{{ editor.version }} +#{% endfor %} +#{% endfor %} diff --git a/.yamato/upm-ci-full.yml b/.yamato/upm-ci-full.yml new file mode 100644 index 000000000..be80a6f67 --- /dev/null +++ b/.yamato/upm-ci-full.yml @@ -0,0 +1,143 @@ +test_editors: + - version: 2019.3.7f1 +test_platforms: + - name: win + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large + extra-args: --force-d3d11 + standalone-platform: StandaloneWindows64 + - name: mac + type: Unity::VM::osx + image: buildfarm/mac:stable + flavor: m1.mac + extra-args: --force-metal + standalone-platform: StandaloneOSX + - name: ubuntu + type: Unity::VM + image: package-ci/ubuntu:latest + flavor: b1.large + +suites: + - name: standalone + display_name: standalone + args: --suite=playmode --platform= + - name: editmode + display_name: editmode + args: --suite=playmode --suite=editor --platform=editmode + +package_variants: + - name: Perception + +projects: + - name: PerceptionHDRP + - name: PerceptionURP +--- +{% for variant in package_variants %} +pack_{{ variant.name }}: + name: Pack {{variant.name}} package + agent: + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large + commands: + - git submodule update --init --recursive + - npm install upm-ci-utils -g --registry https://api.bintray.com/npm/unity/unity-npm + - upm-ci package pack --package-path ./com.unity.perception/ + artifacts: + packages: + paths: + - "upm-ci~/packages/**/*" +{% endfor %} + +{% for variant in package_variants %} +{% for editor in test_editors %} +{% for platform in test_platforms %} +pkg_test_{{variant.name}}_{{ platform.name }}_{{ editor.version }}: + name : Package tests ({{variant.name}} pkg, {{ editor.version }}, {{ platform.name }}) + agent: + type: {{ platform.type }} + image: {{ platform.image }} + flavor: {{ platform.flavor}} + commands: + - git submodule update --init --recursive + - npm install upm-ci-utils -g --registry https://api.bintray.com/npm/unity/unity-npm + - upm-ci package test -u {{ editor.version }} --package-path ./com.unity.perception --type vetting-tests + artifacts: + logs: + paths: + - "upm-ci~/test-results/**/*" + dependencies: + - .yamato/upm-ci-full.yml#pack_{{ variant.name }} +{% endfor %} +{% endfor %} +{% endfor %} + +test_trigger: + name: All Tests + agent: + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.small + commands: + - dir + triggers: + branches: + only: + - "/.*/" + recurring: + - branch: master + frequency: daily # Should run between midnight and 6AM UTC + artifacts: + logs: + paths: + - "upm-ci~/test-results/**/*" + packages: + paths: + - "upm-ci~/packages/**/*" + dependencies: + {% for variant in package_variants %} + {% for editor in test_editors %} + {% for platform in test_platforms %} + - .yamato/upm-ci-full.yml#pkg_test_{{variant.name}}_{{platform.name}}_{{editor.version}} + {% endfor %} + {% endfor %} + {% endfor %} + + # Disabling trigger of standalone tests which aren't working at the moment + {% for editor in test_editors %} + - .yamato/upm-ci-testprojects.yml#codecoverage_windows_editmode_{{editor.version}} + {% for project in projects %} + - .yamato/upm-ci-testprojects.yml#{{project.name}}_windows_standalone_{{editor.version}} + - .yamato/upm-ci-testprojects.yml#{{project.name}}_linux_standalone_{{editor.version}} + - .yamato/upm-ci-testprojects.yml#{{project.name}}_windows_editmode_{{editor.version}} + - .yamato/upm-ci-testprojects.yml#{{project.name}}_linux_editmode_{{editor.version}} + {% endfor %} + {% endfor %} + +{% for variant in package_variants %} +publish: + name: Publish Perception package to internal registry + agent: + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large + commands: + - npm install upm-ci-utils@stable -g --registry https://api.bintray.com/npm/unity/unity-npm + - upm-ci package publish --package-path com.unity.perception + triggers: + tags: + only: + - /^(r|R)(c|C)-\d+\.\d+\.\d+(-preview(\.\d+)?)?$/ + artifacts: + artifacts: + paths: + - "upm-ci~/packages/*.tgz" + dependencies: + - .yamato/upm-ci-full.yml#pack_{{ variant.name }} + {% for editor in test_editors %} + {% for platform in test_platforms %} + - .yamato/upm-ci-full.yml#test_perception_{{ platform.name }}_{{ editor.version }} + {% endfor %} + {% endfor %} +{% endfor %} diff --git a/.yamato/upm-ci-testprojects.yml b/.yamato/upm-ci-testprojects.yml new file mode 100644 index 000000000..bfac06f63 --- /dev/null +++ b/.yamato/upm-ci-testprojects.yml @@ -0,0 +1,115 @@ +test_editors: + - version: 2019.3.7f1 +suites: + - name: standalone + display_name: standalone + args: --suite=playmode --platform= + - name: editmode + display_name: editmode + args: --suite=playmode --suite=editor --platform=Editor +projects: + - name: PerceptionHDRP + - name: PerceptionURP +--- + +{% for editor in test_editors %} +{% for suite in suites %} +{% for project in projects %} +{{project.name}}_windows_{{suite.name}}_{{editor.version}}: + name : {{project.name}} {{ suite.display_name }} tests ({{ editor.version }}, Windows) + agent: + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large + commands: + - git submodule update --init --recursive + - git clone git@github.cds.internal.unity3d.com:unity/utr.git utr + - pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple + - unity-downloader-cli -u {{ editor.version }} -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published + {% if suite.name == "standalone" %} + - utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}}StandaloneWindows64 + {% else %} + - utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=./.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-d3d11" {{suite.args}} + {% endif %} + artifacts: + logs: + paths: + - "test-results/**/*" + +{% endfor %} +{% endfor %} +{% endfor %} + +{% for editor in test_editors %} +{% for suite in suites %} +codecoverage_windows_{{suite.name}}_{{editor.version}}: + name : CodeCoverage {{ suite.display_name }} tests ({{ editor.version }}, Windows) + agent: + type: Unity::VM + image: package-ci/win10:stable + flavor: b1.large + commands: + - git submodule update --init --recursive + - unity-downloader-cli -u {{ editor.version }} -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published + - .\.Editor\Unity.exe -projectPath ./TestProjects/PerceptionHDRP -testPlatform editmode -runTests -automated -testResults test-results -debugCodeOptimization -enableCodeCoverage -coverageResultsPath test-results -coverageOptions enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport; assemblyFilters:Unity.Perception.Editor;Unity.Perception.Runtime;Unity.Perception.Sensors; + - .\.Editor\Unity.exe -projectPath ./TestProjects/PerceptionHDRP -testPlatform playmode -runTests -automated -testResults test-results -debugCodeOptimization -enableCodeCoverage -coverageResultsPath test-results -coverageOptions enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport; assemblyFilters:Unity.Perception.Editor;Unity.Perception.Runtime;Unity.Perception.Sensors; + # - .\.Editor\Unity.exe -projectPath ./TestProjects/PerceptionHDRP -debugCodeOptimization -enableCodeCoverage -coverageResultsPath test-results -coverageOptions enableCyclomaticComplexity;generateHtmlReport;generateBadgeReport; + artifacts: + logs: + paths: + - "test-results/**/*" + - "TestProjects/PerceptionHDRP/test-results/**/*" + dependencies: + - .yamato/upm-ci-full.yml#pack_Perception +{% endfor %} +{% endfor %} + +{% for editor in test_editors %} +{% for suite in suites %} +{% for project in projects %} +{{project.name}}_linux_{{suite.name}}_{{editor.version}}: + name : {{project.name}} {{ suite.display_name }} tests ({{ editor.version }}, Linux) + agent: + type: Unity::VM::GPU + image: cds-ops/ubuntu-18.04-base:latest + flavor: b1.large + commands: + - git submodule update --init --recursive + - sudo -H pip install --upgrade pip + - sudo -H pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple + - git clone git@github.cds.internal.unity3d.com:unity/utr.git utr + - sudo unity-downloader-cli -u {{ editor.version }} -c editor -c StandaloneSupport-IL2CPP -c Linux --wait --published + {% if suite.name == "standalone" %} + - DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}}StandaloneLinux64 + {% else %} + - DISPLAY=:0.0 utr/utr --testproject=./TestProjects/{{project.name}} --editor-location=.Editor --artifacts_path=test-results --stdout-filter=minimal --extra-editor-arg="--force-vulkan" {{suite.args}} + {% endif %} + artifacts: + logs: + paths: + - "test-results/**/*" +{% endfor %} +{% endfor %} +{% endfor %} + +# Not including OSX because the only OSX platform on Bokken with a GPU is a Mac Mini, of which there are only a few and setting up Yamato jobs is very complicated. + +# {% for variant in package_variants %} +# {% for editor in test_editors %} +# code_coverage_win_{{editor.version}}: +# name: Code Coverage Report - Windows +# agent: +# type: Unity::VM +# image: package-ci/win10:stable +# flavor: b1.large +# commands: +# - npm install upm-ci-utils@stable -g --registry https://api.bintray.com/npm/unity/unity-npm +# - upm-ci package test --unity-version {{editor.version}} --enable-code-coverage --code-coverage-options 'enableCyclomaticComplexity;generateHtmlReport' +# artifacts: +# logs: +# paths: +# - "upm-ci~/test-results/**/*" +# dependencies: +# - .yamato/upm-ci-full.yml#pack_{{ variant.name }} +# {% endfor %} +# {% endfor %} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..790603fd1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,9 @@ +# Contributing + +## If you are interested in contributing, here are some ground rules: +* All changes should be made on branches. Open a PR and add a member of the perception team to have your changes be merged. + +## All contributions are subject to the [Unity Contribution Agreement(UCA)](https://unity3d.com/legal/licenses/Unity_Contribution_Agreement) +By making a pull request, you are confirming agreement to the terms and conditions of the UCA, including that your Contributions are your original creation and that you have complete right and authority to make your Contributions. + +## Once you have a change ready following these ground rules. Simply make a pull request diff --git a/CONTRIBUTING.md.meta b/CONTRIBUTING.md.meta new file mode 100644 index 000000000..e2eaae838 --- /dev/null +++ b/CONTRIBUTING.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 4241e97d930be75439e093a301ed068a +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md new file mode 100644 index 000000000..34a6e2391 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Perception + +The Perception package contains tools for authoring and executing autonomous vehicle simulations. They are organized into two categories: Scenarios and Sensors. + +## Scenarios + +TODO + +# Setup for local development +* Clone the perception repository into an arbirary directory on disk +* Install and use Unity 2019.3.0b7 + +## Option 1: PerceptionHDRP/PerceptionURP +The repository includes two projects for local development in `TestProjects`, one set up for HDRP and the other for URP. + +## Option 2: Set up a project from scratch +*The following instructions reference the Unity doc's page on [installing a local package](https://docs.unity3d.com/Manual/upm-ui-local.html)* +* Create a new HDRP project or open an existing one +* Open your project's `/Packages/manifest.json` in a text editor +* At the end of the file, add `"registry": "https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-candidates"` + * _Note: This step will be removed once the dependency `com.unity.entities-0.2.0-preview.*` is published publically._ +* Back in Unity, open the Package Manager window +* Add the High Definition RP package, version 7.1.2 or later +* Click the ***+*** button in the upper lefthand corner of the window +* Click the ***add package from disk*** option +* Select to the package.json file under the com.unity.perception folder in your cloned perception repository +* To allow the compilation and running of tests, add `"testables": [ "com.unity.perception" ]` + * For an example `manifest.json`, see `TestProjects/PerceptionTest/Packages/manifest.json` + * For more on the `manifest.json` schema, see the [Package Manager documentation](https://docs.unity3d.com/Packages/com.unity.package-manager-ui@1.7/manual/index.html#advanced-package-topics) + +## Suggested IDE Setup +For closest standards conformity and best experience overall, JetBrains Rider or Visual Studio w/ JetBrains Resharper are suggested. For optimal experience, perform the following additional steps: +* To allow navigating to code in all packages included in your project, in your Unity Editor, navigate to `Edit -> Preferences... -> External Tools` and check `Generate all .csproj files.` +* To get automatic feedback and fixups on formatting and naming convention violations, set up Rider/JetBrains with our Unity standard .dotsettings file by following [these instructions](https://github.cds.internal.unity3d.com/unity/com.unity.coding/tree/master/UnityCoding/Packages/com.unity.coding/Coding~/Configs/JetBrains). +* If you use VS Code, install the Editorconfig extension to get automatic code formatting according to our conventions. \ No newline at end of file diff --git a/TestProjects/PerceptionHDRP/Assets.meta b/TestProjects/PerceptionHDRP/Assets.meta new file mode 100644 index 000000000..fccc0389a --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0b97a4670b4c465293d5777d6a74ea52 +timeCreated: 1578604969 \ No newline at end of file diff --git a/TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset b/TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset new file mode 100644 index 000000000..5c3dd4874 --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset @@ -0,0 +1,316 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cf1dab834d4ec34195b920ea7bbf9ec, type: 3} + m_Name: HDRenderPipelineAsset + m_EditorClassIdentifier: + m_Version: 9 + m_ObsoleteFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + m_ObsoleteBakedOrCustomReflectionFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + m_ObsoleteRealtimeReflectionFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + m_RenderPipelineResources: {fileID: 11400000, guid: 3ce144cff5783da45aa5d4fdc2da14b7, + type: 2} + m_RenderPipelineRayTracingResources: {fileID: 0} + m_DefaultVolumeProfile: {fileID: 0} + m_RenderingPathDefaultCameraFrameSettings: + bitDatas: + data1: 69730941533981 + data2: 4539628424926265344 + lodBias: 1 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + materialQuality: 0 + m_RenderingPathDefaultBakedOrCustomReflectionFrameSettings: + bitDatas: + data1: 64942043591453 + data2: 4539628424389459968 + lodBias: 1 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + materialQuality: 0 + m_RenderingPathDefaultRealtimeReflectionFrameSettings: + bitDatas: + data1: 69692120112925 + data2: 4539628424657895424 + lodBias: 1 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + materialQuality: 0 + m_RenderPipelineSettings: + supportShadowMask: 1 + supportSSR: 0 + supportSSAO: 1 + supportSubsurfaceScattering: 1 + increaseSssSampleCount: 0 + supportVolumetrics: 1 + increaseResolutionOfVolumetrics: 0 + supportLightLayers: 0 + supportDistortion: 1 + supportTransparentBackface: 1 + supportTransparentDepthPrepass: 1 + supportTransparentDepthPostpass: 1 + colorBufferFormat: 74 + supportedLitShaderMode: 2 + supportDecals: 1 + msaaSampleCount: 1 + supportMotionVectors: 1 + supportRuntimeDebugDisplay: 1 + supportDitheringCrossFade: 1 + supportTerrainHole: 0 + supportRayTracing: 0 + supportedRaytracingTier: 2 + lightLoopSettings: + cookieSize: 128 + cookieTexArraySize: 16 + pointCookieSize: 128 + cubeCookieTexArraySize: 16 + planarReflectionProbeCacheSize: 2 + planarReflectionTextureSize: 1024 + reflectionProbeCacheSize: 64 + reflectionCubemapSize: 256 + reflectionCacheCompressed: 0 + planarReflectionCacheCompressed: 0 + skyReflectionSize: 256 + skyLightingOverrideLayerMask: + serializedVersion: 2 + m_Bits: 0 + supportFabricConvolution: 0 + maxDirectionalLightsOnScreen: 16 + maxPunctualLightsOnScreen: 512 + maxAreaLightsOnScreen: 64 + maxEnvLightsOnScreen: 64 + maxDecalsOnScreen: 512 + hdShadowInitParams: + maxShadowRequests: 128 + directionalShadowsDepthBits: 32 + shadowFilteringQuality: 1 + punctualLightShadowAtlas: + shadowAtlasResolution: 4096 + shadowAtlasDepthBits: 32 + useDynamicViewportRescale: 1 + areaLightShadowAtlas: + shadowAtlasResolution: 4096 + shadowAtlasDepthBits: 32 + useDynamicViewportRescale: 1 + shadowResolutionDirectional: + m_Values: 00010000000200000004000000080000 + shadowResolutionPunctual: + m_Values: 00010000000200000004000000080000 + shadowResolutionArea: + m_Values: 00010000000200000004000000080000 + maxDirectionalShadowMapResolution: 2048 + maxPunctualShadowMapResolution: 2048 + maxAreaShadowMapResolution: 2048 + supportScreenSpaceShadows: 0 + maxScreenSpaceShadows: 2 + decalSettings: + drawDistance: 1000 + atlasWidth: 4096 + atlasHeight: 4096 + perChannelMask: 0 + postProcessSettings: + m_LutSize: 32 + lutFormat: 48 + dynamicResolutionSettings: + enabled: 0 + maxPercentage: 100 + minPercentage: 100 + dynResType: 1 + upsampleFilter: 1 + forceResolution: 0 + forcedPercentage: 100 + lowresTransparentSettings: + enabled: 1 + checkerboardDepthBuffer: 1 + upsampleType: 1 + xrSettings: + occlusionMesh: 1 + postProcessQualitySettings: + NearBlurSampleCount: 030000000500000008000000 + NearBlurMaxRadius: + - 2 + - 4 + - 7 + FarBlurSampleCount: 04000000070000000e000000 + FarBlurMaxRadius: + - 5 + - 8 + - 13 + DoFResolution: 040000000200000001000000 + DoFHighQualityFiltering: 000101 + MotionBlurSampleCount: 04000000080000000c000000 + BloomRes: 040000000200000002000000 + BloomHighQualityFiltering: 000101 + ChromaticAberrationMaxSamples: 03000000060000000c000000 + lightSettings: + useContactShadow: + m_Low: 0 + m_Medium: 0 + m_High: 0 + maximumLODLevel: + m_Low: 0 + m_Medium: 0 + m_High: 0 + lodBias: + m_Low: 1 + m_Medium: 1 + m_High: 1 + allowShaderVariantStripping: 1 + enableSRPBatcher: 1 + shaderVariantLogLevel: 0 + materialQualityLevels: -1 + m_CurrentMaterialQualityLevel: 4 + diffusionProfileSettings: {fileID: 0} + diffusionProfileSettingsList: [] + beforeTransparentCustomPostProcesses: [] + beforePostProcessCustomPostProcesses: [] + afterPostProcessCustomPostProcesses: [] diff --git a/TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset.meta b/TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset.meta new file mode 100644 index 000000000..d6f48907b --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/HDRenderPipelineAsset.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5cd73a3d493926a4eb251403457df953 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset b/TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset new file mode 100644 index 000000000..13a33b88d --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bad10bec3eccd8e49a9d725b2c30f74c, type: 3} + m_Name: LabelingConfiguration + m_EditorClassIdentifier: + LabelingConfigurations: + - label: Box + value: 10000 + - label: Crate + value: 20000 + - label: Cube + value: 30000 diff --git a/TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset.meta b/TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset.meta new file mode 100644 index 000000000..23a03f7b8 --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/LabelingConfiguration.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: be3971a848968144e8d07d9136a5bf49 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionHDRP/Assets/Rotator.cs b/TestProjects/PerceptionHDRP/Assets/Rotator.cs new file mode 100644 index 000000000..d0b4c79be --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/Rotator.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Rotator : MonoBehaviour +{ + [SerializeField] + public float yDegreesPerSecond = 180; + + // Update is called once per frame + void Update() + { + transform.localRotation *= Quaternion.Euler(0, yDegreesPerSecond * Time.deltaTime, 0); + } +} diff --git a/TestProjects/PerceptionHDRP/Assets/Rotator.cs.meta b/TestProjects/PerceptionHDRP/Assets/Rotator.cs.meta new file mode 100644 index 000000000..6ee0804b1 --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/Rotator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 673a227032a8e4940b9828c5b6f852ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionHDRP/Assets/Scenes.meta b/TestProjects/PerceptionHDRP/Assets/Scenes.meta new file mode 100644 index 000000000..9ce1f8637 --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98cfbce5bd48d9d4d99e5c8b8a1ee97b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity b/TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity new file mode 100644 index 000000000..fcf38b5a9 --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity @@ -0,0 +1,931 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 705507994} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &4662619 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4662620} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4662620 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4662619} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.7286716, y: -2.380882, z: 5.498973} + m_LocalScale: {x: 36.249973, y: 36.249973, z: 36.249973} + m_Children: + - {fileID: 963194228} + - {fileID: 705507995} + - {fileID: 1640252283} + - {fileID: 464025709} + - {fileID: 411238281} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &411238276 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 411238281} + - component: {fileID: 411238280} + - component: {fileID: 411238279} + - component: {fileID: 411238278} + - component: {fileID: 411238277} + - component: {fileID: 411238282} + m_Layer: 0 + m_Name: Cube (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &411238277 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b33f0bc2b78db642a758f07826d0dd0, type: 3} + m_Name: + m_EditorClassIdentifier: + classes: + - Crate +--- !u!65 &411238278 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &411238279 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &411238280 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &411238281 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.3786716, y: 2.380882, z: -4.288973} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &411238282 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 673a227032a8e4940b9828c5b6f852ab, type: 3} + m_Name: + m_EditorClassIdentifier: + yDegreesPerSecond: 180 +--- !u!1 &464025704 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 464025709} + - component: {fileID: 464025708} + - component: {fileID: 464025707} + - component: {fileID: 464025706} + - component: {fileID: 464025705} + - component: {fileID: 464025710} + m_Layer: 0 + m_Name: Cube (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &464025705 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b33f0bc2b78db642a758f07826d0dd0, type: 3} + m_Name: + m_EditorClassIdentifier: + classes: + - Cube +--- !u!65 &464025706 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &464025707 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &464025708 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &464025709 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 2.6386716, y: 2.380882, z: -3.9089727} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &464025710 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 673a227032a8e4940b9828c5b6f852ab, type: 3} + m_Name: + m_EditorClassIdentifier: + yDegreesPerSecond: 180 +--- !u!1 &705507993 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 705507995} + - component: {fileID: 705507994} + - component: {fileID: 705507996} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &705507994 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 3.1415927 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 1 + m_LightShadowCasterMode: 2 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 6.25e-43, y: 1.0156355e+12, z: 6.25e-43, w: 2.8676e-41} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &705507995 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 2.7286716, y: 5.3808823, z: -5.498973} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &705507996 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 9 + m_ObsoleteShadowResolutionTier: 1 + m_ObsoleteUseShadowQualitySettings: 0 + m_ObsoleteCustomShadowResolution: 512 + m_ObsoleteContactShadows: 0 + m_PointlightHDType: 0 + m_SpotLightShape: 0 + m_AreaLightShape: 0 + m_Intensity: 3.1415927 + m_EnableSpotReflector: 0 + m_LuxAtDistance: 1 + m_InnerSpotPercent: 0 + m_LightDimmer: 1 + m_VolumetricDimmer: 1 + m_LightUnit: 2 + m_FadeDistance: 10000 + m_AffectDiffuse: 1 + m_AffectSpecular: 1 + m_NonLightmappedOnly: 0 + m_ShapeWidth: 0.5 + m_ShapeHeight: 0.5 + m_AspectRatio: 1 + m_ShapeRadius: 0 + m_SoftnessScale: 1 + m_UseCustomSpotLightShadowCone: 0 + m_CustomSpotLightShadowCone: 30 + m_MaxSmoothness: 0.99 + m_ApplyRangeAttenuation: 1 + m_DisplayAreaLightEmissiveMesh: 0 + m_AreaLightCookie: {fileID: 0} + m_AreaLightShadowCone: 120 + m_UseScreenSpaceShadows: 0 + m_InteractsWithSky: 1 + m_AngularDiameter: 0 + m_FlareSize: 2 + m_FlareTint: {r: 1, g: 1, b: 1, a: 1} + m_FlareFalloff: 4 + m_SurfaceTexture: {fileID: 0} + m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} + m_Distance: 150000000 + m_UseRayTracedShadows: 0 + m_NumRayTracingSamples: 4 + m_FilterTracedShadow: 1 + m_FilterSizeTraced: 16 + m_SunLightConeAngle: 0.5 + m_LightShadowRadius: 0.5 + m_EvsmExponent: 15 + m_EvsmLightLeakBias: 0 + m_EvsmVarianceBias: 0.00001 + m_EvsmBlurPasses: 0 + m_LightlayersMask: 1 + m_LinkShadowLayers: 1 + m_ShadowNearPlane: 0.1 + m_BlockerSampleCount: 24 + m_FilterSampleCount: 16 + m_MinFilterSize: 0.01 + m_KernelSize: 5 + m_LightAngle: 1 + m_MaxDepthBias: 0.001 + m_ShadowResolution: + m_Override: 512 + m_UseOverride: 1 + m_Level: 0 + m_ShadowDimmer: 1 + m_VolumetricShadowDimmer: 1 + m_ShadowFadeDistance: 10000 + m_UseContactShadow: + m_Override: 0 + m_UseOverride: 1 + m_Level: 0 + m_RayTracedContactShadow: 0 + m_ShadowTint: {r: 0, g: 0, b: 0, a: 1} + m_PenumbraTint: 0 + m_NormalBias: 0.75 + m_SlopeBias: 0.5 + m_ShadowUpdateMode: 0 + m_BarnDoorAngle: 90 + m_BarnDoorLength: 0.05 + m_ShadowCascadeRatios: + - 0.05 + - 0.2 + - 0.3 + m_ShadowCascadeBorders: + - 0.2 + - 0.2 + - 0.2 + - 0.2 + m_ShadowAlgorithm: 0 + m_ShadowVariant: 0 + m_ShadowPrecision: 0 + useOldInspector: 0 + useVolumetric: 1 + featuresFoldout: 1 + showAdditionalSettings: 0 +--- !u!1 &963194225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 963194228} + - component: {fileID: 963194227} + - component: {fileID: 963194226} + - component: {fileID: 963194229} + - component: {fileID: 963194230} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &963194226 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 +--- !u!20 &963194227 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &963194228 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_LocalRotation: {x: -0.17179534, y: 0.30667058, z: -0.056378223, w: -0.93448436} + m_LocalPosition: {x: 5.5378666, y: 3.5565922, z: -7.528791} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &963194229 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 7 + m_ObsoleteRenderingPath: 0 + m_ObsoleteFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + clearColorMode: 0 + backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0} + clearDepth: 1 + volumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + volumeAnchorOverride: {fileID: 0} + antialiasing: 0 + SMAAQuality: 2 + dithering: 0 + stopNaNs: 0 + taaSharpenStrength: 0.6 + physicalParameters: + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + flipYMode: 0 + fullscreenPassthrough: 0 + allowDynamicResolution: 0 + customRenderingSettings: 0 + invertFaceCulling: 0 + probeLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + hasPersistentHistory: 0 + m_RenderingPathCustomFrameSettings: + bitDatas: + data1: 70280697347933 + data2: 4539628424926265344 + lodBias: 1 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + materialQuality: 0 + renderingPathCustomFrameSettingsOverrideMask: + mask: + data1: 0 + data2: 0 + defaultFrameSettings: 0 +--- !u!114 &963194230 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4467405dbcbd3d64ab4363e9ae8bb813, type: 3} + m_Name: + m_EditorClassIdentifier: + description: The main camera + period: 0.0166 + startTime: 0 + produceSegmentationImages: 1 + produceObjectCountAnnotations: 1 + LabelingConfiguration: {fileID: 11400000, guid: be3971a848968144e8d07d9136a5bf49, + type: 2} +--- !u!1 &1640252278 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1640252283} + - component: {fileID: 1640252282} + - component: {fileID: 1640252281} + - component: {fileID: 1640252280} + - component: {fileID: 1640252279} + - component: {fileID: 1640252284} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1640252279 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b33f0bc2b78db642a758f07826d0dd0, type: 3} + m_Name: + m_EditorClassIdentifier: + classes: + - Box +--- !u!65 &1640252280 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1640252281 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &1640252282 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1640252283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 2.7286716, y: 2.380882, z: -5.498973} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1640252284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 673a227032a8e4940b9828c5b6f852ab, type: 3} + m_Name: + m_EditorClassIdentifier: + yDegreesPerSecond: 180 diff --git a/TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity.meta b/TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity.meta new file mode 100644 index 000000000..952bd1e9e --- /dev/null +++ b/TestProjects/PerceptionHDRP/Assets/Scenes/SampleScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9fc0d4010bbf28b4594072e72b8655ab +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionHDRP/Packages/manifest.json b/TestProjects/PerceptionHDRP/Packages/manifest.json new file mode 100644 index 000000000..d8465a476 --- /dev/null +++ b/TestProjects/PerceptionHDRP/Packages/manifest.json @@ -0,0 +1,51 @@ +{ + "dependencies": { + "com.unity.collab-proxy": "1.2.16", + "com.unity.ext.nunit": "1.0.0", + "com.unity.ide.rider": "1.1.4", + "com.unity.ide.vscode": "1.1.4", + "com.unity.render-pipelines.core": "7.1.8", + "com.unity.render-pipelines.high-definition": "7.1.8", + "com.unity.simulation.capture": "0.0.10-preview.6", + "com.unity.simulation.core": "0.0.10-preview.8", + "com.unity.perception": "file:../../../com.unity.perception", + "com.unity.test-framework": "1.1.11", + "com.unity.testtools.codecoverage": "0.2.2-preview", + "com.unity.textmeshpro": "2.0.1", + "com.unity.ugui": "1.0.0", + "com.unity.modules.ai": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.cloth": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.physics2d": "1.0.0", + "com.unity.modules.screencapture": "1.0.0", + "com.unity.modules.terrain": "1.0.0", + "com.unity.modules.terrainphysics": "1.0.0", + "com.unity.modules.tilemap": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.umbra": "1.0.0", + "com.unity.modules.unityanalytics": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.unitywebrequesttexture": "1.0.0", + "com.unity.modules.unitywebrequestwww": "1.0.0", + "com.unity.modules.vehicles": "1.0.0", + "com.unity.modules.video": "1.0.0", + "com.unity.modules.vr": "1.0.0", + "com.unity.modules.wind": "1.0.0", + "com.unity.modules.xr": "1.0.0" + }, + "testables": [ + "com.unity.perception" + ] +} diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/AudioManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/AudioManager.asset new file mode 100644 index 000000000..07ebfb05d --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/AudioManager.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!11 &1 +AudioManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Volume: 1 + Rolloff Scale: 1 + Doppler Factor: 1 + Default Speaker Mode: 2 + m_SampleRate: 0 + m_DSPBufferSize: 1024 + m_VirtualVoiceCount: 512 + m_RealVoiceCount: 32 + m_SpatializerPlugin: + m_AmbisonicDecoderPlugin: + m_DisableAudio: 0 + m_VirtualizeEffects: 1 + m_RequestedDSPBufferSize: 1024 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json b/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json new file mode 100644 index 000000000..bff2343ed --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json @@ -0,0 +1,11 @@ +{ + + "MonoBehaviour": { + "m_EditorHideFlags": 0, + "m_Name": "", + "m_EditorClassIdentifier":"Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", + "DisableOptimisations": false, + "DisableSafetyChecks": true, + "DisableBurstCompilation": true + } +} diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneOSX.json b/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneOSX.json new file mode 100644 index 000000000..ec0089d85 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneOSX.json @@ -0,0 +1,11 @@ +{ + "MonoBehaviour": { + "m_Enabled": true, + "m_EditorHideFlags": 0, + "m_Name": "", + "m_EditorClassIdentifier": "Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", + "DisableOptimisations": false, + "DisableSafetyChecks": true, + "DisableBurstCompilation": false + } +} \ No newline at end of file diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneWindows.json new file mode 100644 index 000000000..ec0089d85 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/BurstAotSettings_StandaloneWindows.json @@ -0,0 +1,11 @@ +{ + "MonoBehaviour": { + "m_Enabled": true, + "m_EditorHideFlags": 0, + "m_Name": "", + "m_EditorClassIdentifier": "Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", + "DisableOptimisations": false, + "DisableSafetyChecks": true, + "DisableBurstCompilation": false + } +} \ No newline at end of file diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/ClusterInputManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/ClusterInputManager.asset new file mode 100644 index 000000000..e7886b266 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/ClusterInputManager.asset @@ -0,0 +1,6 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!236 &1 +ClusterInputManager: + m_ObjectHideFlags: 0 + m_Inputs: [] diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/DynamicsManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/DynamicsManager.asset new file mode 100644 index 000000000..cdc1f3eab --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/DynamicsManager.asset @@ -0,0 +1,34 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!55 &1 +PhysicsManager: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_Gravity: {x: 0, y: -9.81, z: 0} + m_DefaultMaterial: {fileID: 0} + m_BounceThreshold: 2 + m_SleepThreshold: 0.005 + m_DefaultContactOffset: 0.01 + m_DefaultSolverIterations: 6 + m_DefaultSolverVelocityIterations: 1 + m_QueriesHitBackfaces: 0 + m_QueriesHitTriggers: 1 + m_EnableAdaptiveForce: 0 + m_ClothInterCollisionDistance: 0 + m_ClothInterCollisionStiffness: 0 + m_ContactsGeneration: 1 + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + m_AutoSimulation: 1 + m_AutoSyncTransforms: 0 + m_ReuseCollisionCallbacks: 1 + m_ClothInterCollisionSettingsToggle: 0 + m_ContactPairsMode: 0 + m_BroadphaseType: 0 + m_WorldBounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 250, y: 250, z: 250} + m_WorldSubdivisions: 8 + m_FrictionType: 0 + m_EnableEnhancedDeterminism: 0 + m_EnableUnifiedHeightmaps: 1 + m_DefaultMaxAngluarSpeed: 7 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 000000000..0147887ef --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1045 &1 +EditorBuildSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Scenes: [] + m_configObjects: {} diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset~6f5b6cb06b253baf30333594f2fc40616d3dc6f7 b/TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset~6f5b6cb06b253baf30333594f2fc40616d3dc6f7 new file mode 100644 index 000000000..af975d257 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/EditorBuildSettings.asset~6f5b6cb06b253baf30333594f2fc40616d3dc6f7 @@ -0,0 +1,26 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1045 &1 +EditorBuildSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Scenes: + - enabled: 1 + path: Assets/Scenes/BaseScene.unity + guid: fed3eaea9e9d3c34787d39797aa00f26 + - enabled: 1 + path: Assets/Scenes/Obstacles1.unity + guid: f19b05d154ab6da45b4ae5556f8fa110 + - enabled: 1 + path: Assets/Scenes/Obstacles3.unity + guid: 35ac3be42349f61458a34067689566e5 + - enabled: 1 + path: Assets/Scenes/Obstacles2.unity + guid: 95ade26b3aa67b64db11a0bd0ea495b1 + - enabled: 1 + path: Assets/Scenes/Scenery.unity + guid: eaa1792ae064eb04d965ee47bd5e60dc + - enabled: 1 + path: Assets/Scenes/TestScene.unity + guid: 8b475f4ab5d969e4e88495336fa26c8c + m_configObjects: {} diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/EditorSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/EditorSettings.asset new file mode 100644 index 000000000..1a44c3d3c --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/EditorSettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!159 &1 +EditorSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_ExternalVersionControlSupport: Visible Meta Files + m_SerializationMode: 2 + m_LineEndingsForNewScripts: 2 + m_DefaultBehaviorMode: 0 + m_PrefabRegularEnvironment: {fileID: 0} + m_PrefabUIEnvironment: {fileID: 0} + m_SpritePackerMode: 0 + m_SpritePackerPaddingPower: 1 + m_EtcTextureCompressorBehavior: 1 + m_EtcTextureFastCompressor: 1 + m_EtcTextureNormalCompressor: 2 + m_EtcTextureBestCompressor: 4 + m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref + m_ProjectGenerationRootNamespace: + m_CollabEditorSettings: + inProgressEnabled: 1 + m_EnableTextureStreamingInEditMode: 1 + m_EnableTextureStreamingInPlayMode: 1 + m_AsyncShaderCompilation: 1 + m_EnterPlayModeOptionsEnabled: 0 + m_EnterPlayModeOptions: 3 + m_ShowLightmapResolutionOverlay: 1 + m_UseLegacyProbeSampleCount: 1 + m_AssetPipelineMode: 1 + m_CacheServerMode: 0 + m_CacheServerEndpoint: + m_CacheServerNamespacePrefix: default + m_CacheServerEnableDownload: 1 + m_CacheServerEnableUpload: 1 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/GraphicsSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 000000000..b0486139e --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/GraphicsSettings.asset @@ -0,0 +1,61 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!30 &1 +GraphicsSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_Deferred: + m_Mode: 1 + m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} + m_DeferredReflections: + m_Mode: 1 + m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} + m_ScreenSpaceShadows: + m_Mode: 1 + m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} + m_LegacyDeferred: + m_Mode: 1 + m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} + m_DepthNormals: + m_Mode: 1 + m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} + m_MotionVectors: + m_Mode: 1 + m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} + m_LightHalo: + m_Mode: 1 + m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} + m_LensFlare: + m_Mode: 1 + m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} + m_AlwaysIncludedShaders: + - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} + m_PreloadedShaders: [] + m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, + type: 0} + m_CustomRenderPipeline: {fileID: 11400000, guid: 5cd73a3d493926a4eb251403457df953, + type: 2} + m_TransparencySortMode: 0 + m_TransparencySortAxis: {x: 0, y: 0, z: 1} + m_DefaultRenderingPath: 1 + m_DefaultMobileRenderingPath: 1 + m_TierSettings: [] + m_LightmapStripping: 0 + m_FogStripping: 0 + m_InstancingStripping: 0 + m_LightmapKeepPlain: 1 + m_LightmapKeepDirCombined: 1 + m_LightmapKeepDynamicPlain: 1 + m_LightmapKeepDynamicDirCombined: 1 + m_LightmapKeepShadowMask: 1 + m_LightmapKeepSubtractive: 1 + m_FogKeepLinear: 1 + m_FogKeepExp: 1 + m_FogKeepExp2: 1 + m_AlbedoSwatchInfos: [] + m_LightsUseLinearIntensity: 1 + m_LightsUseColorTemperature: 1 + m_LogWhenShaderIsCompiled: 0 + m_AllowEnlightenSupportForUpgradedProject: 0 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/HDRPProjectSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/HDRPProjectSettings.asset new file mode 100644 index 000000000..dddb307fe --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/HDRPProjectSettings.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 63a2978a97e4fc04cb9d905947216f3d, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 1 + m_DefaultScenePrefabSaved: {fileID: 0} + m_DefaultDXRScenePrefabSaved: {fileID: 0} + m_ProjectSettingFolderPath: HDRPDefaultResources + m_WizardPopupAtStart: 0 + m_WizardActiveTab: 0 + m_PackageVersionForMaterials: 7.1.8 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/InputManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/InputManager.asset new file mode 100644 index 000000000..b16147e95 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/InputManager.asset @@ -0,0 +1,487 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!13 &1 +InputManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Axes: + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: a + altPositiveButton: d + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: s + altPositiveButton: w + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: mouse 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: mouse 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: mouse 2 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: space + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse X + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse Y + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse ScrollWheel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 2 + joyNum: 0 + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 0 + type: 2 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 1 + type: 2 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 0 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 1 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 2 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: enter + altNegativeButton: + altPositiveButton: space + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Cancel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: escape + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Enable Debug Button 1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: joystick button 8 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Enable Debug Button 2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: backspace + altNegativeButton: + altPositiveButton: joystick button 9 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Reset + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Next + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: page down + altNegativeButton: + altPositiveButton: joystick button 5 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Previous + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: page up + altNegativeButton: + altPositiveButton: joystick button 4 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Validate + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Persistent + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: right shift + altNegativeButton: + altPositiveButton: joystick button 2 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Multiplier + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: joystick button 3 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 2 + axis: 6 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 2 + axis: 5 + joyNum: 0 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/NavMeshAreas.asset b/TestProjects/PerceptionHDRP/ProjectSettings/NavMeshAreas.asset new file mode 100644 index 000000000..3b0b7c3d1 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/NavMeshAreas.asset @@ -0,0 +1,91 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!126 &1 +NavMeshProjectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + areas: + - name: Walkable + cost: 1 + - name: Not Walkable + cost: 1 + - name: Jump + cost: 2 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + m_LastAgentTypeID: -887442657 + m_Settings: + - serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.75 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_SettingNames: + - Humanoid diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/Physics2DSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 000000000..47880b1c8 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/Physics2DSettings.asset @@ -0,0 +1,56 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!19 &1 +Physics2DSettings: + m_ObjectHideFlags: 0 + serializedVersion: 4 + m_Gravity: {x: 0, y: -9.81} + m_DefaultMaterial: {fileID: 0} + m_VelocityIterations: 8 + m_PositionIterations: 3 + m_VelocityThreshold: 1 + m_MaxLinearCorrection: 0.2 + m_MaxAngularCorrection: 8 + m_MaxTranslationSpeed: 100 + m_MaxRotationSpeed: 360 + m_BaumgarteScale: 0.2 + m_BaumgarteTimeOfImpactScale: 0.75 + m_TimeToSleep: 0.5 + m_LinearSleepTolerance: 0.01 + m_AngularSleepTolerance: 2 + m_DefaultContactOffset: 0.01 + m_JobOptions: + serializedVersion: 2 + useMultithreading: 0 + useConsistencySorting: 0 + m_InterpolationPosesPerJob: 100 + m_NewContactsPerJob: 30 + m_CollideContactsPerJob: 100 + m_ClearFlagsPerJob: 200 + m_ClearBodyForcesPerJob: 200 + m_SyncDiscreteFixturesPerJob: 50 + m_SyncContinuousFixturesPerJob: 50 + m_FindNearestContactsPerJob: 100 + m_UpdateTriggerContactsPerJob: 100 + m_IslandSolverCostThreshold: 100 + m_IslandSolverBodyCostScale: 1 + m_IslandSolverContactCostScale: 10 + m_IslandSolverJointCostScale: 10 + m_IslandSolverBodiesPerJob: 50 + m_IslandSolverContactsPerJob: 50 + m_AutoSimulation: 1 + m_QueriesHitTriggers: 1 + m_QueriesStartInColliders: 1 + m_CallbacksOnDisable: 1 + m_ReuseCollisionCallbacks: 1 + m_AutoSyncTransforms: 0 + m_AlwaysShowColliders: 0 + m_ShowColliderSleep: 1 + m_ShowColliderContacts: 0 + m_ShowColliderAABB: 0 + m_ContactArrowScale: 0.2 + m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} + m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} + m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} + m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/PresetManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/PresetManager.asset new file mode 100644 index 000000000..67a94daef --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/PresetManager.asset @@ -0,0 +1,7 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1386491679 &1 +PresetManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_DefaultPresets: {} diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/ProjectSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/ProjectSettings.asset new file mode 100644 index 000000000..848431ad7 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/ProjectSettings.asset @@ -0,0 +1,620 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!129 &1 +PlayerSettings: + m_ObjectHideFlags: 0 + serializedVersion: 20 + productGUID: 57f77c262a9af434b9423af9c6b04c37 + AndroidProfiler: 0 + AndroidFilterTouchesWhenObscured: 0 + AndroidEnableSustainedPerformanceMode: 0 + defaultScreenOrientation: 4 + targetDevice: 2 + useOnDemandResources: 0 + accelerometerFrequency: 60 + companyName: DefaultCompany + productName: UnityTestFramework + defaultCursor: {fileID: 0} + cursorHotspot: {x: 0, y: 0} + m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} + m_ShowUnitySplashScreen: 0 + m_ShowUnitySplashLogo: 1 + m_SplashScreenOverlayOpacity: 1 + m_SplashScreenAnimation: 1 + m_SplashScreenLogoStyle: 1 + m_SplashScreenDrawMode: 0 + m_SplashScreenBackgroundAnimationZoom: 1 + m_SplashScreenLogoAnimationZoom: 1 + m_SplashScreenBackgroundLandscapeAspect: 1 + m_SplashScreenBackgroundPortraitAspect: 1 + m_SplashScreenBackgroundLandscapeUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenBackgroundPortraitUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenLogos: [] + m_VirtualRealitySplashScreen: {fileID: 0} + m_HolographicTrackingLossScreen: {fileID: 0} + defaultScreenWidth: 1024 + defaultScreenHeight: 768 + defaultScreenWidthWeb: 960 + defaultScreenHeightWeb: 600 + m_StereoRenderingPath: 0 + m_ActiveColorSpace: 1 + m_MTRendering: 1 + m_StackTraceTypes: 010000000100000001000000010000000100000001000000 + iosShowActivityIndicatorOnLoading: -1 + androidShowActivityIndicatorOnLoading: -1 + iosUseCustomAppBackgroundBehavior: 0 + iosAllowHTTPDownload: 1 + allowedAutorotateToPortrait: 1 + allowedAutorotateToPortraitUpsideDown: 1 + allowedAutorotateToLandscapeRight: 1 + allowedAutorotateToLandscapeLeft: 1 + useOSAutorotation: 1 + use32BitDisplayBuffer: 1 + preserveFramebufferAlpha: 0 + disableDepthAndStencilBuffers: 0 + androidStartInFullscreen: 1 + androidRenderOutsideSafeArea: 1 + androidUseSwappy: 0 + androidBlitType: 0 + defaultIsNativeResolution: 1 + macRetinaSupport: 1 + runInBackground: 1 + captureSingleScreen: 0 + muteOtherAudioSources: 0 + Prepare IOS For Recording: 0 + Force IOS Speakers When Recording: 0 + deferSystemGesturesMode: 0 + hideHomeButton: 0 + submitAnalytics: 1 + usePlayerLog: 1 + bakeCollisionMeshes: 0 + forceSingleInstance: 0 + useFlipModelSwapchain: 1 + resizableWindow: 1 + useMacAppStoreValidation: 0 + macAppStoreCategory: public.app-category.games + gpuSkinning: 0 + xboxPIXTextureCapture: 0 + xboxEnableAvatar: 0 + xboxEnableKinect: 0 + xboxEnableKinectAutoTracking: 0 + xboxEnableFitness: 0 + visibleInBackground: 1 + allowFullscreenSwitch: 1 + fullscreenMode: 3 + xboxSpeechDB: 0 + xboxEnableHeadOrientation: 0 + xboxEnableGuest: 0 + xboxEnablePIXSampling: 0 + metalFramebufferOnly: 0 + xboxOneResolution: 0 + xboxOneSResolution: 0 + xboxOneXResolution: 3 + xboxOneMonoLoggingLevel: 0 + xboxOneLoggingLevel: 1 + xboxOneDisableEsram: 0 + xboxOneEnableTypeOptimization: 0 + xboxOnePresentImmediateThreshold: 0 + switchQueueCommandMemory: 1048576 + switchQueueControlMemory: 16384 + switchQueueComputeMemory: 262144 + switchNVNShaderPoolsGranularity: 33554432 + switchNVNDefaultPoolsGranularity: 16777216 + switchNVNOtherPoolsGranularity: 16777216 + vulkanNumSwapchainBuffers: 2 + vulkanEnableSetSRGBWrite: 0 + m_SupportedAspectRatios: + 4:3: 1 + 5:4: 1 + 16:10: 1 + 16:9: 1 + Others: 1 + bundleVersion: 1.0 + preloadedAssets: [] + metroInputSource: 0 + wsaTransparentSwapchain: 0 + m_HolographicPauseOnTrackingLoss: 1 + xboxOneDisableKinectGpuReservation: 1 + xboxOneEnable7thCore: 1 + vrSettings: + cardboard: + depthFormat: 0 + enableTransitionView: 0 + daydream: + depthFormat: 0 + useSustainedPerformanceMode: 0 + enableVideoLayer: 0 + useProtectedVideoMemory: 0 + minimumSupportedHeadTracking: 0 + maximumSupportedHeadTracking: 1 + hololens: + depthFormat: 1 + depthBufferSharingEnabled: 1 + lumin: + depthFormat: 0 + frameTiming: 2 + enableGLCache: 0 + glCacheMaxBlobSize: 524288 + glCacheMaxFileSize: 8388608 + oculus: + sharedDepthBuffer: 1 + dashSupport: 1 + lowOverheadMode: 0 + protectedContext: 0 + v2Signing: 1 + enable360StereoCapture: 0 + isWsaHolographicRemotingEnabled: 0 + enableFrameTimingStats: 0 + useHDRDisplay: 0 + D3DHDRBitDepth: 0 + m_ColorGamuts: 00000000 + targetPixelDensity: 30 + resolutionScalingMode: 0 + androidSupportedAspectRatio: 1 + androidMaxAspectRatio: 2.1 + applicationIdentifier: + Standalone: com.unity.PerceptionTest + buildNumber: {} + AndroidBundleVersionCode: 1 + AndroidMinSdkVersion: 19 + AndroidTargetSdkVersion: 0 + AndroidPreferredInstallLocation: 1 + aotOptions: nimt-trampolines=1024 + stripEngineCode: 1 + iPhoneStrippingLevel: 0 + iPhoneScriptCallOptimization: 0 + ForceInternetPermission: 0 + ForceSDCardPermission: 0 + CreateWallpaper: 0 + APKExpansionFiles: 0 + keepLoadedShadersAlive: 0 + StripUnusedMeshComponents: 0 + VertexChannelCompressionMask: 4054 + iPhoneSdkVersion: 988 + iOSTargetOSVersionString: 11.0 + tvOSSdkVersion: 0 + tvOSRequireExtendedGameController: 0 + tvOSTargetOSVersionString: 11.0 + uIPrerenderedIcon: 0 + uIRequiresPersistentWiFi: 0 + uIRequiresFullScreen: 1 + uIStatusBarHidden: 1 + uIExitOnSuspend: 0 + uIStatusBarStyle: 0 + iPhoneSplashScreen: {fileID: 0} + iPhoneHighResSplashScreen: {fileID: 0} + iPhoneTallHighResSplashScreen: {fileID: 0} + iPhone47inSplashScreen: {fileID: 0} + iPhone55inPortraitSplashScreen: {fileID: 0} + iPhone55inLandscapeSplashScreen: {fileID: 0} + iPhone58inPortraitSplashScreen: {fileID: 0} + iPhone58inLandscapeSplashScreen: {fileID: 0} + iPadPortraitSplashScreen: {fileID: 0} + iPadHighResPortraitSplashScreen: {fileID: 0} + iPadLandscapeSplashScreen: {fileID: 0} + iPadHighResLandscapeSplashScreen: {fileID: 0} + iPhone65inPortraitSplashScreen: {fileID: 0} + iPhone65inLandscapeSplashScreen: {fileID: 0} + iPhone61inPortraitSplashScreen: {fileID: 0} + iPhone61inLandscapeSplashScreen: {fileID: 0} + appleTVSplashScreen: {fileID: 0} + appleTVSplashScreen2x: {fileID: 0} + tvOSSmallIconLayers: [] + tvOSSmallIconLayers2x: [] + tvOSLargeIconLayers: [] + tvOSLargeIconLayers2x: [] + tvOSTopShelfImageLayers: [] + tvOSTopShelfImageLayers2x: [] + tvOSTopShelfImageWideLayers: [] + tvOSTopShelfImageWideLayers2x: [] + iOSLaunchScreenType: 0 + iOSLaunchScreenPortrait: {fileID: 0} + iOSLaunchScreenLandscape: {fileID: 0} + iOSLaunchScreenBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreenFillPct: 100 + iOSLaunchScreenSize: 100 + iOSLaunchScreenCustomXibPath: + iOSLaunchScreeniPadType: 0 + iOSLaunchScreeniPadImage: {fileID: 0} + iOSLaunchScreeniPadBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreeniPadFillPct: 100 + iOSLaunchScreeniPadSize: 100 + iOSLaunchScreeniPadCustomXibPath: + iOSUseLaunchScreenStoryboard: 0 + iOSLaunchScreenCustomStoryboardPath: + iOSDeviceRequirements: [] + iOSURLSchemes: [] + iOSBackgroundModes: 0 + iOSMetalForceHardShadows: 0 + metalEditorSupport: 1 + metalAPIValidation: 1 + iOSRenderExtraFrameOnPause: 0 + appleDeveloperTeamID: + iOSManualSigningProvisioningProfileID: + tvOSManualSigningProvisioningProfileID: + iOSManualSigningProvisioningProfileType: 0 + tvOSManualSigningProvisioningProfileType: 0 + appleEnableAutomaticSigning: 2 + iOSRequireARKit: 0 + iOSAutomaticallyDetectAndAddCapabilities: 1 + appleEnableProMotion: 0 + clonedFromGUID: 00000000000000000000000000000000 + templatePackageId: + templateDefaultScene: + AndroidTargetArchitectures: 1 + AndroidSplashScreenScale: 0 + androidSplashScreen: {fileID: 0} + AndroidKeystoreName: + AndroidKeyaliasName: + AndroidBuildApkPerCpuArchitecture: 0 + AndroidTVCompatibility: 0 + AndroidIsGame: 1 + AndroidEnableTango: 0 + androidEnableBanner: 1 + androidUseLowAccuracyLocation: 0 + androidUseCustomKeystore: 0 + m_AndroidBanners: + - width: 320 + height: 180 + banner: {fileID: 0} + androidGamepadSupportLevel: 0 + AndroidValidateAppBundleSize: 1 + AndroidAppBundleSizeToValidate: 150 + m_BuildTargetIcons: [] + m_BuildTargetPlatformIcons: [] + m_BuildTargetBatching: [] + m_BuildTargetGraphicsJobs: [] + m_BuildTargetGraphicsJobMode: [] + m_BuildTargetGraphicsAPIs: + - m_BuildTarget: LinuxStandaloneSupport + m_APIs: 15000000 + m_Automatic: 0 + - m_BuildTarget: MacStandaloneSupport + m_APIs: 10000000 + m_Automatic: 0 + m_BuildTargetVRSettings: [] + openGLRequireES31: 0 + openGLRequireES31AEP: 0 + openGLRequireES32: 0 + m_TemplateCustomTags: {} + mobileMTRendering: + Android: 1 + iPhone: 1 + tvOS: 1 + m_BuildTargetGroupLightmapEncodingQuality: [] + m_BuildTargetGroupLightmapSettings: [] + playModeTestRunnerEnabled: 0 + runPlayModeTestAsEditModeTest: 0 + actionOnDotNetUnhandledException: 1 + enableInternalProfiler: 0 + logObjCUncaughtExceptions: 1 + enableCrashReportAPI: 0 + cameraUsageDescription: + locationUsageDescription: + microphoneUsageDescription: + switchNetLibKey: + switchSocketMemoryPoolSize: 6144 + switchSocketAllocatorPoolSize: 128 + switchSocketConcurrencyLimit: 14 + switchScreenResolutionBehavior: 2 + switchUseCPUProfiler: 0 + switchApplicationID: 0x01004b9000490000 + switchNSODependencies: + switchTitleNames_0: + switchTitleNames_1: + switchTitleNames_2: + switchTitleNames_3: + switchTitleNames_4: + switchTitleNames_5: + switchTitleNames_6: + switchTitleNames_7: + switchTitleNames_8: + switchTitleNames_9: + switchTitleNames_10: + switchTitleNames_11: + switchTitleNames_12: + switchTitleNames_13: + switchTitleNames_14: + switchPublisherNames_0: + switchPublisherNames_1: + switchPublisherNames_2: + switchPublisherNames_3: + switchPublisherNames_4: + switchPublisherNames_5: + switchPublisherNames_6: + switchPublisherNames_7: + switchPublisherNames_8: + switchPublisherNames_9: + switchPublisherNames_10: + switchPublisherNames_11: + switchPublisherNames_12: + switchPublisherNames_13: + switchPublisherNames_14: + switchIcons_0: {fileID: 0} + switchIcons_1: {fileID: 0} + switchIcons_2: {fileID: 0} + switchIcons_3: {fileID: 0} + switchIcons_4: {fileID: 0} + switchIcons_5: {fileID: 0} + switchIcons_6: {fileID: 0} + switchIcons_7: {fileID: 0} + switchIcons_8: {fileID: 0} + switchIcons_9: {fileID: 0} + switchIcons_10: {fileID: 0} + switchIcons_11: {fileID: 0} + switchIcons_12: {fileID: 0} + switchIcons_13: {fileID: 0} + switchIcons_14: {fileID: 0} + switchSmallIcons_0: {fileID: 0} + switchSmallIcons_1: {fileID: 0} + switchSmallIcons_2: {fileID: 0} + switchSmallIcons_3: {fileID: 0} + switchSmallIcons_4: {fileID: 0} + switchSmallIcons_5: {fileID: 0} + switchSmallIcons_6: {fileID: 0} + switchSmallIcons_7: {fileID: 0} + switchSmallIcons_8: {fileID: 0} + switchSmallIcons_9: {fileID: 0} + switchSmallIcons_10: {fileID: 0} + switchSmallIcons_11: {fileID: 0} + switchSmallIcons_12: {fileID: 0} + switchSmallIcons_13: {fileID: 0} + switchSmallIcons_14: {fileID: 0} + switchManualHTML: + switchAccessibleURLs: + switchLegalInformation: + switchMainThreadStackSize: 1048576 + switchPresenceGroupId: + switchLogoHandling: 0 + switchReleaseVersion: 0 + switchDisplayVersion: 1.0.0 + switchStartupUserAccount: 0 + switchTouchScreenUsage: 0 + switchSupportedLanguagesMask: 0 + switchLogoType: 0 + switchApplicationErrorCodeCategory: + switchUserAccountSaveDataSize: 0 + switchUserAccountSaveDataJournalSize: 0 + switchApplicationAttribute: 0 + switchCardSpecSize: -1 + switchCardSpecClock: -1 + switchRatingsMask: 0 + switchRatingsInt_0: 0 + switchRatingsInt_1: 0 + switchRatingsInt_2: 0 + switchRatingsInt_3: 0 + switchRatingsInt_4: 0 + switchRatingsInt_5: 0 + switchRatingsInt_6: 0 + switchRatingsInt_7: 0 + switchRatingsInt_8: 0 + switchRatingsInt_9: 0 + switchRatingsInt_10: 0 + switchRatingsInt_11: 0 + switchRatingsInt_12: 0 + switchLocalCommunicationIds_0: + switchLocalCommunicationIds_1: + switchLocalCommunicationIds_2: + switchLocalCommunicationIds_3: + switchLocalCommunicationIds_4: + switchLocalCommunicationIds_5: + switchLocalCommunicationIds_6: + switchLocalCommunicationIds_7: + switchParentalControl: 0 + switchAllowsScreenshot: 1 + switchAllowsVideoCapturing: 1 + switchAllowsRuntimeAddOnContentInstall: 0 + switchDataLossConfirmation: 0 + switchUserAccountLockEnabled: 0 + switchSystemResourceMemory: 16777216 + switchSupportedNpadStyles: 22 + switchNativeFsCacheSize: 32 + switchIsHoldTypeHorizontal: 0 + switchSupportedNpadCount: 8 + switchSocketConfigEnabled: 0 + switchTcpInitialSendBufferSize: 32 + switchTcpInitialReceiveBufferSize: 64 + switchTcpAutoSendBufferSizeMax: 256 + switchTcpAutoReceiveBufferSizeMax: 256 + switchUdpSendBufferSize: 9 + switchUdpReceiveBufferSize: 42 + switchSocketBufferEfficiency: 4 + switchSocketInitializeEnabled: 1 + switchNetworkInterfaceManagerInitializeEnabled: 1 + switchPlayerConnectionEnabled: 1 + ps4NPAgeRating: 12 + ps4NPTitleSecret: + ps4NPTrophyPackPath: + ps4ParentalLevel: 11 + ps4ContentID: ED1633-NPXX51362_00-0000000000000000 + ps4Category: 0 + ps4MasterVersion: 01.00 + ps4AppVersion: 01.00 + ps4AppType: 0 + ps4ParamSfxPath: + ps4VideoOutPixelFormat: 0 + ps4VideoOutInitialWidth: 1920 + ps4VideoOutBaseModeInitialWidth: 1920 + ps4VideoOutReprojectionRate: 60 + ps4PronunciationXMLPath: + ps4PronunciationSIGPath: + ps4BackgroundImagePath: + ps4StartupImagePath: + ps4StartupImagesFolder: + ps4IconImagesFolder: + ps4SaveDataImagePath: + ps4SdkOverride: + ps4BGMPath: + ps4ShareFilePath: + ps4ShareOverlayImagePath: + ps4PrivacyGuardImagePath: + ps4NPtitleDatPath: + ps4RemotePlayKeyAssignment: -1 + ps4RemotePlayKeyMappingDir: + ps4PlayTogetherPlayerCount: 0 + ps4EnterButtonAssignment: 2 + ps4ApplicationParam1: 0 + ps4ApplicationParam2: 0 + ps4ApplicationParam3: 0 + ps4ApplicationParam4: 0 + ps4DownloadDataSize: 0 + ps4GarlicHeapSize: 2048 + ps4ProGarlicHeapSize: 2560 + playerPrefsMaxSize: 32768 + ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ + ps4pnSessions: 1 + ps4pnPresence: 1 + ps4pnFriends: 1 + ps4pnGameCustomData: 1 + playerPrefsSupport: 0 + enableApplicationExit: 0 + resetTempFolder: 1 + restrictedAudioUsageRights: 0 + ps4UseResolutionFallback: 0 + ps4ReprojectionSupport: 0 + ps4UseAudio3dBackend: 0 + ps4SocialScreenEnabled: 0 + ps4ScriptOptimizationLevel: 2 + ps4Audio3dVirtualSpeakerCount: 14 + ps4attribCpuUsage: 0 + ps4PatchPkgPath: + ps4PatchLatestPkgPath: + ps4PatchChangeinfoPath: + ps4PatchDayOne: 0 + ps4attribUserManagement: 0 + ps4attribMoveSupport: 0 + ps4attrib3DSupport: 0 + ps4attribShareSupport: 0 + ps4attribExclusiveVR: 0 + ps4disableAutoHideSplash: 0 + ps4videoRecordingFeaturesUsed: 0 + ps4contentSearchFeaturesUsed: 0 + ps4attribEyeToEyeDistanceSettingVR: 0 + ps4IncludedModules: [] + ps4attribVROutputEnabled: 0 + monoEnv: + splashScreenBackgroundSourceLandscape: {fileID: 0} + splashScreenBackgroundSourcePortrait: {fileID: 0} + blurSplashScreenBackground: 1 + spritePackerPolicy: + webGLMemorySize: 32 + webGLExceptionSupport: 1 + webGLNameFilesAsHashes: 0 + webGLDataCaching: 1 + webGLDebugSymbols: 0 + webGLEmscriptenArgs: + webGLModulesDirectory: + webGLTemplate: APPLICATION:Default + webGLAnalyzeBuildSize: 0 + webGLUseEmbeddedResources: 0 + webGLCompressionFormat: 0 + webGLLinkerTarget: 1 + webGLThreadsSupport: 0 + webGLWasmStreaming: 0 + scriptingDefineSymbols: {} + platformArchitecture: {} + scriptingBackend: + Standalone: 0 + il2cppCompilerConfiguration: {} + managedStrippingLevel: {} + incrementalIl2cppBuild: {} + allowUnsafeCode: 0 + additionalIl2CppArgs: + scriptingRuntimeVersion: 1 + gcIncremental: 0 + gcWBarrierValidation: 0 + apiCompatibilityLevelPerPlatform: + Standalone: 6 + m_RenderingPath: 1 + m_MobileRenderingPath: 1 + metroPackageName: PerceptionTest + metroPackageVersion: + metroCertificatePath: + metroCertificatePassword: + metroCertificateSubject: + metroCertificateIssuer: + metroCertificateNotAfter: 0000000000000000 + metroApplicationDescription: PerceptionTest + wsaImages: {} + metroTileShortName: + metroTileShowName: 0 + metroMediumTileShowName: 0 + metroLargeTileShowName: 0 + metroWideTileShowName: 0 + metroSupportStreamingInstall: 0 + metroLastRequiredScene: 0 + metroDefaultTileSize: 1 + metroTileForegroundText: 2 + metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} + metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, + a: 1} + metroSplashScreenUseBackgroundColor: 0 + platformCapabilities: {} + metroTargetDeviceFamilies: {} + metroFTAName: + metroFTAFileTypes: [] + metroProtocolName: + XboxOneProductId: + XboxOneUpdateKey: + XboxOneSandboxId: + XboxOneContentId: + XboxOneTitleId: + XboxOneSCId: + XboxOneGameOsOverridePath: + XboxOnePackagingOverridePath: + XboxOneAppManifestOverridePath: + XboxOneVersion: 1.0.0.0 + XboxOnePackageEncryption: 0 + XboxOnePackageUpdateGranularity: 2 + XboxOneDescription: + XboxOneLanguage: + - enus + XboxOneCapability: [] + XboxOneGameRating: {} + XboxOneIsContentPackage: 0 + XboxOneEnableGPUVariability: 1 + XboxOneSockets: {} + XboxOneSplashScreen: {fileID: 0} + XboxOneAllowedProductIds: [] + XboxOnePersistentLocalStorageSize: 0 + XboxOneXTitleMemory: 8 + XboxOneOverrideIdentityName: + vrEditorSettings: + daydream: + daydreamIconForeground: {fileID: 0} + daydreamIconBackground: {fileID: 0} + cloudServicesEnabled: {} + luminIcon: + m_Name: + m_ModelFolderPath: + m_PortalFolderPath: + luminCert: + m_CertPath: + m_SignPackage: 1 + luminIsChannelApp: 0 + luminVersion: + m_VersionCode: 1 + m_VersionName: + apiCompatibilityLevel: 6 + cloudProjectId: 8defcb31-8c8c-49c0-a50b-c0928c5c07e4 + framebufferDepthMemorylessMode: 0 + projectName: SimViz Test + organizationId: jonhunity + cloudEnabled: 0 + enableNativePlatformBackendsForNewInputSystem: 0 + disableOldInputManagerSupport: 0 + legacyClampBlendShapeWeights: 0 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/ProjectVersion.txt b/TestProjects/PerceptionHDRP/ProjectSettings/ProjectVersion.txt new file mode 100644 index 000000000..e76bfbec8 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/ProjectVersion.txt @@ -0,0 +1,2 @@ +m_EditorVersion: 2019.3.6f1 +m_EditorVersionWithRevision: 2019.3.6f1 (5c3fb0a11183) diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/QualitySettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/QualitySettings.asset new file mode 100644 index 000000000..d24eb10c1 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/QualitySettings.asset @@ -0,0 +1,236 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!47 &1 +QualitySettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_CurrentQuality: 5 + m_QualitySettings: + - serializedVersion: 2 + name: Very Low + pixelLightCount: 0 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 15 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 1 + textureQuality: 1 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 0 + lodBias: 0.3 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 4 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Low + pixelLightCount: 0 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 0 + lodBias: 0.4 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 16 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Medium + pixelLightCount: 1 + shadows: 1 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 1 + lodBias: 0.7 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 64 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: High + pixelLightCount: 2 + shadows: 2 + shadowResolution: 1 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 40 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 256 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Very High + pixelLightCount: 3 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 70 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + skinWeights: 4 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 2 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1.5 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 1024 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Ultra + pixelLightCount: 4 + shadows: 2 + shadowResolution: 2 + shadowProjection: 1 + shadowCascades: 4 + shadowDistance: 150 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + skinWeights: 255 + textureQuality: 0 + anisotropicTextures: 2 + antiAliasing: 2 + softParticles: 1 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 2 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 4096 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} + excludedTargetPlatforms: [] + m_PerPlatformDefaultQuality: + Android: 2 + Lumin: 5 + Nintendo Switch: 5 + PS4: 5 + Stadia: 5 + Standalone: 5 + WebGL: 3 + Windows Store Apps: 5 + XboxOne: 5 + iPhone: 2 + tvOS: 2 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/TagManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/TagManager.asset new file mode 100644 index 000000000..1c92a7840 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/TagManager.asset @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!78 &1 +TagManager: + serializedVersion: 2 + tags: [] + layers: + - Default + - TransparentFX + - Ignore Raycast + - + - Water + - UI + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + m_SortingLayers: + - name: Default + uniqueID: 0 + locked: 0 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/TimeManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/TimeManager.asset new file mode 100644 index 000000000..558a017e1 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/TimeManager.asset @@ -0,0 +1,9 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!5 &1 +TimeManager: + m_ObjectHideFlags: 0 + Fixed Timestep: 0.02 + Maximum Allowed Timestep: 0.33333334 + m_TimeScale: 1 + Maximum Particle Timestep: 0.03 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/UnityConnectSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/UnityConnectSettings.asset new file mode 100644 index 000000000..fa0b14657 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/UnityConnectSettings.asset @@ -0,0 +1,34 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!310 &1 +UnityConnectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 1 + m_Enabled: 0 + m_TestMode: 0 + m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events + m_EventUrl: https://cdp.cloud.unity3d.com/v1/events + m_ConfigUrl: https://config.uca.cloud.unity3d.com + m_TestInitMode: 0 + CrashReportingSettings: + m_EventUrl: https://perf-events.cloud.unity3d.com + m_Enabled: 0 + m_LogBufferSize: 10 + m_CaptureEditorExceptions: 1 + UnityPurchasingSettings: + m_Enabled: 0 + m_TestMode: 0 + UnityAnalyticsSettings: + m_Enabled: 0 + m_TestMode: 0 + m_InitializeOnStartup: 1 + UnityAdsSettings: + m_Enabled: 0 + m_InitializeOnStartup: 1 + m_TestMode: 0 + m_IosGameId: + m_AndroidGameId: + m_GameIds: {} + m_GameId: + PerformanceReportingSettings: + m_Enabled: 0 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/VFXManager.asset b/TestProjects/PerceptionHDRP/ProjectSettings/VFXManager.asset new file mode 100644 index 000000000..3a95c98be --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/VFXManager.asset @@ -0,0 +1,12 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!937362698 &1 +VFXManager: + m_ObjectHideFlags: 0 + m_IndirectShader: {fileID: 0} + m_CopyBufferShader: {fileID: 0} + m_SortShader: {fileID: 0} + m_StripUpdateShader: {fileID: 0} + m_RenderPipeSettingsPath: + m_FixedTimeStep: 0.016666668 + m_MaxDeltaTime: 0.05 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/VersionControlSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/VersionControlSettings.asset new file mode 100644 index 000000000..dca288142 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/VersionControlSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!890905787 &1 +VersionControlSettings: + m_ObjectHideFlags: 0 + m_Mode: Visible Meta Files + m_CollabEditorSettings: + inProgressEnabled: 1 diff --git a/TestProjects/PerceptionHDRP/ProjectSettings/XRSettings.asset b/TestProjects/PerceptionHDRP/ProjectSettings/XRSettings.asset new file mode 100644 index 000000000..482590c19 --- /dev/null +++ b/TestProjects/PerceptionHDRP/ProjectSettings/XRSettings.asset @@ -0,0 +1,10 @@ +{ + "m_SettingKeys": [ + "VR Device Disabled", + "VR Device User Alert" + ], + "m_SettingValues": [ + "False", + "False" + ] +} \ No newline at end of file diff --git a/TestProjects/PerceptionHDRP/TestRunnerOptions.json b/TestProjects/PerceptionHDRP/TestRunnerOptions.json new file mode 100644 index 000000000..cfc872fc1 --- /dev/null +++ b/TestProjects/PerceptionHDRP/TestRunnerOptions.json @@ -0,0 +1,3 @@ +{ + "disableBatchMode": true +} \ No newline at end of file diff --git a/TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset b/TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset new file mode 100644 index 000000000..46f48d9f1 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset @@ -0,0 +1,21 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bad10bec3eccd8e49a9d725b2c30f74c, type: 3} + m_Name: ExampleLabelingConfiguration + m_EditorClassIdentifier: + LabelingConfigurations: + - label: Box + value: 10000 + - label: Cube + value: 20000 + - label: Crate + value: 30000 diff --git a/TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset.meta b/TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset.meta new file mode 100644 index 000000000..179e1d50a --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/ExampleLabelingConfiguration.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e74234fe725079e4aa7ecd74797ceb79 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Assets/Rotator.cs b/TestProjects/PerceptionURP/Assets/Rotator.cs new file mode 100644 index 000000000..d0b4c79be --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Rotator.cs @@ -0,0 +1,15 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class Rotator : MonoBehaviour +{ + [SerializeField] + public float yDegreesPerSecond = 180; + + // Update is called once per frame + void Update() + { + transform.localRotation *= Quaternion.Euler(0, yDegreesPerSecond * Time.deltaTime, 0); + } +} diff --git a/TestProjects/PerceptionURP/Assets/Rotator.cs.meta b/TestProjects/PerceptionURP/Assets/Rotator.cs.meta new file mode 100644 index 000000000..6ee0804b1 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Rotator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 673a227032a8e4940b9828c5b6f852ab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Assets/Scenes.meta b/TestProjects/PerceptionURP/Assets/Scenes.meta new file mode 100644 index 000000000..23f8632c4 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Scenes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2e7e21f798e7d52489ac087464405d70 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity b/TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity new file mode 100644 index 000000000..8f713de57 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity @@ -0,0 +1,765 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 705507994} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &4662619 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4662620} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4662620 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4662619} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.7286716, y: -2.380882, z: 5.498973} + m_LocalScale: {x: 36.249973, y: 36.249973, z: 36.249973} + m_Children: + - {fileID: 963194228} + - {fileID: 705507995} + - {fileID: 1640252283} + - {fileID: 464025709} + - {fileID: 411238281} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &411238276 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 411238281} + - component: {fileID: 411238280} + - component: {fileID: 411238279} + - component: {fileID: 411238278} + - component: {fileID: 411238277} + - component: {fileID: 411238282} + m_Layer: 0 + m_Name: Crate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &411238277 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b33f0bc2b78db642a758f07826d0dd0, type: 3} + m_Name: + m_EditorClassIdentifier: + classes: + - Crate +--- !u!65 &411238278 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &411238279 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &411238280 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &411238281 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.3786716, y: 2.380882, z: -4.288973} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &411238282 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 411238276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 673a227032a8e4940b9828c5b6f852ab, type: 3} + m_Name: + m_EditorClassIdentifier: + yDegreesPerSecond: 180 +--- !u!1 &464025704 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 464025709} + - component: {fileID: 464025708} + - component: {fileID: 464025707} + - component: {fileID: 464025706} + - component: {fileID: 464025705} + - component: {fileID: 464025710} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &464025705 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b33f0bc2b78db642a758f07826d0dd0, type: 3} + m_Name: + m_EditorClassIdentifier: + classes: + - Cube +--- !u!65 &464025706 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &464025707 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &464025708 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &464025709 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 2.6386716, y: 2.380882, z: -3.9089727} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &464025710 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 464025704} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 673a227032a8e4940b9828c5b6f852ab, type: 3} + m_Name: + m_EditorClassIdentifier: + yDegreesPerSecond: 180 +--- !u!1 &705507993 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 705507995} + - component: {fileID: 705507994} + - component: {fileID: 705507996} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &705507994 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 3.1415927 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 1 + m_LightShadowCasterMode: 2 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 6.25e-43, y: 1.0156355e+12, z: 6.25e-43, w: 2.8676e-41} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &705507995 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 2.7286716, y: 5.3808823, z: -5.498973} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &705507996 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 705507993} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &963194225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 963194228} + - component: {fileID: 963194226} + - component: {fileID: 963194230} + - component: {fileID: 963194229} + - component: {fileID: 963194227} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &963194226 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 +--- !u!114 &963194227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_RenderShadows: 1 + m_RequiresDepthTextureOption: 2 + m_RequiresOpaqueTextureOption: 2 + m_CameraType: 0 + m_CameraOutput: 0 + m_Cameras: [] + m_RendererIndex: -1 + m_VolumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + m_VolumeTrigger: {fileID: 0} + m_RenderPostProcessing: 0 + m_Antialiasing: 0 + m_AntialiasingQuality: 2 + m_StopNaN: 0 + m_Dithering: 0 + m_RequiresDepthTexture: 0 + m_RequiresColorTexture: 0 + m_Version: 2 +--- !u!4 &963194228 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_LocalRotation: {x: -0.17179534, y: 0.30667058, z: -0.056378223, w: -0.93448436} + m_LocalPosition: {x: 5.5378666, y: 3.5565922, z: -7.528791} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &963194229 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!114 &963194230 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 963194225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4467405dbcbd3d64ab4363e9ae8bb813, type: 3} + m_Name: + m_EditorClassIdentifier: + description: The main camera + period: 0.0166 + startTime: 0 + captureRgbImages: 1 + produceSegmentationImages: 1 + produceObjectCountAnnotations: 1 + LabelingConfiguration: {fileID: 11400000, guid: e74234fe725079e4aa7ecd74797ceb79, + type: 2} +--- !u!1 &1640252278 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1640252283} + - component: {fileID: 1640252282} + - component: {fileID: 1640252281} + - component: {fileID: 1640252280} + - component: {fileID: 1640252279} + - component: {fileID: 1640252284} + m_Layer: 0 + m_Name: Box + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1640252279 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b33f0bc2b78db642a758f07826d0dd0, type: 3} + m_Name: + m_EditorClassIdentifier: + classes: + - Box +--- !u!65 &1640252280 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1640252281 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!33 &1640252282 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1640252283 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 2.7286716, y: 2.380882, z: -5.498973} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4662620} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1640252284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1640252278} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 673a227032a8e4940b9828c5b6f852ab, type: 3} + m_Name: + m_EditorClassIdentifier: + yDegreesPerSecond: 180 diff --git a/TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity.meta b/TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity.meta new file mode 100644 index 000000000..952bd1e9e --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9fc0d4010bbf28b4594072e72b8655ab +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Assets/Settings.meta b/TestProjects/PerceptionURP/Assets/Settings.meta new file mode 100644 index 000000000..8e9f13c8f --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Settings.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0735c275001a2c84dafdb30deced5d8d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset b/TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset new file mode 100644 index 000000000..6ba5ab526 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset @@ -0,0 +1,49 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} + m_Name: ForwardRenderer + m_EditorClassIdentifier: + m_RendererFeatures: + - {fileID: 5741507687788441411} + postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} + shaders: + blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} + copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3} + screenSpaceShadowPS: {fileID: 4800000, guid: 0f854b35a0cf61a429bd5dcfea30eddd, + type: 3} + samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} + fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3} + m_OpaqueLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_TransparentLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_DefaultStencilState: + overrideStencilState: 0 + stencilReference: 0 + stencilCompareFunction: 8 + passOperation: 0 + failOperation: 0 + zFailOperation: 0 +--- !u!114 &5741507687788441411 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 780f1bb8e775c4245b86116069a82828, type: 3} + m_Name: Segmentation + m_EditorClassIdentifier: diff --git a/TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset.meta b/TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset.meta new file mode 100644 index 000000000..06d9cabc2 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Settings/ForwardRenderer.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a8e21d5c33334b11b34a596161b9360 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset b/TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset new file mode 100644 index 000000000..cbc629b5c --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset @@ -0,0 +1,118 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7893295128165547882 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3} + m_Name: Bloom + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + threshold: + m_OverrideState: 1 + m_Value: 1 + min: 0 + intensity: + m_OverrideState: 1 + m_Value: 1 + min: 0 + scatter: + m_OverrideState: 0 + m_Value: 0.7 + min: 0 + max: 1 + clamp: + m_OverrideState: 0 + m_Value: 65472 + min: 0 + tint: + m_OverrideState: 0 + m_Value: {r: 1, g: 1, b: 1, a: 1} + hdr: 0 + showAlpha: 0 + showEyeDropper: 1 + highQualityFiltering: + m_OverrideState: 0 + m_Value: 0 + dirtTexture: + m_OverrideState: 0 + m_Value: {fileID: 0} + dirtIntensity: + m_OverrideState: 0 + m_Value: 0 + min: 0 +--- !u!114 &-7011558710299706105 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3} + m_Name: Vignette + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + color: + m_OverrideState: 0 + m_Value: {r: 0, g: 0, b: 0, a: 1} + hdr: 0 + showAlpha: 0 + showEyeDropper: 1 + center: + m_OverrideState: 0 + m_Value: {x: 0.5, y: 0.5} + intensity: + m_OverrideState: 1 + m_Value: 0.25 + min: 0 + max: 1 + smoothness: + m_OverrideState: 1 + m_Value: 0.4 + min: 0.01 + max: 1 + rounded: + m_OverrideState: 0 + m_Value: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: SampleSceneProfile + m_EditorClassIdentifier: + components: + - {fileID: 849379129802519247} + - {fileID: -7893295128165547882} + - {fileID: -7011558710299706105} +--- !u!114 &849379129802519247 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3} + m_Name: Tonemapping + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + mode: + m_OverrideState: 1 + m_Value: 2 diff --git a/TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset.meta b/TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset.meta new file mode 100644 index 000000000..b82270c5b --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Settings/SampleSceneProfile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 10fc4df2da32a41aaa32d77bc913491c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset b/TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset new file mode 100644 index 000000000..47c2600e9 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset @@ -0,0 +1,54 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} + m_Name: UniversalRP-HighQuality + m_EditorClassIdentifier: + k_AssetVersion: 5 + k_AssetPreviousVersion: 5 + m_RendererType: 1 + m_RendererData: {fileID: 0} + m_RendererDataList: + - {fileID: 11400000, guid: 4a8e21d5c33334b11b34a596161b9360, type: 2} + m_DefaultRendererIndex: 0 + m_RequireDepthTexture: 0 + m_RequireOpaqueTexture: 0 + m_OpaqueDownsampling: 1 + m_SupportsTerrainHoles: 1 + m_SupportsHDR: 1 + m_MSAA: 2 + m_RenderScale: 1 + m_MainLightRenderingMode: 1 + m_MainLightShadowsSupported: 1 + m_MainLightShadowmapResolution: 2048 + m_AdditionalLightsRenderingMode: 1 + m_AdditionalLightsPerObjectLimit: 4 + m_AdditionalLightShadowsSupported: 1 + m_AdditionalLightsShadowmapResolution: 512 + m_ShadowDistance: 50 + m_ShadowCascades: 1 + m_Cascade2Split: 0.25 + m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} + m_ShadowDepthBias: 1 + m_ShadowNormalBias: 1 + m_SoftShadowsSupported: 1 + m_UseSRPBatcher: 1 + m_SupportsDynamicBatching: 0 + m_MixedLightingSupported: 1 + m_DebugLevel: 0 + m_ColorGradingMode: 0 + m_ColorGradingLutSize: 32 + m_ShadowType: 1 + m_LocalShadowsSupported: 0 + m_LocalShadowsAtlasResolution: 256 + m_MaxPixelLights: 0 + m_ShadowAtlasResolution: 256 + m_ShaderVariantLogLevel: 0 diff --git a/TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset.meta b/TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset.meta new file mode 100644 index 000000000..c8fa31758 --- /dev/null +++ b/TestProjects/PerceptionURP/Assets/Settings/UniversalRP-HighQuality.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 19ba41d7c0026c3459d37c2fe90c55a0 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/PerceptionURP/Packages/manifest.json b/TestProjects/PerceptionURP/Packages/manifest.json new file mode 100644 index 000000000..ba97ac93a --- /dev/null +++ b/TestProjects/PerceptionURP/Packages/manifest.json @@ -0,0 +1,49 @@ +{ + "dependencies": { + "com.unity.simulation.capture": "0.0.10-preview.6", + "com.unity.simulation.core": "0.0.10-preview.8", + "com.unity.collab-proxy": "1.2.16", + "com.unity.ide.rider": "1.1.4", + "com.unity.ide.vscode": "1.1.4", + "com.unity.render-pipelines.universal": "7.1.8", + "com.unity.perception": "file:../../../com.unity.perception", + "com.unity.test-framework": "1.1.11", + "com.unity.textmeshpro": "2.0.1", + "com.unity.timeline": "1.2.12", + "com.unity.ugui": "1.0.0", + "com.unity.modules.ai": "1.0.0", + "com.unity.modules.androidjni": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.cloth": "1.0.0", + "com.unity.modules.director": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.physics2d": "1.0.0", + "com.unity.modules.screencapture": "1.0.0", + "com.unity.modules.terrain": "1.0.0", + "com.unity.modules.terrainphysics": "1.0.0", + "com.unity.modules.tilemap": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.modules.umbra": "1.0.0", + "com.unity.modules.unityanalytics": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.unitywebrequesttexture": "1.0.0", + "com.unity.modules.unitywebrequestwww": "1.0.0", + "com.unity.modules.vehicles": "1.0.0", + "com.unity.modules.video": "1.0.0", + "com.unity.modules.vr": "1.0.0", + "com.unity.modules.wind": "1.0.0", + "com.unity.modules.xr": "1.0.0" + }, + "testables": [ + "com.unity.perception" + ] +} diff --git a/TestProjects/PerceptionURP/ProjectSettings/AudioManager.asset b/TestProjects/PerceptionURP/ProjectSettings/AudioManager.asset new file mode 100644 index 000000000..27287fec5 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/AudioManager.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!11 &1 +AudioManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Volume: 1 + Rolloff Scale: 1 + Doppler Factor: 1 + Default Speaker Mode: 2 + m_SampleRate: 0 + m_DSPBufferSize: 1024 + m_VirtualVoiceCount: 512 + m_RealVoiceCount: 32 + m_SpatializerPlugin: + m_AmbisonicDecoderPlugin: + m_DisableAudio: 0 + m_VirtualizeEffects: 1 + m_RequestedDSPBufferSize: 0 diff --git a/TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json b/TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json new file mode 100644 index 000000000..bff2343ed --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneLinux64.json @@ -0,0 +1,11 @@ +{ + + "MonoBehaviour": { + "m_EditorHideFlags": 0, + "m_Name": "", + "m_EditorClassIdentifier":"Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", + "DisableOptimisations": false, + "DisableSafetyChecks": true, + "DisableBurstCompilation": true + } +} diff --git a/TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneWindows.json new file mode 100644 index 000000000..e1325d0e3 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/BurstAotSettings_StandaloneWindows.json @@ -0,0 +1,11 @@ +{ + "MonoBehaviour": { + "m_Enabled": true, + "m_EditorHideFlags": 0, + "m_Name": "", + "m_EditorClassIdentifier": "Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", + "DisableOptimisations": true, + "DisableSafetyChecks": true, + "DisableBurstCompilation": true + } +} \ No newline at end of file diff --git a/TestProjects/PerceptionURP/ProjectSettings/ClusterInputManager.asset b/TestProjects/PerceptionURP/ProjectSettings/ClusterInputManager.asset new file mode 100644 index 000000000..e7886b266 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/ClusterInputManager.asset @@ -0,0 +1,6 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!236 &1 +ClusterInputManager: + m_ObjectHideFlags: 0 + m_Inputs: [] diff --git a/TestProjects/PerceptionURP/ProjectSettings/DynamicsManager.asset b/TestProjects/PerceptionURP/ProjectSettings/DynamicsManager.asset new file mode 100644 index 000000000..5d5bacb2a --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/DynamicsManager.asset @@ -0,0 +1,36 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!55 &1 +PhysicsManager: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_Gravity: {x: 0, y: -9.81, z: 0} + m_DefaultMaterial: {fileID: 0} + m_BounceThreshold: 2 + m_SleepThreshold: 0.005 + m_DefaultContactOffset: 0.01 + m_DefaultSolverIterations: 6 + m_DefaultSolverVelocityIterations: 1 + m_QueriesHitBackfaces: 0 + m_QueriesHitTriggers: 1 + m_EnableAdaptiveForce: 0 + m_ClothInterCollisionDistance: 0.1 + m_ClothInterCollisionStiffness: 0.2 + m_ContactsGeneration: 1 + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + m_AutoSimulation: 1 + m_AutoSyncTransforms: 0 + m_ReuseCollisionCallbacks: 1 + m_ClothInterCollisionSettingsToggle: 0 + m_ClothGravity: {x: 0, y: -9.81, z: 0} + m_ContactPairsMode: 0 + m_BroadphaseType: 0 + m_WorldBounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 250, y: 250, z: 250} + m_WorldSubdivisions: 8 + m_FrictionType: 0 + m_EnableEnhancedDeterminism: 0 + m_EnableUnifiedHeightmaps: 1 + m_SolverType: 0 + m_DefaultMaxAngularSpeed: 7 diff --git a/TestProjects/PerceptionURP/ProjectSettings/EditorBuildSettings.asset b/TestProjects/PerceptionURP/ProjectSettings/EditorBuildSettings.asset new file mode 100644 index 000000000..0147887ef --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/EditorBuildSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1045 &1 +EditorBuildSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Scenes: [] + m_configObjects: {} diff --git a/TestProjects/PerceptionURP/ProjectSettings/EditorSettings.asset b/TestProjects/PerceptionURP/ProjectSettings/EditorSettings.asset new file mode 100644 index 000000000..1de0d1cac --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/EditorSettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!159 &1 +EditorSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_ExternalVersionControlSupport: Visible Meta Files + m_SerializationMode: 2 + m_LineEndingsForNewScripts: 1 + m_DefaultBehaviorMode: 0 + m_PrefabRegularEnvironment: {fileID: 0} + m_PrefabUIEnvironment: {fileID: 0} + m_SpritePackerMode: 0 + m_SpritePackerPaddingPower: 1 + m_EtcTextureCompressorBehavior: 0 + m_EtcTextureFastCompressor: 2 + m_EtcTextureNormalCompressor: 2 + m_EtcTextureBestCompressor: 5 + m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp;asmref + m_ProjectGenerationRootNamespace: + m_CollabEditorSettings: + inProgressEnabled: 1 + m_EnableTextureStreamingInEditMode: 1 + m_EnableTextureStreamingInPlayMode: 1 + m_AsyncShaderCompilation: 1 + m_EnterPlayModeOptionsEnabled: 0 + m_EnterPlayModeOptions: 3 + m_ShowLightmapResolutionOverlay: 1 + m_UseLegacyProbeSampleCount: 1 + m_AssetPipelineMode: 1 + m_CacheServerMode: 0 + m_CacheServerEndpoint: + m_CacheServerNamespacePrefix: default + m_CacheServerEnableDownload: 1 + m_CacheServerEnableUpload: 1 diff --git a/TestProjects/PerceptionURP/ProjectSettings/GraphicsSettings.asset b/TestProjects/PerceptionURP/ProjectSettings/GraphicsSettings.asset new file mode 100644 index 000000000..db10dd6de --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/GraphicsSettings.asset @@ -0,0 +1,68 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!30 &1 +GraphicsSettings: + m_ObjectHideFlags: 0 + serializedVersion: 13 + m_Deferred: + m_Mode: 1 + m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} + m_DeferredReflections: + m_Mode: 1 + m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} + m_ScreenSpaceShadows: + m_Mode: 1 + m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} + m_LegacyDeferred: + m_Mode: 1 + m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} + m_DepthNormals: + m_Mode: 1 + m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} + m_MotionVectors: + m_Mode: 1 + m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} + m_LightHalo: + m_Mode: 1 + m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} + m_LensFlare: + m_Mode: 1 + m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} + m_AlwaysIncludedShaders: + - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} + - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} + m_PreloadedShaders: [] + m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, + type: 0} + m_CustomRenderPipeline: {fileID: 11400000, guid: 19ba41d7c0026c3459d37c2fe90c55a0, + type: 2} + m_TransparencySortMode: 0 + m_TransparencySortAxis: {x: 0, y: 0, z: 1} + m_DefaultRenderingPath: 1 + m_DefaultMobileRenderingPath: 1 + m_TierSettings: [] + m_LightmapStripping: 0 + m_FogStripping: 0 + m_InstancingStripping: 0 + m_LightmapKeepPlain: 1 + m_LightmapKeepDirCombined: 1 + m_LightmapKeepDynamicPlain: 1 + m_LightmapKeepDynamicDirCombined: 1 + m_LightmapKeepShadowMask: 1 + m_LightmapKeepSubtractive: 1 + m_FogKeepLinear: 1 + m_FogKeepExp: 1 + m_FogKeepExp2: 1 + m_AlbedoSwatchInfos: [] + m_LightsUseLinearIntensity: 1 + m_LightsUseColorTemperature: 0 + m_LogWhenShaderIsCompiled: 0 + m_AllowEnlightenSupportForUpgradedProject: 1 diff --git a/TestProjects/PerceptionURP/ProjectSettings/InputManager.asset b/TestProjects/PerceptionURP/ProjectSettings/InputManager.asset new file mode 100644 index 000000000..b16147e95 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/InputManager.asset @@ -0,0 +1,487 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!13 &1 +InputManager: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Axes: + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: a + altPositiveButton: d + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: s + altPositiveButton: w + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: mouse 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: mouse 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: mouse 2 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: space + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse X + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse Y + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Mouse ScrollWheel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0 + sensitivity: 0.1 + snap: 0 + invert: 0 + type: 1 + axis: 2 + joyNum: 0 + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 0 + type: 2 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 0 + dead: 0.19 + sensitivity: 1 + snap: 0 + invert: 1 + type: 2 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 0 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 1 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Fire3 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 2 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Jump + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: joystick button 3 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: enter + altNegativeButton: + altPositiveButton: space + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Cancel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: escape + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Enable Debug Button 1 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: joystick button 8 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Enable Debug Button 2 + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: backspace + altNegativeButton: + altPositiveButton: joystick button 9 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Reset + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left alt + altNegativeButton: + altPositiveButton: joystick button 1 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Next + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: page down + altNegativeButton: + altPositiveButton: joystick button 5 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Previous + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: page up + altNegativeButton: + altPositiveButton: joystick button 4 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Validate + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: return + altNegativeButton: + altPositiveButton: joystick button 0 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Persistent + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: right shift + altNegativeButton: + altPositiveButton: joystick button 2 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Multiplier + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left shift + altNegativeButton: + altPositiveButton: joystick button 3 + gravity: 0 + dead: 0 + sensitivity: 0 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Vertical + descriptiveName: + descriptiveNegativeName: + negativeButton: down + positiveButton: up + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 2 + axis: 6 + joyNum: 0 + - serializedVersion: 3 + m_Name: Debug Horizontal + descriptiveName: + descriptiveNegativeName: + negativeButton: left + positiveButton: right + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 2 + axis: 5 + joyNum: 0 diff --git a/TestProjects/PerceptionURP/ProjectSettings/NavMeshAreas.asset b/TestProjects/PerceptionURP/ProjectSettings/NavMeshAreas.asset new file mode 100644 index 000000000..3b0b7c3d1 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/NavMeshAreas.asset @@ -0,0 +1,91 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!126 &1 +NavMeshProjectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + areas: + - name: Walkable + cost: 1 + - name: Not Walkable + cost: 1 + - name: Jump + cost: 2 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + - name: + cost: 1 + m_LastAgentTypeID: -887442657 + m_Settings: + - serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.75 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_SettingNames: + - Humanoid diff --git a/TestProjects/PerceptionURP/ProjectSettings/Physics2DSettings.asset b/TestProjects/PerceptionURP/ProjectSettings/Physics2DSettings.asset new file mode 100644 index 000000000..47880b1c8 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/Physics2DSettings.asset @@ -0,0 +1,56 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!19 &1 +Physics2DSettings: + m_ObjectHideFlags: 0 + serializedVersion: 4 + m_Gravity: {x: 0, y: -9.81} + m_DefaultMaterial: {fileID: 0} + m_VelocityIterations: 8 + m_PositionIterations: 3 + m_VelocityThreshold: 1 + m_MaxLinearCorrection: 0.2 + m_MaxAngularCorrection: 8 + m_MaxTranslationSpeed: 100 + m_MaxRotationSpeed: 360 + m_BaumgarteScale: 0.2 + m_BaumgarteTimeOfImpactScale: 0.75 + m_TimeToSleep: 0.5 + m_LinearSleepTolerance: 0.01 + m_AngularSleepTolerance: 2 + m_DefaultContactOffset: 0.01 + m_JobOptions: + serializedVersion: 2 + useMultithreading: 0 + useConsistencySorting: 0 + m_InterpolationPosesPerJob: 100 + m_NewContactsPerJob: 30 + m_CollideContactsPerJob: 100 + m_ClearFlagsPerJob: 200 + m_ClearBodyForcesPerJob: 200 + m_SyncDiscreteFixturesPerJob: 50 + m_SyncContinuousFixturesPerJob: 50 + m_FindNearestContactsPerJob: 100 + m_UpdateTriggerContactsPerJob: 100 + m_IslandSolverCostThreshold: 100 + m_IslandSolverBodyCostScale: 1 + m_IslandSolverContactCostScale: 10 + m_IslandSolverJointCostScale: 10 + m_IslandSolverBodiesPerJob: 50 + m_IslandSolverContactsPerJob: 50 + m_AutoSimulation: 1 + m_QueriesHitTriggers: 1 + m_QueriesStartInColliders: 1 + m_CallbacksOnDisable: 1 + m_ReuseCollisionCallbacks: 1 + m_AutoSyncTransforms: 0 + m_AlwaysShowColliders: 0 + m_ShowColliderSleep: 1 + m_ShowColliderContacts: 0 + m_ShowColliderAABB: 0 + m_ContactArrowScale: 0.2 + m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} + m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} + m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} + m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} + m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/TestProjects/PerceptionURP/ProjectSettings/PresetManager.asset b/TestProjects/PerceptionURP/ProjectSettings/PresetManager.asset new file mode 100644 index 000000000..10a1b0738 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/PresetManager.asset @@ -0,0 +1,27 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1386491679 &1 +PresetManager: + m_ObjectHideFlags: 0 + m_DefaultList: + - type: + m_NativeTypeID: 108 + m_ManagedTypePPtr: {fileID: 0} + m_ManagedTypeFallback: + defaultPresets: + - m_Preset: {fileID: 2655988077585873504, guid: 463065d4f17d1d94d848aa127b94dd43, + type: 2} + - type: + m_NativeTypeID: 1020 + m_ManagedTypePPtr: {fileID: 0} + m_ManagedTypeFallback: + defaultPresets: + - m_Preset: {fileID: 2655988077585873504, guid: e7689051185d12f4298e1ebb2693a29f, + type: 2} + - type: + m_NativeTypeID: 1006 + m_ManagedTypePPtr: {fileID: 0} + m_ManagedTypeFallback: + defaultPresets: + - m_Preset: {fileID: 2655988077585873504, guid: e8537455c6c08bd4e8bf0be3707da685, + type: 2} diff --git a/TestProjects/PerceptionURP/ProjectSettings/ProjectSettings.asset b/TestProjects/PerceptionURP/ProjectSettings/ProjectSettings.asset new file mode 100644 index 000000000..e0e91268a --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/ProjectSettings.asset @@ -0,0 +1,671 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!129 &1 +PlayerSettings: + m_ObjectHideFlags: 0 + serializedVersion: 20 + productGUID: c71ca984bf3bb534fa9035b7369b68b5 + AndroidProfiler: 0 + AndroidFilterTouchesWhenObscured: 0 + AndroidEnableSustainedPerformanceMode: 0 + defaultScreenOrientation: 4 + targetDevice: 2 + useOnDemandResources: 0 + accelerometerFrequency: 60 + companyName: DefaultCompany + productName: PerceptionURP + defaultCursor: {fileID: 0} + cursorHotspot: {x: 0, y: 0} + m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} + m_ShowUnitySplashScreen: 1 + m_ShowUnitySplashLogo: 1 + m_SplashScreenOverlayOpacity: 1 + m_SplashScreenAnimation: 1 + m_SplashScreenLogoStyle: 1 + m_SplashScreenDrawMode: 0 + m_SplashScreenBackgroundAnimationZoom: 1 + m_SplashScreenLogoAnimationZoom: 1 + m_SplashScreenBackgroundLandscapeAspect: 1 + m_SplashScreenBackgroundPortraitAspect: 1 + m_SplashScreenBackgroundLandscapeUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenBackgroundPortraitUvs: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + m_SplashScreenLogos: [] + m_VirtualRealitySplashScreen: {fileID: 0} + m_HolographicTrackingLossScreen: {fileID: 0} + defaultScreenWidth: 1024 + defaultScreenHeight: 768 + defaultScreenWidthWeb: 960 + defaultScreenHeightWeb: 600 + m_StereoRenderingPath: 0 + m_ActiveColorSpace: 1 + m_MTRendering: 1 + m_StackTraceTypes: 010000000100000001000000010000000100000001000000 + iosShowActivityIndicatorOnLoading: -1 + androidShowActivityIndicatorOnLoading: -1 + iosUseCustomAppBackgroundBehavior: 0 + iosAllowHTTPDownload: 1 + allowedAutorotateToPortrait: 1 + allowedAutorotateToPortraitUpsideDown: 1 + allowedAutorotateToLandscapeRight: 1 + allowedAutorotateToLandscapeLeft: 1 + useOSAutorotation: 1 + use32BitDisplayBuffer: 1 + preserveFramebufferAlpha: 0 + disableDepthAndStencilBuffers: 0 + androidStartInFullscreen: 1 + androidRenderOutsideSafeArea: 0 + androidUseSwappy: 0 + androidBlitType: 1 + defaultIsNativeResolution: 1 + macRetinaSupport: 1 + runInBackground: 1 + captureSingleScreen: 0 + muteOtherAudioSources: 0 + Prepare IOS For Recording: 0 + Force IOS Speakers When Recording: 0 + deferSystemGesturesMode: 0 + hideHomeButton: 0 + submitAnalytics: 1 + usePlayerLog: 1 + bakeCollisionMeshes: 0 + forceSingleInstance: 0 + useFlipModelSwapchain: 1 + resizableWindow: 0 + useMacAppStoreValidation: 0 + macAppStoreCategory: public.app-category.games + gpuSkinning: 1 + xboxPIXTextureCapture: 0 + xboxEnableAvatar: 0 + xboxEnableKinect: 0 + xboxEnableKinectAutoTracking: 0 + xboxEnableFitness: 0 + visibleInBackground: 1 + allowFullscreenSwitch: 1 + fullscreenMode: 1 + xboxSpeechDB: 0 + xboxEnableHeadOrientation: 0 + xboxEnableGuest: 0 + xboxEnablePIXSampling: 0 + metalFramebufferOnly: 0 + xboxOneResolution: 0 + xboxOneSResolution: 0 + xboxOneXResolution: 3 + xboxOneMonoLoggingLevel: 0 + xboxOneLoggingLevel: 1 + xboxOneDisableEsram: 0 + xboxOneEnableTypeOptimization: 0 + xboxOnePresentImmediateThreshold: 0 + switchQueueCommandMemory: 0 + switchQueueControlMemory: 0 + switchQueueComputeMemory: 262144 + switchNVNShaderPoolsGranularity: 33554432 + switchNVNDefaultPoolsGranularity: 16777216 + switchNVNOtherPoolsGranularity: 16777216 + vulkanNumSwapchainBuffers: 3 + vulkanEnableSetSRGBWrite: 0 + m_SupportedAspectRatios: + 4:3: 1 + 5:4: 1 + 16:10: 1 + 16:9: 1 + Others: 1 + bundleVersion: 0.1 + preloadedAssets: [] + metroInputSource: 0 + wsaTransparentSwapchain: 0 + m_HolographicPauseOnTrackingLoss: 1 + xboxOneDisableKinectGpuReservation: 1 + xboxOneEnable7thCore: 1 + vrSettings: + cardboard: + depthFormat: 0 + enableTransitionView: 0 + daydream: + depthFormat: 0 + useSustainedPerformanceMode: 0 + enableVideoLayer: 0 + useProtectedVideoMemory: 0 + minimumSupportedHeadTracking: 0 + maximumSupportedHeadTracking: 1 + hololens: + depthFormat: 1 + depthBufferSharingEnabled: 1 + lumin: + depthFormat: 0 + frameTiming: 2 + enableGLCache: 0 + glCacheMaxBlobSize: 524288 + glCacheMaxFileSize: 8388608 + oculus: + sharedDepthBuffer: 1 + dashSupport: 1 + lowOverheadMode: 0 + protectedContext: 0 + v2Signing: 1 + enable360StereoCapture: 0 + isWsaHolographicRemotingEnabled: 0 + enableFrameTimingStats: 0 + useHDRDisplay: 0 + D3DHDRBitDepth: 0 + m_ColorGamuts: 0000000003000000 + targetPixelDensity: 30 + resolutionScalingMode: 0 + androidSupportedAspectRatio: 1 + androidMaxAspectRatio: 2.1 + applicationIdentifier: {} + buildNumber: {} + AndroidBundleVersionCode: 1 + AndroidMinSdkVersion: 19 + AndroidTargetSdkVersion: 0 + AndroidPreferredInstallLocation: 1 + aotOptions: + stripEngineCode: 1 + iPhoneStrippingLevel: 0 + iPhoneScriptCallOptimization: 0 + ForceInternetPermission: 0 + ForceSDCardPermission: 0 + CreateWallpaper: 0 + APKExpansionFiles: 0 + keepLoadedShadersAlive: 0 + StripUnusedMeshComponents: 0 + VertexChannelCompressionMask: 4054 + iPhoneSdkVersion: 988 + iOSTargetOSVersionString: 10.0 + tvOSSdkVersion: 0 + tvOSRequireExtendedGameController: 0 + tvOSTargetOSVersionString: 10.0 + uIPrerenderedIcon: 0 + uIRequiresPersistentWiFi: 0 + uIRequiresFullScreen: 1 + uIStatusBarHidden: 1 + uIExitOnSuspend: 0 + uIStatusBarStyle: 0 + iPhoneSplashScreen: {fileID: 0} + iPhoneHighResSplashScreen: {fileID: 0} + iPhoneTallHighResSplashScreen: {fileID: 0} + iPhone47inSplashScreen: {fileID: 0} + iPhone55inPortraitSplashScreen: {fileID: 0} + iPhone55inLandscapeSplashScreen: {fileID: 0} + iPhone58inPortraitSplashScreen: {fileID: 0} + iPhone58inLandscapeSplashScreen: {fileID: 0} + iPadPortraitSplashScreen: {fileID: 0} + iPadHighResPortraitSplashScreen: {fileID: 0} + iPadLandscapeSplashScreen: {fileID: 0} + iPadHighResLandscapeSplashScreen: {fileID: 0} + iPhone65inPortraitSplashScreen: {fileID: 0} + iPhone65inLandscapeSplashScreen: {fileID: 0} + iPhone61inPortraitSplashScreen: {fileID: 0} + iPhone61inLandscapeSplashScreen: {fileID: 0} + appleTVSplashScreen: {fileID: 0} + appleTVSplashScreen2x: {fileID: 0} + tvOSSmallIconLayers: [] + tvOSSmallIconLayers2x: [] + tvOSLargeIconLayers: [] + tvOSLargeIconLayers2x: [] + tvOSTopShelfImageLayers: [] + tvOSTopShelfImageLayers2x: [] + tvOSTopShelfImageWideLayers: [] + tvOSTopShelfImageWideLayers2x: [] + iOSLaunchScreenType: 0 + iOSLaunchScreenPortrait: {fileID: 0} + iOSLaunchScreenLandscape: {fileID: 0} + iOSLaunchScreenBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreenFillPct: 100 + iOSLaunchScreenSize: 100 + iOSLaunchScreenCustomXibPath: + iOSLaunchScreeniPadType: 0 + iOSLaunchScreeniPadImage: {fileID: 0} + iOSLaunchScreeniPadBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreeniPadFillPct: 100 + iOSLaunchScreeniPadSize: 100 + iOSLaunchScreeniPadCustomXibPath: + iOSUseLaunchScreenStoryboard: 0 + iOSLaunchScreenCustomStoryboardPath: + iOSDeviceRequirements: [] + iOSURLSchemes: [] + iOSBackgroundModes: 0 + iOSMetalForceHardShadows: 0 + metalEditorSupport: 1 + metalAPIValidation: 1 + iOSRenderExtraFrameOnPause: 0 + appleDeveloperTeamID: + iOSManualSigningProvisioningProfileID: + tvOSManualSigningProvisioningProfileID: + iOSManualSigningProvisioningProfileType: 0 + tvOSManualSigningProvisioningProfileType: 0 + appleEnableAutomaticSigning: 0 + iOSRequireARKit: 0 + iOSAutomaticallyDetectAndAddCapabilities: 1 + appleEnableProMotion: 0 + clonedFromGUID: 9870af204204ab84596f8a656f2f2ce6 + templatePackageId: com.unity.template.universal@7.1.7 + templateDefaultScene: Assets/Scenes/SampleScene.unity + AndroidTargetArchitectures: 1 + AndroidSplashScreenScale: 0 + androidSplashScreen: {fileID: 0} + AndroidKeystoreName: + AndroidKeyaliasName: + AndroidBuildApkPerCpuArchitecture: 0 + AndroidTVCompatibility: 0 + AndroidIsGame: 1 + AndroidEnableTango: 0 + androidEnableBanner: 1 + androidUseLowAccuracyLocation: 0 + androidUseCustomKeystore: 0 + m_AndroidBanners: + - width: 320 + height: 180 + banner: {fileID: 0} + androidGamepadSupportLevel: 0 + AndroidValidateAppBundleSize: 1 + AndroidAppBundleSizeToValidate: 100 + m_BuildTargetIcons: [] + m_BuildTargetPlatformIcons: [] + m_BuildTargetBatching: + - m_BuildTarget: Standalone + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: tvOS + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: iPhone + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: Android + m_StaticBatching: 1 + m_DynamicBatching: 0 + - m_BuildTarget: WebGL + m_StaticBatching: 0 + m_DynamicBatching: 0 + m_BuildTargetGraphicsJobs: + - m_BuildTarget: MacStandaloneSupport + m_GraphicsJobs: 0 + - m_BuildTarget: Switch + m_GraphicsJobs: 1 + - m_BuildTarget: MetroSupport + m_GraphicsJobs: 1 + - m_BuildTarget: AppleTVSupport + m_GraphicsJobs: 0 + - m_BuildTarget: BJMSupport + m_GraphicsJobs: 1 + - m_BuildTarget: LinuxStandaloneSupport + m_GraphicsJobs: 1 + - m_BuildTarget: PS4Player + m_GraphicsJobs: 1 + - m_BuildTarget: iOSSupport + m_GraphicsJobs: 0 + - m_BuildTarget: WindowsStandaloneSupport + m_GraphicsJobs: 1 + - m_BuildTarget: XboxOnePlayer + m_GraphicsJobs: 1 + - m_BuildTarget: LuminSupport + m_GraphicsJobs: 0 + - m_BuildTarget: AndroidPlayer + m_GraphicsJobs: 0 + - m_BuildTarget: WebGLSupport + m_GraphicsJobs: 0 + m_BuildTargetGraphicsJobMode: + - m_BuildTarget: PS4Player + m_GraphicsJobMode: 0 + - m_BuildTarget: XboxOnePlayer + m_GraphicsJobMode: 0 + m_BuildTargetGraphicsAPIs: + - m_BuildTarget: iOSSupport + m_APIs: 10000000 + m_Automatic: 0 + - m_BuildTarget: AppleTVSupport + m_APIs: 10000000 + m_Automatic: 0 + - m_BuildTarget: AndroidPlayer + m_APIs: 150000000b000000 + m_Automatic: 0 + - m_BuildTarget: WebGLSupport + m_APIs: 0b000000 + m_Automatic: 0 + m_BuildTargetVRSettings: [] + openGLRequireES31: 0 + openGLRequireES31AEP: 0 + openGLRequireES32: 0 + m_TemplateCustomTags: {} + mobileMTRendering: + Android: 1 + iPhone: 1 + tvOS: 1 + m_BuildTargetGroupLightmapEncodingQuality: + - m_BuildTarget: Standalone + m_EncodingQuality: 1 + m_BuildTargetGroupLightmapSettings: [] + playModeTestRunnerEnabled: 0 + runPlayModeTestAsEditModeTest: 0 + actionOnDotNetUnhandledException: 1 + enableInternalProfiler: 0 + logObjCUncaughtExceptions: 1 + enableCrashReportAPI: 0 + cameraUsageDescription: + locationUsageDescription: + microphoneUsageDescription: + switchNetLibKey: + switchSocketMemoryPoolSize: 6144 + switchSocketAllocatorPoolSize: 128 + switchSocketConcurrencyLimit: 14 + switchScreenResolutionBehavior: 2 + switchUseCPUProfiler: 0 + switchApplicationID: 0x01004b9000490000 + switchNSODependencies: + switchTitleNames_0: + switchTitleNames_1: + switchTitleNames_2: + switchTitleNames_3: + switchTitleNames_4: + switchTitleNames_5: + switchTitleNames_6: + switchTitleNames_7: + switchTitleNames_8: + switchTitleNames_9: + switchTitleNames_10: + switchTitleNames_11: + switchTitleNames_12: + switchTitleNames_13: + switchTitleNames_14: + switchPublisherNames_0: + switchPublisherNames_1: + switchPublisherNames_2: + switchPublisherNames_3: + switchPublisherNames_4: + switchPublisherNames_5: + switchPublisherNames_6: + switchPublisherNames_7: + switchPublisherNames_8: + switchPublisherNames_9: + switchPublisherNames_10: + switchPublisherNames_11: + switchPublisherNames_12: + switchPublisherNames_13: + switchPublisherNames_14: + switchIcons_0: {fileID: 0} + switchIcons_1: {fileID: 0} + switchIcons_2: {fileID: 0} + switchIcons_3: {fileID: 0} + switchIcons_4: {fileID: 0} + switchIcons_5: {fileID: 0} + switchIcons_6: {fileID: 0} + switchIcons_7: {fileID: 0} + switchIcons_8: {fileID: 0} + switchIcons_9: {fileID: 0} + switchIcons_10: {fileID: 0} + switchIcons_11: {fileID: 0} + switchIcons_12: {fileID: 0} + switchIcons_13: {fileID: 0} + switchIcons_14: {fileID: 0} + switchSmallIcons_0: {fileID: 0} + switchSmallIcons_1: {fileID: 0} + switchSmallIcons_2: {fileID: 0} + switchSmallIcons_3: {fileID: 0} + switchSmallIcons_4: {fileID: 0} + switchSmallIcons_5: {fileID: 0} + switchSmallIcons_6: {fileID: 0} + switchSmallIcons_7: {fileID: 0} + switchSmallIcons_8: {fileID: 0} + switchSmallIcons_9: {fileID: 0} + switchSmallIcons_10: {fileID: 0} + switchSmallIcons_11: {fileID: 0} + switchSmallIcons_12: {fileID: 0} + switchSmallIcons_13: {fileID: 0} + switchSmallIcons_14: {fileID: 0} + switchManualHTML: + switchAccessibleURLs: + switchLegalInformation: + switchMainThreadStackSize: 1048576 + switchPresenceGroupId: + switchLogoHandling: 0 + switchReleaseVersion: 0 + switchDisplayVersion: 1.0.0 + switchStartupUserAccount: 0 + switchTouchScreenUsage: 0 + switchSupportedLanguagesMask: 0 + switchLogoType: 0 + switchApplicationErrorCodeCategory: + switchUserAccountSaveDataSize: 0 + switchUserAccountSaveDataJournalSize: 0 + switchApplicationAttribute: 0 + switchCardSpecSize: -1 + switchCardSpecClock: -1 + switchRatingsMask: 0 + switchRatingsInt_0: 0 + switchRatingsInt_1: 0 + switchRatingsInt_2: 0 + switchRatingsInt_3: 0 + switchRatingsInt_4: 0 + switchRatingsInt_5: 0 + switchRatingsInt_6: 0 + switchRatingsInt_7: 0 + switchRatingsInt_8: 0 + switchRatingsInt_9: 0 + switchRatingsInt_10: 0 + switchRatingsInt_11: 0 + switchRatingsInt_12: 0 + switchLocalCommunicationIds_0: + switchLocalCommunicationIds_1: + switchLocalCommunicationIds_2: + switchLocalCommunicationIds_3: + switchLocalCommunicationIds_4: + switchLocalCommunicationIds_5: + switchLocalCommunicationIds_6: + switchLocalCommunicationIds_7: + switchParentalControl: 0 + switchAllowsScreenshot: 1 + switchAllowsVideoCapturing: 1 + switchAllowsRuntimeAddOnContentInstall: 0 + switchDataLossConfirmation: 0 + switchUserAccountLockEnabled: 0 + switchSystemResourceMemory: 16777216 + switchSupportedNpadStyles: 22 + switchNativeFsCacheSize: 32 + switchIsHoldTypeHorizontal: 0 + switchSupportedNpadCount: 8 + switchSocketConfigEnabled: 0 + switchTcpInitialSendBufferSize: 32 + switchTcpInitialReceiveBufferSize: 64 + switchTcpAutoSendBufferSizeMax: 256 + switchTcpAutoReceiveBufferSizeMax: 256 + switchUdpSendBufferSize: 9 + switchUdpReceiveBufferSize: 42 + switchSocketBufferEfficiency: 4 + switchSocketInitializeEnabled: 1 + switchNetworkInterfaceManagerInitializeEnabled: 1 + switchPlayerConnectionEnabled: 1 + ps4NPAgeRating: 12 + ps4NPTitleSecret: + ps4NPTrophyPackPath: + ps4ParentalLevel: 11 + ps4ContentID: ED1633-NPXX51362_00-0000000000000000 + ps4Category: 0 + ps4MasterVersion: 01.00 + ps4AppVersion: 01.00 + ps4AppType: 0 + ps4ParamSfxPath: + ps4VideoOutPixelFormat: 0 + ps4VideoOutInitialWidth: 1920 + ps4VideoOutBaseModeInitialWidth: 1920 + ps4VideoOutReprojectionRate: 60 + ps4PronunciationXMLPath: + ps4PronunciationSIGPath: + ps4BackgroundImagePath: + ps4StartupImagePath: + ps4StartupImagesFolder: + ps4IconImagesFolder: + ps4SaveDataImagePath: + ps4SdkOverride: + ps4BGMPath: + ps4ShareFilePath: + ps4ShareOverlayImagePath: + ps4PrivacyGuardImagePath: + ps4NPtitleDatPath: + ps4RemotePlayKeyAssignment: -1 + ps4RemotePlayKeyMappingDir: + ps4PlayTogetherPlayerCount: 0 + ps4EnterButtonAssignment: 1 + ps4ApplicationParam1: 0 + ps4ApplicationParam2: 0 + ps4ApplicationParam3: 0 + ps4ApplicationParam4: 0 + ps4DownloadDataSize: 0 + ps4GarlicHeapSize: 2048 + ps4ProGarlicHeapSize: 2560 + playerPrefsMaxSize: 32768 + ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ + ps4pnSessions: 1 + ps4pnPresence: 1 + ps4pnFriends: 1 + ps4pnGameCustomData: 1 + playerPrefsSupport: 0 + enableApplicationExit: 0 + resetTempFolder: 1 + restrictedAudioUsageRights: 0 + ps4UseResolutionFallback: 0 + ps4ReprojectionSupport: 0 + ps4UseAudio3dBackend: 0 + ps4SocialScreenEnabled: 0 + ps4ScriptOptimizationLevel: 0 + ps4Audio3dVirtualSpeakerCount: 14 + ps4attribCpuUsage: 0 + ps4PatchPkgPath: + ps4PatchLatestPkgPath: + ps4PatchChangeinfoPath: + ps4PatchDayOne: 0 + ps4attribUserManagement: 0 + ps4attribMoveSupport: 0 + ps4attrib3DSupport: 0 + ps4attribShareSupport: 0 + ps4attribExclusiveVR: 0 + ps4disableAutoHideSplash: 0 + ps4videoRecordingFeaturesUsed: 0 + ps4contentSearchFeaturesUsed: 0 + ps4attribEyeToEyeDistanceSettingVR: 0 + ps4IncludedModules: [] + ps4attribVROutputEnabled: 0 + monoEnv: + splashScreenBackgroundSourceLandscape: {fileID: 0} + splashScreenBackgroundSourcePortrait: {fileID: 0} + blurSplashScreenBackground: 1 + spritePackerPolicy: + webGLMemorySize: 16 + webGLExceptionSupport: 1 + webGLNameFilesAsHashes: 0 + webGLDataCaching: 1 + webGLDebugSymbols: 0 + webGLEmscriptenArgs: + webGLModulesDirectory: + webGLTemplate: APPLICATION:Default + webGLAnalyzeBuildSize: 0 + webGLUseEmbeddedResources: 0 + webGLCompressionFormat: 1 + webGLLinkerTarget: 1 + webGLThreadsSupport: 0 + webGLWasmStreaming: 0 + scriptingDefineSymbols: {} + platformArchitecture: {} + scriptingBackend: {} + il2cppCompilerConfiguration: {} + managedStrippingLevel: {} + incrementalIl2cppBuild: {} + allowUnsafeCode: 0 + additionalIl2CppArgs: + scriptingRuntimeVersion: 1 + gcIncremental: 0 + gcWBarrierValidation: 0 + apiCompatibilityLevelPerPlatform: {} + m_RenderingPath: 1 + m_MobileRenderingPath: 1 + metroPackageName: Template_Lightweight + metroPackageVersion: + metroCertificatePath: + metroCertificatePassword: + metroCertificateSubject: + metroCertificateIssuer: + metroCertificateNotAfter: 0000000000000000 + metroApplicationDescription: Template_Lightweight + wsaImages: {} + metroTileShortName: + metroTileShowName: 0 + metroMediumTileShowName: 0 + metroLargeTileShowName: 0 + metroWideTileShowName: 0 + metroSupportStreamingInstall: 0 + metroLastRequiredScene: 0 + metroDefaultTileSize: 1 + metroTileForegroundText: 2 + metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} + metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, + a: 1} + metroSplashScreenUseBackgroundColor: 0 + platformCapabilities: {} + metroTargetDeviceFamilies: {} + metroFTAName: + metroFTAFileTypes: [] + metroProtocolName: + XboxOneProductId: + XboxOneUpdateKey: + XboxOneSandboxId: + XboxOneContentId: + XboxOneTitleId: + XboxOneSCId: + XboxOneGameOsOverridePath: + XboxOnePackagingOverridePath: + XboxOneAppManifestOverridePath: + XboxOneVersion: 1.0.0.0 + XboxOnePackageEncryption: 0 + XboxOnePackageUpdateGranularity: 2 + XboxOneDescription: + XboxOneLanguage: + - enus + XboxOneCapability: [] + XboxOneGameRating: {} + XboxOneIsContentPackage: 0 + XboxOneEnableGPUVariability: 1 + XboxOneSockets: {} + XboxOneSplashScreen: {fileID: 0} + XboxOneAllowedProductIds: [] + XboxOnePersistentLocalStorageSize: 0 + XboxOneXTitleMemory: 8 + XboxOneOverrideIdentityName: + vrEditorSettings: + daydream: + daydreamIconForeground: {fileID: 0} + daydreamIconBackground: {fileID: 0} + cloudServicesEnabled: + UNet: 1 + luminIcon: + m_Name: + m_ModelFolderPath: + m_PortalFolderPath: + luminCert: + m_CertPath: + m_SignPackage: 1 + luminIsChannelApp: 0 + luminVersion: + m_VersionCode: 1 + m_VersionName: + apiCompatibilityLevel: 6 + cloudProjectId: + framebufferDepthMemorylessMode: 0 + projectName: + organizationId: + cloudEnabled: 0 + enableNativePlatformBackendsForNewInputSystem: 0 + disableOldInputManagerSupport: 0 + legacyClampBlendShapeWeights: 0 diff --git a/TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt b/TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt new file mode 100644 index 000000000..e76bfbec8 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/ProjectVersion.txt @@ -0,0 +1,2 @@ +m_EditorVersion: 2019.3.6f1 +m_EditorVersionWithRevision: 2019.3.6f1 (5c3fb0a11183) diff --git a/TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset b/TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset new file mode 100644 index 000000000..a45c679e5 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset @@ -0,0 +1,131 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!47 &1 +QualitySettings: + m_ObjectHideFlags: 0 + serializedVersion: 5 + m_CurrentQuality: 2 + m_QualitySettings: + - serializedVersion: 2 + name: Low + pixelLightCount: 0 + shadows: 0 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 0 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 0 + lodBias: 0.4 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 16 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 11400000, guid: a31e9f9f9c9d4b9429ed0d1234e22103, + type: 2} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: Medium + pixelLightCount: 1 + shadows: 1 + shadowResolution: 0 + shadowProjection: 1 + shadowCascades: 1 + shadowDistance: 20 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 0 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 0 + softParticles: 0 + softVegetation: 0 + realtimeReflectionProbes: 0 + billboardsFaceCameraPosition: 0 + vSyncCount: 1 + lodBias: 0.7 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 64 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 11400000, guid: d847b876476d3d6468f5dfcd34266f96, + type: 2} + excludedTargetPlatforms: [] + - serializedVersion: 2 + name: High + pixelLightCount: 2 + shadows: 2 + shadowResolution: 1 + shadowProjection: 1 + shadowCascades: 2 + shadowDistance: 40 + shadowNearPlaneOffset: 3 + shadowCascade2Split: 0.33333334 + shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} + shadowmaskMode: 1 + skinWeights: 2 + textureQuality: 0 + anisotropicTextures: 1 + antiAliasing: 2 + softParticles: 0 + softVegetation: 1 + realtimeReflectionProbes: 1 + billboardsFaceCameraPosition: 1 + vSyncCount: 1 + lodBias: 1 + maximumLODLevel: 0 + streamingMipmapsActive: 0 + streamingMipmapsAddAllCameras: 1 + streamingMipmapsMemoryBudget: 512 + streamingMipmapsRenderersPerFrame: 512 + streamingMipmapsMaxLevelReduction: 2 + streamingMipmapsMaxFileIORequests: 1024 + particleRaycastBudget: 256 + asyncUploadTimeSlice: 2 + asyncUploadBufferSize: 16 + asyncUploadPersistentBuffer: 1 + resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 11400000, guid: 19ba41d7c0026c3459d37c2fe90c55a0, + type: 2} + excludedTargetPlatforms: [] + m_PerPlatformDefaultQuality: + Android: 1 + Lumin: 2 + Nintendo Switch: 2 + PS4: 2 + Stadia: 2 + Standalone: 2 + WebGL: 1 + Windows Store Apps: 2 + XboxOne: 2 + iPhone: 1 + tvOS: 1 diff --git a/TestProjects/PerceptionURP/ProjectSettings/TagManager.asset b/TestProjects/PerceptionURP/ProjectSettings/TagManager.asset new file mode 100644 index 000000000..1c92a7840 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/TagManager.asset @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!78 &1 +TagManager: + serializedVersion: 2 + tags: [] + layers: + - Default + - TransparentFX + - Ignore Raycast + - + - Water + - UI + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + m_SortingLayers: + - name: Default + uniqueID: 0 + locked: 0 diff --git a/TestProjects/PerceptionURP/ProjectSettings/TimeManager.asset b/TestProjects/PerceptionURP/ProjectSettings/TimeManager.asset new file mode 100644 index 000000000..06bcc6d29 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/TimeManager.asset @@ -0,0 +1,9 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!5 &1 +TimeManager: + m_ObjectHideFlags: 0 + Fixed Timestep: 0.02 + Maximum Allowed Timestep: 0.1 + m_TimeScale: 1 + Maximum Particle Timestep: 0.03 diff --git a/TestProjects/PerceptionURP/ProjectSettings/UnityConnectSettings.asset b/TestProjects/PerceptionURP/ProjectSettings/UnityConnectSettings.asset new file mode 100644 index 000000000..fa0b14657 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/UnityConnectSettings.asset @@ -0,0 +1,34 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!310 &1 +UnityConnectSettings: + m_ObjectHideFlags: 0 + serializedVersion: 1 + m_Enabled: 0 + m_TestMode: 0 + m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events + m_EventUrl: https://cdp.cloud.unity3d.com/v1/events + m_ConfigUrl: https://config.uca.cloud.unity3d.com + m_TestInitMode: 0 + CrashReportingSettings: + m_EventUrl: https://perf-events.cloud.unity3d.com + m_Enabled: 0 + m_LogBufferSize: 10 + m_CaptureEditorExceptions: 1 + UnityPurchasingSettings: + m_Enabled: 0 + m_TestMode: 0 + UnityAnalyticsSettings: + m_Enabled: 0 + m_TestMode: 0 + m_InitializeOnStartup: 1 + UnityAdsSettings: + m_Enabled: 0 + m_InitializeOnStartup: 1 + m_TestMode: 0 + m_IosGameId: + m_AndroidGameId: + m_GameIds: {} + m_GameId: + PerformanceReportingSettings: + m_Enabled: 0 diff --git a/TestProjects/PerceptionURP/ProjectSettings/VFXManager.asset b/TestProjects/PerceptionURP/ProjectSettings/VFXManager.asset new file mode 100644 index 000000000..6e0eaca40 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/VFXManager.asset @@ -0,0 +1,11 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!937362698 &1 +VFXManager: + m_ObjectHideFlags: 0 + m_IndirectShader: {fileID: 0} + m_CopyBufferShader: {fileID: 0} + m_SortShader: {fileID: 0} + m_RenderPipeSettingsPath: + m_FixedTimeStep: 0.016666668 + m_MaxDeltaTime: 0.05 diff --git a/TestProjects/PerceptionURP/ProjectSettings/XRSettings.asset b/TestProjects/PerceptionURP/ProjectSettings/XRSettings.asset new file mode 100644 index 000000000..482590c19 --- /dev/null +++ b/TestProjects/PerceptionURP/ProjectSettings/XRSettings.asset @@ -0,0 +1,10 @@ +{ + "m_SettingKeys": [ + "VR Device Disabled", + "VR Device User Alert" + ], + "m_SettingValues": [ + "False", + "False" + ] +} \ No newline at end of file diff --git a/TestProjects/PerceptionURP/TestRunnerOptions.json b/TestProjects/PerceptionURP/TestRunnerOptions.json new file mode 100644 index 000000000..cfc872fc1 --- /dev/null +++ b/TestProjects/PerceptionURP/TestRunnerOptions.json @@ -0,0 +1,3 @@ +{ + "disableBatchMode": true +} \ No newline at end of file diff --git a/com.unity.perception/.editorconfig b/com.unity.perception/.editorconfig new file mode 100644 index 000000000..e9c465506 --- /dev/null +++ b/com.unity.perception/.editorconfig @@ -0,0 +1,75 @@ +; see http://editorconfig.org/ for docs on this file +; Copied from https://github.cds.internal.unity3d.com/unity/com.unity.coding/tree/master/UnityCoding/Packages/com.unity.coding/Coding~/Configs/EditorConfig/.editorconfig + +root = true + +[*] +ignore_if_in_header = This code was generated by a tool| +indent_style = space +indent_size = 4 +; uncomment to help with sharing files across os's (i.e. network share or through local vm) +#end_of_line = lf +; avoid a bom, which causes endless problems with naive text tooling +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +; keeping auto-format enabled helps avoid merge hell for projects without CI-based format validation +#disable_auto_format = true + +[*.cs] +; uncomment to enable full formatting of c# files +formatters = generic, uncrustify + +[*.asmdef] +scrape_api = true + +[**/Tests/**.asmdef] +scrape_api = false + +[*.Tests.asmdef] +scrape_api = false + +[*.md] +indent_size = 2 +; trailing whitespace is unfortunately significant in markdown +trim_trailing_whitespace = false +; uncomment to enable basic formatting of markdown files +#formatters = generic + +[{Makefile,makefile}] +; tab characters are part of the Makefile format +indent_style = tab + +[*.asmdef] +indent_size = 4 + +[*.json] +indent_size = 2 + +[*.{vcproj,bat,cmd,xaml,tt,t4,ttinclude}] +end_of_line = crlf + +; this VS-specific stuff is based on experiments to see how VS will modify a file after it has been manually edited. +; the settings are meant to closely match what VS does to minimize unnecessary diffs. +[*.{vcxproj,vcxproj.filters}] +indent_style = space +indent_size = 2 +end_of_line = crlf +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = false +; must be broken out because of 51-char bug (https://github.com/editorconfig/editorconfig-visualstudio/issues/21) +[*.{csproj,pyproj,props,targets}] +indent_style = space +indent_size = 2 +end_of_line = crlf +charset = utf-8-bom +trim_trailing_whitespace = true +insert_final_newline = false +[*.{sln,sln.template}] +indent_style = tab +indent_size = 4 +end_of_line = crlf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false diff --git a/com.unity.perception/.npmignore b/com.unity.perception/.npmignore new file mode 100644 index 000000000..fb8a059b4 --- /dev/null +++ b/com.unity.perception/.npmignore @@ -0,0 +1,26 @@ +upm-ci~/** +.Editor/** +.yamato/** +*.zip* +TestRunnerOptions.json +.idea/** +!*core +artifacts/** +build/** +.build_script/** +node_modules/** +Documentation/ApiDocs/** +Documentation~/ApiDocs/** +.DS_Store +.npmrc +.npmignore +.gitignore +CONTRIBUTING.md +CONTRIBUTING.md.meta +QAReport.md +QAReport.md.meta +.gitlab-ci.yml +build.sh +build.sh.meta +build.bat +build.bat.meta \ No newline at end of file diff --git a/com.unity.perception/CHANGELOG.md b/com.unity.perception/CHANGELOG.md new file mode 100644 index 000000000..f0afd0f89 --- /dev/null +++ b/com.unity.perception/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog +All notable changes to this package will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). + +## [Unreleased] +### Added + +### Changed + +### Deprecated + +### Removed + +### Fixed + +### Security + diff --git a/com.unity.perception/CHANGELOG.md.meta b/com.unity.perception/CHANGELOG.md.meta new file mode 100644 index 000000000..cc5b8cc11 --- /dev/null +++ b/com.unity.perception/CHANGELOG.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 33aca7baf1ada694d87e935cca4334bc +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Documentation~/GroundTruth-Custom.md b/com.unity.perception/Documentation~/GroundTruth-Custom.md new file mode 100644 index 000000000..e1ecd656a --- /dev/null +++ b/com.unity.perception/Documentation~/GroundTruth-Custom.md @@ -0,0 +1,4 @@ +_Note: This document is a work in progress_ + +# Custom Ground Truth + diff --git a/com.unity.perception/Documentation~/GroundTruth-Labeling.md b/com.unity.perception/Documentation~/GroundTruth-Labeling.md new file mode 100644 index 000000000..96852161c --- /dev/null +++ b/com.unity.perception/Documentation~/GroundTruth-Labeling.md @@ -0,0 +1,34 @@ +_Note: This document is a work in progress_ + +# Labeling +Accurately labeling assets with a predefined taxonomy will inform training and testing of algorithms as to which objects in a dataset have importance. Example: assets labeled with “table” and “chair” will provide an algorithm with the information it needs to train on identifying these objects separately within a scene. + + +You can add a Labeling component to individual GameModels within a scene although it is a good practice to create a prefab of a GameModel and apply the Labeling component to it. +The Labeling components contain properties that control the number of labels applied to the GameModel. “Classes” has a property named “size”, this identifies how many labels are applied to a GameModel. Default = 0 (no label). Setting “size” to 1 will expose an “Element 0” parameter and an input field allowing for a custom label as text or numbers (combination of both) that can be used to label the asset. + +Multiple labels can be used by setting “size” to 2 or more. These additional Elements (labels) can be used for any purpose in development. For example in SynthDet labels have a hierarchy where Element0 is the highest level label identifying an GameModel in a very general category. Subsequent categories become more focused in identifying what types and groups an object can be classified. The last Element is reserved for the specific name (or label) the asset is defined as. + +# Labeling Configuration +Semantic segmentation (and other metrics) require a labeling configuration file located here: +This file gives a list of all labels currently being used in the data set and what RGB value they are associated with. This file can be used as is or created by the developer. When a Semantic segmentation output is generated the per pixel RGB value can be used to identify the object for the algorithm. + +Note: the labeling configuration file is not validated and must be managed by the developer. + +## Best practices +Generally algorithm testing and training requires a single label on an asset for proper identification (“chair”, “table”, “door, “window”, etc.) In Unity SynthDet a labeling hierarchy is used to identify assets at a higher level and/or more granularly. + +Example +An asset representing a box of Rice Krispies cereal is labeled as: food\cereal\kellogs\ricekrispies +“food” - type +“cereal” - subtype +“kellogs” - main descriptor +“ricekrispies” - sub descriptor + +If the goal of the algorithm is to identify all objects in a scene that is “food” that label is available and can be used. Conversely if the goal is to identify only Rice Krispies cereal within a scene that label is also available. Depending on the goal of the algorithm any mix of labels in the hierarchy can be used at the discretion of the developer. + +Note: this labeling hierarchy is suggested and not required. Please adjust or discard if your project goals have other requirements. +Adding Labels to a Unity Asset +Labels are added to Unity Assets by attaching a labeling script to an asset and creating a prefab object. + +### Asset Organization diff --git a/com.unity.perception/Documentation~/GroundTruth-Overview.md b/com.unity.perception/Documentation~/GroundTruth-Overview.md new file mode 100644 index 000000000..90fca5f5b --- /dev/null +++ b/com.unity.perception/Documentation~/GroundTruth-Overview.md @@ -0,0 +1,18 @@ +_Note: This document is a work in progress_ + +# Ground truth and metrics + +Ground truth is an essential part of most datasets for perception tasks. The Perception package provides the generation of many common forms of ground truth on top of an extensible ground truth and metric capture framework. + +## PerceptionCamera +TODO +## Rgb image +TODO +## Semantic segmentation +TODO +## 2D bounding box +TODO +## Object Count +TODO +## Visible pixels metric +TODO \ No newline at end of file diff --git a/com.unity.perception/Documentation~/ScenarioManager.md b/com.unity.perception/Documentation~/ScenarioManager.md new file mode 100644 index 000000000..40f53dfc6 --- /dev/null +++ b/com.unity.perception/Documentation~/ScenarioManager.md @@ -0,0 +1,4 @@ +_Note: This document is a work in progress_ + +# Scenario Manager + diff --git a/com.unity.perception/Documentation~/index.md b/com.unity.perception/Documentation~/index.md new file mode 100644 index 000000000..a07a2df77 --- /dev/null +++ b/com.unity.perception/Documentation~/index.md @@ -0,0 +1,19 @@ +# About the Perception SDK +com.unity.perception provides a toolkit for generating large-scale datasets for perception-based machine learning training and validation. It is focused on a handful of camera-based use cases for now and will ultimately expand to other forms of sensors and machine learning tasks. + +# Using Perception + +# Technical details +## Requirements + +This version of _Perception_ is compatible Unity Editor 2019.3 and later + + +## Package contents +|Ground Truth|Captures semantic segmentation, bounding boxes, and other forms of ground truth.| +|---|---| +|Labeling|Script object that labels an asset for target taxonomy| +|Labeling Configuration|Captures all the labeling and adds the data to the corresponding pixels| + +|Scenarios|Contains different sample scenarios of driving conditions for a car to operate in| +|---|---| \ No newline at end of file diff --git a/com.unity.perception/Editor.meta b/com.unity.perception/Editor.meta new file mode 100644 index 000000000..b9ae2ac5f --- /dev/null +++ b/com.unity.perception/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 40926328ac8665c4ab5bca37039a16c9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Editor/AssemblyInfo.cs b/com.unity.perception/Editor/AssemblyInfo.cs new file mode 100644 index 000000000..1a873b084 --- /dev/null +++ b/com.unity.perception/Editor/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Unity.Perception.Editor.Tests")] +[assembly: InternalsVisibleTo("Unity.Perception.Runtime.Tests")] diff --git a/com.unity.perception/Editor/AssemblyInfo.cs.meta b/com.unity.perception/Editor/AssemblyInfo.cs.meta new file mode 100644 index 000000000..019844404 --- /dev/null +++ b/com.unity.perception/Editor/AssemblyInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: d2055e6c18904b8d8cb191265d774059 +timeCreated: 1585002121 \ No newline at end of file diff --git a/com.unity.perception/Editor/GroundTruth.meta b/com.unity.perception/Editor/GroundTruth.meta new file mode 100644 index 000000000..8acb1a68f --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d27db46df47e0f549aa844ef5159134b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs b/com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs new file mode 100644 index 000000000..5da12329d --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Unity.Perception.Runtime.Tests")] +[assembly: InternalsVisibleTo("Unity.Perception.Runtime")] diff --git a/com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs.meta b/com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs.meta new file mode 100644 index 000000000..70518c2aa --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd1e43723c778f9458b87cb8ae47772b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs b/com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs new file mode 100644 index 000000000..63f0e9a72 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs @@ -0,0 +1,42 @@ +#if HDRP_PRESENT + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEditor.Rendering.HighDefinition; + +namespace UnityEngine.Perception.Sensors.Editor +{ + public class BaseCustomPassDrawer : CustomPassDrawer + { + List m_CustomPassUserProperties = new List(); + static float s_DefaultLineSpace = EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; + + protected void AddProperty(SerializedProperty property) + { + m_CustomPassUserProperties.Add(property); + } + + protected override void DoPassGUI(SerializedProperty customPass, Rect rect) + { + foreach (var prop in m_CustomPassUserProperties) + { + EditorGUI.PropertyField(rect, prop); + rect.y += s_DefaultLineSpace; + } + } + + protected override float GetPassHeight(SerializedProperty customPass) + { + float height = 0f; + foreach (var prop in m_CustomPassUserProperties) + { + height += EditorGUI.GetPropertyHeight(prop); + height += EditorGUIUtility.standardVerticalSpacing; + } + + return height; + } + } +} +#endif \ No newline at end of file diff --git a/com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs.meta b/com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs.meta new file mode 100644 index 000000000..47fdd75b0 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/BaseCustomPassDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9015134759dfd004f9367a84ce764121 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs b/com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs new file mode 100644 index 000000000..8cdb481f8 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs @@ -0,0 +1,23 @@ +#if HDRP_PRESENT + +using UnityEditor; +using UnityEditor.Rendering.HighDefinition; + +namespace UnityEngine.Perception.Sensors.Editor +{ + [CustomPassDrawer(typeof(InstanceSegmentationPass))] + public class InstanceSegmentationPassEditor : BaseCustomPassDrawer + { + protected override void Initialize(SerializedProperty customPass) + { + var targetCameraProperty = customPass.FindPropertyRelative(nameof(GroundTruthPass.targetCamera)); + AddProperty(targetCameraProperty); + AddProperty(customPass.FindPropertyRelative(nameof(InstanceSegmentationPass.targetTexture))); + AddProperty(customPass.FindPropertyRelative(nameof(InstanceSegmentationPass.reassignIds))); + AddProperty(customPass.FindPropertyRelative(nameof(InstanceSegmentationPass.idStart))); + AddProperty(customPass.FindPropertyRelative(nameof(InstanceSegmentationPass.idStep))); + base.Initialize(customPass); + } + } +} +#endif diff --git a/com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs.meta b/com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs.meta new file mode 100644 index 000000000..fb70691c7 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/InstanceSegmentationPassEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b21f1f12690d8ad44a83df43632ab4bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs b/com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs new file mode 100644 index 000000000..70b362961 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs @@ -0,0 +1,56 @@ +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; +using UnityEngine.Perception.Sensors; + +[CustomEditor(typeof(LabelingConfiguration))] +public class LabelingConfigurationEditor : Editor +{ + ReorderableList m_LabelsList; + + public void OnEnable() + { + m_LabelsList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty(nameof(LabelingConfiguration.LabelingConfigurations)), true, false, true, true); + m_LabelsList.elementHeight = EditorGUIUtility.singleLineHeight * 2; + m_LabelsList.drawElementCallback = DrawElement; + m_LabelsList.onAddCallback += OnAdd; + m_LabelsList.onRemoveCallback += OnRemove; + } + + void OnRemove(ReorderableList list) + { + if (list.index != -1) + config.LabelingConfigurations.RemoveAt(list.index); + } + + LabelingConfiguration config => (LabelingConfiguration)this.target; + + void OnAdd(ReorderableList list) + { + config.LabelingConfigurations.Add(new LabelingConfigurationEntry("", 0)); + } + + void DrawElement(Rect rect, int index, bool isactive, bool isfocused) + { + var entry = config.LabelingConfigurations[index]; + using (var change = new EditorGUI.ChangeCheckScope()) + { + var contentRect = new Rect(rect.position, new Vector2(rect.width, EditorGUIUtility.singleLineHeight)); + var newLabel = EditorGUI.TextField(contentRect, nameof(LabelingConfigurationEntry.label), entry.label); + if (change.changed) + config.LabelingConfigurations[index] = new LabelingConfigurationEntry(newLabel, entry.value); + } + using (var change = new EditorGUI.ChangeCheckScope()) + { + var contentRect = new Rect(rect.position + new Vector2(0, EditorGUIUtility.singleLineHeight), new Vector2(rect.width, EditorGUIUtility.singleLineHeight)); + var newValue = EditorGUI.IntField(contentRect, nameof(LabelingConfigurationEntry.value), entry.value); + if (change.changed) + config.LabelingConfigurations[index] = new LabelingConfigurationEntry(entry.label, newValue); + } + } + + public override void OnInspectorGUI() + { + m_LabelsList.DoLayoutList(); + } +} diff --git a/com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs.meta b/com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs.meta new file mode 100644 index 000000000..b7d1d62ec --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/LabelingConfigurationEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 910dd3186e1c4fad8eb6aca9b9ee0f48 +timeCreated: 1585940009 \ No newline at end of file diff --git a/com.unity.perception/Editor/GroundTruth/LabelingEditor.cs b/com.unity.perception/Editor/GroundTruth/LabelingEditor.cs new file mode 100644 index 000000000..4e1ddd947 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/LabelingEditor.cs @@ -0,0 +1,53 @@ +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; + +[CustomEditor(typeof(Labeling))] +public class LabelingEditor : Editor +{ + const int k_Indent = 7; + ReorderableList m_LabelsList; + + public void OnEnable() + { + m_LabelsList = new ReorderableList(this.serializedObject, this.serializedObject.FindProperty(nameof(Labeling.classes)), true, false, true, true); + m_LabelsList.drawElementCallback = DrawElement; + m_LabelsList.onAddCallback += OnAdd; + m_LabelsList.onRemoveCallback += OnRemove; + } + + void OnRemove(ReorderableList list) + { + if (list.index != -1) + labeling.classes.RemoveAt(list.index); + } + + Labeling labeling => (Labeling)this.target; + + void OnAdd(ReorderableList list) + { + labeling.classes.Add(""); + } + + void DrawElement(Rect rect, int index, bool isactive, bool isfocused) + { + using (var change = new EditorGUI.ChangeCheckScope()) + { + var indent = k_Indent * index; + if (indent >= rect.width) + return; + + var contentRect = new Rect(rect.x + indent, rect.y, rect.width - indent, rect.height); + var value = EditorGUI.TextField(contentRect, labeling.classes[index]); + if (change.changed) + { + labeling.classes[index] = value; + } + } + } + + public override void OnInspectorGUI() + { + m_LabelsList.DoLayoutList(); + } +} diff --git a/com.unity.perception/Editor/GroundTruth/LabelingEditor.cs.meta b/com.unity.perception/Editor/GroundTruth/LabelingEditor.cs.meta new file mode 100644 index 000000000..a19921242 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/LabelingEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 2e725508a34c40a0938c8d891b371980 +timeCreated: 1585933334 \ No newline at end of file diff --git a/com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs b/com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs new file mode 100644 index 000000000..05d911243 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs @@ -0,0 +1,22 @@ +#if HDRP_PRESENT + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEditor.Rendering.HighDefinition; + +namespace UnityEngine.Perception.Sensors.Editor +{ + [CustomPassDrawer(typeof(SemanticSegmentationPass))] + public class SemanticSegmentationPassEditor : BaseCustomPassDrawer + { + protected override void Initialize(SerializedProperty customPass) + { + AddProperty(customPass.FindPropertyRelative(nameof(SemanticSegmentationPass.targetCamera))); + AddProperty(customPass.FindPropertyRelative(nameof(SemanticSegmentationPass.targetTexture))); + AddProperty(customPass.FindPropertyRelative(nameof(SemanticSegmentationPass.labelingConfiguration))); + base.Initialize(customPass); + } + } +} +#endif diff --git a/com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs.meta b/com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs.meta new file mode 100644 index 000000000..f611fe4a9 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/LabelingPassEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b40b70efe1daed14ebb469162c8f799f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs b/com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs new file mode 100644 index 000000000..2e0a6df3e --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs @@ -0,0 +1,22 @@ +#if HDRP_PRESENT + +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEditor.Rendering.HighDefinition; + +namespace UnityEngine.Perception.Sensors.Editor +{ + [CustomPassDrawer(typeof(ObjectCountPass))] + public class ObjectCountPassEditor : BaseCustomPassDrawer + { + protected override void Initialize(SerializedProperty customPass) + { + AddProperty(customPass.FindPropertyRelative(nameof(GroundTruthPass.targetCamera))); + AddProperty(customPass.FindPropertyRelative(nameof(ObjectCountPass.SegmentationTexture))); + AddProperty(customPass.FindPropertyRelative(nameof(ObjectCountPass.LabelingConfiguration))); + base.Initialize(customPass); + } + } +} +#endif diff --git a/com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs.meta b/com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs.meta new file mode 100644 index 000000000..a7e06f564 --- /dev/null +++ b/com.unity.perception/Editor/GroundTruth/ObjectCountPassEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d28b6eb98e988b34b9da6e73fccc09bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Editor/Unity.Perception.Editor.asmdef b/com.unity.perception/Editor/Unity.Perception.Editor.asmdef new file mode 100644 index 000000000..598beaa2d --- /dev/null +++ b/com.unity.perception/Editor/Unity.Perception.Editor.asmdef @@ -0,0 +1,31 @@ +{ + "name": "Unity.Perception.Editor", + "references": [ + "Unity.RenderPipelines.Core.Runtime", + "Unity.RenderPipelines.HighDefinition.Runtime", + "Unity.RenderPipelines.HighDefinition.Editor", + "Unity.Mathematics", + "Unity.Entities", + "Unity.Collections", + "Unity.Perception.Runtime", + "PathCreatorEditor", + "PathCreator" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.unity.render-pipelines.high-definition", + "expression": "", + "define": "HDRP_PRESENT" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/com.unity.perception/Editor/Unity.Perception.Editor.asmdef.meta b/com.unity.perception/Editor/Unity.Perception.Editor.asmdef.meta new file mode 100644 index 000000000..071a69e9b --- /dev/null +++ b/com.unity.perception/Editor/Unity.Perception.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 37ffee9220709f84da520f9bb148d7ae +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/LICENSE.md b/com.unity.perception/LICENSE.md new file mode 100644 index 000000000..0bb3290d1 --- /dev/null +++ b/com.unity.perception/LICENSE.md @@ -0,0 +1,3 @@ +Perception copyright © 2019 Unity Technologies ApS + +Unless expressly provided otherwise, the Software under this license is made available strictly on an “AS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions. diff --git a/com.unity.perception/LICENSE.md.meta b/com.unity.perception/LICENSE.md.meta new file mode 100644 index 000000000..391c32a55 --- /dev/null +++ b/com.unity.perception/LICENSE.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e03bbcfdc78278d4eba1293b50f01197 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/QAReport.md b/com.unity.perception/QAReport.md new file mode 100644 index 000000000..26c5ba377 --- /dev/null +++ b/com.unity.perception/QAReport.md @@ -0,0 +1,26 @@ +# Quality Report +Use this file to outline the test strategy for this package. + +## Version tested: [*package version*] + +## QA Owner: [*Add Name*] +## UX Owner: [*Add Name*] + +## Test strategy +*Use this section to describe how this feature was tested.* +* A link to the Test Plan (Test Rails, other) +* Results from the package's editor and runtime test suite. +* Link to automated test results (if any) +* Manual test Results, [here's an example](https://docs.google.com/spreadsheets/d/12A76U5Gf969w10KL4Ik0wC1oFIBDUoRrqIvQgD18TFo/edit#gid=0) +* Scenario test week outcome +* etc. + +## Package Status +Use this section to describe: +* UX status/evaluation results +* package stability +* known bugs, issues +* performance metrics, +* etc + +In other words, a general feeling on the health of this package. diff --git a/com.unity.perception/QAReport.md.meta b/com.unity.perception/QAReport.md.meta new file mode 100644 index 000000000..58b6b72df --- /dev/null +++ b/com.unity.perception/QAReport.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3ef8f9173658e8a40a6665c5898c5b7a +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime.meta b/com.unity.perception/Runtime.meta new file mode 100644 index 000000000..b8ec62576 --- /dev/null +++ b/com.unity.perception/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 85f3a9ac334db1242b3de159daa0a594 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/AssemblyInfo.cs b/com.unity.perception/Runtime/AssemblyInfo.cs new file mode 100644 index 000000000..7afdd2dba --- /dev/null +++ b/com.unity.perception/Runtime/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Runtime.CompilerServices; + +#if UNITY_EDITOR +[assembly: InternalsVisibleTo("Unity.Perception.Editor.Tests")] +[assembly: InternalsVisibleTo("Unity.Perception.Editor")] +#endif +[assembly: InternalsVisibleTo("Untiy.Perception.Tests.Scripts")] +[assembly: InternalsVisibleTo("Unity.Perception.Runtime.Tests")] +[assembly: InternalsVisibleTo("Unity.Perception.Runtime")] +[assembly: InternalsVisibleTo("Unity.Perception.TestProject")] diff --git a/com.unity.perception/Runtime/AssemblyInfo.cs.meta b/com.unity.perception/Runtime/AssemblyInfo.cs.meta new file mode 100644 index 000000000..2b7d9a3b8 --- /dev/null +++ b/com.unity.perception/Runtime/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3457b6930a5ee0f42889a56a16becfa9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth.meta b/com.unity.perception/Runtime/GroundTruth.meta new file mode 100644 index 000000000..20b703816 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee60d38a4a4ff124690ec5b7b149395e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs b/com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs new file mode 100644 index 000000000..b540b080f --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs @@ -0,0 +1,18 @@ +using System; + +namespace UnityEngine.Perception { + /// + /// The origin to use for bounding box calculation + /// + public enum BoundingBoxOrigin + { + /// + /// (0, 0) is located at the top-left of the image, with +y pointing down. + /// + TopLeft, + /// + /// (0, 0) is located at the bottom-left of the image, with +y pointing up. + /// + BottomLeft + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs.meta b/com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs.meta new file mode 100644 index 000000000..013b42e80 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/BoundingBoxOrigin.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 794135384c604b20b9edc9d1465c3f3d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs b/com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs new file mode 100644 index 000000000..a3e929ff4 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs @@ -0,0 +1,76 @@ +using System; +using Newtonsoft.Json.Linq; +using Unity.Mathematics; + +namespace UnityEngine.Perception.Sensors +{ + /// + /// Utilities for producing Json for datasets. + /// + static class DatasetJsonUtility + { + //static JsonConverter[] s_Converters = { new Vector3Converter(), new QuaternionConverter(), new Float3X3Converter(), new Float3Converter() }; + + public static JToken ToJToken(Vector3 value) + { + var obj = new JArray(); + obj.Add(value.x); + obj.Add(value.y); + obj.Add(value.z); + return obj; + } + public static JToken ToJToken(Quaternion value) + { + var obj = new JArray(); + obj.Add(value.x); + obj.Add(value.y); + obj.Add(value.z); + obj.Add(value.w); + return obj; + } + public static JToken ToJToken(float3x3 value) + { + var obj = new JArray(); + obj.Add(ToJToken(value.c0)); + obj.Add(ToJToken(value.c1)); + obj.Add(ToJToken(value.c2)); + return obj; + } + public static JToken ToJToken(float3 value) + { + var obj = new JArray(); + obj.Add(value.x); + obj.Add(value.y); + obj.Add(value.z); + return obj; + } + public static JToken ToJToken(T value) + { + switch (value) + { + case float3 v: + return ToJToken(v); + case float3x3 v: + return ToJToken(v); + case Quaternion v: + return ToJToken(v); + case Vector3 v: + return ToJToken(v); + case float v: + return new JValue(v); + case int v: + return new JValue(v); + case double v: + return new JValue(v); + case string v: + return new JValue($"\"{v}\""); + case uint v: + return new JValue(v); + } + //Unfortunate solution of creating Json, and immediately parsing to a structure to work around the lack of + //Reflection.Emit in players. We could just use this json directly, but then line endings and indentation are inconsistent + var rawJson = JsonUtility.ToJson(value, true); + return JObject.Parse(rawJson); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs.meta b/com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs.meta new file mode 100644 index 000000000..1a6552627 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/DatasetJsonUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b7d494d1ba6b6e4a936ad5a015d26d0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/EgoMarker.cs b/com.unity.perception/Runtime/GroundTruth/EgoMarker.cs new file mode 100644 index 000000000..847b10532 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/EgoMarker.cs @@ -0,0 +1,31 @@ +using System; +using UnityEngine; + +namespace UnityEngine.Perception +{ + public class EgoMarker : MonoBehaviour + { + public string Description; + Ego m_Ego; + + public Ego Ego + { + get + { + EnsureEgoInitialized(); + return m_Ego; + } + } + + void Start() + { + EnsureEgoInitialized(); + } + + void EnsureEgoInitialized() + { + if (m_Ego == default) + m_Ego = SimulationManager.RegisterEgo(Description); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/EgoMarker.cs.meta b/com.unity.perception/Runtime/GroundTruth/EgoMarker.cs.meta new file mode 100644 index 000000000..eb8d4b123 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/EgoMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 309b456982ed4146b0f71d453c791989 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs b/com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs new file mode 100644 index 000000000..3197e0dbb --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs @@ -0,0 +1,107 @@ +using System; +using Unity.Entities; +using UnityEngine; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Rendering; +using UnityEngine.Perception.Sensors; + +public abstract class GroundTruthCrossPipelinePass : IGroundTruthGenerator +{ + public Camera targetCamera; + + bool m_IsActivated; + + protected GroundTruthCrossPipelinePass(Camera targetCamera) + { + this.targetCamera = targetCamera; + } + + public virtual void Setup() + { + if (targetCamera == null) + throw new InvalidOperationException("targetCamera may not be null"); + + // If we are forced to activate here we will get zeroes in the first frame. + EnsureActivated(); + } + + public void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, Camera camera, CullingResults cullingResult) + { + // CustomPasses are executed for each camera. We only want to run for the target camera + if (camera != targetCamera) + return; + + ExecutePass(renderContext, cmd, camera, cullingResult); + } + + protected abstract void ExecutePass(ScriptableRenderContext renderContext, CommandBuffer cmd, Camera camera, CullingResults cullingResult); + + public void EnsureActivated() + { + if (!m_IsActivated) + { + var labelSetupSystem = World.DefaultGameObjectInjectionWorld?.GetExistingSystem(); + labelSetupSystem?.Activate(this); + m_IsActivated = true; + } + } + + public void Cleanup() + { + var labelSetupSystem = World.DefaultGameObjectInjectionWorld?.GetExistingSystem(); + labelSetupSystem?.Deactivate(this); + } + + + protected RendererListDesc CreateRendererListDesc(Camera camera, CullingResults cullingResult, string overrideMaterialPassName, int overrideMaterialPassIndex, Material overrideMaterial, LayerMask layerMask/*, PerObjectData perObjectData*/) + { + var shaderPasses = new[] + { + new ShaderTagId("Forward"), // HD Lit shader + new ShaderTagId("ForwardOnly"), // HD Unlit shader + new ShaderTagId("SRPDefaultUnlit"), // Cross SRP Unlit shader + new ShaderTagId("UniversalForward"), // URP Forward + new ShaderTagId("LightweightForward"), // LWRP Forward + new ShaderTagId(overrideMaterialPassName), // The override material shader + }; + + var stateBlock = new RenderStateBlock(0) + { + depthState = new DepthState(true, CompareFunction.LessEqual), + }; + + var result = new RendererListDesc(shaderPasses, cullingResult, camera) + { + rendererConfiguration = PerObjectData.None, + renderQueueRange = new RenderQueueRange { lowerBound = 0, upperBound = 5000 }, + sortingCriteria = SortingCriteria.CommonOpaque, + excludeObjectMotionVectors = false, + overrideMaterial = overrideMaterial, + overrideMaterialPassIndex = overrideMaterialPassIndex, + stateBlock = stateBlock, + layerMask = layerMask, + }; + return result; + } + + + public static void DrawRendererList(ScriptableRenderContext renderContext, CommandBuffer cmd, RendererList rendererList) + { + if (!rendererList.isValid) + throw new ArgumentException("Invalid renderer list provided to DrawRendererList"); + + // This is done here because DrawRenderers API lives outside command buffers so we need to make call this before doing any DrawRenders or things will be executed out of order + renderContext.ExecuteCommandBuffer(cmd); + cmd.Clear(); + + if (rendererList.stateBlock == null) + renderContext.DrawRenderers(rendererList.cullingResult, ref rendererList.drawSettings, ref rendererList.filteringSettings); + else + { + var renderStateBlock = rendererList.stateBlock.Value; + renderContext.DrawRenderers(rendererList.cullingResult, ref rendererList.drawSettings, ref rendererList.filteringSettings, ref renderStateBlock); + } + } + + public abstract void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRenderer meshRenderer, Labeling labeling, uint instanceId); +} diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs.meta b/com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs.meta new file mode 100644 index 000000000..542650518 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthCrossPipelinePass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3a8d5a7497d49a2a2c8f0c1c52aae18 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs b/com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs new file mode 100644 index 000000000..e83a77d6c --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs @@ -0,0 +1,9 @@ +using Unity.Entities; + +namespace UnityEngine.Perception.Sensors +{ + public struct GroundTruthInfo : IComponentData + { + public uint instanceId; + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs.meta b/com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs.meta new file mode 100644 index 000000000..98502d744 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 013782ed5fce31d46b9849bbb3cc3da8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs b/com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs new file mode 100644 index 000000000..a0ebaa829 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs @@ -0,0 +1,92 @@ +using System.Collections.Generic; +using System.Threading; +using Unity.Entities; + +namespace UnityEngine.Perception.Sensors +{ + struct IdAssignmentParameters : IComponentData + { + public uint idStart; + public uint idStep; + } + public class GroundTruthLabelSetupSystem : ComponentSystem + { + List m_ActiveGenerators = new List(); + ThreadLocal m_MaterialPropertyBlocks = new ThreadLocal(); + int m_CurrentObjectIndex = -1; + + protected override void OnCreate() + { + //These are here to inform the system runner the queries we are interested in. Without these calls, OnUpdate() might not be called + GetEntityQuery( ComponentType.Exclude(), ComponentType.ReadOnly()); + GetEntityQuery( ComponentType.ReadOnly(), ComponentType.ReadOnly()); + } + + protected override void OnUpdate() + { + var entityQuery = Entities.WithAll().ToEntityQuery(); + IdAssignmentParameters idAssignmentParameters; + if (entityQuery.CalculateEntityCount() == 1) + idAssignmentParameters = entityQuery.GetSingleton(); + else + idAssignmentParameters = new IdAssignmentParameters {idStart = 1, idStep = 1}; + + var entityCount = Entities.WithAll().ToEntityQuery().CalculateEntityCount(); + if (entityCount == 0) + m_CurrentObjectIndex = -1; + + Entities.WithNone().ForEach((Entity e, Labeling labeling) => + { + var objectIndex = (uint)Interlocked.Increment(ref m_CurrentObjectIndex); + var instanceId = idAssignmentParameters.idStart + objectIndex * idAssignmentParameters.idStep; + var gameObject = labeling.gameObject; + if (!m_MaterialPropertyBlocks.IsValueCreated) + m_MaterialPropertyBlocks.Value = new MaterialPropertyBlock(); + + InitGameObjectRecursive(gameObject, m_MaterialPropertyBlocks.Value, labeling, instanceId); + EntityManager.AddComponentData(e, new GroundTruthInfo + { + instanceId = instanceId + }); + }); + } + + void InitGameObjectRecursive(GameObject gameObject, MaterialPropertyBlock mpb, Labeling labeling, uint instanceId) + { + var meshRenderer = gameObject.GetComponent(); + if (meshRenderer != null) + { + meshRenderer.GetPropertyBlock(mpb); + foreach (var pass in m_ActiveGenerators) + pass.SetupMaterialProperties(mpb, meshRenderer, labeling, instanceId); + + meshRenderer.SetPropertyBlock(mpb); + } + + for (var i = 0; i < gameObject.transform.childCount; i++) + { + var child = gameObject.transform.GetChild(i).gameObject; + if (child.GetComponent() != null) + continue; + + InitGameObjectRecursive(child, mpb, labeling, instanceId); + } + } + + public void Activate(IGroundTruthGenerator pass) + { + m_ActiveGenerators.Add(pass); + Entities.ForEach((Labeling labeling, ref GroundTruthInfo info) => + { + var gameObject = labeling.gameObject; + InitGameObjectRecursive(gameObject, m_MaterialPropertyBlocks.Value, labeling, info.instanceId); + }); + + } + + public void Deactivate(IGroundTruthGenerator pass) + { + m_ActiveGenerators.Remove(pass); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs.meta b/com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs.meta new file mode 100644 index 000000000..5c2816842 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 67ff3a1956c5bb14487beccf559cdd49 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs b/com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs new file mode 100644 index 000000000..f64e7b192 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs @@ -0,0 +1,95 @@ +#if HDRP_PRESENT + +using System; +using Unity.Entities; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; + +namespace UnityEngine.Perception.Sensors +{ + public abstract class GroundTruthPass : CustomPass, IGroundTruthGenerator + { + public Camera targetCamera; + + bool m_IsActivated; + public abstract void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRenderer meshRenderer, Labeling labeling, uint instanceId); + + protected GroundTruthPass(Camera targetCamera) + { + this.targetCamera = targetCamera; + } + + protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) + { + if (targetCamera == null) + throw new InvalidOperationException("targetCamera may not be null"); + + // If we are forced to activate here we will get zeroes in the first frame. + EnsureActivated(); + + this.targetColorBuffer = TargetBuffer.Custom; + this.targetDepthBuffer = TargetBuffer.Custom; + } + + protected sealed override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult) + { + // CustomPasses are executed for each camera. We only want to run for the target camera + if (hdCamera.camera != targetCamera) + return; + + ExecutePass(renderContext, cmd, hdCamera, cullingResult); + } + + protected abstract void ExecutePass(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult); + + protected void EnsureActivated() + { + if (!m_IsActivated) + { + var labelSetupSystem = World.DefaultGameObjectInjectionWorld?.GetExistingSystem(); + labelSetupSystem?.Activate(this); + m_IsActivated = true; + } + } + + protected override void Cleanup() + { + var labelSetupSystem = World.DefaultGameObjectInjectionWorld?.GetExistingSystem(); + labelSetupSystem?.Deactivate(this); + } + + + protected RendererListDesc CreateRendererListDesc(HDCamera hdCamera, CullingResults cullingResult, string overrideMaterialPassName, int overrideMaterialPassIndex, Material overrideMaterial, LayerMask layerMask) + { + var shaderPasses = new[] + { + new ShaderTagId("Forward"), // HD Lit shader + new ShaderTagId("ForwardOnly"), // HD Unlit shader + new ShaderTagId("SRPDefaultUnlit"), // Cross SRP Unlit shader + new ShaderTagId(overrideMaterialPassName), // The override material shader + }; + + var stateBlock = new RenderStateBlock(0) + { + depthState = new DepthState(true, CompareFunction.LessEqual), + }; + + PerObjectData renderConfig = hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask) ? HDUtils.k_RendererConfigurationBakedLightingWithShadowMask : HDUtils.k_RendererConfigurationBakedLighting; + + var result = new RendererListDesc(shaderPasses, cullingResult, hdCamera.camera) + { + rendererConfiguration = renderConfig, + renderQueueRange = GetRenderQueueRange(RenderQueueType.All), + sortingCriteria = SortingCriteria.CommonOpaque, + excludeObjectMotionVectors = false, + overrideMaterial = overrideMaterial, + overrideMaterialPassIndex = overrideMaterialPassIndex, + stateBlock = stateBlock, + layerMask = layerMask, + }; + return result; + } + } +} +#endif diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs.meta b/com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs.meta new file mode 100644 index 000000000..de31988c5 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthPass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0d7678390ae7b4844ad760a9e39dfd7d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs b/com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs new file mode 100644 index 000000000..1120b0ae3 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs @@ -0,0 +1,71 @@ +#if URP_PRESENT +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.Universal; +using UnityEngine.Perception; +using UnityEngine.Perception.Sensors; + +class InstanceSegmentationUrpPass : ScriptableRenderPass +{ + InstanceSegmentationCrossPipelinePass m_InstanceSegmentationPass; + + public InstanceSegmentationUrpPass(Camera camera, RenderTexture targetTexture) + { + m_InstanceSegmentationPass = new InstanceSegmentationCrossPipelinePass(camera); + ConfigureTarget(targetTexture, targetTexture.depthBuffer); + m_InstanceSegmentationPass.Setup(); + } + + public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) + { + var commandBuffer = CommandBufferPool.Get(nameof(InstanceSegmentationUrpPass)); + m_InstanceSegmentationPass.Execute(context, commandBuffer, renderingData.cameraData.camera, renderingData.cullResults); + CommandBufferPool.Release(commandBuffer); + } +} +class SemanticSegmentationUrpPass : ScriptableRenderPass +{ + SemanticSegmentationCrossPipelinePass m_SemanticSegmentationCrossPipelinePass; + + public SemanticSegmentationUrpPass(Camera camera, RenderTexture targetTexture, LabelingConfiguration labelingConfiguration) + { + m_SemanticSegmentationCrossPipelinePass = new SemanticSegmentationCrossPipelinePass(camera, labelingConfiguration); + ConfigureTarget(targetTexture, targetTexture.depthBuffer); + m_SemanticSegmentationCrossPipelinePass.Setup(); + } + + public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) + { + var commandBuffer = CommandBufferPool.Get(nameof(SemanticSegmentationUrpPass)); + m_SemanticSegmentationCrossPipelinePass.Execute(context, commandBuffer, renderingData.cameraData.camera, renderingData.cullResults); + CommandBufferPool.Release(commandBuffer); + } +} + +public class GroundTruthRendererFeature : ScriptableRendererFeature +{ + public override void Create() + { + } + + public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) + { + var cameraObject = renderingData.cameraData.camera.gameObject; + var perceptionCamera = cameraObject.GetComponent(); + + if (perceptionCamera == null) + return; + +#if UNITY_EDITOR + if (!EditorApplication.isPlaying) + return; +#endif + + renderer.EnqueuePass(perceptionCamera.instanceSegmentationUrpPass); + renderer.EnqueuePass(perceptionCamera.semanticSegmentationUrpPass); + } +} +#endif diff --git a/com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs.meta b/com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs.meta new file mode 100644 index 000000000..86916ffd0 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/GroundTruthRendererFeature.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 780f1bb8e775c4245b86116069a82828 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs b/com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs new file mode 100644 index 000000000..c46c980a0 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs @@ -0,0 +1,6 @@ +using UnityEngine; + +public interface IGroundTruthGenerator +{ + void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRenderer meshRenderer, Labeling labeling, uint instanceId); +} diff --git a/com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs.meta b/com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs.meta new file mode 100644 index 000000000..0f7da357d --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/IGroundTruthGenerator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f5bd07e4ea9541f49f16b85e13c1f441 +timeCreated: 1585064376 \ No newline at end of file diff --git a/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs new file mode 100644 index 000000000..9f8c66c32 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using Unity.Profiling; +using UnityEngine; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Rendering; + +public class InstanceSegmentationCrossPipelinePass : GroundTruthCrossPipelinePass +{ + public static readonly int SegmentationIdProperty = Shader.PropertyToID("_SegmentationId"); + const string k_SegmentationPassShaderName = "Perception/InstanceSegmentation"; + + static ProfilerMarker s_ExecuteMarker = new ProfilerMarker("SegmentationPass_Execute"); + + //Filter settings + public LayerMask layerMask = -1; + + Shader m_SegmentationShader; + Material m_OverrideMaterial; + public bool reassignIds = false; + public uint idStart = 1; + public uint idStep = 1; + int m_NextObjectIndex; + + Dictionary m_Ids; + + public InstanceSegmentationCrossPipelinePass(Camera targetCamera, uint idStart = 1, uint idStep = 1) + :base(targetCamera) + { + if (targetCamera == null) + throw new ArgumentNullException(nameof(targetCamera)); + + //Activating in the constructor allows us to get correct labeling in the first frame. + EnsureActivated(); + + this.idStart = idStart; + this.idStep = idStep; + } + + public override void Setup() + { + base.Setup(); + m_SegmentationShader = Shader.Find(k_SegmentationPassShaderName); + var shaderVariantCollection = new ShaderVariantCollection(); + shaderVariantCollection.Add(new ShaderVariantCollection.ShaderVariant(m_SegmentationShader, PassType.ScriptableRenderPipeline)); + shaderVariantCollection.WarmUp(); + + m_OverrideMaterial = new Material(m_SegmentationShader); + } + + //Render all objects to our target RenderTexture using `overrideMaterial` to use our shader + protected override void ExecutePass(ScriptableRenderContext renderContext, CommandBuffer cmd, Camera camera, CullingResults cullingResult) + { + using (s_ExecuteMarker.Auto()) + { + cmd.ClearRenderTarget(true, true, Color.clear); + var result = CreateRendererListDesc(camera, cullingResult, "FirstPass", 0, m_OverrideMaterial, layerMask); + + DrawRendererList(renderContext, cmd, RendererList.Create(result)); + } + } + + public override void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRenderer meshRenderer, Labeling labeling, uint instanceId) + { + if (reassignIds) + { + //Almost all the code here interacts with shared state, so just use a simple lock for now. + lock (this) + { + if (m_Ids == null) + m_Ids = new Dictionary(); + + if (!m_Ids.TryGetValue(instanceId, out var actualId)) + { + actualId = (uint)m_NextObjectIndex * idStep + idStart; + m_Ids.Add(instanceId, actualId); + instanceId = actualId; + m_NextObjectIndex++; + } + } + } + mpb.SetInt(SegmentationIdProperty, (int)instanceId); +#if PERCEPTION_DEBUG + Debug.Log($"Assigning id. Frame {Time.frameCount} id {id}"); +#endif + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs.meta b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs.meta new file mode 100644 index 000000000..d092102ae --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationCrossPipelinePass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b575537c5b92d6949bb233707280a614 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs new file mode 100644 index 000000000..49563c163 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs @@ -0,0 +1,51 @@ +#if HDRP_PRESENT + +using System; +using JetBrains.Annotations; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering; + +namespace UnityEngine.Perception.Sensors +{ + /// + /// A CustomPass for creating object instance segmentation images. GameObjects containing Labeling components + /// are assigned unique IDs, which are rendered into the target texture. + /// + public class InstanceSegmentationPass : CustomPass + { + InstanceSegmentationCrossPipelinePass m_InstanceSegmentationCrossPipelinePass; + + public RenderTexture targetTexture; + public bool reassignIds = false; + public uint idStart = 1; + public uint idStep = 1; + public Camera targetCamera; + + [UsedImplicitly] + public InstanceSegmentationPass() + {} + + protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult) + { + CoreUtils.SetRenderTarget(cmd, targetTexture, ClearFlag.All); + m_InstanceSegmentationCrossPipelinePass.Execute(renderContext, cmd, hdCamera.camera, cullingResult); + } + + public void EnsureInit() + { + if (m_InstanceSegmentationCrossPipelinePass == null) + { + m_InstanceSegmentationCrossPipelinePass = new InstanceSegmentationCrossPipelinePass(targetCamera, idStart, idStep); + m_InstanceSegmentationCrossPipelinePass.Setup(); + } + } + + protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) + { + base.Setup(renderContext, cmd); + Debug.Assert(m_InstanceSegmentationCrossPipelinePass != null, "InstanceSegmentationPass.EnsureInit() should be called before the first camera render to get proper object labels in the first frame"); + EnsureInit(); + } + } +} +#endif diff --git a/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs.meta b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs.meta new file mode 100644 index 000000000..17cf4530e --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/InstanceSegmentationPass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 843e65dbdc27ff64c9c9774380276096 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/Labeling.meta b/com.unity.perception/Runtime/GroundTruth/Labeling.meta new file mode 100644 index 000000000..d08bb9d5d --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Labeling.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8c2ac7d7ba3f8514387e241239491d72 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs b/com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs new file mode 100644 index 000000000..d29dfc264 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Unity.Entities; +using UnityEngine; + +/// +/// Defines a set of classes associated with the object and its descendants. Classes can be overwritten +/// +public class Labeling : MonoBehaviour +{ + public List classes = new List(); + + Entity entity; + + // Start is called before the first frame update + void Awake() + { + entity = World.DefaultGameObjectInjectionWorld.EntityManager.CreateEntity(); + World.DefaultGameObjectInjectionWorld.EntityManager.AddComponentObject(entity, this); + } + + private void OnDestroy() + { + if (World.DefaultGameObjectInjectionWorld != null) + World.DefaultGameObjectInjectionWorld.EntityManager.DestroyEntity(entity); + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs.meta b/com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs.meta new file mode 100644 index 000000000..ed6dcc137 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8b33f0bc2b78db642a758f07826d0dd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs b/com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs new file mode 100644 index 000000000..39998099f --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; + +namespace UnityEngine.Perception.Sensors +{ + [CreateAssetMenu(fileName = "LabelingConfiguration", menuName = "Perception/Labeling Configuration", order = 1)] + public class LabelingConfiguration : ScriptableObject + { + [SerializeField] + public List LabelingConfigurations = new List(); + + public bool TryGetMatchingConfigurationIndex(Labeling labeling, out int index) + { + foreach (var labelingClass in labeling.classes) + { + for (var i = 0; i < LabelingConfigurations.Count; i++) + { + var configuration = LabelingConfigurations[i]; + if (string.Equals(configuration.label, labelingClass)) + { + index = i; + return true; + } + } + } + + index = -1; + return false; + } + } + + [Serializable] + public struct LabelingConfigurationEntry + { + public string label; + public int value; + public LabelingConfigurationEntry(string label, int value) + { + this.label = label; + this.value = value; + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs.meta b/com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs.meta new file mode 100644 index 000000000..0e093e7f6 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Labeling/LabelingConfiguration.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bad10bec3eccd8e49a9d725b2c30f74c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/MetricData.cs b/com.unity.perception/Runtime/GroundTruth/MetricData.cs new file mode 100644 index 000000000..28d0da0c1 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/MetricData.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using USim = Unity.Simulation; + +namespace UnityEngine.Perception.Sensors +{ + class MetricData + { + public string Name; + public SimulationInfo SimulationInfo; + public CurrentContext CurrentContext; + public T Metric; + + public MetricData(string name, T metric) + { + if(string.IsNullOrEmpty(name)) { + throw new ArgumentException("Arg name is null or empty"); + } + + this.Name = name; + this.Metric = metric; + this.SimulationInfo = SimulationInfo.GetInstance(); + this.CurrentContext = CurrentContext.NewCurrentContext(); + } + } + + [Serializable] + class SensorMetric + { + public string SensorId; + public int FrameId; + public List SegmentedHistogram = new List(); + } + + [Serializable] + struct ObjectCountEntry + { + public string Label; + public uint Count; + } + + [Serializable] + struct CurrentContext + { + static USim.Manager s_Manager; + public double SimulationElapsedTime; + public double SimulationElapsedTimeUnscaled; + + public static CurrentContext NewCurrentContext() + { + if(s_Manager == null) { + s_Manager = USim.Manager.Instance; + } + + return new CurrentContext() { + SimulationElapsedTime = s_Manager.SimulationElapsedTime, + SimulationElapsedTimeUnscaled = s_Manager.SimulationElapsedTimeUnscaled, + }; + } + } + + /// SimulationInfo - Context that is unchanged for this entire simulation + [Serializable] + class SimulationInfo + { + public string ProjectId; + public string RunId; + public string ExecutionId; + public string AppParamId; + public string RunInstanceId; + public string AttemptId; + + public override string ToString() + { + return string.Format("{0}/{1}/{2}/{3}/{4}/{5}", + this.ProjectId, + this.RunId, + this.ExecutionId, + this.AppParamId, + this.RunInstanceId, + this.AttemptId); + } + + static SimulationInfo s_Context; + + public static SimulationInfo GetInstance() + { + if(s_Context != null) { + return s_Context; + } + + var config = USim.Configuration.Instance; + if(config.IsSimulationRunningInCloud()) { + s_Context = GetInstance(config.GetStoragePath()); + } else { + s_Context = new SimulationInfo() { + ProjectId = Guid.NewGuid().ToString(), + AppParamId = "urn:app_param_id:app_param_id", + ExecutionId = "urn:app_param_id:exn_id", + RunId = "urn:app_param_id:run_id", + RunInstanceId = "0", + AttemptId = "0" + }; + } + + return s_Context; + } + + static SimulationInfo GetInstance(string storagePath) + { + if(string.IsNullOrEmpty(storagePath)) { + throw new ArgumentException("Arg storagePath is null or empty"); + } + + const int expectedTokenCount = 8; + var tokens = storagePath.Split('/'); + if (tokens.Length < expectedTokenCount) { + var msg = "Storage path not in the expected format"; + Debug.LogError(msg); + throw new ArgumentException(msg); + } + + return new SimulationInfo() + { + ProjectId = tokens[1], + RunId = tokens[3], + ExecutionId = tokens[4], + AppParamId = tokens[5], + RunInstanceId = tokens[6], + AttemptId = tokens[7] + }; + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/MetricData.cs.meta b/com.unity.perception/Runtime/GroundTruth/MetricData.cs.meta new file mode 100644 index 000000000..4604293f6 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/MetricData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 21e0b364c4d364d4a8d36cd1b2648bb0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs b/com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs new file mode 100644 index 000000000..80eaf87b4 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs @@ -0,0 +1,208 @@ +#if HDRP_PRESENT + +using Unity.Collections.LowLevel.Unsafe; +using System; +using System.Collections.Generic; +using Unity.Collections; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering; + +namespace UnityEngine.Perception.Sensors +{ + /// + /// CustomPass which computes object count for each label in the given LabelingConfiguration in the frame. + /// Requires the texture produced by an InstanceSegmentationPass. + /// + public class ObjectCountPass : GroundTruthPass + { + const int k_StartingObjectCount = 1 << 8; + public RenderTexture SegmentationTexture; + public LabelingConfiguration LabelingConfiguration; + + ComputeShader m_ComputeShader; + ComputeBuffer m_InstanceIdPresenceMask; + ComputeBuffer m_InstanceIdToClassId; + ComputeBuffer m_ClassCounts; + NativeList m_InstanceIdToClassIdLookup; + HashSet m_CamerasRendered = new HashSet(); + bool m_IdBuffersNeedUpdating; + bool m_DidComputeLastFrame; + + public ObjectCountPass(Camera camera) : base(camera) + { + } + + // ReSharper disable once UnusedMember.Global + public ObjectCountPass() : base(null) + { + } + + public bool WriteToLog { get; set; } + + public override void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRenderer meshRenderer, Labeling labeling, uint instanceId) + { + if (!m_InstanceIdToClassIdLookup.IsCreated) + { + m_InstanceIdToClassIdLookup = new NativeList(k_StartingObjectCount, Allocator.Persistent); + } + if (LabelingConfiguration.TryGetMatchingConfigurationIndex(labeling, out var index)) + { + if (m_InstanceIdToClassIdLookup.Length <= instanceId) + { + m_InstanceIdToClassIdLookup.Resize((int)instanceId + 1, NativeArrayOptions.ClearMemory); + } + m_IdBuffersNeedUpdating = true; + m_InstanceIdToClassIdLookup[(int) instanceId] = index + 1; + } + } + + protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) + { + base.Setup(renderContext, cmd); + m_ComputeShader = Resources.Load("LabeledObjectHistogram"); + + var objectCount = k_StartingObjectCount; + UpdateIdBufferSizes(objectCount); + m_ClassCounts = new ComputeBuffer(LabelingConfiguration.LabelingConfigurations.Count + 1, UnsafeUtility.SizeOf(), ComputeBufferType.Structured); + m_DataLogger = new Unity.Simulation.Logger("LabelHistogram"); + + RenderPipelineManager.endCameraRendering += OnEndCameraRendering; + } + + void OnEndCameraRendering(ScriptableRenderContext renderContext, Camera camera) + { + } + + void UpdateIdBufferSizes(int objectCount) + { + var presenceMaskSizeNeeded = objectCount; + if (m_InstanceIdPresenceMask == null || presenceMaskSizeNeeded > m_InstanceIdPresenceMask.count) + { + m_InstanceIdPresenceMask?.Release(); + m_InstanceIdPresenceMask = new ComputeBuffer(presenceMaskSizeNeeded, UnsafeUtility.SizeOf(), ComputeBufferType.Structured); + } + + if (m_InstanceIdToClassId == null || m_InstanceIdToClassId.count < objectCount) + { + m_InstanceIdToClassId?.Release(); + m_InstanceIdToClassId = new ComputeBuffer(objectCount, UnsafeUtility.SizeOf(), ComputeBufferType.Structured); + } + } + + protected override void ExecutePass(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult) + { + //If there are no objects to label, skip the pass + if (!m_InstanceIdToClassIdLookup.IsCreated || m_InstanceIdToClassIdLookup.Length == 0) + { + var counts = new NativeArray(LabelingConfiguration.LabelingConfigurations.Count + 1, Allocator.Temp); + OnClassCountReadback(Time.frameCount, counts); + counts.Dispose(); + return; + } + + m_CamerasRendered.Add(hdCamera.camera); + + if (m_IdBuffersNeedUpdating) + { + UpdateIdBufferSizes(m_InstanceIdToClassIdLookup.Capacity); + m_InstanceIdToClassId.SetData(m_InstanceIdToClassIdLookup.AsArray()); + } + + //The following section kicks off the four kernels in LabeledObjectHistogram.compute + + //clear ClassCounts + cmd.SetComputeBufferParam(m_ComputeShader, 1, "ClassCounts", m_ClassCounts); + cmd.DispatchCompute(m_ComputeShader, 1, m_ClassCounts.count, 1, 1); + + //clear InstanceIdPresenceMask + cmd.SetComputeBufferParam(m_ComputeShader, 2, "InstanceIdPresenceMask", m_InstanceIdPresenceMask); + cmd.DispatchCompute(m_ComputeShader, 2, m_InstanceIdPresenceMask.count, 1, 1); + + //clear InstanceIdPresenceMask + cmd.SetComputeTextureParam(m_ComputeShader, 0, "SegmentationTexture", SegmentationTexture); + cmd.SetComputeBufferParam(m_ComputeShader, 0, "InstanceIdPresenceMask", m_InstanceIdPresenceMask); + cmd.SetComputeIntParam(m_ComputeShader, "Width", SegmentationTexture.width); + cmd.SetComputeIntParam(m_ComputeShader, "Height", SegmentationTexture.height); + cmd.DispatchCompute(m_ComputeShader, 0, SegmentationTexture.width, SegmentationTexture.height, 1); + + //clear InstanceIdPresenceMask + cmd.SetComputeBufferParam(m_ComputeShader, 3, "InstanceIdPresenceMask", m_InstanceIdPresenceMask); + cmd.SetComputeBufferParam(m_ComputeShader, 3, "InstanceIdToClassId", m_InstanceIdToClassId); + cmd.SetComputeBufferParam(m_ComputeShader, 3, "ClassCounts", m_ClassCounts); + cmd.DispatchCompute(m_ComputeShader, 3, m_InstanceIdToClassIdLookup.Length, 1, 1); + + var requestFrameCount = Time.frameCount; + cmd.RequestAsyncReadback(m_ClassCounts, request => OnClassCountReadback(requestFrameCount, request.GetData())); + } + + protected override void Cleanup() + { + base.Cleanup(); + m_InstanceIdPresenceMask?.Dispose(); + m_InstanceIdPresenceMask = null; + m_InstanceIdToClassId?.Dispose(); + m_InstanceIdToClassId = null; + m_ClassCounts?.Dispose(); + m_ClassCounts = null; + WaitForAllRequests(); + + if (m_InstanceIdToClassIdLookup.IsCreated) + { + m_InstanceIdToClassIdLookup.Dispose(); + m_InstanceIdToClassIdLookup = default; + } + } + + internal event Action, IReadOnlyList, int> ClassCountsReceived; + + Unity.Simulation.Logger m_DataLogger; + + void OnClassCountReadback(int requestFrameCount, NativeArray counts) + { +#if PERCEPTION_DEBUG + StringBuilder sb = new StringBuilder(); + sb.AppendFormat("Histogram data. Frame {0}", requestFrameCount.ToString()); + for (int i = 0; i < LabelingConfiguration.LabelingConfigurations.Count; i++) + { + sb.AppendFormat("{0}: {1}", LabelingConfiguration.LabelingConfigurations[i].label, + counts[i + 1].ToString()); + sb.AppendLine(); + } + Debug.Log(sb); +#endif + + if (WriteToLog) + { + //This is a bad pattern. We need to be able to log a JSON string without tons of allocations + var sensorMetric = new SensorMetric() { + FrameId = Time.frameCount + }; + var sensorMetricData = new MetricData( + "sensor_metric", + sensorMetric); + + for (int i = 0; i < LabelingConfiguration.LabelingConfigurations.Count; i++) + { + sensorMetric.SegmentedHistogram.Add(new ObjectCountEntry + { + Label = LabelingConfiguration.LabelingConfigurations[i].label, + Count = counts[i + 1] + }); + } + + m_DataLogger.Log(sensorMetricData); + } + + ClassCountsReceived?.Invoke(new NativeSlice(counts, 1), LabelingConfiguration.LabelingConfigurations, requestFrameCount); + } + + public void WaitForAllRequests() + { + var commandBuffer = CommandBufferPool.Get("LabelHistorgramCleanup"); + commandBuffer.WaitAllAsyncReadbackRequests(); + Graphics.ExecuteCommandBuffer(commandBuffer); + CommandBufferPool.Release(commandBuffer); + } + } +} +#endif diff --git a/com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs.meta b/com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs.meta new file mode 100644 index 000000000..83e27a018 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/ObjectCountPass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0e6829808d75dc849a5c29b6b547c0e1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs b/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs new file mode 100644 index 000000000..5e8d35b31 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs @@ -0,0 +1,702 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.IO; +using System.Linq; +using JetBrains.Annotations; +using Unity.Collections; +using Unity.Collections.LowLevel.Unsafe; +using Unity.Entities; +using Unity.Profiling; +using Unity.Simulation; +using UnityEngine; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Profiling; +using UnityEngine.Rendering; +#if HDRP_PRESENT +using UnityEngine.Rendering.HighDefinition; +#endif +using UnityEngine.Perception.Sensors; + +namespace UnityEngine.Perception +{ + /// + /// Captures ground truth from the associated Camera. + /// + [RequireComponent(typeof(Camera))] + public class PerceptionCamera : MonoBehaviour + { + const string k_SemanticSegmentationDirectory = "SemanticSegmentation"; + //TODO: Remove the Guid path when we have proper dataset merging in USim/Thea + internal static string RgbDirectory { get; } = $"RGB{Guid.NewGuid()}"; + static string s_RgbFilePrefix = "rgb_"; + const string k_SegmentationFilePrefix = "segmentation_"; + + /// + /// A human-readable description of the camera. + /// + public string description; + /// + /// The period in seconds that the Camera should render + /// + public float period = .0166f; + /// + /// The start time in seconds of the first frame in the simulation. + /// + public float startTime; + /// + /// Whether camera output should be captured to disk + /// + public bool captureRgbImages = true; + /// + /// Whether semantic segmentation images should be generated + /// + public bool produceSegmentationImages = true; + /// + /// Whether object counts should be computed + /// + public bool produceObjectCountAnnotations = true; + /// + /// The ID to use for object count annotations in the resulting dataset + /// + public string m_ObjectCountID = "51DA3C27-369D-4929-AEA6-D01614635CE2"; + /// + /// Whether object bounding boxes should be computed + /// + public bool produceBoundingBoxAnnotations = true; + /// + /// The ID to use for bounding box annotations in the resulting dataset + /// + public string m_BoundingBoxID = "F9F22E05-443F-4602-A422-EBE4EA9B55CB"; + /// + /// Whether visible pixels should be computed for each labeled object + /// + public bool produceVisiblePixelsMetric = true; + /// + /// The ID to use for visible pixels metrics in the resulting dataset + /// + public string m_VisiblePixelsID = "5BA92024-B3B7-41A7-9D3F-C03A6A8DDD01"; + /// + /// The corner of the image to use as the origin for bounding boxs. + /// + public BoundingBoxOrigin boundingBoxOrigin = BoundingBoxOrigin.TopLeft; + /// + /// The LabelingConfiguration to use for segmentation and object count. + /// + public LabelingConfiguration LabelingConfiguration; + + /// + /// Invoked when RenderedObjectInfos (bounding boxes) are calculated. The first parameter is the Time.frameCount at which the objects were rendered. This may be called many frames after the frame in which the objects were rendered. + /// + public event Action> renderedObjectInfosCalculated; + + internal event Action> segmentationImageReceived; + + internal event Action, IReadOnlyList, int> classCountsReceived; + + [NonSerialized] + internal RenderTexture m_LabelingTexture; + [NonSerialized] + internal RenderTexture m_SegmentationTexture; + + RenderTextureReader m_ClassLabelingTextureReader; + RenderTextureReader m_SegmentationReader; + RenderedObjectInfoGenerator m_RenderedObjectInfoGenerator; + Dictionary m_PersistentSensorData = new Dictionary(); + +#if URP_PRESENT + [NonSerialized] + internal InstanceSegmentationUrpPass instanceSegmentationUrpPass; + [NonSerialized] + internal SemanticSegmentationUrpPass semanticSegmentationUrpPass; +#endif + + bool m_CapturedLastFrame; + + EgoMarker m_EgoMarker; + + /// + /// The associated with this camera. Use this to report additional annotations and metrics at runtime. + /// + public SensorHandle SensorHandle { get; private set; } + + struct AsyncSemanticSegmentationWrite + { + public short[] dataArray; + public int width; + public int height; + public string path; + } + struct AsyncCaptureInfo + { + public int FrameCount; + public AsyncAnnotation SegmentationAsyncAnnotation; + public AsyncMetric ClassCountAsyncMetric; + public AsyncMetric VisiblePixelsAsyncMetric; + public AsyncAnnotation BoundingBoxAsyncMetric; + } + + List m_AsyncCaptureInfos = new List(); + + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "NotAccessedField.Local")] + struct ClassCountValue + { + public int label_id; + public string label_name; + public uint count; + } + + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "NotAccessedField.Local")] + struct BoundingBoxValue + { + public int label_id; + public string label_name; + public int instance_id; + public float x; + public float y; + public float width; + public float height; + } + + ClassCountValue[] m_ClassCountValues; + BoundingBoxValue[] m_BoundingBoxValues; + VisiblePixelsValue[] m_VisiblePixelsValues; + +#if HDRP_PRESENT + InstanceSegmentationPass m_SegmentationPass; + SemanticSegmentationPass m_SemanticSegmentationPass; + ObjectCountPass m_ObjectCountPass; +#endif + MetricDefinition m_ObjectCountMetricDefinition; + AnnotationDefinition m_BoundingBoxAnnotationDefinition; + AnnotationDefinition m_SegmentationAnnotationDefinition; + MetricDefinition m_VisiblePixelsMetricDefinition; + + static ProfilerMarker s_WriteFrame = new ProfilerMarker("Write Frame (PerceptionCamera)"); + static ProfilerMarker s_FlipY = new ProfilerMarker("Flip Y (PerceptionCamera)"); + static ProfilerMarker s_EncodeAndSave = new ProfilerMarker("Encode and save (PerceptionCamera)"); + static ProfilerMarker s_ClassCountCallback = new ProfilerMarker("OnClassLabelsReceived"); + static ProfilerMarker s_RenderedObjectInfosCalculatedEvent = new ProfilerMarker("renderedObjectInfosCalculated event"); + static ProfilerMarker s_BoundingBoxCallback = new ProfilerMarker("OnBoundingBoxesReceived"); + static ProfilerMarker s_ProduceVisiblePixelsMetric = new ProfilerMarker("ProduceVisiblePixelsMetric"); + + [SuppressMessage("ReSharper", "InconsistentNaming")] + struct SemanticSegmentationSpec + { + [UsedImplicitly] + public int label_id; + [UsedImplicitly] + public string label_name; + [UsedImplicitly] + public int pixel_value; + } + + [SuppressMessage("ReSharper", "InconsistentNaming")] + struct ObjectCountSpec + { + [UsedImplicitly] + public int label_id; + [UsedImplicitly] + public string label_name; + } + + /// + /// Add a data object which will be added to the dataset with each capture. Overrides existing sensor data associated with the given key. + /// + /// The key to associate with the data. + /// An object containing the data. Will be serialized into json. + public void SetPersistentSensorData(string key, object data) + { + m_PersistentSensorData[key] = data; + } + + /// + /// Removes a persistent sensor data object. + /// + /// The key of the object to remove. + /// True if a data object was removed. False if it was not set. + public bool RemovePersistentSensorData(string key) + { + return m_PersistentSensorData.Remove(key); + } + + // Start is called before the first frame update + void Awake() + { + //CaptureOptions.useAsyncReadbackIfSupported = false; + + m_EgoMarker = this.GetComponentInParent(); + var ego = m_EgoMarker == null ? SimulationManager.RegisterEgo("") : m_EgoMarker.Ego; + SensorHandle = SimulationManager.RegisterSensor(ego, "camera", description, period, startTime); + + var myCamera = GetComponent(); + var width = myCamera.pixelWidth; + var height = myCamera.pixelHeight; + + if ((produceSegmentationImages || produceObjectCountAnnotations || produceBoundingBoxAnnotations) && LabelingConfiguration == null) + { + Debug.LogError("LabelingConfiguration must be set if producing ground truth data"); + produceSegmentationImages = false; + produceObjectCountAnnotations = false; + produceBoundingBoxAnnotations = false; + } + + m_SegmentationTexture = new RenderTexture(new RenderTextureDescriptor(width, height, GraphicsFormat.R8G8B8A8_UNorm, 8)); + m_SegmentationTexture.name = "Segmentation"; + m_LabelingTexture = new RenderTexture(new RenderTextureDescriptor(width, height, GraphicsFormat.R8G8B8A8_UNorm, 8)); + m_LabelingTexture.name = "Labeling"; + +#if HDRP_PRESENT + var customPassVolume = this.GetComponent() ?? gameObject.AddComponent(); + customPassVolume.injectionPoint = CustomPassInjectionPoint.BeforeRendering; + customPassVolume.isGlobal = true; + m_SegmentationPass = new InstanceSegmentationPass() + { + name = "Segmentation Pass", + targetCamera = myCamera, + targetTexture = m_SegmentationTexture + }; + m_SegmentationPass.EnsureInit(); + m_SemanticSegmentationPass = new SemanticSegmentationPass(myCamera, m_LabelingTexture, LabelingConfiguration) + { + name = "Labeling Pass" + }; + + m_ObjectCountPass = new ObjectCountPass(myCamera) + { + name = "Label Histogram Pass", + SegmentationTexture = m_SegmentationTexture, + LabelingConfiguration = LabelingConfiguration, + WriteToLog = false + }; + + m_ObjectCountPass.ClassCountsReceived += OnClassCountsReceived; + + SetupPasses(customPassVolume); +#endif +#if URP_PRESENT + instanceSegmentationUrpPass = new InstanceSegmentationUrpPass(myCamera, m_SegmentationTexture); + semanticSegmentationUrpPass = new SemanticSegmentationUrpPass(myCamera, m_LabelingTexture, LabelingConfiguration); +#endif + + if (produceSegmentationImages) + { + var specs = LabelingConfiguration.LabelingConfigurations.Select((l, index) => new SemanticSegmentationSpec() + { + label_id = index, + label_name = l.label, + pixel_value = l.value + }).ToArray(); + + m_SegmentationAnnotationDefinition = SimulationManager.RegisterAnnotationDefinition("semantic segmentation", specs, "pixel-wise semantic segmentation label", "PNG"); + + m_ClassLabelingTextureReader = new RenderTextureReader(m_LabelingTexture, myCamera, + (frameCount, data, tex) => OnSemanticSegmentationImageRead(frameCount, data)); + } + + if (produceObjectCountAnnotations || produceBoundingBoxAnnotations) + { + var labelingMetricSpec = LabelingConfiguration.LabelingConfigurations.Select((l, index) => new ObjectCountSpec() + { + label_id = index, + label_name = l.label, + }).ToArray(); + + if (produceObjectCountAnnotations) + { + m_ObjectCountMetricDefinition = SimulationManager.RegisterMetricDefinition("object count", labelingMetricSpec, "Counts of objects for each label in the sensor's view", id: new Guid(m_ObjectCountID)); + } + + if (produceBoundingBoxAnnotations) + { + m_BoundingBoxAnnotationDefinition = SimulationManager.RegisterAnnotationDefinition("bounding box", labelingMetricSpec, "Bounding boxe for each labeled object visible to the sensor", id: new Guid(m_BoundingBoxID)); + } + + if (produceVisiblePixelsMetric) + m_VisiblePixelsMetricDefinition = SimulationManager.RegisterMetricDefinition("visible pixels", labelingMetricSpec, "Visible pixels for each visible object", id: new Guid(m_VisiblePixelsID)); + + m_RenderedObjectInfoGenerator = new RenderedObjectInfoGenerator(LabelingConfiguration); + World.DefaultGameObjectInjectionWorld.GetExistingSystem().Activate(m_RenderedObjectInfoGenerator); + + m_SegmentationReader = new RenderTextureReader(m_SegmentationTexture, myCamera, (frameCount, data, tex) => + { + if (segmentationImageReceived != null) + segmentationImageReceived(frameCount, data); + + m_RenderedObjectInfoGenerator.Compute(data, tex.width, boundingBoxOrigin, out var renderedObjectInfos, out var classCounts, Allocator.Temp); + + using (s_RenderedObjectInfosCalculatedEvent.Auto()) + renderedObjectInfosCalculated?.Invoke(frameCount, renderedObjectInfos); + + if (produceObjectCountAnnotations) + OnObjectCountsReceived(classCounts, LabelingConfiguration.LabelingConfigurations, frameCount); + + if (produceBoundingBoxAnnotations) + ProduceBoundingBoxesAnnotation(renderedObjectInfos, LabelingConfiguration.LabelingConfigurations, frameCount); + + if (produceVisiblePixelsMetric) + ProduceVisiblePixelsMetric(renderedObjectInfos, frameCount); + }); + } + + RenderPipelineManager.beginCameraRendering += OnBeginCameraRendering; + SimulationManager.SimulationEnding += OnSimulationEnding; + } + + struct VisiblePixelsValue + { + public int label_id; + public int instance_id; + public int visible_pixels; + } + + void ProduceVisiblePixelsMetric(NativeArray renderedObjectInfos, int frameCount) + { + using (s_ProduceVisiblePixelsMetric.Auto()) + { + var findResult = FindAsyncCaptureInfo(frameCount); + if (findResult.index == -1) + return; + var asyncCaptureInfo = findResult.asyncCaptureInfo; + var visiblePixelsAsyncMetric = asyncCaptureInfo.VisiblePixelsAsyncMetric; + if (!visiblePixelsAsyncMetric.IsValid) + return; + + if (m_VisiblePixelsValues == null || m_VisiblePixelsValues.Length != renderedObjectInfos.Length) + m_VisiblePixelsValues = new VisiblePixelsValue[renderedObjectInfos.Length]; + + for (var i = 0; i < renderedObjectInfos.Length; i++) + { + var objectInfo = renderedObjectInfos[i]; + if (!TryGetClassIdFromInstanceId(objectInfo.instanceId, out var labelId)) + continue; + + m_VisiblePixelsValues[i] = new VisiblePixelsValue + { + label_id = labelId, + instance_id = objectInfo.instanceId, + visible_pixels = objectInfo.pixelCount + }; + } + + visiblePixelsAsyncMetric.ReportValues(m_VisiblePixelsValues); + } + } + +#if HDRP_PRESENT + void SetupPasses(CustomPassVolume customPassVolume) + { + customPassVolume.customPasses.Remove(m_SegmentationPass); + customPassVolume.customPasses.Remove(m_SemanticSegmentationPass); + customPassVolume.customPasses.Remove(m_ObjectCountPass); + + if (produceSegmentationImages || produceObjectCountAnnotations) + customPassVolume.customPasses.Add(m_SegmentationPass); + + if (produceSegmentationImages) + customPassVolume.customPasses.Add(m_SemanticSegmentationPass); + + if (produceObjectCountAnnotations) + { + customPassVolume.customPasses.Add(m_ObjectCountPass); + } + } +#endif + + void ProduceBoundingBoxesAnnotation(NativeArray renderedObjectInfos, List labelingConfigurations, int frameCount) + { + using (s_BoundingBoxCallback.Auto()) + { + var findResult = FindAsyncCaptureInfo(frameCount); + if (findResult.index == -1) + return; + var asyncCaptureInfo = findResult.asyncCaptureInfo; + var boundingBoxAsyncAnnotation = asyncCaptureInfo.BoundingBoxAsyncMetric; + if (!boundingBoxAsyncAnnotation.IsValid) + return; + + if (m_BoundingBoxValues == null || m_BoundingBoxValues.Length != renderedObjectInfos.Length) + m_BoundingBoxValues = new BoundingBoxValue[renderedObjectInfos.Length]; + + for (var i = 0; i < renderedObjectInfos.Length; i++) + { + var objectInfo = renderedObjectInfos[i]; + if (!TryGetClassIdFromInstanceId(objectInfo.instanceId, out var labelId)) + continue; + + m_BoundingBoxValues[i] = new BoundingBoxValue + { + label_id = labelId, + label_name = labelingConfigurations[labelId].label, + instance_id = objectInfo.instanceId, + x = objectInfo.boundingBox.x, + y = objectInfo.boundingBox.y, + width = objectInfo.boundingBox.width, + height = objectInfo.boundingBox.height, + }; + } + + boundingBoxAsyncAnnotation.ReportValues(m_BoundingBoxValues); + } + } + + public bool TryGetClassIdFromInstanceId(int instanceId, out int labelId) + { + if (m_RenderedObjectInfoGenerator == null) + throw new InvalidOperationException($"{nameof(TryGetClassIdFromInstanceId)} can only be used when bounding box capture is enabled"); + return m_RenderedObjectInfoGenerator.TryGetLabelIdFromInstanceId(instanceId, out labelId); + } + + void OnObjectCountsReceived(NativeSlice counts, IReadOnlyList entries, int frameCount) + { + using (s_ClassCountCallback.Auto()) + { + classCountsReceived?.Invoke(counts, entries, frameCount); + + var findResult = FindAsyncCaptureInfo(frameCount); + if (findResult.index == -1) + return; + + var asyncCaptureInfo = findResult.asyncCaptureInfo; + var classCountAsyncMetric = asyncCaptureInfo.ClassCountAsyncMetric; + if (!classCountAsyncMetric.IsValid) + return; + + if (m_ClassCountValues == null || m_ClassCountValues.Length != entries.Count) + m_ClassCountValues = new ClassCountValue[entries.Count]; + + for (var i = 0; i < entries.Count; i++) + { + m_ClassCountValues[i] = new ClassCountValue() + { + label_id = i, + label_name = entries[i].label, + count = counts[i] + }; + } + + classCountAsyncMetric.ReportValues(m_ClassCountValues); + } + } + + (int index, AsyncCaptureInfo asyncCaptureInfo) FindAsyncCaptureInfo(int frameCount) + { + for (var i = 0; i < m_AsyncCaptureInfos.Count; i++) + { + var captureInfo = m_AsyncCaptureInfos[i]; + if (captureInfo.FrameCount == frameCount) + { + return (i, captureInfo); + } + } + + return (-1, default); + } + + // Update is called once per frame + void Update() + { + if (!SensorHandle.IsValid) + return; + + var camera = this.GetComponent(); + camera.enabled = SensorHandle.ShouldCaptureThisFrame; + + m_AsyncCaptureInfos.RemoveSwapBack(i => + !i.SegmentationAsyncAnnotation.IsPending && + !i.BoundingBoxAsyncMetric.IsPending && + !i.VisiblePixelsAsyncMetric.IsPending && + !i.ClassCountAsyncMetric.IsPending); + } + + void ReportAsyncAnnotations() + { + if (produceSegmentationImages || produceObjectCountAnnotations || produceBoundingBoxAnnotations || produceVisiblePixelsMetric) + { + var captureInfo = new AsyncCaptureInfo() + { + FrameCount = Time.frameCount + }; + if (produceSegmentationImages) + captureInfo.SegmentationAsyncAnnotation = SensorHandle.ReportAnnotationAsync(m_SegmentationAnnotationDefinition); + + if (produceObjectCountAnnotations) + captureInfo.ClassCountAsyncMetric = SensorHandle.ReportMetricAsync(m_ObjectCountMetricDefinition); + + if (produceBoundingBoxAnnotations) + captureInfo.BoundingBoxAsyncMetric = SensorHandle.ReportAnnotationAsync(m_BoundingBoxAnnotationDefinition); + + if (produceVisiblePixelsMetric) + captureInfo.VisiblePixelsAsyncMetric = SensorHandle.ReportMetricAsync(m_VisiblePixelsMetricDefinition); + + m_AsyncCaptureInfos.Add(captureInfo); + } + } + + void CaptureRgbData(Camera camera) + { + Profiler.BeginSample("CaptureDataFromLastFrame"); + if (!captureRgbImages) + return; + + var captureFilename = Path.Combine(Manager.Instance.GetDirectoryFor(RgbDirectory), $"{s_RgbFilePrefix}{Time.frameCount}.png"); + var dxRootPath = Path.Combine(RgbDirectory, $"{s_RgbFilePrefix}{Time.frameCount}.png"); + SensorHandle.ReportCapture(dxRootPath, SensorSpatialData.FromGameObjects(m_EgoMarker == null ? null : m_EgoMarker.gameObject, gameObject), m_PersistentSensorData.Select(kvp => (kvp.Key, kvp.Value)).ToArray()); + + Func, AsyncRequest.Result> colorFunctor = null; + var width = camera.pixelWidth; + var height = camera.pixelHeight; + var flipY = ShouldFlipY(camera); + + colorFunctor = r => + { + using (s_WriteFrame.Auto()) + { + var dataColorBuffer = (byte[])r.data.colorBuffer; + if (flipY) + FlipImageY(dataColorBuffer, height); + + byte[] encodedData; + using (s_EncodeAndSave.Auto()) + { + encodedData = ImageConversion.EncodeArrayToPNG(dataColorBuffer, GraphicsFormat.R8G8B8A8_UNorm, (uint)width, (uint)height); + } + + return !FileProducer.Write(captureFilename, encodedData) ? AsyncRequest.Result.Error : AsyncRequest.Result.Completed; + } + }; + + CaptureCamera.Capture(camera, colorFunctor); + + Profiler.EndSample(); + } + + // ReSharper disable once ParameterHidesMember + bool ShouldFlipY(Camera camera) + { +#if HDRP_PRESENT + var hdAdditionalCameraData = GetComponent(); + + //Based on logic in HDRenderPipeline.PrepareFinalBlitParameters + return camera.targetTexture != null || hdAdditionalCameraData.flipYMode == HDAdditionalCameraData.FlipYMode.ForceFlipY || camera.cameraType == CameraType.Game; +#elif URP_PRESENT + return false; +#else + return false; +#endif + } + + static unsafe void FlipImageY(byte[] dataColorBuffer, int height) + { + using (s_FlipY.Auto()) + { + var stride = dataColorBuffer.Length / height; + var buffer = new NativeArray(stride, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); + fixed (byte* colorBufferPtr = &dataColorBuffer[0]) + { + var unsafePtr = (byte*)buffer.GetUnsafePtr(); + for (var row = 0; row < height / 2; row++) + { + var nearRowStartPtr = colorBufferPtr + stride * row; + var oppositeRowStartPtr = colorBufferPtr + stride * (height - row - 1); + UnsafeUtility.MemCpy(unsafePtr, oppositeRowStartPtr, stride); + UnsafeUtility.MemCpy(oppositeRowStartPtr, nearRowStartPtr, stride); + UnsafeUtility.MemCpy(nearRowStartPtr, unsafePtr, stride); + } + } + buffer.Dispose(); + } + } + + void OnSimulationEnding() + { +#if HDRP_PRESENT + m_ObjectCountPass.WaitForAllRequests(); +#endif + m_ClassLabelingTextureReader?.WaitForAllImages(); + m_ClassLabelingTextureReader?.Dispose(); + m_ClassLabelingTextureReader = null; + + m_SegmentationReader?.WaitForAllImages(); + m_SegmentationReader?.Dispose(); + m_SegmentationReader = null; + + RenderPipelineManager.beginCameraRendering -= OnBeginCameraRendering; + } + + void OnBeginCameraRendering(ScriptableRenderContext _, Camera camera) + { + if (camera != GetComponent()) + return; + ReportAsyncAnnotations(); + CaptureRgbData(camera); + } + + void OnDisable() + { + SimulationManager.SimulationEnding -= OnSimulationEnding; + + OnSimulationEnding(); + + m_ClassLabelingTextureReader?.Dispose(); + m_ClassLabelingTextureReader = null; + if (m_SegmentationTexture != null) + m_SegmentationTexture.Release(); + + m_SegmentationTexture = null; + if (m_LabelingTexture != null) + m_LabelingTexture.Release(); + + if (m_RenderedObjectInfoGenerator != null) + { + World.DefaultGameObjectInjectionWorld.GetExistingSystem().Deactivate(m_RenderedObjectInfoGenerator); + m_RenderedObjectInfoGenerator?.Dispose(); + m_RenderedObjectInfoGenerator = null; + } + + if (SensorHandle.IsValid) + SensorHandle.Dispose(); + + SensorHandle = default; + + m_LabelingTexture = null; + } + + void OnSemanticSegmentationImageRead(int frameCount, NativeArray data) + { + var findResult = FindAsyncCaptureInfo(frameCount); + var asyncCaptureInfo = findResult.asyncCaptureInfo; + + var dxLocalPath = Path.Combine(k_SemanticSegmentationDirectory, k_SegmentationFilePrefix) + frameCount + ".png"; + var path = Path.Combine(Manager.Instance.GetDirectoryFor(k_SemanticSegmentationDirectory), k_SegmentationFilePrefix) + frameCount + ".png"; + var annotation = asyncCaptureInfo.SegmentationAsyncAnnotation; + if (!annotation.IsValid) + return; + + annotation.ReportFile(dxLocalPath); + + var asyncRequest = Manager.Instance.CreateRequest>(); + asyncRequest.data = new AsyncSemanticSegmentationWrite() + { + dataArray = data.ToArray(), + width = m_LabelingTexture.width, + height = m_LabelingTexture.height, + path = path + }; + asyncRequest.Start((r) => + { + Profiler.EndSample(); + Profiler.BeginSample("Encode"); + var pngBytes = ImageConversion.EncodeArrayToPNG(r.data.dataArray, GraphicsFormat.R8G8B8A8_UNorm, (uint)r.data.width, (uint)r.data.height); + Profiler.EndSample(); + Profiler.BeginSample("WritePng"); + File.WriteAllBytes(r.data.path, pngBytes); + Manager.Instance.ConsumerFileProduced(r.data.path); + Profiler.EndSample(); + return AsyncRequest.Result.Completed; + }); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs.meta b/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs.meta new file mode 100644 index 000000000..bc4b0f760 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/PerceptionCamera.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4467405dbcbd3d64ab4363e9ae8bb813 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs b/com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs new file mode 100644 index 000000000..af9d656a1 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs @@ -0,0 +1,156 @@ +using System; +using System.Linq; +using Unity.Collections; +using Unity.Profiling; +using Unity.Simulation; +using UnityEngine.Assertions; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Rendering; + +namespace UnityEngine.Perception.Sensors +{ + /// + /// RenderTextureReader reads a RenderTexture from the GPU each frame and passes the data back through a provided callback. + /// + public class RenderTextureReader : IDisposable where T : struct + { + RenderTexture m_Source; + int m_NumSwapFrames = 2; + + Action, RenderTexture> m_ImageReadCallback; + + struct ReadbackRequest + { + public AsyncGPUReadbackRequest asyncGpuReadbackRequest; + public int frameCount; + } + + // this array is 1:1 with the swap chain array and stores the readback requests for each texture + ReadbackRequest?[] m_ReadbackRequests; + + Action[] m_ReadbackRequestDelegates; + int m_NextSwapChainIndex; + int m_NextFrameToCapture; + + Texture2D m_CpuTexture; + Camera m_CameraRenderingToSource; + + ProfilerMarker m_WaitingForCompletionMarker = new ProfilerMarker("RenderTextureReader_WaitingForCompletion"); + + public RenderTextureReader(RenderTexture source, Camera cameraRenderingToSource, Action, RenderTexture> imageReadCallback) + { + this.m_Source = source; + this.m_ImageReadCallback = imageReadCallback; + this.m_CameraRenderingToSource = cameraRenderingToSource; + m_NextFrameToCapture = Time.frameCount; + + if (!GraphicsUtilities.SupportsAsyncReadback()) + { + m_CpuTexture = new Texture2D(m_Source.width, m_Source.height, m_Source.graphicsFormat, TextureCreationFlags.None); + m_NumSwapFrames = 0; + } + else + { + m_ReadbackRequests = new ReadbackRequest?[m_NumSwapFrames]; + m_ReadbackRequestDelegates = new Action[m_NumSwapFrames]; + for (var i = 0; i < m_NumSwapFrames; i++) + { + var iForDelegate = i; + m_ReadbackRequestDelegates[i] = request => OnGpuReadback(request, iForDelegate); + } + } + + RenderPipelineManager.endFrameRendering += OnEndFrameRendering; + } + + void OnEndFrameRendering(ScriptableRenderContext context, Camera[] cameras) + { +#if UNITY_EDITOR + if (UnityEditor.EditorApplication.isPaused) + return; +#endif + if (!cameras.Contains(m_CameraRenderingToSource)) + return; + + if (m_NextFrameToCapture > Time.frameCount) + return; + + m_NextFrameToCapture = Time.frameCount + 1; + + if (!GraphicsUtilities.SupportsAsyncReadback()) + { + RenderTexture.active = m_Source; + m_CpuTexture.ReadPixels(new Rect( + Vector2.zero, + new Vector2(m_Source.width, m_Source.height)), + 0, 0); + RenderTexture.active = null; + var data = m_CpuTexture.GetRawTextureData(); + m_ImageReadCallback(Time.frameCount, data, m_Source); + return; + } + + ProcessReadbackRequests(m_NextSwapChainIndex); + Assert.IsFalse(m_ReadbackRequests[m_NextSwapChainIndex].HasValue); + + m_ReadbackRequests[m_NextSwapChainIndex] = new ReadbackRequest + { + asyncGpuReadbackRequest = AsyncGPUReadback.Request(m_Source, 0, m_Source.graphicsFormat, m_ReadbackRequestDelegates[m_NextSwapChainIndex]), + frameCount = Time.frameCount + }; + + m_NextSwapChainIndex = (m_NextSwapChainIndex + 1) % m_NumSwapFrames; + } + + void OnGpuReadback(AsyncGPUReadbackRequest request, int swapChainIndex) + { + //TODO: add equality operators to AsyncGPUReadbackRequest + if (request.hasError) + { + Debug.LogError("Error reading segmentation image from GPU"); + } + else if (request.done && m_ImageReadCallback != null) + { + m_ImageReadCallback(m_ReadbackRequests[swapChainIndex].Value.frameCount, request.GetData(), m_Source); + } + m_ReadbackRequests[swapChainIndex] = null; + } + + void ProcessReadbackRequests( int swapChainIndexToForce = -1, bool forceAll = false) + { + for (var i = 0; i < m_NumSwapFrames; i++) + { + var currentReadbackRequest = m_ReadbackRequests[i]; + if (currentReadbackRequest.HasValue) + { + var readbackRequest = currentReadbackRequest.Value.asyncGpuReadbackRequest; + + if (swapChainIndexToForce == i || forceAll) + { + using (m_WaitingForCompletionMarker.Auto()) + readbackRequest.WaitForCompletion(); + + m_ReadbackRequests[i] = null; + } + } + } + } + + public void WaitForAllImages() + { + ProcessReadbackRequests(forceAll: true); + } + + public void Dispose() + { + WaitForAllImages(); + + RenderPipelineManager.endFrameRendering -= OnEndFrameRendering; + if (m_CpuTexture != null) + { + Object.Destroy(m_CpuTexture); + m_CpuTexture = null; + } + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs.meta b/com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs.meta new file mode 100644 index 000000000..dc7ced080 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/RenderTextureReader.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 50ff3d5271f06224bbdd42d0b5cf7aac +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs new file mode 100644 index 000000000..2cc94fe36 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs @@ -0,0 +1,39 @@ +using System; + +namespace UnityEngine.Perception +{ + public struct RenderedObjectInfo : IEquatable + { + public int instanceId; + public int labelId; + public Rect boundingBox; + public int pixelCount; + + public override string ToString() + { + return $"{nameof(instanceId)}: {instanceId}, {nameof(labelId)}: {labelId}, {nameof(boundingBox)}: {boundingBox}, {nameof(pixelCount)}: {pixelCount}"; + } + + public bool Equals(RenderedObjectInfo other) + { + return instanceId == other.instanceId && labelId == other.labelId && boundingBox.Equals(other.boundingBox) && pixelCount == other.pixelCount; + } + + public override bool Equals(object obj) + { + return obj is RenderedObjectInfo other && Equals(other); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = instanceId; + hashCode = (hashCode * 397) ^ labelId; + hashCode = (hashCode * 397) ^ boundingBox.GetHashCode(); + hashCode = (hashCode * 397) ^ pixelCount; + return hashCode; + } + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs.meta b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs.meta new file mode 100644 index 000000000..c509db59d --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfo.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6ea3afa1e6894670b3ab6e08d772f3a7 +timeCreated: 1581522735 \ No newline at end of file diff --git a/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs new file mode 100644 index 000000000..56273d197 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs @@ -0,0 +1,248 @@ +using System; +using Unity.Burst; +using Unity.Collections; +using Unity.Collections.LowLevel.Unsafe; +using Unity.Jobs; +using Unity.Mathematics; +using Unity.Profiling; +using UnityEngine.Rendering; +using UnityEngine.Perception.Sensors; + +namespace UnityEngine.Perception +{ + /// + /// A CPU-based pass which computes bounding box and pixel counts per-object from instance segmentation images + /// + public class RenderedObjectInfoGenerator : IGroundTruthGenerator, IDisposable + { + static ProfilerMarker s_LabelJobs = new ProfilerMarker("Label Jobs"); + static ProfilerMarker s_LabelMerge = new ProfilerMarker("Label Merge"); + + const int k_StartingObjectCount = 1 << 8; + + struct Object1DSpan + { + public int instanceId; + public int row; + public int left; + public int right; + } + [BurstCompile] + struct ComputeHistogramPerRowJob : IJob + { + [ReadOnly] + public NativeSlice segmentationImageData; + public int width; + public int rows; + public int rowStart; + [NativeDisableContainerSafetyRestriction] + public NativeList boundingBoxes; + + public void Execute() + { + for (var row = 0; row < rows; row++) + { + var rowSlice = new NativeSlice(segmentationImageData, width * row, width); + var currentBB = new Object1DSpan + { + instanceId = -1, + row = row + rowStart + }; + for (var i = 0; i < rowSlice.Length; i++) + { + var value = rowSlice[i]; + + if (value != currentBB.instanceId) + { + if (currentBB.instanceId > 0) + { + //save off currentBB + currentBB.right = i - 1; + boundingBoxes.Add(currentBB); + } + + currentBB = new Object1DSpan + { + instanceId = (int)value, + left = i, + row = row + rowStart + }; + } + } + + if (currentBB.instanceId > 0) + { + //save off currentBB + currentBB.right = width - 1; + boundingBoxes.Add(currentBB); + } + } + } + } + + NativeList m_InstanceIdToClassIdLookup; + LabelingConfiguration m_LabelingConfiguration; + + /// + /// Create a new CpuRenderedObjectInfoPass with the given LabelingConfiguration. + /// + /// The LabelingConfiguration to use to determine labelId. Should match the + /// one used by the generating the input image. See + public RenderedObjectInfoGenerator(LabelingConfiguration labelingConfiguration) + { + m_LabelingConfiguration = labelingConfiguration; + m_InstanceIdToClassIdLookup = new NativeList(k_StartingObjectCount, Allocator.Persistent); + } + + /// + public void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRenderer meshRenderer, Labeling labeling, uint instanceId) + { + if (m_LabelingConfiguration.TryGetMatchingConfigurationIndex(labeling, out var index)) + { + if (m_InstanceIdToClassIdLookup.Length <= instanceId) + { + m_InstanceIdToClassIdLookup.Resize((int)instanceId + 1, NativeArrayOptions.ClearMemory); + } + + m_InstanceIdToClassIdLookup[(int)instanceId] = index; + } + } + + /// + /// Compute RenderedObjectInfo for each visible object in the given instance segmentation image. + /// InstanceSegmentationRawData should be the raw data from a texture filled by + /// using the same LabelingConfiguration that was passed into this object. + /// + /// + /// + /// + /// + /// + /// + public void Compute(NativeArray instanceSegmentationRawData, int stride, BoundingBoxOrigin boundingBoxOrigin, out NativeArray boundingBoxes, out NativeArray classCounts, Allocator allocator) + { + const int jobCount = 24; + var height = instanceSegmentationRawData.Length / stride; + //special math to round up + var rowsPerJob = height / jobCount; + var rowRemainder = height % jobCount; + var handles = new NativeArray(jobCount, Allocator.Temp); + var jobBoundingBoxLists = new NativeList[jobCount]; + using (s_LabelJobs.Auto()) + { + for (int row = 0, jobIndex = 0; row < height; row += rowsPerJob, jobIndex++) + { + jobBoundingBoxLists[jobIndex] = new NativeList(10, Allocator.TempJob); + var rowsThisJob = math.min(height - row, rowsPerJob); + if (jobIndex < rowRemainder) + rowsThisJob++; + + handles[jobIndex] = new ComputeHistogramPerRowJob + { + segmentationImageData = new NativeSlice(instanceSegmentationRawData, row * stride, stride * rowsThisJob), + width = stride, + rowStart = row, + rows = rowsThisJob, + boundingBoxes = jobBoundingBoxLists[jobIndex] + }.Schedule(); + + if (jobIndex < rowRemainder) + row++; + } + + JobHandle.CompleteAll(handles); + } + + classCounts = new NativeArray(m_LabelingConfiguration.LabelingConfigurations.Count, allocator); + var boundingBoxMap = new NativeHashMap(100, Allocator.Temp); + using (s_LabelMerge.Auto()) + { + foreach (var boundingBoxList in jobBoundingBoxLists) + { + if (!boundingBoxList.IsCreated) + continue; + + foreach (var info1D in boundingBoxList) + { + var objectInfo = new RenderedObjectInfo + { + boundingBox = new Rect(info1D.left, info1D.row, info1D.right - info1D.left + 1, 1), + instanceId = info1D.instanceId, + pixelCount = info1D.right - info1D.left + 1 + }; + + if (boundingBoxMap.TryGetValue(info1D.instanceId, out var info)) + { + objectInfo.boundingBox = Rect.MinMaxRect( + math.min(info.boundingBox.xMin, objectInfo.boundingBox.xMin), + math.min(info.boundingBox.yMin, objectInfo.boundingBox.yMin), + math.max(info.boundingBox.xMax, objectInfo.boundingBox.xMax), + math.max(info.boundingBox.yMax, objectInfo.boundingBox.yMax)); + objectInfo.pixelCount += info.pixelCount; + } + + boundingBoxMap[info1D.instanceId] = objectInfo; + } + } + + var keyValueArrays = boundingBoxMap.GetKeyValueArrays(Allocator.Temp); + boundingBoxes = new NativeArray(keyValueArrays.Keys.Length, allocator); + for (var i = 0; i < keyValueArrays.Keys.Length; i++) + { + var instanceId = keyValueArrays.Keys[i]; + if (m_InstanceIdToClassIdLookup.Length <= instanceId) + continue; + + var classId = m_InstanceIdToClassIdLookup[instanceId]; + classCounts[classId]++; + var renderedObjectInfo = keyValueArrays.Values[i]; + var boundingBox = renderedObjectInfo.boundingBox; + if (boundingBoxOrigin == BoundingBoxOrigin.TopLeft) + { + var y = height - boundingBox.yMax; + boundingBox = new Rect(boundingBox.x, y, boundingBox.width, boundingBox.height); + } + boundingBoxes[i] = new RenderedObjectInfo + { + instanceId = instanceId, + labelId = classId, + boundingBox = boundingBox, + pixelCount = renderedObjectInfo.pixelCount + }; + } + keyValueArrays.Dispose(); + } + + boundingBoxMap.Dispose(); + foreach (var rowBoundingBox in jobBoundingBoxLists) + { + if (rowBoundingBox.IsCreated) + rowBoundingBox.Dispose(); + } + + handles.Dispose(); + } + + /// + /// Attempts to find the label id for the given instance id using the LabelingConfiguration passed into the constructor. + /// + /// The instanceId of the object for which the labelId should be found + /// The labelId of the object. -1 if not found + /// True if a labelId is found for the given instanceId. + public bool TryGetLabelIdFromInstanceId(int instanceId, out int labelId) + { + labelId = -1; + if (m_InstanceIdToClassIdLookup.Length <= instanceId) + return false; + + labelId = m_InstanceIdToClassIdLookup[instanceId]; + return true; + } + + /// + public void Dispose() + { + m_InstanceIdToClassIdLookup.Dispose(); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs.meta b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs.meta new file mode 100644 index 000000000..fc133f218 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/RenderedObjectInfoGenerator.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5de9054094e68c640bf24e44e335d677 +timeCreated: 1580322194 \ No newline at end of file diff --git a/com.unity.perception/Runtime/GroundTruth/Resources.meta b/com.unity.perception/Runtime/GroundTruth/Resources.meta new file mode 100644 index 000000000..a52c97c4e --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: afff82e05c58c4db9968746e171f04f2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader b/com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader new file mode 100644 index 000000000..c6edf6771 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader @@ -0,0 +1,49 @@ +Shader "Perception/InstanceSegmentation" +{ + Properties + { + [PerObjectData] _SegmentationId("Segmentation ID", int) = 0 + } + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + Pass + { + Tags { "LightMode" = "SRP" } + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl" + + struct appdata + { + float4 vertex : POSITION; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + }; + + uint _SegmentationId; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + return float4(UnpackUIntToFloat((uint)_SegmentationId, 0, 8), UnpackUIntToFloat(_SegmentationId, 8, 8), UnpackUIntToFloat(_SegmentationId, 16, 8), UnpackUIntToFloat(_SegmentationId, 24, 8)); + } + ENDCG + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader.meta b/com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader.meta new file mode 100644 index 000000000..cfab48e4b --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Resources/InstanceSegmentation.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: f8bd15da542149242aa5a7a262408062 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute b/com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute new file mode 100644 index 000000000..1882e525c --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute @@ -0,0 +1,78 @@ +// Each #kernel tells which function to compile; you can have many kernels +#pragma kernel PresenseMask +#pragma kernel ClearCounts +#pragma kernel ClearPresenceMask +#pragma kernel CombineCounts + +#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" +#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl" + +// Create a RenderTexture with enableRandomWrite flag and set it +// with cs.SetTexture +Texture2D SegmentationTexture; +SamplerState sampler_SegmentationTexture; + +StructuredBuffer InstanceIdToClassId; + +RWStructuredBuffer InstanceIdPresenceMask; +RWStructuredBuffer ClassCounts; + +uint Width; +uint Height; + +uint SampleSegmentationTexture(uint2 pixelCoord) +{ + float2 sampleCoord = pixelCoord + float2(.5, .5); + float4 segmentationSample = SegmentationTexture.SampleLevel(sampler_SegmentationTexture, sampleCoord * float2(1/(float)Width, 1/(float)Height), 0); + uint objectId = PackFloatToUInt(segmentationSample.x, 0, 8) + PackFloatToUInt(segmentationSample.y, 8, 8) + PackFloatToUInt(segmentationSample.z, 16, 8) + PackFloatToUInt(segmentationSample.w, 24, 8); + return objectId; +} + +// For each pixel in the segmentation image, set InstanceIdPresenceMask[pixelValue] to 1 +[numthreads(8,8,1)] +void PresenseMask (uint3 id : SV_DispatchThreadID) +{ + uint instanceId = SampleSegmentationTexture(id.xy); + if (instanceId != 0) + InstanceIdPresenceMask[instanceId] = 1; + + //Attempt at packing presense into single bits. Good for memory, bad for perf due to InterlockedOr. + + //int bitOffset = objectId % 32; + //int maskOffset = objectId / 32; + + //InterlockedOr(IdPresenceMask[maskOffset], 1 << bitOffset); +} + +[numthreads(8,1,1)] +void ClearCounts (uint3 id : SV_DispatchThreadID) +{ + ClassCounts[id.x] = 0; +} + +[numthreads(8,1,1)] +void ClearPresenceMask(uint3 id : SV_DispatchThreadID) +{ + InstanceIdPresenceMask[id.x] = 0; +} + +// For instanceId in InstanceIdPresenceMask, increment the corresponding class count. Uses InterlockedAdd, which may be a significant bottleneck. +[numthreads(8,1,1)] +void CombineCounts (uint3 id : SV_DispatchThreadID) +{ + uint mask = InstanceIdPresenceMask[id.x]; + if (mask > 0) + InterlockedAdd(ClassCounts[InstanceIdToClassId[id.x]], 1); + + //Attempt at packing presense into single bits. Good for memory, bad for perf due to InterlockedOr in PresenseMask(...). + + //int idStart = id.x * 32; + //for(int i = 0; i < 32 ; i++) + //{ + // bool isPresent = mask & 1 << i; + // if (isPresent) + // { + // InterlockedAdd(ClassCounts[InstanceIdToClassId[idStart + i]], 1); + // } + //} +} \ No newline at end of file diff --git a/com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute.meta b/com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute.meta new file mode 100644 index 000000000..0073b4a4d --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Resources/LabeledObjectHistogram.compute.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 83bf85242eedd564a8daf8b59ecc739a +ComputeShaderImporter: + externalObjects: {} + currentAPIMask: 4 + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader b/com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader new file mode 100644 index 000000000..f92140dd5 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader @@ -0,0 +1,70 @@ +Shader "Perception/SemanticSegmentation" +{ + Properties + { + [PerObjectData] LabelingId("Labeling Id", int) = 0 + } + + HLSLINCLUDE + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + + //enable GPU instancing support + #pragma multi_compile_instancing + + ENDHLSL + + SubShader + { + Tags { "RenderType"="Opaque" } + LOD 100 + + Pass + { + Tags { "LightMode" = "SRP" } + + Blend Off + ZWrite On + ZTest LEqual + + Cull Back + + CGPROGRAM + + #pragma vertex vert + #pragma fragment frag + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl" + + uint LabelingId; + + struct appdata + { + float4 vertex : POSITION; + }; + + struct v2f + { + float4 vertex : SV_POSITION; + }; + + uint _SegmentationId; + + v2f vert (appdata v) + { + v2f o; + o.vertex = UnityObjectToClipPos(v.vertex); + return o; + } + + fixed4 frag (v2f i) : SV_Target + { + return float4(UnpackUIntToFloat((uint)LabelingId, 0, 8), UnpackUIntToFloat((uint)LabelingId, 8, 8), 0, 1.0); + } + + ENDCG + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader.meta b/com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader.meta new file mode 100644 index 000000000..d1cef5441 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/Resources/SemanticSegmentation.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 26e13d5ef4d152a4c815d9316d2c1a2b +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs new file mode 100644 index 000000000..79c09cfd3 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs @@ -0,0 +1,64 @@ +using System; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Rendering; + +namespace UnityEngine.Perception.Sensors +{ + /// + /// Custom Pass which renders labeled images where each object labeled with a Labeling component is drawn with the + /// value specified by the given LabelingConfiguration. + /// + public class SemanticSegmentationCrossPipelinePass : GroundTruthCrossPipelinePass + { + const string k_ShaderName = "Perception/SemanticSegmentation"; + static readonly int k_LabelingId = Shader.PropertyToID("LabelingId"); + + LabelingConfiguration m_LabelingConfiguration; + + //Serialize the shader so that the shader asset is included in player builds when the SemanticSegmentationPass is used. + //Currently commented out and shaders moved to Resources folder due to serialization crashes when it is enabled. + //See https://fogbugz.unity3d.com/f/cases/1187378/ + //[SerializeField] + Shader m_ClassLabelingShader; + Material m_OverrideMaterial; + + public SemanticSegmentationCrossPipelinePass(Camera targetCamera, LabelingConfiguration labelingConfiguration) : base(targetCamera) + { + this.m_LabelingConfiguration = labelingConfiguration; + } + + public override void Setup() + { + base.Setup(); + m_ClassLabelingShader = Shader.Find(k_ShaderName); + var shaderVariantCollection = new ShaderVariantCollection(); + shaderVariantCollection.Add(new ShaderVariantCollection.ShaderVariant(m_ClassLabelingShader, PassType.ScriptableRenderPipeline)); + shaderVariantCollection.WarmUp(); + + m_OverrideMaterial = new Material(m_ClassLabelingShader); + } + + protected override void ExecutePass(ScriptableRenderContext renderContext, CommandBuffer cmd, Camera camera, CullingResults cullingResult) + { + var renderList = CreateRendererListDesc(camera, cullingResult, "FirstPass", 0, m_OverrideMaterial, -1); + cmd.ClearRenderTarget(true, true, Color.clear); + DrawRendererList(renderContext, cmd, RendererList.Create(renderList)); + } + + public override void SetupMaterialProperties(MaterialPropertyBlock mpb, MeshRenderer meshRenderer, Labeling labeling, uint instanceId) + { + var entry = new LabelingConfigurationEntry(); + foreach (var l in m_LabelingConfiguration.LabelingConfigurations) + { + if (labeling.classes.Contains(l.label)) + { + entry = l; + break; + } + } + + //Set the labeling ID so that it can be accessed in ClassSemanticSegmentationPass.shader + mpb.SetInt(k_LabelingId, entry.value); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs.meta b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs.meta new file mode 100644 index 000000000..6289353b5 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationCrossPipelinePass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a6740ca70f44ece45901dc26511f9aa0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs new file mode 100644 index 000000000..4bda66ba8 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs @@ -0,0 +1,55 @@ +#if HDRP_PRESENT + +using System; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; + +namespace UnityEngine.Perception.Sensors +{ + /// + /// Custom Pass which renders labeled images where each object with a Labeling component is drawn with the value + /// specified by the given LabelingConfiguration. + /// + public class SemanticSegmentationPass : CustomPass + { + public RenderTexture targetTexture; + public LabelingConfiguration labelingConfiguration; + public Camera targetCamera; + + SemanticSegmentationCrossPipelinePass m_SemanticSegmentationCrossPipelinePass; + + public SemanticSegmentationPass(Camera targetCamera, RenderTexture targetTexture, LabelingConfiguration labelingConfiguration) + { + this.targetTexture = targetTexture; + this.labelingConfiguration = labelingConfiguration; + this.targetCamera = targetCamera; + EnsureInit(); + } + + void EnsureInit() + { + if (m_SemanticSegmentationCrossPipelinePass == null) + { + m_SemanticSegmentationCrossPipelinePass = new SemanticSegmentationCrossPipelinePass(targetCamera, labelingConfiguration); + m_SemanticSegmentationCrossPipelinePass.EnsureActivated(); + } + } + + public SemanticSegmentationPass() + { + } + + protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) + { + EnsureInit(); + m_SemanticSegmentationCrossPipelinePass.Setup(); + } + + protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult) + { + CoreUtils.SetRenderTarget(cmd, targetTexture, ClearFlag.All); + m_SemanticSegmentationCrossPipelinePass.Execute(renderContext, cmd, hdCamera.camera, cullingResult); + } + } +} +#endif diff --git a/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs.meta b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs.meta new file mode 100644 index 000000000..5c97139db --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SemanticSegmentationPass.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6d4bfcc857cac4d4ab70b19c87508947 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs b/com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs new file mode 100644 index 000000000..29303ca0a --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs @@ -0,0 +1,13 @@ +using System; +using Unity.Entities; + +namespace UnityEngine.Perception +{ + class SimulationManagementComponentSystem : ComponentSystem + { + protected override void OnUpdate() + { + SimulationManager.SimulationState?.Update(); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs.meta b/com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs.meta new file mode 100644 index 000000000..462b15bd3 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationManagementComponentSystem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8dfdda78cfa74c6991ac2d757d8e7019 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationManager.cs b/com.unity.perception/Runtime/GroundTruth/SimulationManager.cs new file mode 100644 index 000000000..3c6946a84 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationManager.cs @@ -0,0 +1,759 @@ +using System; +using JetBrains.Annotations; +using Newtonsoft.Json.Linq; +using Unity.Simulation; +using UnityEngine; + +#pragma warning disable 649 +namespace UnityEngine.Perception +{ + /// + /// Global manager for frame scheduling and output capture for simulations. + /// Data capture follows the schema defined in *TODO: Expose schema publicly* + /// + public static class SimulationManager + { + static readonly Guid k_DatasetGuid = Guid.NewGuid(); + internal static SimulationState SimulationState { get; private set; } = CreateSimulationData(); + + internal static string OutputDirectory => SimulationState.OutputDirectory; + + /// + /// The json metadata schema version the SimulationManager's output conforms to. + /// + public static string SchemaVersion => "0.0.1"; + + public static event Action SimulationEnding; + + /// + /// Register a new ego. Used along with RegisterSensor to organize sensors under a top-level ego container. + /// + /// A human-readable description for the ego + /// An , which can be used to organize sensors under a common ego. + public static Ego RegisterEgo(string description) + { + var ego = new Ego(Guid.NewGuid(), description); + SimulationState.AddEgo(ego); + return ego; + } + + /// + /// Register a new sensor under the given ego. + /// + /// The ego container for the sensor. Sensor orientation will be reported in the context of the given ego. + /// The kind of the sensor (ex. "camera", "lidar") + /// A human-readable description of the sensor (ex. "front-left rgb camera") + /// The period, in seconds, on which the sensor should capture. Frames will be scheduled in the simulation such that each sensor is triggered every _period_ seconds. + /// The time, in seconds, from the start of the sequence on which this sensor should first be scheduled. + /// A , which should be used to check each frame to determine whether to capture (or render) that frame. + /// It is also used to report captures, annotations, and metrics on the sensor. + /// Thrown if ego is invalid. + public static SensorHandle RegisterSensor(Ego ego, string modality, string description, float period, float firstCaptureTime) + { + if (!SimulationState.Contains(ego.Id)) + throw new ArgumentException("Supplied ego is not part of the simulation.", nameof(ego)); + + var sensor = new SensorHandle(Guid.NewGuid()); + SimulationState.AddSensor(ego, modality, description, period, firstCaptureTime, sensor); + return sensor; + } + + /// + /// Creates a metric type, which can be used to produce metrics during the simulation. + /// See , , , + /// , , + /// + /// Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) + /// Description of the annotation. + /// The ID for this metric. This allows metric types to be shared across simulations and sequences. + /// A MetricDefinition, which can be used during this simulation to report metrics. + public static MetricDefinition RegisterMetricDefinition(string name, string description = null, Guid id = default) + { + return RegisterMetricDefinition(name, null, description, id); + } + + /// + /// Creates a metric type, which can be used to produce metrics during the simulation. + /// See , , , + /// , , + /// + /// Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) + /// Description of the annotation. + /// Format-specific specification for the metric values + /// The ID for this metric. This allows metric types to be shared across simulations and sequences. + /// A MetricDefinition, which can be used during this simulation to report metrics. + public static MetricDefinition RegisterMetricDefinition(string name, TSpec[] specValues, string description = null, Guid id = default) + { + return SimulationState.RegisterMetricDefinition(name, specValues, description, id); + } + + /// + /// Creates an annotation type, which can be used to produce annotations during the simulation. + /// See , and . + /// + /// Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) + /// Description of the annotation. + /// Optional format name. + /// The ID for this annotation type. This allows annotation types to be shared across simulations and sequences. + /// An AnnotationDefinition. If the given has already been defined, its AnnotationDefinition is returned. + public static AnnotationDefinition RegisterAnnotationDefinition(string name, string description = null, string format = "json", Guid id = default) + { + return RegisterAnnotationDefinition(name, null, description, format, id); + } + + /// + /// Creates an annotation type, which can be used to produce annotations during the simulation. + /// See , and . + /// + /// Human readable annotation spec name (e.g. sementic_segmentation, instance_segmentation, etc.) + /// Description of the annotation. + /// Optional format name. + /// Format-specific specification for the annotation values (ex. label-value mappings for semantic segmentation images) + /// The ID for this annotation type. This allows annotation types to be shared across simulations and sequences. + /// The type of the values for the spec array in the resulting json. + /// An AnnotationDefinition. If the given has already been defined, its AnnotationDefinition is returned. + public static AnnotationDefinition RegisterAnnotationDefinition(string name, TSpec[] specValues, string description = null, string format = "json", Guid id = default) + { + return SimulationState.RegisterAnnotationDefinition(name, specValues, description, format, id); + } + + /// + /// Report a metric not associated with any sensor or annotation. + /// + /// The MetricDefinition associated with this metric. + /// An array to be converted to json and put in the "values" field of the metric + public static void ReportMetric(MetricDefinition metricDefinition, T[] values) + { + SimulationState.ReportMetric(metricDefinition, values, default, default); + } + + /// + /// Report a metric not associated with any sensor or annotation. + /// + /// The MetricDefinition associated with this metric. + /// A string-based JSON array to be placed in the "values" field of the metric + public static void ReportMetric(MetricDefinition metricDefinition, string valuesJsonArray) + { + SimulationState.ReportMetric(metricDefinition, new JRaw(valuesJsonArray), default, default); + } + + /// + /// Report a metric not associated with any sensor or annotation. + /// + /// + public static AsyncMetric ReportMetricAsync(MetricDefinition metricDefinition) => SimulationState.CreateAsyncMetric(metricDefinition); + + /// + /// Starts a new sequence in the capture. + /// + public static void StartNewSequence() => SimulationState.StartNewSequence(); + + internal static bool IsValid(Guid id) => SimulationState.Contains(id); + + static SimulationState CreateSimulationData() + { + //TODO: Remove the Guid path when we have proper dataset merging in USim/Thea + return new SimulationState(Manager.Instance.GetDirectoryFor($"Dataset{k_DatasetGuid}")); + } + + [RuntimeInitializeOnLoadMethod] + static void OnInitializeOnLoad() + { + Manager.Instance.ShutdownNotification += ResetSimulation; + } + + internal static void ResetSimulation() + { + //this order ensures that exceptions thrown by End() do not prevent the state from being reset + SimulationEnding?.Invoke(); + var oldSimulationState = SimulationState; + SimulationState = CreateSimulationData(); + oldSimulationState.End(); + } + } + + /// + /// A handle to a sensor managed by the . It can be used to check whether the sensor + /// is expected to capture this frame and report captures, annotations, and metrics regarding the sensor. + /// + public struct SensorHandle : IDisposable, IEquatable + { + /// + /// The unique ID of the sensor. This ID is used to refer to this sensor in the json metadata. + /// + public Guid Id { get; } + + internal SensorHandle(Guid id) + { + Id = id; + } + + /// + /// Whether the sensor is currently enabled. When disabled, the SimulationManager will no longer schedule frames for running captures on this sensor. + /// + public bool Enabled + { + get => SimulationManager.SimulationState.IsEnabled(this); + set + { + CheckValid(); + SimulationManager.SimulationState.SetEnabled(this, value); + } + } + + /// + /// Report a file-based annotation related to this sensor in this frame. + /// + /// The AnnotationDefinition of this annotation. + /// The path to the file containing the annotation data. + /// A handle to the reported annotation for reporting annotation-based metrics. + /// Thrown if this method is called during a frame where is false. + /// Thrown if the given AnnotationDefinition is invalid. + public Annotation ReportAnnotationFile(AnnotationDefinition annotationDefinition, string filename) + { + if (!ShouldCaptureThisFrame) + throw new InvalidOperationException("Annotation reported on SensorHandle in frame when its ShouldCaptureThisFrame is false."); + if (!annotationDefinition.IsValid) + throw new ArgumentException("The given annotationDefinition is invalid", nameof(annotationDefinition)); + + return SimulationManager.SimulationState.ReportAnnotationFile(annotationDefinition, this, filename); + } + + /// + /// Report a value-based annotation related to this sensor in this frame. + /// + /// The AnnotationDefinition of this annotation. + /// The annotation data. + /// A handle to the reported annotation for reporting annotation-based metrics. + /// Thrown if this method is called during a frame where is false. + /// Thrown if the given AnnotationDefinition is invalid. + public Annotation ReportAnnotationValues(AnnotationDefinition annotationDefinition, T[] values) + { + if (!ShouldCaptureThisFrame) + throw new InvalidOperationException("Annotation reported on SensorHandle in frame when its ShouldCaptureThisFrame is false."); + if (!annotationDefinition.IsValid) + throw new ArgumentException("The given annotationDefinition is invalid", nameof(annotationDefinition)); + + return SimulationManager.SimulationState.ReportAnnotationValues(annotationDefinition, this, values); + } + + /// + /// Creates an async annotation for reporting the values for an annotation during a future frame. + /// + /// + /// The AnnotationDefinition of this annotation. + /// A handle to the , which can be used to report annotation data during a subsequent frame. + /// Thrown if this method is called during a frame where is false. + /// Thrown if the given AnnotationDefinition is invalid. + public AsyncAnnotation ReportAnnotationAsync(AnnotationDefinition annotationDefinition) + { + if (!ShouldCaptureThisFrame) + throw new InvalidOperationException("Annotation reported on SensorHandle in frame when its ShouldCaptureThisFrame is false."); + if (!annotationDefinition.IsValid) + throw new ArgumentException("The given annotationDefinition is invalid", nameof(annotationDefinition)); + + return SimulationManager.SimulationState.ReportAnnotationAsync(annotationDefinition, this); + } + + /// + /// Report a sensor capture recorded to disk. This should be called on the same frame as the capture is taken, and may be called before the file is written to disk. + /// + /// The path to the capture data. + /// Spatial data describing the sensor and the ego containing it. + /// Additional values to be emitted as json name/value pairs on the sensor object under the capture. + /// Thrown if ReportCapture is being called when ShouldCaptureThisFrame is false or it has already been called this frame. + public void ReportCapture(string filename, SensorSpatialData sensorSpatialData, params (string, object)[] additionalSensorValues) + { + if (!ShouldCaptureThisFrame) + { + throw new InvalidOperationException("Capture reported in frame when ShouldCaptureThisFrame is false."); + } + + SimulationManager.SimulationState.ReportCapture(this, filename, sensorSpatialData, additionalSensorValues); + } + + /// + /// Whether the sensor should capture this frame. Sensors are expected to call this method each frame to determine whether + /// they should capture during the frame. Captures should only be reported when this is true. + /// + public bool ShouldCaptureThisFrame => SimulationManager.SimulationState.ShouldCaptureThisFrame(this); + + /// + /// Report a metric regarding this sensor in the current frame. + /// + /// The of the metric. + /// An array to be converted to json and put in the "values" field of the metric + /// The value type + /// Thrown if values is null + /// Thrown if is false. + public void ReportMetric(MetricDefinition metricDefinition, [NotNull] T[] values) + { + if (values == null) + throw new ArgumentNullException(nameof(values)); + + if (!ShouldCaptureThisFrame) + throw new InvalidOperationException($"Sensor-based metrics may only be reported when SensorHandle.ShouldCaptureThisFrame is true"); + + SimulationManager.SimulationState.ReportMetric(metricDefinition, values, this, default); + } + + /// + /// Report a metric regarding this sensor in the current frame. + /// + /// The of the metric. + /// A string-based JSON array to be placed in the "values" field of the metric + /// The value type + /// Thrown if values is null + /// Thrown if is false. + public void ReportMetric(MetricDefinition metricDefinition, [NotNull] string valuesJsonArray) + { + if (!ShouldCaptureThisFrame) + throw new InvalidOperationException($"Sensor-based metrics may only be reported when SensorHandle.ShouldCaptureThisFrame is true"); + + SimulationManager.SimulationState.ReportMetric(metricDefinition, new JRaw(valuesJsonArray), this, default); + } + + /// + /// Start an async metric for reporting metric values for this frame in a subsequent frame. + /// + /// The of the metric. + /// Thrown if is false. + public AsyncMetric ReportMetricAsync(MetricDefinition metricDefinition) + { + if (!ShouldCaptureThisFrame) + throw new InvalidOperationException($"Sensor-based metrics may only be reported when SensorHandle.ShouldCaptureThisFrame is true"); + + return SimulationManager.SimulationState.CreateAsyncMetric(metricDefinition, this); + } + + /// + /// Dispose this SensorHandle. + /// + public void Dispose() + { + this.Enabled = false; + } + + /// + /// Returns whether this SensorHandle is valid in the current simulation. Nil SensorHandles are never valid. + /// + public bool IsValid => SimulationManager.IsValid(this.Id); + /// + /// Returns true if this SensorHandle was default-instantiated. + /// + public bool IsNil => this == default; + + void CheckValid() + { + if (!SimulationManager.IsValid(this.Id)) + throw new InvalidOperationException("SensorHandle has been disposed or its simulation has ended"); + } + + public bool Equals(SensorHandle other) + { + return Id.Equals(other.Id); + } + + public override bool Equals(object obj) + { + return obj is SensorHandle other && Equals(other); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + + public static bool operator ==(SensorHandle left, SensorHandle right) + { + return left.Equals(right); + } + + public static bool operator !=(SensorHandle left, SensorHandle right) + { + return !left.Equals(right); + } + } + + /// + /// Handle to a metric whose values may be reported in a subsequent frame. + /// + public struct AsyncMetric + { + internal readonly int Id; + readonly SimulationState m_SimulationState; + + internal AsyncMetric(MetricDefinition metricDefinition, int id, SimulationState simulationState) + { + this.Id = id; + MetricDefinition = metricDefinition; + m_SimulationState = simulationState; + } + + /// + /// The MetricDefinition associated with this AsyncMetric. + /// + public readonly MetricDefinition MetricDefinition; + + /// + /// True if the simulation is still running. + /// + public bool IsValid => !IsNil && m_SimulationState.IsRunning; + + /// + /// True if ReportValues has not been called yet. + /// + public bool IsPending => !IsNil && m_SimulationState.IsPending(ref this); + + /// + /// Returns true if the AsyncMetric is its default value. + /// + public bool IsNil => m_SimulationState == null && Id == default; + + /// + /// Report the values for this AsyncMetric. Calling this method will transition to false. + /// ReportValues may only be called once per AsyncMetric. + /// + /// The values to report for the metric. These values will be converted to json. + /// The type of the values + /// Thrown if values is null + public void ReportValues(T[] values) + { + if (values == null) + throw new ArgumentNullException(nameof(values)); + + m_SimulationState.ReportAsyncMetricResult(this, values: values); + } + + /// + /// Report the values for this AsyncMetric. Calling this method will transition to false. + /// ReportValues may only be called once per AsyncMetric. + /// + /// A JSON array in string form. + /// The type of the values + /// Thrown if values is null + public void ReportValues(string valuesJsonArray) + { + if (valuesJsonArray == null) + throw new ArgumentNullException(nameof(valuesJsonArray)); + + m_SimulationState.ReportAsyncMetricResult(this, valuesJsonArray); + } + } + + /// + /// A handle to an async annotation, used to report values for an annotation after the frame for the annotation has past. + /// See + /// + public struct AsyncAnnotation + { + internal AsyncAnnotation(Annotation annotation, SimulationState simulationState) + { + Annotation = annotation; + m_SimulationState = simulationState; + } + + /// + /// The annotation associated with this AsyncAnnotation. Can be used to report metrics on the annotation. + /// + public readonly Annotation Annotation; + readonly SimulationState m_SimulationState; + /// + /// True if the annotation is nil (was created using default instantiation) + /// + internal bool IsNil => m_SimulationState == null && Annotation.IsNil; + /// + /// True if the annotation is generated by the currently running simulation. + /// + public bool IsValid => !IsNil && m_SimulationState.IsRunning; + /// + /// True if neither nor have been called. + /// + public bool IsPending => !IsNil && m_SimulationState.IsPending(Annotation); + + /// + /// Report a file-based data for this annotation. + /// + /// The path to the file containing the annotation data. + /// Thrown if path is null + public void ReportFile(string path) + { + if (path == null) + throw new ArgumentNullException(nameof(path)); + + m_SimulationState.ReportAsyncAnnotationResult(this, path); + } + + /// + /// Report a value-based data for this annotation. + /// + /// The annotation data. + /// Thrown if values is null + public void ReportValues(T[] values) + { + if (values == null) + throw new ArgumentNullException(nameof(values)); + + m_SimulationState.ReportAsyncAnnotationResult(this, values: values); + } + } + + /// + /// A handle to an annotation. Can be used to report metrics on the annotation. + /// + public struct Annotation : IEquatable + { + /// + /// The ID of the annotation which will be used in the json metadata. + /// + public readonly Guid Id; + /// + /// The step on which the annotation was reported. + /// + public readonly int Step; + /// + /// The SensorHandle on which the annotation was reported + /// + public readonly SensorHandle SensorHandle; + + internal Annotation(SensorHandle sensorHandle, int step) + { + Id = Guid.NewGuid(); + SensorHandle = sensorHandle; + Step = step; + } + + /// + /// Returns true if the annotation is nil (created using default instantiation). + /// + public bool IsNil => Id == Guid.Empty; + + /// + /// Reports a metric on this annotation. May only be called in the same frame as the annotation was reported. + /// + /// + /// + /// + /// Thrown if values is null + /// Thrown if reports false for . + public void ReportMetric(MetricDefinition metricDefinition, [NotNull] T[] values) + { + if (values == null) + throw new ArgumentNullException(nameof(values)); + + if (!SensorHandle.ShouldCaptureThisFrame) + throw new InvalidOperationException($"Sensor-based metrics may only be reported when SensorHandle.ShouldCaptureThisFrame is true"); + + SimulationManager.SimulationState.ReportMetric(metricDefinition, values, SensorHandle, this); + } + + /// + /// Reports a metric on this annotation. May only be called in the same frame as the annotation was reported. + /// + /// + /// A string-based JSON array to be placed in the "values" field of the metric + /// Thrown if values is null + /// Thrown if reports false for . + public void ReportMetric(MetricDefinition metricDefinition, [NotNull] string valuesJsonArray) + { + if (valuesJsonArray == null) + throw new ArgumentNullException(nameof(valuesJsonArray)); + + if (!SensorHandle.ShouldCaptureThisFrame) + throw new InvalidOperationException($"Sensor-based metrics may only be reported when SensorHandle.ShouldCaptureThisFrame is true"); + + SimulationManager.SimulationState.ReportMetric(metricDefinition, new JRaw(valuesJsonArray), SensorHandle, this); + } + + /// + /// Report a metric whose values will be supplied in a later frame. + /// + /// The type of the metric. + /// A handle to an AsyncMetric, which can be used to report values for this metric in future frames. + public AsyncMetric ReportMetricAsync(MetricDefinition metricDefinition) => SimulationManager.SimulationState.CreateAsyncMetric(metricDefinition, SensorHandle, this); + + public bool Equals(Annotation other) + { + return Id.Equals(other.Id); + } + + public override bool Equals(object obj) + { + return obj is Annotation other && Equals(other); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } + + /// + /// An ego, which is used to group multiple sensors under a single frame of reference. + /// + public struct Ego : IEquatable + { + /// + /// The ID for this ego. This ID will be used to refer to this ego in the json metadata. + /// + public readonly Guid Id; + + /// + /// A human-readable description of this ego. + /// + public readonly string Description; + + internal Ego(Guid id, string description) + { + this.Id = id; + this.Description = description; + } + + public bool Equals(Ego other) + { + return Id.Equals(other.Id); + } + + public override bool Equals(object obj) + { + return obj is Ego other && Equals(other); + } + + public override int GetHashCode() + { + return Id.GetHashCode(); + } + + public static bool operator ==(Ego left, Ego right) + { + return left.Equals(right); + } + + public static bool operator !=(Ego left, Ego right) + { + return !left.Equals(right); + } + } + + /// + /// A metric type, used to define a kind of metric. . + /// + public struct MetricDefinition : IEquatable + { + /// + /// The ID of the metric + /// + public readonly Guid Id; + + internal MetricDefinition(Guid id) + { + Id = id; + } + /// + public bool Equals(MetricDefinition other) + { + return Id.Equals(other.Id); + } + + /// + public override bool Equals(object obj) + { + return obj is MetricDefinition other && Equals(other); + } + + /// + public override int GetHashCode() + { + return Id.GetHashCode(); + } + } + + /// + /// A metric type, used to define a kind of annotation. . + /// + public struct AnnotationDefinition : IEquatable + { + /// + public bool Equals(AnnotationDefinition other) + { + return Id.Equals(other.Id); + } + + /// + public override bool Equals(object obj) + { + return obj is AnnotationDefinition other && Equals(other); + } + + /// + public override int GetHashCode() + { + return Id.GetHashCode(); + } + + /// + /// The ID of the annotation type. Used in the json metadata to associate anntations with the type. + /// + public readonly Guid Id; + internal bool IsValid => SimulationManager.IsValid(Id); + + internal AnnotationDefinition(Guid id) + { + Id = id; + } + } + + /// + /// Container holding the poses of the ego and sensor. Also optionally contains the ego velocity and acceleration. + /// + public struct SensorSpatialData + { + /// + /// The pose of the ego. + /// + public Pose EgoPose; + /// + /// The pose of the sensor relative to the ego. + /// + public Pose SensorPose; + /// + /// The velocity of the ego (optional). + /// + public Vector3? EgoVelocity; + /// + /// The acceleration of the ego (optional). + /// + public Vector3? EgoAcceleration; + + /// + /// Create a new SensorSpatialData with the given values. + /// + public SensorSpatialData(Pose egoPose, Pose sensorPose, Vector3? egoVelocity, Vector3? egoAcceleration) + { + EgoPose = egoPose; + SensorPose = sensorPose; + EgoVelocity = egoVelocity; + EgoAcceleration = egoAcceleration; + } + + /// + /// Create a SensorSpatialData from two s, one representing the ego and the other representing the sensor. + /// + /// The ego GameObject. + /// The sensor GameObject. + /// + public static SensorSpatialData FromGameObjects(GameObject ego, GameObject sensor) + { + ego = ego == null ? sensor : ego; + var egoRotation = ego.transform.rotation; + var egoPosition = ego.transform.position; + var sensorSpatialData = new SensorSpatialData() + { + EgoPose = new Pose(egoPosition, egoRotation), + SensorPose = new Pose(sensor.transform.position - egoPosition, sensor.transform.rotation * Quaternion.Inverse(egoRotation)) + }; + return sensorSpatialData; + } + } + +} diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationManager.cs.meta b/com.unity.perception/Runtime/GroundTruth/SimulationManager.cs.meta new file mode 100644 index 000000000..a4fe90ab0 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d48684e5b954424840b377f0293e47a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationState.cs b/com.unity.perception/Runtime/GroundTruth/SimulationState.cs new file mode 100644 index 000000000..2bd6234c2 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationState.cs @@ -0,0 +1,707 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json.Linq; +using UnityEngine; +using UnityEngine.Profiling; +using UnityEngine.Perception.Sensors; +// ReSharper disable NotAccessedField.Local +// ReSharper disable NonReadonlyMemberInGetHashCode + +namespace UnityEngine.Perception +{ + partial class SimulationState + { + public string OutputDirectory { get; } + + HashSet m_ActiveSensors = new HashSet(); + Dictionary m_Sensors = new Dictionary(); + HashSet m_Egos = new HashSet(); + HashSet m_Ids = new HashSet(); + Guid m_SequenceId = Guid.NewGuid(); + + //Always use the property SequenceTimeMs instead + int m_FrameCountLastUpdatedSequenceTime; + float m_SequenceTimeDoNotUse; + float m_UnscaledSequenceTimeDoNotUse; + + int m_FrameCountLastStepIncremented = -1; + int m_Step = -1; + + bool m_HasStarted; + int m_CaptureFileIndex; + List m_AdditionalInfoTypeData = new List(); + List m_PendingCaptures = new List(k_MinPendingCapturesBeforeWrite + 10); + List m_PendingMetrics = new List(k_MinPendingMetricsBeforeWrite + 10); + + int m_MetricsFileIndex; + int m_NextMetricId = 1; + + CustomSampler m_SerializeCapturesSampler = CustomSampler.Create("SerializeCaptures"); + CustomSampler m_SerializeCapturesAsyncSampler = CustomSampler.Create("SerializeCapturesAsync"); + CustomSampler m_JsonToStringSampler = CustomSampler.Create("JsonToString"); + CustomSampler m_WriteToDiskSampler = CustomSampler.Create("WriteJsonToDisk"); + CustomSampler m_SerializeMetricsSampler = CustomSampler.Create("SerializeMetrics"); + CustomSampler m_SerializeMetricsAsyncSampler = CustomSampler.Create("SerializeMetricsAsync"); + CustomSampler m_GetOrCreatePendingCaptureForThisFrameSampler = CustomSampler.Create("GetOrCreatePendingCaptureForThisFrame"); + float m_LastTimeScale; + + public bool IsRunning { get; private set; } + + //A sensor will be triggered if sequenceTime is within includeThreshold seconds of the next trigger + const float k_IncludeInFrameThreshold = .01f; + const int k_MinPendingCapturesBeforeWrite = 150; + const int k_MinPendingMetricsBeforeWrite = 150; + const int k_MaxDeltaTime = 10; + + public SimulationState(string outputDirectory) + { + OutputDirectory = outputDirectory; + IsRunning = true; + } + + /// + /// A self-sufficient container for all information about a reported capture. Capture writing should not depend on any + /// state outside of this container, as other state may have changed since the capture was reported. + /// + class PendingCapture + { + public Guid Id; + public SensorHandle SensorHandle; + public SensorData SensorData; + public string Path; + public SensorSpatialData SensorSpatialData; + public int FrameCount; + public int Step; + public float Timestamp; + public Guid SequenceId; + public (string, object)[] AdditionalSensorValues; + public List<(Annotation, AnnotationData )> Annotations = new List<(Annotation, AnnotationData)>(); + public bool CaptureReported; + + public PendingCapture(Guid id, SensorHandle sensorHandle, SensorData sensorData, Guid sequenceId, int frameCount, int step, float timestamp) + { + SensorHandle = sensorHandle; + FrameCount = frameCount; + Step = step; + SequenceId = sequenceId; + Timestamp = timestamp; + Id = id; + SensorData = sensorData; + } + } + + struct PendingMetric + { + public PendingMetric(MetricDefinition metricDefinition, int metricId, SensorHandle sensorHandle, Guid captureId, Annotation annotation, Guid sequenceId, int step, JToken values = null) + { + MetricDefinition = metricDefinition; + MetricId = metricId; + SensorHandle = sensorHandle; + Annotation = annotation; + SequenceId = sequenceId; + Step = step; + CaptureId = captureId; + Values = values; + } + + public readonly MetricDefinition MetricDefinition; + public readonly int MetricId; + public readonly SensorHandle SensorHandle; + public readonly Guid CaptureId; + public readonly Annotation Annotation; + public readonly Guid SequenceId; + public readonly int Step; + public JToken Values; + + public bool IsAssigned => Values != null; + } + + public struct SensorData + { + public string modality; + public string description; + public float period; + public float firstCaptureTime; + + public float sequenceTimeNextCapture; + public int lastCaptureFrameCount; + public Ego ego; + } + + struct AnnotationData + { + public readonly AnnotationDefinition AnnotationDefinition; + public string Path; + public JArray ValuesJson; + public bool IsAssigned => Path != null || ValuesJson != null; + + public AnnotationData(AnnotationDefinition annotationDefinition, string path, JArray valuesJson) + : this() + { + AnnotationDefinition = annotationDefinition; + Path = path; + ValuesJson = valuesJson; + } + } + + enum AdditionalInfoKind + { + Metric, + Annotation + } + + struct AdditionalInfoTypeData : IEquatable + { + public string name; + public string description; + public string format; + public Guid id; + public Array specValues; + public AdditionalInfoKind additionalInfoKind; + + public override string ToString() + { + return $"{nameof(name)}: {name}, {nameof(description)}: {description}, {nameof(format)}: {format}, {nameof(id)}: {id}"; + } + + public bool Equals(AdditionalInfoTypeData other) + { + var areMembersEqual = additionalInfoKind == other.additionalInfoKind && + string.Equals(name, other.name, StringComparison.InvariantCulture) && + string.Equals(description, other.description, StringComparison.InvariantCulture) && + string.Equals(format, other.format, StringComparison.InvariantCulture) && + id.Equals(other.id); + + if (!areMembersEqual) + return false; + + if (specValues == other.specValues) + return true; + if (specValues == null || other.specValues == null) + return false; + if (specValues.Length != other.specValues.Length) + return false; + + for (var i = 0; i < specValues.Length; i++) + { + if (!specValues.GetValue(i).Equals(other.specValues.GetValue(i))) + return false; + } + + return true; + } + + public override bool Equals(object obj) + { + return obj is AdditionalInfoTypeData other && Equals(other); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (name != null ? StringComparer.InvariantCulture.GetHashCode(name) : 0); + hashCode = (hashCode * 397) ^ (description != null ? StringComparer.InvariantCulture.GetHashCode(description) : 0); + hashCode = (hashCode * 397) ^ (format != null ? StringComparer.InvariantCulture.GetHashCode(format) : 0); + hashCode = (hashCode * 397) ^ id.GetHashCode(); + return hashCode; + } + } + } + + internal void ReportCapture(SensorHandle sensorHandle, string filename, SensorSpatialData sensorSpatialData, params (string, object)[] additionalSensorValues) + { + var sensorData = m_Sensors[sensorHandle]; + var pendingCapture = GetOrCreatePendingCaptureForThisFrame(sensorHandle, out _); + + if (pendingCapture.CaptureReported) + throw new InvalidOperationException($"Capture for frame {Time.frameCount} already reported for sensor {this}"); + + pendingCapture.CaptureReported = true; + pendingCapture.Path = filename; + pendingCapture.AdditionalSensorValues = additionalSensorValues; + pendingCapture.SensorSpatialData = sensorSpatialData; + + sensorData.lastCaptureFrameCount = Time.frameCount; + m_Sensors[sensorHandle] = sensorData; + } + + static string GetFormatFromFilename(string filename) + { + var ext = Path.GetExtension(filename); + if (ext == null) + return null; + + if (ext.StartsWith(".")) + ext = ext.Substring(1); + + return ext.ToUpperInvariant(); + } + + /// + /// Use this to get the current step when it is desirable to ensure the step has been allocated for this frame. Steps should only be allocated in frames where a capture or metric is reported. + /// + /// The current step + int AcquireStep() + { + EnsureStepIncremented(); + EnsureSequenceTimingsUpdated(); + return m_Step; + } + + // ReSharper restore InconsistentNaming + + /// + /// The simulation time that has elapsed since the beginning of the sequence. + /// + public float SequenceTime + { + get + { + //TODO: Can this be replaced with Time.time - sequenceTimeStart? + if (!m_HasStarted) + return 0; + + EnsureSequenceTimingsUpdated(); + + return m_SequenceTimeDoNotUse; + } + } + + /// + /// The unscaled simulation time that has elapsed since the beginning of the sequence. This is the time that should be used for scheduling sensors + /// + public float UnscaledSequenceTime + { + get + { + //TODO: Can this be replaced with Time.time - sequenceTimeStart? + if (!m_HasStarted) + return 0; + + EnsureSequenceTimingsUpdated(); + return m_UnscaledSequenceTimeDoNotUse; + } + } + + void EnsureSequenceTimingsUpdated() + { + if (!m_HasStarted) + { + ResetTimings(); + } + else if (m_FrameCountLastUpdatedSequenceTime != Time.frameCount) + { + m_SequenceTimeDoNotUse += Time.deltaTime; + if (Time.timeScale > 0) + m_UnscaledSequenceTimeDoNotUse += Time.deltaTime / Time.timeScale; + + CheckTimeScale(); + + m_FrameCountLastUpdatedSequenceTime = Time.frameCount; + } + } + + void CheckTimeScale() + { + if (m_LastTimeScale != Time.timeScale) + Debug.LogError($"Time.timeScale may not change mid-sequence. This can cause sensors to get out of sync and corrupt the data. Previous: {m_LastTimeScale} Current: {Time.timeScale}"); + + m_LastTimeScale = Time.timeScale; + } + + void EnsureStepIncremented() + { + if (m_FrameCountLastStepIncremented != Time.frameCount) + { + m_FrameCountLastStepIncremented = Time.frameCount; + m_Step++; + } + } + + public void StartNewSequence() + { + ResetTimings(); + m_FrameCountLastStepIncremented = -1; + m_Step = -1; + foreach (var kvp in m_Sensors.ToArray()) + { + var sensorData = kvp.Value; + sensorData.sequenceTimeNextCapture = SequenceTimeOfNextCapture(sensorData); + m_Sensors[kvp.Key] = sensorData; + } + + m_SequenceId = Guid.NewGuid(); + } + + void ResetTimings() + { + m_FrameCountLastUpdatedSequenceTime = Time.frameCount; + m_SequenceTimeDoNotUse = 0; + m_UnscaledSequenceTimeDoNotUse = 0; + m_LastTimeScale = Time.timeScale; + } + + public void AddSensor(Ego ego, string modality, string description, float period, float firstCaptureTime, SensorHandle sensor) + { + var sensorData = new SensorData() + { + modality = modality, + description = description, + period = period, + firstCaptureTime = firstCaptureTime, + ego = ego, + lastCaptureFrameCount = -1 + }; + sensorData.sequenceTimeNextCapture = SequenceTimeOfNextCapture(sensorData); + m_ActiveSensors.Add(sensor); + m_Sensors.Add(sensor, sensorData); + m_Ids.Add(sensor.Id); + } + + float SequenceTimeOfNextCapture(SensorData sensorData) + { + if (sensorData.firstCaptureTime >= UnscaledSequenceTime) + return sensorData.firstCaptureTime; + + return sensorData.period - (UnscaledSequenceTime - sensorData.firstCaptureTime) % sensorData.period; + } + + public bool Contains(Guid id) => m_Ids.Contains(id); + + public void AddEgo(Ego ego) + { + m_Egos.Add(ego); + m_Ids.Add(ego.Id); + } + + public bool IsEnabled(SensorHandle sensorHandle) => m_ActiveSensors.Contains(sensorHandle); + + public void SetEnabled(SensorHandle sensorHandle, bool value) + { + if (!value) + m_ActiveSensors.Remove(sensorHandle); + else + m_ActiveSensors.Add(sensorHandle); + } + + public void Update() + { + if (m_ActiveSensors.Count == 0) + return; + + if (!m_HasStarted) + { + //simulation starts now + m_FrameCountLastUpdatedSequenceTime = Time.frameCount; + m_LastTimeScale = Time.timeScale; + m_HasStarted = true; + } + + //update the active sensors sequenceTimeNextCapture and lastCaptureFrameCount + foreach (var activeSensor in m_ActiveSensors) + { + var sensorData = m_Sensors[activeSensor]; + if (!activeSensor.ShouldCaptureThisFrame) + continue; + + //Just in case we get in a situation where we are so far beyond sequenceTimeNextCapture that incrementing next time by the period still doesn't get us to a time past "now" + do + { + sensorData.sequenceTimeNextCapture += sensorData.period; + } while (sensorData.sequenceTimeNextCapture <= UnscaledSequenceTime); + + sensorData.lastCaptureFrameCount = Time.frameCount; + m_Sensors[activeSensor] = sensorData; + } + + //find the deltatime required to land on the next active sensor that needs simulation + float nextFrameDt = k_MaxDeltaTime; + foreach (var activeSensor in m_ActiveSensors) + { + var sensorData = m_Sensors[activeSensor]; + var thisSensorNextFrameDt = sensorData.sequenceTimeNextCapture - UnscaledSequenceTime; + + Debug.Assert(thisSensorNextFrameDt > 0f, "Sensor was scheduled to run in the past but got skipped over."); + if (thisSensorNextFrameDt > 0f && thisSensorNextFrameDt < nextFrameDt) + nextFrameDt = thisSensorNextFrameDt; + } + + WritePendingCaptures(); + WritePendingMetrics(); + + Time.captureDeltaTime = nextFrameDt; + } + + public bool ShouldCaptureThisFrame(SensorHandle sensorHandle) + { + var data = m_Sensors[sensorHandle]; + if (data.lastCaptureFrameCount == Time.frameCount) + return true; + + return (data.sequenceTimeNextCapture - UnscaledSequenceTime) < k_IncludeInFrameThreshold; + } + + public void End() + { + if (m_Ids.Count == 0) + return; + + WritePendingCaptures(true, writeCapturesFromThisFrame: true); + if (m_PendingCaptures.Count > 0) + Debug.LogError($"Simulation ended with pending annotations: {string.Join(", ", m_PendingCaptures.Select(c => $"id:{c.SensorHandle.Id} frame:{c.FrameCount}"))}"); + + WritePendingMetrics(true); + if (m_PendingMetrics.Count > 0) + Debug.LogError($"Simulation ended with pending metrics: {string.Join(", ", m_PendingMetrics.Select(c => $"id:{c.MetricId} step:{c.Step}"))}"); + + WriteReferences(); + Time.captureDeltaTime = 0; + IsRunning = false; + } + + public AnnotationDefinition RegisterAnnotationDefinition(string name, TSpec[] specValues, string description, string format, Guid id) + { + if (id == Guid.Empty) + id = Guid.NewGuid(); + + RegisterAdditionalInfoType(name, specValues, description, format, id, AdditionalInfoKind.Annotation); + + return new AnnotationDefinition(id); + } + + public MetricDefinition RegisterMetricDefinition(string name, TSpec[] specValues, string description, Guid id) + { + if (id == Guid.Empty) + id = Guid.NewGuid(); + + RegisterAdditionalInfoType(name, specValues, description, null, id, AdditionalInfoKind.Metric); + + return new MetricDefinition(id); + } + + void RegisterAdditionalInfoType(string name, TSpec[] specValues, string description, string format, Guid id, AdditionalInfoKind additionalInfoKind) + { + var annotationDefinitionInfo = new AdditionalInfoTypeData() + { + additionalInfoKind = additionalInfoKind, + name = name, + description = description, + format = format, + id = id, + specValues = specValues + }; + + if (!m_Ids.Add(id)) + { + foreach (var existingAnnotationDefinition in m_AdditionalInfoTypeData) + { + if (existingAnnotationDefinition.id == id) + { + if (existingAnnotationDefinition.Equals(annotationDefinitionInfo)) + { + return; + } + + throw new ArgumentException($"{id} has already been registered to an AnnotationDefinition or MetricDefinition with different information.\nExisting: {existingAnnotationDefinition}"); + } + } + + throw new ArgumentException($"Id {id} is already in use. Ids must be unique."); + } + + m_AdditionalInfoTypeData.Add(annotationDefinitionInfo); + } + + public Annotation ReportAnnotationFile(AnnotationDefinition annotationDefinition, SensorHandle sensorHandle, string filename) + { + var annotation = new Annotation(sensorHandle, AcquireStep()); + var pendingCapture = GetOrCreatePendingCaptureForThisFrame(sensorHandle); + pendingCapture.Annotations.Add((annotation, new AnnotationData(annotationDefinition, filename, null))); + return annotation; + } + + public Annotation ReportAnnotationValues(AnnotationDefinition annotationDefinition, SensorHandle sensorHandle, T[] values) + { + var annotation = new Annotation(sensorHandle, AcquireStep()); + var pendingCapture = GetOrCreatePendingCaptureForThisFrame(sensorHandle); + var valuesJson = new JArray(); + foreach (var value in values) + { + valuesJson.Add(DatasetJsonUtility.ToJToken(value)); + } + pendingCapture.Annotations.Add((annotation, new AnnotationData(annotationDefinition, null, valuesJson))); + return annotation; + } + + PendingCapture GetOrCreatePendingCaptureForThisFrame(SensorHandle sensorHandle) + { + return GetOrCreatePendingCaptureForThisFrame(sensorHandle, out var _); + } + + PendingCapture GetOrCreatePendingCaptureForThisFrame(SensorHandle sensorHandle, out bool created) + { + created = false; + m_GetOrCreatePendingCaptureForThisFrameSampler.Begin(); + EnsureStepIncremented(); + + //Following is this converted to code: m_PendingCaptures.FirstOrDefault(c => c.SensorHandle == sensorHandle && c.FrameCount == Time.frameCount); + //We also start at the end, since the pending capture list can get long as we await writing to disk + PendingCapture pendingCapture = null; + for (var i = m_PendingCaptures.Count - 1; i >= 0; i--) + { + var c = m_PendingCaptures[i]; + if (c.SensorHandle == sensorHandle && c.FrameCount == Time.frameCount) + { + pendingCapture = c; + break; + } + } + + if (pendingCapture == null) + { + created = true; + pendingCapture = new PendingCapture(Guid.NewGuid(), sensorHandle, m_Sensors[sensorHandle], m_SequenceId, Time.frameCount, AcquireStep(), SequenceTime); + m_PendingCaptures.Add(pendingCapture); + } + + m_GetOrCreatePendingCaptureForThisFrameSampler.End(); + return pendingCapture; + } + + public AsyncAnnotation ReportAnnotationAsync(AnnotationDefinition annotationDefinition, SensorHandle sensorHandle) + { + return new AsyncAnnotation(ReportAnnotationFile(annotationDefinition, sensorHandle, null), this); + } + + public void ReportAsyncAnnotationResult(AsyncAnnotation asyncAnnotation, string filename = null, T[] values = null) + { + if (!asyncAnnotation.IsPending) + throw new InvalidOperationException("AsyncAnnotation has already been reported and cannot be reported again."); + + PendingCapture pendingCapture = null; + foreach (var c in m_PendingCaptures) + { + if (c.Step == asyncAnnotation.Annotation.Step && c.SensorHandle == asyncAnnotation.Annotation.SensorHandle) + { + pendingCapture = c; + break; + } + } + + Debug.Assert(pendingCapture != null); + + var annotationIndex = pendingCapture.Annotations.FindIndex(a => a.Item1.Equals(asyncAnnotation.Annotation)); + var annotationTuple = pendingCapture.Annotations[annotationIndex]; + var annotationData = annotationTuple.Item2; + + annotationData.Path = filename; + annotationData.ValuesJson = values == null ? null : JArray.FromObject(values); + + annotationTuple.Item2 = annotationData; + pendingCapture.Annotations[annotationIndex] = annotationTuple; + } + + public bool IsPending(Annotation annotation) + { + foreach (var c in m_PendingCaptures) + { + foreach (var a in c.Annotations) + { + if (a.Item1.Equals(annotation)) + return !a.Item2.IsAssigned; + } + } + + return false; + } + + public bool IsPending(ref AsyncMetric asyncMetric) + { + foreach (var m in m_PendingMetrics) + { + if (m.MetricId == asyncMetric.Id) + return !m.IsAssigned; + } + + return false; + } + + public void ReportAsyncMetricResult(AsyncMetric asyncMetric, T[] values) + { + var pendingMetricValues = JArrayFromArray(values); + ReportAsyncMetricResult(asyncMetric, pendingMetricValues); + } + + public void ReportAsyncMetricResult(AsyncMetric asyncMetric, string valuesJsonArray) + { + ReportAsyncMetricResult(asyncMetric, new JRaw(valuesJsonArray)); + } + + void ReportAsyncMetricResult(AsyncMetric asyncMetric, JToken values) + { + var metricIndex = -1; + for (var i = 0; i < m_PendingMetrics.Count; i++) + { + if (m_PendingMetrics[i].MetricId == asyncMetric.Id) + { + metricIndex = i; + break; + } + } + + if (metricIndex == -1) + throw new InvalidOperationException("asyncMetric is invalid or has already been reported"); + + var pendingMetric = m_PendingMetrics[metricIndex]; + if (pendingMetric.IsAssigned) + throw new InvalidOperationException("asyncMetric already been reported. ReportAsyncMetricResult may only be called once per AsyncMetric"); + + pendingMetric.Values = values; + m_PendingMetrics[metricIndex] = pendingMetric; + } + + static JArray JArrayFromArray(T[] values) + { + var jArray = new JArray(); + + foreach (var value in values) + jArray.Add(DatasetJsonUtility.ToJToken(value)); + + return jArray; + } + + public AsyncMetric CreateAsyncMetric(MetricDefinition metricDefinition, SensorHandle sensorHandle = default, Annotation annotation = default) + { + EnsureStepIncremented(); + var id = m_NextMetricId++; + var captureId = Guid.Empty; + if (sensorHandle != default) + { + var capture = GetOrCreatePendingCaptureForThisFrame(sensorHandle); + captureId = capture.Id; + } + + m_PendingMetrics.Add(new PendingMetric(metricDefinition, id, sensorHandle, captureId, annotation, m_SequenceId, AcquireStep())); + return new AsyncMetric(metricDefinition, id, this); + } + + public void ReportMetric(MetricDefinition metricDefinition, T[] values, SensorHandle sensorHandle, Annotation annotation) + { + var jArray = JArrayFromArray(values); + ReportMetric(metricDefinition, jArray, sensorHandle, annotation); + } + + public void ReportMetric(MetricDefinition metricDefinition, JToken values, SensorHandle sensorHandle, Annotation annotation) + { + if (values == null) + throw new ArgumentNullException(nameof(values)); + + EnsureStepIncremented(); + var captureId = sensorHandle.IsNil ? Guid.Empty : GetOrCreatePendingCaptureForThisFrame(sensorHandle).Id; + m_PendingMetrics.Add(new PendingMetric(metricDefinition, m_NextMetricId++, sensorHandle, captureId, annotation, m_SequenceId, AcquireStep(), values)); + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationState.cs.meta b/com.unity.perception/Runtime/GroundTruth/SimulationState.cs.meta new file mode 100644 index 000000000..ba50456ca --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: da96d87fc71558a42b951ce60766dcfb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs b/com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs new file mode 100644 index 000000000..7b60500ea --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs @@ -0,0 +1,344 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using Unity.Simulation; +using UnityEngine.Perception.Sensors; +// ReSharper disable NotAccessedField.Local +// ReSharper disable CoVariantArrayConversion + +namespace UnityEngine.Perception +{ + partial class SimulationState + { + const Formatting k_Formatting = Formatting.Indented; + + /// + /// Writes sensors.json, egos.json, metric_definitions.json, and annotation_definitions.json + /// + public void WriteReferences() + { + var egoReference = new JObject(); + egoReference["version"] = SimulationManager.SchemaVersion; + egoReference["egos"] = new JArray(m_Egos.Select(e => + { + var egoObj = new JObject(); + egoObj["id"] = e.Id.ToString(); + if (e.Description != null) + egoObj["description"] = e.Description; + + return egoObj; + }).ToArray()); + + WriteJObjectToFile(egoReference, "egos.json"); + + var sensorReferenceDoc = new JObject(); + sensorReferenceDoc["version"] = SimulationManager.SchemaVersion; + sensorReferenceDoc["sensors"] = new JArray(m_Sensors.Select(kvp => + { + var sensorReference = new JObject(); + sensorReference["id"] = kvp.Key.Id.ToString(); + sensorReference["ego_id"] = kvp.Value.ego.Id.ToString(); + sensorReference["modality"] = kvp.Value.modality; + if (kvp.Value.description != null) + sensorReference["description"] = kvp.Value.description; + + return sensorReference; + }).ToArray()); + WriteJObjectToFile(sensorReferenceDoc, "sensors.json"); + + if (m_AdditionalInfoTypeData.Count > 0) + { + var annotationDefinitionsJArray = new JArray(); + var metricDefinitionsJArray = new JArray(); + foreach (var typeInfo in m_AdditionalInfoTypeData) + { + var typeJObject = new JObject(); + typeJObject.Add("id", new JValue(typeInfo.id.ToString())); + typeJObject.Add("name", new JValue(typeInfo.name)); + if (typeInfo.description != null) + typeJObject.Add("description", new JValue(typeInfo.description)); + + if (typeInfo.format != null) + typeJObject.Add("format", new JValue(typeInfo.format)); + + if (typeInfo.specValues != null) + { + var specValues = new JArray(); + foreach (var value in typeInfo.specValues) + { + specValues.Add(DatasetJsonUtility.ToJToken(value)); + } + typeJObject.Add("spec", specValues); + } + + switch (typeInfo.additionalInfoKind) + { + case AdditionalInfoKind.Annotation: + annotationDefinitionsJArray.Add(typeJObject); + break; + case AdditionalInfoKind.Metric: + metricDefinitionsJArray.Add(typeJObject); + break; + default: + throw new NotSupportedException("Unsupported info kind"); + } + } + + if (annotationDefinitionsJArray.Count > 0) + { + var annotationDefinitionsJObject = new JObject(); + annotationDefinitionsJObject.Add("version", SimulationManager.SchemaVersion); + annotationDefinitionsJObject.Add("annotation_definitions", annotationDefinitionsJArray); + WriteJObjectToFile(annotationDefinitionsJObject, "annotation_definitions.json"); + } + + if (metricDefinitionsJArray.Count > 0) + { + var metricDefinitionsJObject = new JObject(); + metricDefinitionsJObject.Add("version", SimulationManager.SchemaVersion); + metricDefinitionsJObject.Add("metric_definitions", metricDefinitionsJArray); + WriteJObjectToFile(metricDefinitionsJObject, "metric_definitions.json"); + } + } + } + + void WriteJObjectToFile(JObject jObject, string filename) + { + m_JsonToStringSampler.Begin(); + var stringWriter = new StringWriter(new StringBuilder(256), CultureInfo.InvariantCulture); + using (var jsonTextWriter = new JsonTextWriter(stringWriter)) + { + jsonTextWriter.Formatting = k_Formatting; + jObject.WriteTo(jsonTextWriter); + } + + var contents = stringWriter.ToString(); + m_JsonToStringSampler.End(); + + m_WriteToDiskSampler.Begin(); + + var path = Path.Combine(OutputDirectory, filename); + File.WriteAllText(path, contents); + Manager.Instance.ConsumerFileProduced(path); + m_WriteToDiskSampler.End(); + } + + void WritePendingCaptures(bool flush = false, bool writeCapturesFromThisFrame = false) + { + if (!flush && m_PendingCaptures.Count < k_MinPendingCapturesBeforeWrite) + return; + + m_SerializeCapturesSampler.Begin(); + + var pendingCapturesToWrite = new List(m_PendingCaptures.Count); + var frameCountNow = Time.frameCount; + for (var i = 0; i < m_PendingCaptures.Count; i++) + { + var pendingCapture = m_PendingCaptures[i]; + if ((writeCapturesFromThisFrame || pendingCapture.FrameCount < frameCountNow) && + pendingCapture.Annotations.All(a => a.Item2.IsAssigned)) + { + pendingCapturesToWrite.Add(pendingCapture); + m_PendingCaptures.RemoveAt(i); + i--; //decrement i because we removed an element + } + } + + if (pendingCapturesToWrite.Count == 0) + { + m_SerializeCapturesSampler.End(); + return; + } + + void Write(List pendingCaptures, SimulationState simulationState, int captureFileIndex) + { + simulationState.m_SerializeCapturesAsyncSampler.Begin(); + + //lazily allocate for fast zero-write frames + var capturesJArray = new JArray(); + + foreach (var pendingCapture in pendingCaptures) + capturesJArray.Add(JObjectFromPendingCapture(pendingCapture)); + + var capturesJObject = new JObject(); + capturesJObject.Add("version", SimulationManager.SchemaVersion); + capturesJObject.Add("captures", capturesJArray); + + simulationState.WriteJObjectToFile(capturesJObject, + $"captures_{captureFileIndex:000}.json"); + simulationState.m_SerializeCapturesAsyncSampler.End(); + } + + if (flush) + { + Write(pendingCapturesToWrite, this, m_CaptureFileIndex); + } + else + { + var req = Manager.Instance.CreateRequest>(); + req.data = new WritePendingCaptureRequestData() + { + CaptureFileIndex = m_CaptureFileIndex, + PendingCaptures = pendingCapturesToWrite, + SimulationState = this + }; + req.Start(r => + { + Write(r.data.PendingCaptures, r.data.SimulationState, r.data.CaptureFileIndex); + return AsyncRequest.Result.Completed; + }); + } + + m_SerializeCapturesSampler.End(); + m_CaptureFileIndex++; + } + + struct WritePendingMetricRequestData + { + public List PendingMetrics; + public int MetricFileIndex; + } + + void WritePendingMetrics(bool flush = false) + { + if (!flush && m_PendingMetrics.Count < k_MinPendingMetricsBeforeWrite) + return; + + var pendingMetricsToWrite = new List(m_PendingMetrics.Count); + m_SerializeMetricsSampler.Begin(); + for (var i = 0; i < m_PendingMetrics.Count; i++) + { + var metric = m_PendingMetrics[i]; + if (metric.IsAssigned) + { + pendingMetricsToWrite.Add(metric); + m_PendingMetrics.RemoveAt(i); + i--; //decrement i because we removed an element + } + } + + if (pendingMetricsToWrite.Count == 0) + { + m_SerializeMetricsSampler.End(); + return; + } + + void Write(List pendingMetrics, int metricsFileIndex) + { + m_SerializeMetricsAsyncSampler.Begin(); + var jArray = new JArray(); + foreach (var pendingMetric in pendingMetrics) + jArray.Add(JObjectFromPendingMetric(pendingMetric)); + + var metricsJObject = new JObject(); + metricsJObject.Add("version", SimulationManager.SchemaVersion); + metricsJObject.Add("metrics", jArray); + + WriteJObjectToFile(metricsJObject, $"metrics_{metricsFileIndex:000}.json"); + m_SerializeMetricsAsyncSampler.End(); + } + + if (flush) + { + Write(pendingMetricsToWrite, m_MetricsFileIndex); + } + else + { + var req = Manager.Instance.CreateRequest>(); + req.data = new WritePendingMetricRequestData() + { + MetricFileIndex = m_MetricsFileIndex, + PendingMetrics = pendingMetricsToWrite + }; + req.Start(r => + { + Write(r.data.PendingMetrics, r.data.MetricFileIndex); + return AsyncRequest.Result.Completed; + }); + } + + m_MetricsFileIndex++; + m_SerializeMetricsSampler.End(); + } + + static JObject JObjectFromPendingMetric(PendingMetric metric) + { + var jObject = new JObject(); + jObject["capture_id"] = metric.CaptureId == Guid.Empty ? new JRaw("null") : new JValue(metric.CaptureId.ToString()); + jObject["annotation_id"] = metric.Annotation.IsNil ? new JRaw("null") : new JValue(metric.Annotation.Id.ToString()); + jObject["sequence_id"] = metric.SequenceId.ToString(); + jObject["step"] = metric.Step; + jObject["metric_definition"] = metric.MetricDefinition.Id.ToString(); + jObject["values"] = metric.Values; + return jObject; + } + + /// + /// Creates the json representation of the given PendingCapture. Static because this should not depend on any SimulationState members, + /// which may have changed since the capture was reported. + /// + static JToken JObjectFromPendingCapture(PendingCapture pendingCapture) + { + var sensorJObject = new JObject();//new SensorCaptureJson + sensorJObject["sensor_id"] = pendingCapture.SensorHandle.Id.ToString(); + sensorJObject["ego_id"] = pendingCapture.SensorData.ego.Id.ToString(); + sensorJObject["modality"] = pendingCapture.SensorData.modality; + sensorJObject["translation"] = DatasetJsonUtility.ToJToken(pendingCapture.SensorSpatialData.SensorPose.position); + sensorJObject["rotation"] = DatasetJsonUtility.ToJToken(pendingCapture.SensorSpatialData.SensorPose.rotation); + + if (pendingCapture.AdditionalSensorValues != null) + { + foreach (var (name, value) in pendingCapture.AdditionalSensorValues) + sensorJObject.Add(name, DatasetJsonUtility.ToJToken(value)); + } + + var egoCaptureJson = new JObject(); + egoCaptureJson["ego_id"] = pendingCapture.SensorData.ego.Id.ToString(); + egoCaptureJson["translation"] = DatasetJsonUtility.ToJToken(pendingCapture.SensorSpatialData.EgoPose.position); + egoCaptureJson["rotation"] = DatasetJsonUtility.ToJToken(pendingCapture.SensorSpatialData.EgoPose.rotation); + egoCaptureJson["velocity"] = pendingCapture.SensorSpatialData.EgoVelocity.HasValue ? DatasetJsonUtility.ToJToken(pendingCapture.SensorSpatialData.EgoVelocity.Value) : null; + egoCaptureJson["acceleration"] = pendingCapture.SensorSpatialData.EgoAcceleration.HasValue ? DatasetJsonUtility.ToJToken(pendingCapture.SensorSpatialData.EgoAcceleration.Value) : null; + + var capture = new JObject(); + capture["id"] = pendingCapture.Id.ToString(); + capture["sequence_id"] = pendingCapture.SequenceId.ToString(); + capture["step"] = pendingCapture.Step; + capture["timestamp"] = pendingCapture.Timestamp; + capture["sensor"] = sensorJObject; + capture["ego"] = egoCaptureJson; + capture["filename"] = pendingCapture.Path; + capture["format"] = GetFormatFromFilename(pendingCapture.Path); + + if (pendingCapture.Annotations.Any()) + capture["annotations"] = new JArray(pendingCapture.Annotations.Select(JObjectFromAnnotation).ToArray()); + + return capture; + } + + static JObject JObjectFromAnnotation((Annotation, AnnotationData) annotationInfo) + { + var annotationJObject = new JObject(); + annotationJObject["id"] = annotationInfo.Item1.Id.ToString(); + annotationJObject["annotation_definition"] = annotationInfo.Item2.AnnotationDefinition.Id.ToString(); + if (annotationInfo.Item2.Path != null) + annotationJObject["filename"] = annotationInfo.Item2.Path; + + if (annotationInfo.Item2.ValuesJson != null) + annotationJObject["values"] = annotationInfo.Item2.ValuesJson; + + return annotationJObject; + } + + struct WritePendingCaptureRequestData + { + public List PendingCaptures; + public int CaptureFileIndex; + public SimulationState SimulationState; + } + } +} diff --git a/com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs.meta b/com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs.meta new file mode 100644 index 000000000..43b452575 --- /dev/null +++ b/com.unity.perception/Runtime/GroundTruth/SimulationState_Json.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d35ad09e381c4d038b183d17fc67730b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef b/com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef new file mode 100644 index 000000000..bb4fa8563 --- /dev/null +++ b/com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef @@ -0,0 +1,39 @@ +{ + "name": "Unity.Perception.Runtime", + "references": [ + "Unity.Burst", + "Unity.Collections", + "Unity.Entities", + "Unity.Jobs", + "Unity.Mathematics", + "Unity.RenderPipelines.Core.Runtime", + "Unity.RenderPipelines.HighDefinition.Runtime", + "Unity.RenderPipelines.Universal.Runtime", + "Unity.Simulation.Core", + "Unity.Simulation.Capture", + "PathCreator" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": true, + "precompiledReferences": [ + "Newtonsoft.Json.dll", + "QuickGraph.dll" + ], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [ + { + "name": "com.unity.render-pipelines.high-definition", + "expression": "", + "define": "HDRP_PRESENT" + }, + { + "name": "com.unity.render-pipelines.universal", + "expression": "", + "define": "URP_PRESENT" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef.meta b/com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef.meta new file mode 100644 index 000000000..3b1c887e2 --- /dev/null +++ b/com.unity.perception/Runtime/Unity.Perception.Runtime.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a3867139fb5f48e43972bdbc58ef9b3c +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests.meta b/com.unity.perception/Tests.meta new file mode 100644 index 000000000..56b086eb7 --- /dev/null +++ b/com.unity.perception/Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b0e6e008876ee9344af41e6afd54841f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/.tests.json b/com.unity.perception/Tests/.tests.json new file mode 100644 index 000000000..3139c1235 --- /dev/null +++ b/com.unity.perception/Tests/.tests.json @@ -0,0 +1,3 @@ +{ + "createSeparatePackage": false +} diff --git a/com.unity.perception/Tests/Editor.meta b/com.unity.perception/Tests/Editor.meta new file mode 100644 index 000000000..c1f7b1a7a --- /dev/null +++ b/com.unity.perception/Tests/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bdbe4bfec6cb91043bf4b168c028eae3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs b/com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs new file mode 100644 index 000000000..7582e0fff --- /dev/null +++ b/com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs @@ -0,0 +1,124 @@ +using System; +using System.Collections.Generic; +using System.IO; +using NUnit.Framework; +using UnityEditor; +using UnityEditor.Build.Reporting; +using UnityEditor.TestTools; +using UnityEngine; +using UnityEngine.TestTools; + +namespace EditorTests.BuildTests +{ + public class BuildPerceptionPlayer + { + public List editorBuildSettingsScenes = new List(); + public List testScenesPaths = new List(); + public string testSceneBase = "default base scene"; + + private BuildReport report; + private BuildSummary summary; + + private string buildPath = "Build/PerceptionBuild"; + + [SetUp] + public void SetUp() + { + TestsScenesPath(); + } + + [UnityPlatform(RuntimePlatform.WindowsEditor)] + [RequirePlatformSupport(BuildTarget.StandaloneWindows64)] + [Test] + public void BuildPlayerStandaloneWindows64() + { + BuildPlayer(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows64, buildPath, BuildOptions.IncludeTestAssemblies, out report, out summary); + Assert.AreEqual(BuildResult.Succeeded, summary.result, " BuildTarget.StandaloneWindows64 failed to build"); + } + + [RequirePlatformSupport(BuildTarget.StandaloneLinux64)] + [Test] + public void BuildPlayerLinux() + { + BuildPlayer(BuildTargetGroup.Standalone, BuildTarget.StandaloneLinux64, buildPath, BuildOptions.IncludeTestAssemblies, out report, out summary); + Assert.AreEqual(BuildResult.Succeeded, summary.result, "BuildTarget.StandaloneLinux64 failed to build"); + } + + [UnityPlatform(RuntimePlatform.OSXEditor)] + [RequirePlatformSupport(BuildTarget.StandaloneOSX)] + [Test] + public void BuildPlayerOSX() + { + BuildPlayer(BuildTargetGroup.Standalone, BuildTarget.StandaloneOSX, buildPath, BuildOptions.IncludeTestAssemblies, out report, out summary); + Assert.AreEqual(BuildResult.Succeeded, summary.result, "BuildTarget.StandaloneLinux64 failed to build"); + } + + public void TestsScenesPath() + { + var allpaths = AssetDatabase.GetAllAssetPaths(); + foreach (var targetPath in allpaths) + { + if (targetPath.Contains("com.unity.perception") && + targetPath.Contains("Runtime") && + targetPath.Contains("ScenarioTests") && + targetPath.Contains("Scenes")) + { + if (targetPath.Contains("BaseScene.unity")) + { + testSceneBase = targetPath; + Debug.Log("Scenes Path : " + targetPath); + editorBuildSettingsScenes.Add(new EditorBuildSettingsScene(targetPath, true)); + } + else if (targetPath.EndsWith(".unity")) + if (targetPath.EndsWith(".unity")) + { + testScenesPaths.Add(targetPath); + Debug.Log("Scenes Path : " + targetPath); + + editorBuildSettingsScenes.Add(new EditorBuildSettingsScene(targetPath, true)); + } + } + EditorBuildSettings.scenes = editorBuildSettingsScenes.ToArray(); + } + } + + public void BuildPlayer(BuildTargetGroup buildTargetGroup, BuildTarget buildTarget, string buildOutputPath, BuildOptions buildOptions, + out BuildReport buildReport, out BuildSummary buildSummary) + { + BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); + buildPlayerOptions.locationPathName = buildOutputPath; + buildPlayerOptions.target = buildTarget; + buildPlayerOptions.options = buildOptions; + buildPlayerOptions.targetGroup = buildTargetGroup; + + if (buildTarget == BuildTarget.StandaloneLinux64) + TurnOffBurstCompiler(); + + buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions); + buildSummary = buildReport.summary; + } + + public void TurnOffBurstCompiler() + { + var newLine = Environment.NewLine; + const string BurstAOTSettingsFilePath = "ProjectSettings/BurstAotSettings_StandaloneLinux64.json"; + string[] BurstAOTSettingsText = new[] + { + "{" + newLine, + @" ""MonoBehaviour"": {" , + @" ""m_EditorHideFlags"": 0,", + @" ""m_Name"": """",", + @" ""m_EditorClassIdentifier"":""Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings"",", + @" ""DisableOptimisations"": false,", + @" ""DisableSafetyChecks"": true,", + @" ""DisableBurstCompilation"": true", + " }", + "}" + }; + + File.WriteAllLines(BurstAOTSettingsFilePath, BurstAOTSettingsText); + AssetDatabase.Refresh(); + } + } +} + diff --git a/com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs.meta b/com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs.meta new file mode 100644 index 000000000..ac803cef5 --- /dev/null +++ b/com.unity.perception/Tests/Editor/BuildPerceptionPlayer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 32fcc796179769f4c94e776a33bce992 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef b/com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef new file mode 100644 index 000000000..2e8a15799 --- /dev/null +++ b/com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef @@ -0,0 +1,27 @@ +{ + "name": "Unity.Perception.Editor.Tests", + "references": [ + "UnityEditor.TestRunner", + "UnityEngine.TestRunner", + "Unity.Perception.Runtime", + "Unity.Mathematics", + "Unity.Perception.Editor", + "Unity.Collections", + "Unity.Entities" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [], + "noEngineReferences": false +} diff --git a/com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef.meta b/com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef.meta new file mode 100644 index 000000000..0f5b42a10 --- /dev/null +++ b/com.unity.perception/Tests/Editor/Unity.SimViz.Editor.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1ffc05badb9326c488a49f3b8382c7b0 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime.meta b/com.unity.perception/Tests/Runtime.meta new file mode 100644 index 000000000..f740c6773 --- /dev/null +++ b/com.unity.perception/Tests/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2f71a59b9daa4c44acc694b9bea5d65 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests.meta new file mode 100644 index 000000000..136517b1f --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0799200e12b69c74d9f77cc221a3feee +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs new file mode 100644 index 000000000..87c3912a1 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using NUnit.Framework; +using Unity.Collections; +using Unity.Entities; +using UnityEngine; +using UnityEngine.Perception; +using UnityEngine.Perception.Sensors; +using UnityEngine.TestTools; + +namespace GroundTruthTests +{ + [TestFixture] + public class BoundingBox2DTests : PassTestBase + { + public class ProducesCorrectBoundingBoxesData + { + public uint[] classCountsExpected; + public RenderedObjectInfo[] boundingBoxesExpected; + public uint[] data; + public int stride; + public string name; + public ProducesCorrectBoundingBoxesData(uint[] data, RenderedObjectInfo[] boundingBoxesExpected, uint[] classCountsExpected, int stride, string name) + { + this.data = data; + this.boundingBoxesExpected = boundingBoxesExpected; + this.classCountsExpected = classCountsExpected; + this.stride = stride; + this.name = name; + } + + public override string ToString() + { + return name; + } + } + public static IEnumerable ProducesCorrectBoundingBoxesTestCases() + { + yield return new ProducesCorrectBoundingBoxesData( + new uint[] + { + 1, 1, + 1, 1 + }, new[] + { + new RenderedObjectInfo() + { + boundingBox = new Rect(0, 0, 2, 2), + instanceId = 1, + labelId = 0, + pixelCount = 4 + } + }, new uint[] + { + 1, + 0 + }, + 2, + "SimpleBox"); + yield return new ProducesCorrectBoundingBoxesData( + new uint[] + { + 1, 0, 2, + 1, 0, 0 + }, new[] + { + new RenderedObjectInfo() + { + boundingBox = new Rect(0, 0, 1, 2), + instanceId = 1, + labelId = 0, + pixelCount = 2 + }, + new RenderedObjectInfo() + { + boundingBox = new Rect(2, 0, 1, 1), + instanceId = 2, + labelId = 1, + pixelCount = 1 + } + }, new uint[] + { + 1, + 1 + }, + 3, + "WithGaps"); + yield return new ProducesCorrectBoundingBoxesData( + new uint[] + { + 1, 2, 1, + 1, 2, 1 + }, new[] + { + new RenderedObjectInfo() + { + boundingBox = new Rect(0, 0, 3, 2), + instanceId = 1, + labelId = 0, + pixelCount = 4 + }, + new RenderedObjectInfo() + { + boundingBox = new Rect(1, 0, 1, 2), + instanceId = 2, + labelId = 1, + pixelCount = 2 + } + }, new uint[] + { + 1, + 1 + }, + 3, + "Interleaved"); + } + + [UnityTest] + public IEnumerator ProducesCorrectBoundingBoxes([ValueSource(nameof(ProducesCorrectBoundingBoxesTestCases))]ProducesCorrectBoundingBoxesData producesCorrectBoundingBoxesData) + { + var label = "label"; + var label2 = "label2"; + var labelingConfiguration = ScriptableObject.CreateInstance(); + + labelingConfiguration.LabelingConfigurations = new List + { + new LabelingConfigurationEntry + { + label = label, + value = 500 + }, + new LabelingConfigurationEntry + { + label = label2, + value = 500 + } + }; + + var renderedObjectInfoGenerator = new RenderedObjectInfoGenerator(labelingConfiguration); + var groundTruthLabelSetupSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem(); + groundTruthLabelSetupSystem.Activate(renderedObjectInfoGenerator); + + //Put a plane in front of the camera + AddTestObjectForCleanup(TestHelper.CreateLabeledPlane(.1f, label)); + AddTestObjectForCleanup(TestHelper.CreateLabeledPlane(.1f, label2)); + yield return null; + + var dataNativeArray = new NativeArray(producesCorrectBoundingBoxesData.data, Allocator.Persistent); + + renderedObjectInfoGenerator.Compute(dataNativeArray, producesCorrectBoundingBoxesData.stride, BoundingBoxOrigin.BottomLeft, out var boundingBoxes, out var classCounts, Allocator.Temp); + + CollectionAssert.AreEqual(producesCorrectBoundingBoxesData.boundingBoxesExpected, boundingBoxes.ToArray()); + CollectionAssert.AreEqual(producesCorrectBoundingBoxesData.classCountsExpected, classCounts.ToArray()); + + dataNativeArray.Dispose(); + boundingBoxes.Dispose(); + classCounts.Dispose(); + groundTruthLabelSetupSystem.Deactivate(renderedObjectInfoGenerator); + renderedObjectInfoGenerator.Dispose(); + } + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs.meta new file mode 100644 index 000000000..94285d459 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/BoundingBox2DTests.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c180c1c381d9422db9ad10abec1c8a72 +timeCreated: 1581521242 \ No newline at end of file diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs new file mode 100644 index 000000000..9a990bda9 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs @@ -0,0 +1,90 @@ +using NUnit.Framework; +using Unity.Mathematics; +using UnityEngine; +using UnityEngine.Perception.Sensors; + +namespace GroundTruthTests +{ + public class DatasetJsonUtilityTests + { + [Test] + [TestCase(-2f, 0f, 3f, @"[ + -2.0, + 0.0, + 3.0 +]")] + [TestCase(.01f, .02f, .03f, @"[ + 0.01, + 0.02, + 0.03 +]")] + [TestCase(float.NegativeInfinity, float.NaN, float.PositiveInfinity, @"[ + ""-Infinity"", + ""NaN"", + ""Infinity"" +]")] + public void Vector3ToJToken_ReturnsArrayFormat(float x, float y, float z, string jsonExpected) + { + var jsonActual = DatasetJsonUtility.ToJToken(new Vector3(x, y, z)); + Assert.AreEqual(jsonExpected, jsonActual.ToString()); + } + [Test] + [TestCase(-2f, 0f, 3f, 4f, @"[ + -2.0, + 0.0, + 3.0, + 4.0 +]")] + [TestCase(.01f, .02f, .03f, 0.04f, @"[ + 0.01, + 0.02, + 0.03, + 0.04 +]")] + [TestCase(float.NegativeInfinity, float.NaN, float.PositiveInfinity, float.NaN, @"[ + ""-Infinity"", + ""NaN"", + ""Infinity"", + ""NaN"" +]")] + public void QuaternionToJToken_ReturnsArrayFormat(float x, float y, float z, float w, string jsonExpected) + { + var jsonActual = DatasetJsonUtility.ToJToken(new Quaternion(x, y, z, w)).ToString(); + Assert.AreEqual(jsonExpected, jsonActual); + } + [Test] + [TestCase(0.1f, 0.2f, 0.3f, 4f, 5f, 6f, 70f, 80f, 90f, @"[ + [ + 0.1, + 4.0, + 70.0 + ], + [ + 0.2, + 5.0, + 80.0 + ], + [ + 0.3, + 6.0, + 90.0 + ] +]")] + public void Float3x3ToJToken_ReturnsArrayFormat(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22, string jsonExpected) + { + var jsonActual = DatasetJsonUtility.ToJToken(new float3x3(m00, m01, m02, m10, m11, m12, m20, m21, m22)).ToString(); + Assert.AreEqual(jsonExpected, jsonActual); + } + + [TestCase(1, "1")] + [TestCase(1u, "1")] + [TestCase(1.0, "1")] + [TestCase(1.0f, "1")] + [TestCase("string", "\"string\"")] + public void Primitive_ReturnsValue(object o, string jsonExpected) + { + var jsonActual = DatasetJsonUtility.ToJToken(o).ToString(); + Assert.AreEqual(jsonExpected, jsonActual); + } + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs.meta new file mode 100644 index 000000000..68672db0e --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fecf275960c548444bade423d296412f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab b/com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab new file mode 100644 index 000000000..c3cef2dcb --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab @@ -0,0 +1,253 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2608298934752318752 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2608298934752318763} + - component: {fileID: 2608298934752318756} + - component: {fileID: 2608298934752318757} + - component: {fileID: 2608298934752318758} + - component: {fileID: 2608298934752318759} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2608298934752318763 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2608298934752318752} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &2608298934752318756 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2608298934752318752} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!81 &2608298934752318757 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2608298934752318752} + m_Enabled: 1 +--- !u!114 &2608298934752318758 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2608298934752318752} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 6 + m_ObsoleteRenderingPath: 0 + m_ObsoleteFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 + enableDepthPrepassWithDeferredRendering: 0 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 + enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 + lightLoopSettings: + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 + clearColorMode: 0 + backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0} + clearDepth: 1 + volumeLayerMask: + serializedVersion: 2 + m_Bits: 1 + volumeAnchorOverride: {fileID: 0} + antialiasing: 0 + SMAAQuality: 2 + dithering: 0 + stopNaNs: 0 + physicalParameters: + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + flipYMode: 0 + fullscreenPassthrough: 0 + allowDynamicResolution: 0 + customRenderingSettings: 0 + invertFaceCulling: 0 + probeLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPathCustomFrameSettings: + bitDatas: + data1: 69730941533981 + data2: 4539628424926265344 + lodBias: 1 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + materialQuality: 0 + renderingPathCustomFrameSettingsOverrideMask: + mask: + data1: 0 + data2: 0 + defaultFrameSettings: 0 +--- !u!114 &2608298934752318759 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2608298934752318752} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 26d6499a6bd256e47b859377446493a1, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + customPasses: + - id: 0 + - id: 1 + - id: 2 + injectionPoint: 0 + references: + version: 1 + 00000000: + type: {class: InstanceSegmentationPass, ns: UnityEngine.Perception.Sensors, asm: Unity.Perception.GroundTruth} + data: + name: Custom Pass + enabled: 1 + targetColorBuffer: 1 + targetDepthBuffer: 1 + clearFlags: 0 + passFoldout: 0 + targetCamera: {fileID: 0} + layerMask: + serializedVersion: 2 + m_Bits: 4294967295 + targetTexture: {fileID: 8400000, guid: 6519b622da084c14ba19d257dbc156d8, type: 2} + reassignIds: 0 + idStart: 1 + idStep: 1 + 00000001: + type: {class: SemanticSegmentationPass, ns: UnityEngine.Perception.Sensors, asm: Unity.Perception.GroundTruth} + data: + name: Custom Pass + enabled: 1 + targetColorBuffer: 1 + targetDepthBuffer: 1 + clearFlags: 0 + passFoldout: 0 + targetCamera: {fileID: 0} + targetTexture: {fileID: 8400000, guid: 7498338473af7ff4fbbfb55598b6d24e, type: 2} + labelingConfiguration: {fileID: 11400000, guid: 16a81d3f01f4f4345b113509e93fdab6, + type: 2} + 00000002: + type: {class: LabelHistogramPass, ns: UnityEngine.Perception.Sensors, asm: Unity.Perception.GroundTruth} + data: + name: Custom Pass + enabled: 1 + targetColorBuffer: 1 + targetDepthBuffer: 1 + clearFlags: 0 + passFoldout: 0 + targetCamera: {fileID: 0} + SegmentationTexture: {fileID: 8400000, guid: 6519b622da084c14ba19d257dbc156d8, + type: 2} + LabelingConfiguration: {fileID: 11400000, guid: 16a81d3f01f4f4345b113509e93fdab6, + type: 2} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab.meta new file mode 100644 index 000000000..9c1d3286f --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/Main Camera.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b423c67e7ddf25444b8b047b1e9c7735 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs new file mode 100644 index 000000000..6a4db694c --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Unity.Collections; +#if UNITY_EDITOR +using UnityEditor; +using UnityEditorInternal; +#endif +using UnityEngine; +using UnityEngine.Experimental.Rendering; +using UnityEngine.Perception; +using UnityEngine.Perception.Sensors; +using UnityEngine.TestTools; + +#if HDRP_PRESENT +using UnityEngine.Rendering.HighDefinition; +#endif + +namespace GroundTruthTests +{ + //Graphics issues with OpenGL Linux Editor. https://jira.unity3d.com/browse/AISV-422 + [UnityPlatform(exclude = new[] {RuntimePlatform.LinuxEditor, RuntimePlatform.LinuxPlayer})] + [TestFixture] + class ObjectCountTests : PassTestBase + { + [UnityTest] + public IEnumerator LabeledObjectHistogramPassProducesCorrectValuesWithChangingObjects() + { + var label = "label"; + var labelingConfiguration = ScriptableObject.CreateInstance(); + + labelingConfiguration.LabelingConfigurations = new List + { + new LabelingConfigurationEntry + { + label = label, + value = 500 + } + }; + + var receivedResults = new List<(uint[] counts, LabelingConfigurationEntry[] labels, int frameCount)>(); + + var cameraObject = SetupCamera(labelingConfiguration, (counts, labels, frameCount) => + { + receivedResults.Add((counts.ToArray(), labels.ToArray(), frameCount)); + }); + AddTestObjectForCleanup(cameraObject); + + //TestHelper.LoadAndStartRenderDocCapture(out EditorWindow gameView); + var startFrameCount = Time.frameCount; + var expectedFramesAndCounts= new Dictionary() + { + {Time.frameCount , 0}, + {startFrameCount + 1, 1}, + {startFrameCount + 2, 1}, + {startFrameCount + 3, 2}, + {startFrameCount + 4, 1}, + {startFrameCount + 5, 1}, + }; + + yield return null; + //Put a plane in front of the camera + var planeObject = TestHelper.CreateLabeledPlane(.1f, label); + yield return null; + GameObject.DestroyImmediate(planeObject); + planeObject = TestHelper.CreateLabeledPlane(.1f, label); + yield return null; + var planeObject2 = TestHelper.CreateLabeledPlane(.1f, label); + planeObject2.transform.Translate(.5f, 0, 0); + + yield return null; + GameObject.DestroyImmediate(planeObject); + yield return null; + yield return null; + + GameObject.DestroyImmediate(planeObject2); +#if HDRP_PRESENT + //TODO: Remove this when DestroyImmediate properly calls Cleanup on the pass + var labelHistogramPass = (ObjectCountPass)cameraObject.GetComponent().customPasses.First(p => p is ObjectCountPass); + labelHistogramPass.WaitForAllRequests(); +#endif + //destroy the object to force all pending segmented image readbacks to finish and events to be fired. + DestroyTestObject(cameraObject); + + //RenderDoc.EndCaptureRenderDoc(gameView); + + foreach (var result in receivedResults) + { + Assert.AreEqual(1, result.counts.Length); + Assert.AreEqual(1, result.labels.Length); + Assert.Contains(result.frameCount, expectedFramesAndCounts.Keys, "Received event with unexpected frameCount."); + + var expectedCount = expectedFramesAndCounts[result.frameCount]; + + var errorString = $"Wrong count in frame {result.frameCount - startFrameCount}. {string.Join(", ", receivedResults.Select(r => $"count: {r.counts[0]}"))}"; + Assert.AreEqual(expectedCount, result.counts[0], errorString); + + expectedFramesAndCounts.Remove(result.frameCount); + } + + CollectionAssert.IsEmpty(expectedFramesAndCounts); + } + + static GameObject SetupCamera(LabelingConfiguration labelingConfiguration, + Action, IReadOnlyList, int> onClassCountsReceived) + { + var cameraObject = new GameObject(); + cameraObject.SetActive(false); + var camera = cameraObject.AddComponent(); + camera.orthographic = true; + camera.orthographicSize = 1; + +#if HDRP_PRESENT + cameraObject.AddComponent(); + var customPassVolume = cameraObject.AddComponent(); + customPassVolume.isGlobal = true; + var rt = new RenderTexture(128, 128, 1, GraphicsFormat.R8G8B8A8_UNorm); + rt.Create(); + var InstanceSegmentationPass = new InstanceSegmentationPass() + { + targetCamera = camera, + targetTexture = rt, + idStart = 1, + idStep = 1 + }; + InstanceSegmentationPass.name = nameof(InstanceSegmentationPass); + InstanceSegmentationPass.EnsureInit(); + customPassVolume.customPasses.Add(InstanceSegmentationPass); + var ObjectCountPass = new ObjectCountPass(camera); + ObjectCountPass.SegmentationTexture = rt; + ObjectCountPass.LabelingConfiguration = labelingConfiguration; + ObjectCountPass.name = nameof(ObjectCountPass); + customPassVolume.customPasses.Add(ObjectCountPass); + + ObjectCountPass.ClassCountsReceived += onClassCountsReceived; +#endif +#if URP_PRESENT + var perceptionCamera = cameraObject.AddComponent(); + perceptionCamera.LabelingConfiguration = labelingConfiguration; + perceptionCamera.captureRgbImages = false; + perceptionCamera.produceBoundingBoxAnnotations = false; + perceptionCamera.produceObjectCountAnnotations = true; + perceptionCamera.classCountsReceived += onClassCountsReceived; +#endif + cameraObject.SetActive(true); + return cameraObject; + } + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs.meta new file mode 100644 index 000000000..e2d259e3b --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 826aa4dde1412c245b3c7ca95c1f5d6b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs new file mode 100644 index 000000000..11fd3b76e --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.Perception; +using Object = UnityEngine.Object; + +namespace GroundTruthTests +{ + public class PassTestBase + { + List objectsToDestroy = new List(); + [TearDown] + public void TearDown() + { + foreach (var o in objectsToDestroy) + Object.DestroyImmediate(o); + + objectsToDestroy.Clear(); + SimulationManager.ResetSimulation(); + } + + public void AddTestObjectForCleanup(GameObject @object) => objectsToDestroy.Add(@object); + + public void DestroyTestObject(GameObject @object) + { + Object.DestroyImmediate(@object); + objectsToDestroy.Remove(@object); + } + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs.meta new file mode 100644 index 000000000..b957a3ff9 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/PassTestBase.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9b1557ffb78949d49818470fe92c123e +timeCreated: 1571938847 \ No newline at end of file diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs new file mode 100644 index 000000000..16e39981b --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs @@ -0,0 +1,193 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Unity.Collections; +using UnityEngine; +#if HDRP_PRESENT +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Experimental.Rendering; +#endif +using UnityEngine.Perception.Sensors; +using UnityEngine.TestTools; +using Object = UnityEngine.Object; + +namespace GroundTruthTests +{ + public class ImageReaderBehaviour : MonoBehaviour + { + public RenderTexture source; + public Camera cameraSource; + RenderTextureReader m_Reader; + + public event Action> SegmentationImageReceived; + + void Awake() + { + m_Reader = new RenderTextureReader(source, cameraSource, ImageReadCallback); + } + + void ImageReadCallback(int frameCount, NativeArray data, RenderTexture renderTexture) + { + if (SegmentationImageReceived != null) + SegmentationImageReceived(frameCount, data); + } + + void OnDestroy() + { + m_Reader.Dispose(); + m_Reader = null; + } + } + + //Graphics issues with OpenGL Linux Editor. https://jira.unity3d.com/browse/AISV-422 + [UnityPlatform(exclude = new[] {RuntimePlatform.LinuxEditor, RuntimePlatform.LinuxPlayer})] + public class SegmentationPassTests : PassTestBase + { + // A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use + // `yield return null;` to skip a frame. + [UnityTest] + public IEnumerator SegmentationPassTestsWithEnumeratorPasses() + { + int timesSegmentationImageReceived = 0; + int? frameStart = null; + Action> onSegmentationImageReceived = (frameCount, data) => + { + if (frameStart == null || frameStart > frameCount) + return; + + timesSegmentationImageReceived++; + CollectionAssert.AreEqual(Enumerable.Repeat(1, data.Length), data); + }; + + var cameraObject = SetupCamera(onSegmentationImageReceived); + // + // // Arbitrary wait for 5 frames for shaders to load. Workaround for issue with Shader.WarmupAllShaders() + // for (int i=0 ; i<5 ; ++i) + // yield return new WaitForSeconds(1); + + frameStart = Time.frameCount; + + //Put a plane in front of the camera + var planeObject = GameObject.CreatePrimitive(PrimitiveType.Plane); + planeObject.transform.SetPositionAndRotation(new Vector3(0, 0, 10), Quaternion.Euler(90, 0, 0) ); + planeObject.transform.localScale = new Vector3(10, -1, 10); + planeObject.AddComponent(); + AddTestObjectForCleanup(planeObject); + + yield return null; + yield return null; + yield return null; + yield return null; + //destroy the object to force all pending segmented image readbacks to finish and events to be fired. + DestroyTestObject(cameraObject); + DestroyTestObject(planeObject); + + Assert.AreEqual(4, timesSegmentationImageReceived); + } + [UnityTest] + public IEnumerator SegmentationPassProducesCorrectValuesEachFrame() + { + int timesSegmentationImageReceived = 0; + Dictionary expectedLabelAtFrame = null; + + //TestHelper.LoadAndStartRenderDocCapture(out var gameView); + + Action> onSegmentationImageReceived = (frameCount, data) => + { + if (expectedLabelAtFrame == null || !expectedLabelAtFrame.ContainsKey(frameCount)) + return; + + timesSegmentationImageReceived++; + + Debug.Log($"Segmentation image received. FrameCount: {frameCount}"); + + try + { + CollectionAssert.AreEqual(Enumerable.Repeat(expectedLabelAtFrame[frameCount], data.Length), data); + } + catch (Exception e) + { + //uncomment to get RenderDoc captures while this check is failing + //RenderDoc.EndCaptureRenderDoc(gameView); + throw; + } + }; + + var cameraObject = SetupCamera(onSegmentationImageReceived); + + expectedLabelAtFrame = new Dictionary + { + {Time.frameCount , 1}, + {Time.frameCount + 1, 1}, + {Time.frameCount + 2, 1} + }; + GameObject planeObject; + + //Put a plane in front of the camera + planeObject = TestHelper.CreateLabeledPlane(); + yield return null; + + //UnityEditorInternal.RenderDoc.EndCaptureRenderDoc(gameView); + Object.DestroyImmediate(planeObject); + planeObject = TestHelper.CreateLabeledPlane(); + + //TestHelper.LoadAndStartRenderDocCapture(out gameView); + yield return null; + + //UnityEditorInternal.RenderDoc.EndCaptureRenderDoc(gameView); + Object.DestroyImmediate(planeObject); + planeObject = TestHelper.CreateLabeledPlane(); + yield return null; + Object.DestroyImmediate(planeObject); + yield return null; + + //destroy the object to force all pending segmented image readbacks to finish and events to be fired. + DestroyTestObject(cameraObject); + + Assert.AreEqual(3, timesSegmentationImageReceived); + } + + GameObject SetupCamera(Action> onSegmentationImageReceived) + { + var cameraObject = new GameObject(); + cameraObject.SetActive(false); + var camera = cameraObject.AddComponent(); + camera.orthographic = true; + camera.orthographicSize = 1; + +#if HDRP_PRESENT + cameraObject.AddComponent(); + var customPassVolume = cameraObject.AddComponent(); + customPassVolume.isGlobal = true; + var rt = new RenderTexture(128, 128, 1, GraphicsFormat.R8G8B8A8_UNorm); + rt.Create(); + var InstanceSegmentationPass = new InstanceSegmentationPass(); + InstanceSegmentationPass.targetCamera = camera; + InstanceSegmentationPass.targetTexture = rt; + customPassVolume.customPasses.Add(InstanceSegmentationPass); + InstanceSegmentationPass.name = nameof(InstanceSegmentationPass); + InstanceSegmentationPass.EnsureInit(); + + var reader = cameraObject.AddComponent(); + reader.source = rt; + reader.cameraSource = camera; + + reader.SegmentationImageReceived += onSegmentationImageReceived; +#endif +#if URP_PRESENT + var labelingConfiguration = ScriptableObject.CreateInstance(); + var perceptionCamera = cameraObject.AddComponent(); + perceptionCamera.LabelingConfiguration = labelingConfiguration; + perceptionCamera.captureRgbImages = false; + perceptionCamera.produceBoundingBoxAnnotations = false; + perceptionCamera.produceObjectCountAnnotations = true; + perceptionCamera.segmentationImageReceived += onSegmentationImageReceived; +#endif + AddTestObjectForCleanup(cameraObject); + cameraObject.SetActive(true); + return cameraObject; + } + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs.meta new file mode 100644 index 000000000..e20a5c4af --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationPassTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2634ea39f95cae8478d458487782b7cd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs new file mode 100644 index 000000000..f1e044cd9 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs @@ -0,0 +1,891 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using NUnit.Framework; +using Unity.Mathematics; +using Unity.Simulation; +using UnityEngine; +using UnityEngine.Perception; +using UnityEngine.TestTools; +// ReSharper disable InconsistentNaming +// ReSharper disable NotAccessedField.Local + +namespace GroundTruthTests +{ + [TestFixture] + public class SimulationManagerTests + { + [TearDown] + public void TearDown() + { + SimulationManager.ResetSimulation(); + Time.timeScale = 1; + //Manager.Instance.Shutdown(); + if (Directory.Exists(SimulationManager.OutputDirectory)) + Directory.Delete(SimulationManager.OutputDirectory, true); + + //Manager.Instance.Start(); + } + + [Test] + public void RegisterSensor_ReportsProperJson() + { + var egoDescription = @"the main car driving in simulation"; + var sensorDescription = "Cam (FL2-14S3M-C)"; + var modality = "camera"; + + var egoJsonExpected = + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""egos"": [ + {{ + ""id"": , + ""description"": ""{egoDescription}"" + }} + ] +}}"; + var sensorJsonExpected = + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""sensors"": [ + {{ + ""id"": , + ""ego_id"": , + ""modality"": ""{modality}"", + ""description"": ""{sensorDescription}"" + }} + ] +}}"; + + var ego = SimulationManager.RegisterEgo(egoDescription); + var sensorHandle = SimulationManager.RegisterSensor(ego, modality, sensorDescription, 1, 1); + Assert.IsTrue(sensorHandle.IsValid); + SimulationManager.ResetSimulation(); + Assert.IsFalse(sensorHandle.IsValid); + + var sensorsPath = Path.Combine(SimulationManager.OutputDirectory, "sensors.json"); + var egosPath = Path.Combine(SimulationManager.OutputDirectory, "egos.json"); + + FileAssert.Exists(egosPath); + FileAssert.Exists(sensorsPath); + + AssertJsonFileEquals(egoJsonExpected, egosPath); + AssertJsonFileEquals(sensorJsonExpected, sensorsPath); + } + + [Test] + public void ReportCapture_ReportsProperJson() + { + var filename = "my/file.png"; + + var egoPosition = new float3(.02f, .03f, .04f); + var egoRotation = new quaternion(.1f, .2f, .3f, .4f); + + var egoVelocity = new Vector3(.1f, .2f, .3f); + + var position = new float3(.2f, 1.1f, .3f); + var rotation = new quaternion(.3f, .2f, .1f, .5f); + var intrinsics = new float3x3(.1f, .2f, .3f, 1f, 2f, 3f, 10f, 20f, 30f); + + + var capturesJsonExpected = + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""captures"": [ + {{ + ""id"": , + ""sequence_id"": , + ""step"": 0, + ""timestamp"": 0.0, + ""sensor"": {{ + ""sensor_id"": , + ""ego_id"": , + ""modality"": ""camera"", + ""translation"": [ + {Format(position.x)}, + {Format(position.y)}, + {Format(position.z)} + ], + ""rotation"": [ + {Format(rotation.value.x)}, + {Format(rotation.value.y)}, + {Format(rotation.value.z)}, + {Format(rotation.value.w)} + ], + ""camera_intrinsic"": [ + [ + {Format(intrinsics.c0.x)}, + {Format(intrinsics.c0.y)}, + {Format(intrinsics.c0.z)} + ], + [ + {Format(intrinsics.c1.x)}, + {Format(intrinsics.c1.y)}, + {Format(intrinsics.c1.z)} + ], + [ + {Format(intrinsics.c2.x)}, + {Format(intrinsics.c2.y)}, + {Format(intrinsics.c2.z)} + ] + ] + }}, + ""ego"": {{ + ""ego_id"": , + ""translation"": [ + {Format(egoPosition.x)}, + {Format(egoPosition.y)}, + {Format(egoPosition.z)} + ], + ""rotation"": [ + {Format(egoRotation.value.x)}, + {Format(egoRotation.value.y)}, + {Format(egoRotation.value.z)}, + {Format(egoRotation.value.w)} + ], + ""velocity"": [ + {Format(egoVelocity.x)}, + {Format(egoVelocity.y)}, + {Format(egoVelocity.z)} + ], + ""acceleration"": null + }}, + ""filename"": ""{filename}"", + ""format"": ""PNG"" + }} + ] +}}"; + + var ego = SimulationManager.RegisterEgo(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "camera", "", 1, 0); + var sensorSpatialData = new SensorSpatialData(new Pose(egoPosition, egoRotation), new Pose(position, rotation), egoVelocity, null); + sensorHandle.ReportCapture(filename, sensorSpatialData, ("camera_intrinsic", intrinsics)); + + SimulationManager.ResetSimulation(); + Assert.IsFalse(sensorHandle.IsValid); + + var capturesPath = Path.Combine(SimulationManager.OutputDirectory, "captures_000.json"); + + FileAssert.Exists(capturesPath); + + AssertJsonFileEquals(capturesJsonExpected, capturesPath); + } + + [UnityTest] + public IEnumerator StartNewSequence_ProperlyIncrementsSequence() + { + var timingsExpected = new (int step, int timestamp, bool expectNewSequence)[] + { + (0, 0, true), + (1, 2, false), + (0, 0, true), + (1, 2, false) + }; + + var ego = SimulationManager.RegisterEgo(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 2, 0); + var sensorSpatialData = new SensorSpatialData(default, default, null, null); + Assert.IsTrue(sensorHandle.ShouldCaptureThisFrame); + sensorHandle.ReportCapture("f", sensorSpatialData); + yield return null; + Assert.IsTrue(sensorHandle.ShouldCaptureThisFrame); + sensorHandle.ReportCapture("f", sensorSpatialData); + yield return null; + SimulationManager.StartNewSequence(); + Assert.IsTrue(sensorHandle.ShouldCaptureThisFrame); + sensorHandle.ReportCapture("f", sensorSpatialData); + yield return null; + Assert.IsTrue(sensorHandle.ShouldCaptureThisFrame); + sensorHandle.ReportCapture("f", sensorSpatialData); + + SimulationManager.ResetSimulation(); + Assert.IsFalse(sensorHandle.IsValid); + + //read all captures from the output directory + List captures = new List(); + foreach (var capturesPath in Directory.EnumerateFiles(SimulationManager.OutputDirectory, "captures_*.json")) + { + var capturesText = File.ReadAllText(capturesPath); + var jObject = JToken.ReadFrom(new JsonTextReader(new StringReader(capturesText))); + var captureJArray = (JArray)jObject["captures"]; + captures.AddRange(captureJArray.Cast()); + } + + Assert.AreEqual(timingsExpected.Length, captures.Count); + + var currentSequenceId = "00"; + for (int i = 0; i < timingsExpected.Length; i++) + { + var timingExpected = timingsExpected[i]; + var text = captures[i]; + Assert.AreEqual(timingExpected.step, text["step"].Value()); + Assert.AreEqual(timingExpected.timestamp, text["timestamp"].Value()); + var newSequenceId = text["sequence_id"].ToString(); + + if (timingExpected.expectNewSequence) + Assert.AreNotEqual(newSequenceId, currentSequenceId, $"Expected new sequence in frame {i}, but was same"); + else + Assert.AreEqual(newSequenceId, currentSequenceId, $"Expected same sequence in frame {i}, but was new"); + + currentSequenceId = newSequenceId; + } + } + + //Format a float to match Newtonsoft.Json formatting + string Format(float value) + { + var result = value.ToString("R", CultureInfo.InvariantCulture); + if (!result.Contains(".")) + return result + ".0"; + + return result; + } + + [Test] + public void ReportAnnotation_AddsProperJsonToCapture() + { + var filename = "my/file.png"; + var annotationDefinitionGuid = Guid.NewGuid(); + + var annotationDefinitionsJsonExpected= + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""annotation_definitions"": [ + {{ + ""id"": , + ""name"": ""semantic segmentation"", + ""description"": ""pixel-wise semantic segmentation label"", + ""format"": ""PNG"" + }} + ] +}}"; + var annotationsJsonExpected= + $@" ""annotations"": [ + {{ + ""id"": , + ""annotation_definition"": , + ""filename"": ""annotations/semantic_segmentation_000.png"" + }} + ]"; + + var ego = SimulationManager.RegisterEgo(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + sensorHandle.ReportCapture(filename, default); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition("semantic segmentation", "pixel-wise semantic segmentation label", "PNG", annotationDefinitionGuid); + sensorHandle.ReportAnnotationFile(annotationDefinition, "annotations/semantic_segmentation_000.png"); + + SimulationManager.ResetSimulation(); + Assert.IsFalse(sensorHandle.IsValid); + + var annotationDefinitionsPath = Path.Combine(SimulationManager.OutputDirectory, "annotation_definitions.json"); + var capturesPath = Path.Combine(SimulationManager.OutputDirectory, "captures_000.json"); + + + AssertJsonFileEquals(annotationDefinitionsJsonExpected, annotationDefinitionsPath); + + FileAssert.Exists(capturesPath); + StringAssert.Contains(annotationsJsonExpected, EscapeGuids(File.ReadAllText(capturesPath))); + } + + [Test] + public void ReportAnnotationValues_ReportsProperJson() + { + var values = new[] + { + new TestValues() + { + a = "a string", + b = 10 + }, + new TestValues() + { + a = "a second string", + b = 20 + }, + }; + + var expectedAnnotation = $@" ""annotations"": [ + {{ + ""id"": , + ""annotation_definition"": , + ""values"": [ + {{ + ""a"": ""a string"", + ""b"": 10 + }}, + {{ + ""a"": ""a second string"", + ""b"": 20 + }} + ] + }} + ]"; + + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + + sensorHandle.ReportAnnotationValues(annotationDefinition, values); + SimulationManager.ResetSimulation(); + + var capturesPath = Path.Combine(SimulationManager.OutputDirectory, "captures_000.json"); + + FileAssert.Exists(capturesPath); + StringAssert.Contains(expectedAnnotation, EscapeGuids(File.ReadAllText(capturesPath))); + } + + [Test] + public void ReportAnnotationFile_WhenCaptureNotExpected_Throws() + { + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100); + Assert.Throws(()=>sensorHandle.ReportAnnotationFile(annotationDefinition, "")); + } + + [Test] + public void ReportAnnotationValues_WhenCaptureNotExpected_Throws() + { + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100); + Assert.Throws(()=>sensorHandle.ReportAnnotationValues(annotationDefinition, new int[0])); + } + + [Test] + public void ReportAnnotationAsync_WhenCaptureNotExpected_Throws() + { + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100); + Assert.Throws(()=>sensorHandle.ReportAnnotationAsync(annotationDefinition)); + } + + [Test] + public void ResetSimulation_WithUnreportedAnnotationAsync_LogsError() + { + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + sensorHandle.ReportAnnotationAsync(annotationDefinition); + SimulationManager.ResetSimulation(); + LogAssert.Expect(LogType.Error, new Regex("Simulation ended with pending .*")); + } + + [Test] + public void ResetSimulation_CallsSimulationEnding() + { + int timesCalled = 0; + SimulationManager.SimulationEnding += () => timesCalled++; + SimulationManager.ResetSimulation(); + SimulationManager.ResetSimulation(); + Assert.AreEqual(2, timesCalled); + } + + [Test] + public void AnnotationAsyncIsValid_ReturnsProperValue() + { + LogAssert.ignoreFailingMessages = true; //we aren't worried about "Simulation ended with pending..." + + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + var asyncAnnotation = sensorHandle.ReportAnnotationAsync(annotationDefinition); + + Assert.IsTrue(asyncAnnotation.IsValid); + SimulationManager.ResetSimulation(); + Assert.IsFalse(asyncAnnotation.IsValid); + } + + [Test] + public void AnnotationAsyncReportFile_ReportsProperJson() + { + var expectedAnnotation = $@" ""annotations"": [ + {{ + ""id"": , + ""annotation_definition"": , + ""filename"": ""annotations/output.png"" + }} + ]"; + + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + var asyncAnnotation = sensorHandle.ReportAnnotationAsync(annotationDefinition); + + Assert.IsTrue(asyncAnnotation.IsPending); + asyncAnnotation.ReportFile("annotations/output.png"); + Assert.IsFalse(asyncAnnotation.IsPending); + SimulationManager.ResetSimulation(); + + var capturesPath = Path.Combine(SimulationManager.OutputDirectory, "captures_000.json"); + + FileAssert.Exists(capturesPath); + StringAssert.Contains(expectedAnnotation, EscapeGuids(File.ReadAllText(capturesPath))); + } + + + public struct TestValues + { + public string a; + public int b; + } + + [Test] + public void AnnotationAsyncReportValues_ReportsProperJson() + { + var values = new[] + { + new TestValues() + { + a = "a string", + b = 10 + }, + new TestValues() + { + a = "a second string", + b = 20 + }, + }; + + var expectedAnnotation = $@" ""annotations"": [ + {{ + ""id"": , + ""annotation_definition"": , + ""values"": [ + {{ + ""a"": ""a string"", + ""b"": 10 + }}, + {{ + ""a"": ""a second string"", + ""b"": 20 + }} + ] + }} + ]"; + + var ego = SimulationManager.RegisterEgo(""); + var annotationDefinition = SimulationManager.RegisterAnnotationDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + var asyncAnnotation = sensorHandle.ReportAnnotationAsync(annotationDefinition); + + Assert.IsTrue(asyncAnnotation.IsPending); + asyncAnnotation.ReportValues(values); + Assert.IsFalse(asyncAnnotation.IsPending); + SimulationManager.ResetSimulation(); + + var capturesPath = Path.Combine(SimulationManager.OutputDirectory, "captures_000.json"); + + FileAssert.Exists(capturesPath); + StringAssert.Contains(expectedAnnotation, EscapeGuids(File.ReadAllText(capturesPath))); + } + + [Test] + public void CreateAnnotation_MultipleTimes_WritesProperTypeOnce() + { + var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + var annotationDefinitionsJsonExpected= + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""annotation_definitions"": [ + {{ + ""id"": ""{annotationDefinitionGuid}"", + ""name"": ""name"", + ""format"": ""json"" + }} + ] +}}"; + var annotationDefinition1 = SimulationManager.RegisterAnnotationDefinition("name", id: annotationDefinitionGuid); + var annotationDefinition2 = SimulationManager.RegisterAnnotationDefinition("name", id: annotationDefinitionGuid); + + SimulationManager.ResetSimulation(); + + var annotationDefinitionsPath = Path.Combine(SimulationManager.OutputDirectory, "annotation_definitions.json"); + + Assert.AreEqual(annotationDefinition1, annotationDefinition2); + Assert.AreEqual(annotationDefinitionGuid, annotationDefinition1.Id); + Assert.AreEqual(annotationDefinitionGuid, annotationDefinition2.Id); + AssertJsonFileEquals(annotationDefinitionsJsonExpected, annotationDefinitionsPath, false); + } + + [Test] + public void CreateAnnotation_MultipleTimesWithDifferentParameters_WritesProperTypes() + { + var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + var annotationDefinitionsJsonExpected= + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""annotation_definitions"": [ + {{ + ""id"": , + ""name"": ""name"", + ""format"": ""json"" + }}, + {{ + ""id"": , + ""name"": ""name2"", + ""description"": ""description"", + ""format"": ""json"" + }} + ] +}}"; + var annotationDefinition1 = SimulationManager.RegisterAnnotationDefinition("name", id: annotationDefinitionGuid); + var annotationDefinition2 = SimulationManager.RegisterAnnotationDefinition("name2", description: "description"); + + SimulationManager.ResetSimulation(); + + var annotationDefinitionsPath = Path.Combine(SimulationManager.OutputDirectory, "annotation_definitions.json"); + + Assert.AreEqual(annotationDefinitionGuid, annotationDefinition1.Id); + Assert.AreNotEqual(default(Guid), annotationDefinition2.Id); + + AssertJsonFileEquals(annotationDefinitionsJsonExpected, annotationDefinitionsPath); + } + + [Test] + public void ReportMetricValues_WhenCaptureNotExpected_Throws() + { + var ego = SimulationManager.RegisterEgo(""); + var metricDefinition = SimulationManager.RegisterMetricDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100); + Assert.Throws(()=>sensorHandle.ReportMetric(metricDefinition, new int[0])); + } + + [Test] + public void ReportMetricAsync_WhenCaptureNotExpected_Throws() + { + var ego = SimulationManager.RegisterEgo(""); + var metricDefinition = SimulationManager.RegisterMetricDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 100); + Assert.Throws(()=>sensorHandle.ReportMetricAsync(metricDefinition)); + } + + [Test] + public void ResetSimulation_WithUnreportedMetricAsync_LogsError() + { + var ego = SimulationManager.RegisterEgo(""); + var metricDefinition = SimulationManager.RegisterMetricDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + sensorHandle.ReportMetricAsync(metricDefinition); + SimulationManager.ResetSimulation(); + LogAssert.Expect(LogType.Error, new Regex("Simulation ended with pending .*")); + } + + [Test] + public void MetricAsyncIsValid_ReturnsProperValue() + { + LogAssert.ignoreFailingMessages = true; //we aren't worried about "Simulation ended with pending..." + + var ego = SimulationManager.RegisterEgo(""); + var metricDefinition = SimulationManager.RegisterMetricDefinition(""); + var sensorHandle = SimulationManager.RegisterSensor(ego, "", "", 1, 0); + var asyncMetric = sensorHandle.ReportMetricAsync(metricDefinition); + + Assert.IsTrue(asyncMetric.IsValid); + SimulationManager.ResetSimulation(); + Assert.IsFalse(asyncMetric.IsValid); + } + + public enum MetricTarget + { + Global, + Capture, + Annotation + } + + [UnityTest] + public IEnumerator MetricReportValues_WithNoReportsInFrames_DoesNotIncrementStep() + { + var values = new[] { 1 }; + + var expectedLine = @"""step"": 0"; + + var metricDefinition = SimulationManager.RegisterMetricDefinition(""); + SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "", "", 1, 0); + + yield return null; + yield return null; + yield return null; + SimulationManager.ReportMetric(metricDefinition, values); + SimulationManager.ResetSimulation(); + + var text = File.ReadAllText(Path.Combine(SimulationManager.OutputDirectory, "metrics_000.json")); + StringAssert.Contains(expectedLine, text); + } + + [UnityTest] + public IEnumerator SensorHandleReportMetric_BeforeReportCapture_ReportsProperJson() + { + var values = new[] { 1 }; + + var expectedLine = @"""step"": 0"; + + var metricDefinition = SimulationManager.RegisterMetricDefinition(""); + var sensor = SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "", "", 1, 0); + + yield return null; + sensor.ReportMetric(metricDefinition, values); + sensor.ReportCapture("file", new SensorSpatialData(Pose.identity, Pose.identity, null, null)); + SimulationManager.ResetSimulation(); + + var metricsTest = File.ReadAllText(Path.Combine(SimulationManager.OutputDirectory, "metrics_000.json")); + var captures = File.ReadAllText(Path.Combine(SimulationManager.OutputDirectory, "captures_000.json")); + StringAssert.Contains(expectedLine, metricsTest); + StringAssert.Contains(expectedLine, captures); + } + + [Test] + public void MetricAsyncReportValues_ReportsProperJson( + [Values(MetricTarget.Global, MetricTarget.Capture, MetricTarget.Annotation)] MetricTarget metricTarget, + [Values(true, false)] bool async, + [Values(true, false)] bool asStringJsonArray) + { + var values = new[] + { + new TestValues() + { + a = "a string", + b = 10 + }, + new TestValues() + { + a = "a second string", + b = 20 + }, + }; + + var expectedMetric = $@"{{ + ""version"": ""0.0.1"", + ""metrics"": [ + {{ + ""capture_id"": {(metricTarget == MetricTarget.Annotation || metricTarget == MetricTarget.Capture ? "" : "null")}, + ""annotation_id"": {(metricTarget == MetricTarget.Annotation ? "" : "null")}, + ""sequence_id"": , + ""step"": 0, + ""metric_definition"": , + ""values"": [ + {{ + ""a"": ""a string"", + ""b"": 10 + }}, + {{ + ""a"": ""a second string"", + ""b"": 20 + }} + ] + }} + ] +}}"; + + var metricDefinition = SimulationManager.RegisterMetricDefinition(""); + var sensor = SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "", "", 1, 0); + var annotation = sensor.ReportAnnotationFile(SimulationManager.RegisterAnnotationDefinition(""), ""); + var valuesJsonArray = JArray.FromObject(values).ToString(Formatting.Indented); + if (async) + { + AsyncMetric asyncMetric; + switch (metricTarget) + { + case MetricTarget.Global: + asyncMetric = SimulationManager.ReportMetricAsync(metricDefinition); + break; + case MetricTarget.Capture: + asyncMetric = sensor.ReportMetricAsync(metricDefinition); + break; + case MetricTarget.Annotation: + asyncMetric = annotation.ReportMetricAsync(metricDefinition); + break; + default: + throw new Exception("unsupported"); + } + + Assert.IsTrue(asyncMetric.IsPending); + if (asStringJsonArray) + asyncMetric.ReportValues(valuesJsonArray); + else + asyncMetric.ReportValues(values); + + Assert.IsFalse(asyncMetric.IsPending); + } + else + { + switch (metricTarget) + { + case MetricTarget.Global: + if (asStringJsonArray) + SimulationManager.ReportMetric(metricDefinition, valuesJsonArray); + else + SimulationManager.ReportMetric(metricDefinition, values); + break; + case MetricTarget.Capture: + if (asStringJsonArray) + sensor.ReportMetric(metricDefinition, valuesJsonArray); + else + sensor.ReportMetric(metricDefinition, values); + break; + case MetricTarget.Annotation: + if (asStringJsonArray) + annotation.ReportMetric(metricDefinition, valuesJsonArray); + else + annotation.ReportMetric(metricDefinition, values); + break; + default: + throw new Exception("unsupported"); + } + } + SimulationManager.ResetSimulation(); + + AssertJsonFileEquals(expectedMetric, Path.Combine(SimulationManager.OutputDirectory, "metrics_000.json"), escapeGuids: true, ignoreFormatting: true); + } + + [Test] + public void CreateMetric_MultipleTimesWithDifferentParameters_WritesProperTypes() + { + var metricDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + var metricDefinitionsJsonExpected= + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""metric_definitions"": [ + {{ + ""id"": , + ""name"": ""name"" + }}, + {{ + ""id"": , + ""name"": ""name2"", + ""description"": ""description"" + }} + ] +}}"; + var metricDefinition1 = SimulationManager.RegisterMetricDefinition("name", id: metricDefinitionGuid); + var metricDefinition2 = SimulationManager.RegisterMetricDefinition("name2", description: "description"); + + SimulationManager.ResetSimulation(); + + var metricDefinitionsPath = Path.Combine(SimulationManager.OutputDirectory, "metric_definitions.json"); + + Assert.AreEqual(metricDefinitionGuid, metricDefinition1.Id); + Assert.AreNotEqual(default(Guid), metricDefinition2.Id); + + AssertJsonFileEquals(metricDefinitionsJsonExpected, metricDefinitionsPath); + } + + struct TestSpec + { + public int label_id; + public string label_name; + public int[] pixel_value; + } + + public enum AdditionalInfoKind + { + Annotation, + Metric + } + + [Test] + public void CreateAnnotationOrMetric_WithSpecValues_WritesProperTypes( + [Values(AdditionalInfoKind.Annotation, AdditionalInfoKind.Metric)] AdditionalInfoKind additionalInfoKind) + { + var specValues = new [] + { + new TestSpec + { + label_id = 1, + label_name = "sky", + pixel_value = new[] { 1, 2, 3} + }, + new TestSpec + { + label_id = 2, + label_name = "sidewalk", + pixel_value = new[] { 4, 5, 6} + } + }; + + string filename; + string jsonContainerName; + if (additionalInfoKind == AdditionalInfoKind.Annotation) + { + SimulationManager.RegisterAnnotationDefinition("name", specValues); + filename = "annotation_definitions.json"; + jsonContainerName = "annotation_definitions"; + } + else + { + SimulationManager.RegisterMetricDefinition("name", specValues); + filename = "metric_definitions.json"; + jsonContainerName = "metric_definitions"; + } + + var annotationDefinitionsJsonExpected= + $@"{{ + ""version"": ""{SimulationManager.SchemaVersion}"", + ""{jsonContainerName}"": [ + {{ + ""id"": , + ""name"": ""name"",{(additionalInfoKind == AdditionalInfoKind.Annotation ? @" + ""format"": ""json""," : null)} + ""spec"": [ + {{ + ""label_id"": 1, + ""label_name"": ""sky"", + ""pixel_value"": [ + 1, + 2, + 3 + ] + }}, + {{ + ""label_id"": 2, + ""label_name"": ""sidewalk"", + ""pixel_value"": [ + 4, + 5, + 6 + ] + }} + ] + }} + ] +}}"; + SimulationManager.ResetSimulation(); + + var annotationDefinitionsPath = Path.Combine(SimulationManager.OutputDirectory, filename); + + AssertJsonFileEquals(annotationDefinitionsJsonExpected, annotationDefinitionsPath); + } + + static void AssertJsonFileEquals(string jsonExpected, string jsonPath, bool escapeGuids = true, bool ignoreFormatting = false) + { + FileAssert.Exists(jsonPath); + var jsonActual = File.ReadAllText(jsonPath); + if (escapeGuids) + jsonActual = EscapeGuids(jsonActual); + + if (ignoreFormatting) + { + jsonActual = Regex.Replace(jsonActual, "^\\s*", "", RegexOptions.Multiline); + jsonExpected = Regex.Replace(jsonExpected, "^\\s*", "", RegexOptions.Multiline); + } + + Assert.AreEqual(jsonExpected, jsonActual, $"Expected:\n{jsonExpected}\nActual:\n{jsonActual}"); + } + + static string EscapeGuids(string text) + { + var result = Regex.Replace(text, @"""[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*-[a-z0-9]*""", ""); + return result; + } + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs.meta new file mode 100644 index 000000000..caf487678 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManagerTests.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 355a38a8edc948d5ac8649b67a976dd5 +timeCreated: 1577122007 \ No newline at end of file diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs new file mode 100644 index 000000000..edc46ce99 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs @@ -0,0 +1,177 @@ +using System.Collections; +using System.Text.RegularExpressions; +using NUnit.Framework; +using UnityEngine; +using UnityEngine.Assertions.Comparers; +using UnityEngine.Perception; +using UnityEngine.TestTools; + +namespace GroundTruthTests +{ + [TestFixture] + public class SimulationManager_SensorSchedulingTests + { + [TearDown] + public void TearDown() + { + Time.timeScale = 1; + SimulationManager.ResetSimulation(); + } + + [UnityTest] + public IEnumerator FramesScheduledBySensorConfig() + { + var ego = SimulationManager.RegisterEgo("ego"); + var firstCaptureTime = 1.5f; + var period = .4f; + SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime); + + float[] deltaTimeSamplesExpected = { + firstCaptureTime, + period, + period, + period + }; + float[] deltaTimeSamples = new float[deltaTimeSamplesExpected.Length]; + for (int i = 0; i < deltaTimeSamples.Length; i++) + { + yield return null; + Assert.AreEqual(deltaTimeSamplesExpected[i], Time.deltaTime, 0.0001f); + } + } + + [UnityTest] + public IEnumerator FramesScheduled_WithTimeScale_ResultsInProperDeltaTime() + { + var ego = SimulationManager.RegisterEgo("ego"); + var firstCaptureTime = 2f; + var period = 1f; + + var timeScale = 2; + Time.timeScale = timeScale; + SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime); + + float[] deltaTimeSamplesExpected = { + timeScale * firstCaptureTime, + timeScale * period, + timeScale * period, + timeScale * period + }; + for (int i = 0; i < deltaTimeSamplesExpected.Length; i++) + { + yield return null; + Assert.AreEqual(deltaTimeSamplesExpected[i], Time.deltaTime, 0.0001f); + } + } + + [UnityTest] + public IEnumerator ChangingTimeScale_CausesDebugError() + { + var ego = SimulationManager.RegisterEgo("ego"); + SimulationManager.RegisterSensor(ego, "cam", "", 1f, 2f); + + yield return null; + Time.timeScale = 5; + yield return null; + LogAssert.Expect(LogType.Error, new Regex("Time\\.timeScale may not change mid-sequence.*")); + } + + [UnityTest] + public IEnumerator ChangingTimeScale_DuringStartNewSequence_Succeeds() + { + var ego = SimulationManager.RegisterEgo("ego"); + SimulationManager.RegisterSensor(ego, "cam", "", 1f, 2f); + + yield return null; + Time.timeScale = 1; + SimulationManager.StartNewSequence(); + yield return null; + } + + [Ignore("Changing timeScale mid-sequence is not supported")] + [UnityTest] + public IEnumerator FramesScheduled_WithChangingTimeScale_ResultsInProperDeltaTime() + { + var ego = SimulationManager.RegisterEgo("ego"); + var firstCaptureTime = 2f; + var period = 1f; + float[] newTimeScalesPerFrame = { + 2f, + 10f, + .01f, + 1f + }; + SimulationManager.RegisterSensor(ego, "cam", "", period, firstCaptureTime); + + float[] deltaTimeSamplesExpected = { + newTimeScalesPerFrame[0] * firstCaptureTime, + newTimeScalesPerFrame[1] * period, + newTimeScalesPerFrame[2] * period, + newTimeScalesPerFrame[3] * period + }; + float[] unscaledDeltaTimeSamplesExpected = { + firstCaptureTime, + period, + period, + period + }; + for (int i = 0; i < deltaTimeSamplesExpected.Length; i++) + { + Time.timeScale = newTimeScalesPerFrame[i]; + yield return null; + Assert.AreEqual(deltaTimeSamplesExpected[i], Time.deltaTime, 0.0001f); + //Assert.AreEqual(unscaledDeltaTimeSamplesExpected[i], Time.unscaledDeltaTime, 0.0001f); + } + } + + [UnityTest] + public IEnumerator ResetSimulation_ResetsCaptureDeltaTime() + { + var ego = SimulationManager.RegisterEgo("ego"); + SimulationManager.RegisterSensor(ego, "cam", "", 4, 10); + yield return null; + Assert.AreEqual(10, Time.captureDeltaTime); + SimulationManager.ResetSimulation(); + Assert.AreEqual(0, Time.captureDeltaTime); + } + + [UnityTest] + public IEnumerator ShouldCaptureThisFrame_ReturnsTrueOnProperFrames() + { + var ego = SimulationManager.RegisterEgo("ego"); + var firstCaptureTime1 = 10; + var frequencyInMs1 = 4; + var sensor1 = SimulationManager.RegisterSensor(ego, "cam", "1", frequencyInMs1, firstCaptureTime1); + + var firstCaptureTime2 = 10; + var frequencyInMs2 = 6; + var sensor2 = SimulationManager.RegisterSensor(ego, "cam", "2", frequencyInMs2, firstCaptureTime2); + + var sensor3 = SimulationManager.RegisterSensor(ego, "cam", "3", 1, 1); + sensor3.Enabled = false; + + (float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[] samplesExpected = { + ((float)firstCaptureTime1, true, true), + (4, true, false), + (2, false, true), + (2, true, false), + (4, true, true) + }; + var samplesActual = new (float deltaTime, bool sensor1ShouldCapture, bool sensor2ShouldCapture)[samplesExpected.Length]; + for (int i = 0; i < samplesActual.Length; i++) + { + yield return null; + samplesActual[i] = (Time.deltaTime, sensor1.ShouldCaptureThisFrame, sensor2.ShouldCaptureThisFrame); + } + + CollectionAssert.AreEqual(samplesExpected, samplesActual); + } + + [Test] + public void Enabled_StartsTrue() + { + var sensor1 = SimulationManager.RegisterSensor(SimulationManager.RegisterEgo(""), "cam", "1", 1,1); + Assert.IsTrue(sensor1.Enabled); + } + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs.meta new file mode 100644 index 000000000..64e72a256 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/SimulationManager_SensorSchedulingTests.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 25a1ad2bc73f47bcbe7138c54bad45e5 +timeCreated: 1577125461 \ No newline at end of file diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs b/com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs new file mode 100644 index 000000000..c4b3b7c1c --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs @@ -0,0 +1,29 @@ +using System; +using UnityEngine; + +namespace GroundTruthTests +{ + static class TestHelper + { + public static GameObject CreateLabeledPlane(float scale = 10, string label = "label") + { + GameObject planeObject; + planeObject = GameObject.CreatePrimitive(PrimitiveType.Plane); + planeObject.transform.SetPositionAndRotation(new Vector3(0, 0, 10), Quaternion.Euler(90, 0, 0)); + planeObject.transform.localScale = new Vector3(scale, -1, scale); + var labeling = planeObject.AddComponent(); + labeling.classes.Add(label); + return planeObject; + } +#if UNITY_EDITOR + public static void LoadAndStartRenderDocCapture(out UnityEditor.EditorWindow gameView) + { + UnityEditorInternal.RenderDoc.Load(); + System.Reflection.Assembly assembly = typeof(UnityEditor.EditorWindow).Assembly; + Type type = assembly.GetType("UnityEditor.GameView"); + gameView = UnityEditor.EditorWindow.GetWindow(type); + UnityEditorInternal.RenderDoc.BeginCaptureRenderDoc(gameView); + } +#endif + } +} diff --git a/com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs.meta b/com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs.meta new file mode 100644 index 000000000..0c729c61d --- /dev/null +++ b/com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 62a206a3ca9d4674b9c708eab0427136 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef b/com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef new file mode 100644 index 000000000..8bfd3a073 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef @@ -0,0 +1,40 @@ +{ + "name": "Unity.Perception.Runtime.Tests", + "references": [ + "UnityEngine.TestRunner", + "Unity.Mathematics", + "Unity.Collections", + "Unity.Burst", + "Unity.Entities", + "Unity.Perception.Runtime", + "Unity.Perception.Editor", + "Unity.Simulation.Core", + "Unity.RenderPipelines.HighDefinition.Runtime", + "Unity.RenderPipelines.Universal.Runtime" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll", + "Newtonsoft.Json.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS" + ], + "versionDefines": [ + { + "name": "com.unity.render-pipelines.universal", + "expression": "", + "define": "URP_PRESENT" + }, + { + "name": "com.unity.render-pipelines.high-definition", + "expression": "", + "define": "HDRP_PRESENT" + } + ], + "noEngineReferences": false +} diff --git a/com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef.meta b/com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef.meta new file mode 100644 index 000000000..5ceb35e31 --- /dev/null +++ b/com.unity.perception/Tests/Runtime/Unity.SimViz.Runtime.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 9bb66e7233867224ab0034ded12f01fc +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/Third Party Notices.md b/com.unity.perception/Third Party Notices.md new file mode 100644 index 000000000..d1ac3963d --- /dev/null +++ b/com.unity.perception/Third Party Notices.md @@ -0,0 +1,71 @@ +This package contains third-party software components governed by the license(s) indicated below: +--------- + +Component Name: QuickGraph + +License Type: MS-PL + +https://github.com/YaccConstructor/QuickGraph/blob/master/LICENSE.txt + +--------- + +Component Name: ExtendedScriptableObjectDrawer + +License Type: MIT + +https://opensource.org/licenses/MIT + + +--------- + +Component Name: ReorderableList + +License Type: MIT + +https://opensource.org/licenses/MIT + +--------- + +Component Name: SceneReference + +License type: Don't Be a Jerk: The Open Source Software License + +License text: + +Don't Be a Jerk: The Open Source Software License. +Adapted from: https://github.com/evantahler/Dont-be-a-Jerk + + +_I_ am the software author - JohannesMP on Github. +_You_ are the user of this software. You might be a _we_, and that's OK! + +This is free, open source software. I will never charge you to use, +license, or obtain this software. Doing so would make me a jerk. + +You may use the content of this project (and by "project" I mean the immediate +directory containing this license, and all its files) for whatever you want. +Personal use, Educational use, Corporate use, and all other uses are OK! + +I offer no warranty on anything in this project, and you are using it at +your own risk, of your own free will. I've tried my best to ensure that +there are no gaping security holes where using this software might erase +your hard drive or give you constipation, but it might happen. I'm sorry. +However, I warned you, so you can't sue me. Suing people over free +software would make you a jerk. + +If you find bugs, it would be nice if you let me know so I can fix them. +You don't have to, but it would be appreciated. + +Speaking of bugs, I am not obligated to fix anything, nor am I obligated +to add any features for you, though I will consider your suggestions. +Feeling entitled about free software would make you a jerk. + +If you add a new feature or fix a bug, it would be nice if you contributed +it back to the project, but you don't have to. The repository/site you +obtained this software from should contain a way for you to contact me. +Contributing to open source makes you awesome! + +If you use this software, you may remove this license, and don't have to +give me any credit, but it would be great if you did. + +Don't be a jerk. Enjoy your free software! :) \ No newline at end of file diff --git a/com.unity.perception/Third Party Notices.md.meta b/com.unity.perception/Third Party Notices.md.meta new file mode 100644 index 000000000..526f86343 --- /dev/null +++ b/com.unity.perception/Third Party Notices.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 98c0d46397afbfd42831d327f3277b8d +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.perception/package.json b/com.unity.perception/package.json new file mode 100644 index 000000000..ab668cc3d --- /dev/null +++ b/com.unity.perception/package.json @@ -0,0 +1,14 @@ +{ + "dependencies": { + "com.unity.nuget.newtonsoft-json": "1.1.2", + "com.unity.render-pipelines.core": "7.1.6", + "com.unity.entities": "0.8.0-preview.8", + "com.unity.simulation.capture": "0.0.10-preview.6", + "com.unity.simulation.core": "0.0.10-preview.8" + }, + "description": "Tools for authoring and executing autonomous vehicle simulations.", + "displayName": "Perception", + "name": "com.unity.perception", + "unity": "2019.3", + "version": "0.1.0-preview.3" +} diff --git a/com.unity.perception/package.json.meta b/com.unity.perception/package.json.meta new file mode 100644 index 000000000..8e49474e8 --- /dev/null +++ b/com.unity.perception/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c0ffe4c744a19c2428b3bcc79ab65eae +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: