From 175892a576659cabf11d8c687b2b0ac0a91416ab Mon Sep 17 00:00:00 2001 From: Chikashi Miyama Date: Sun, 7 Jul 2019 22:00:44 +0200 Subject: [PATCH] implement both kinect and pd integration --- .../.idea.UnityProject/.idea/contentModel.xml | 1 - .../.idea.UnityProject/.idea/workspace.xml | 244 ++++++------- UnityProject/Assembly-CSharp.csproj | 1 - UnityProject/Assets/Materials/PointCloud.mat | 2 +- UnityProject/Assets/Prefabs.meta | 8 + .../Assets/Prefabs/KinectVisualization.prefab | 232 ++++++++++++ .../Prefabs/KinectVisualization.prefab.meta | 7 + UnityProject/Assets/Scenes/MainScene.unity | 337 ++++-------------- .../VideoInput/KinectManagerBehaviour.cs | 4 +- .../Scripts/Visualizer/MeshController.cs | 24 -- .../Scripts/Visualizer/MeshController.cs.meta | 3 - .../Scripts/Visualizer/PointCloudBehaviour.cs | 28 +- UnityProject/Assets/Shader.meta | 8 + .../Assets/Shader/Vertex Modifier.shader | 10 +- 14 files changed, 464 insertions(+), 445 deletions(-) create mode 100644 UnityProject/Assets/Prefabs.meta create mode 100644 UnityProject/Assets/Prefabs/KinectVisualization.prefab create mode 100644 UnityProject/Assets/Prefabs/KinectVisualization.prefab.meta delete mode 100644 UnityProject/Assets/Scripts/Visualizer/MeshController.cs delete mode 100644 UnityProject/Assets/Scripts/Visualizer/MeshController.cs.meta create mode 100644 UnityProject/Assets/Shader.meta diff --git a/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml b/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml index 6e4d621..3ca935e 100644 --- a/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml +++ b/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml @@ -25,7 +25,6 @@ - diff --git a/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml b/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml index 5651ca5..893f295 100644 --- a/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml +++ b/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml @@ -2,18 +2,16 @@ - - - - - - + + + + - + + @@ -202,7 +183,6 @@ - @@ -253,22 +233,23 @@ - @@ -353,10 +334,10 @@ - @@ -399,11 +387,11 @@ - + - - + + @@ -448,7 +436,8 @@ - @@ -899,20 +888,6 @@ - - - - - - - - - - - - - - @@ -938,6 +913,20 @@ + + + + + + + + + + + + + + @@ -952,44 +941,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -999,24 +954,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/UnityProject/Assembly-CSharp.csproj b/UnityProject/Assembly-CSharp.csproj index b4f9d07..135b05b 100644 --- a/UnityProject/Assembly-CSharp.csproj +++ b/UnityProject/Assembly-CSharp.csproj @@ -63,7 +63,6 @@ - diff --git a/UnityProject/Assets/Materials/PointCloud.mat b/UnityProject/Assets/Materials/PointCloud.mat index b5232d1..9a7fd8d 100644 --- a/UnityProject/Assets/Materials/PointCloud.mat +++ b/UnityProject/Assets/Materials/PointCloud.mat @@ -13,7 +13,7 @@ Material: m_LightmapFlags: 0 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: -1 + m_CustomRenderQueue: 2000 stringTagMap: {} disabledShaderPasses: [] m_SavedProperties: diff --git a/UnityProject/Assets/Prefabs.meta b/UnityProject/Assets/Prefabs.meta new file mode 100644 index 0000000..8e19d10 --- /dev/null +++ b/UnityProject/Assets/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e93f7dbfd936d244a9e25f7474dc10ea +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Prefabs/KinectVisualization.prefab b/UnityProject/Assets/Prefabs/KinectVisualization.prefab new file mode 100644 index 0000000..e34f6e4 --- /dev/null +++ b/UnityProject/Assets/Prefabs/KinectVisualization.prefab @@ -0,0 +1,232 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &4731626927875726491 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4731626927875726468} + - component: {fileID: 5059429581819481323} + m_Layer: 0 + m_Name: KinectVisualization + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4731626927875726468 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626927875726491} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4731626929094548426} + - {fileID: 4731626929341064471} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &5059429581819481323 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626927875726491} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5b54a31bc1a14c1abb51fe86c56c6227, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &4731626929094548425 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4731626929094548426} + - component: {fileID: 4731626929094548469} + - component: {fileID: 4731626929094548468} + - component: {fileID: 4731626929094548427} + m_Layer: 0 + m_Name: IRPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!4 &4731626929094548426 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929094548425} + m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4731626927875726468} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} +--- !u!33 &4731626929094548469 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929094548425} + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &4731626929094548468 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929094548425} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: a8f5d1054ef74a44b9ad9a606a412c6a, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + 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!114 &4731626929094548427 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929094548425} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c0603bf64edb4c8885cefbc40ee206fe, type: 3} + m_Name: + m_EditorClassIdentifier: + kinectManagerBehaviour: {fileID: 5059429581819481323} + panel: {fileID: 4731626929094548425} +--- !u!1 &4731626929341064470 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4731626929341064471} + - component: {fileID: 4731626929341064466} + - component: {fileID: 4731626929341064465} + - component: {fileID: 4731626929341064464} + m_Layer: 0 + m_Name: PointCloud + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4731626929341064471 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929341064470} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4731626927875726468} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &4731626929341064466 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929341064470} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 3f6444796bbb89e45a6a51b5bb0037f6, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + 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 &4731626929341064465 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929341064470} + m_Mesh: {fileID: 0} +--- !u!114 &4731626929341064464 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4731626929341064470} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ffecec984845420991cec1a5fcf11959, type: 3} + m_Name: + m_EditorClassIdentifier: + zScale: 1 + kinectManagerBehaviour: {fileID: 5059429581819481323} + meshFilter: {fileID: 4731626929341064465} diff --git a/UnityProject/Assets/Prefabs/KinectVisualization.prefab.meta b/UnityProject/Assets/Prefabs/KinectVisualization.prefab.meta new file mode 100644 index 0000000..d155581 --- /dev/null +++ b/UnityProject/Assets/Prefabs/KinectVisualization.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2cf41770dc7914b46aa31a442508dd25 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Scenes/MainScene.unity b/UnityProject/Assets/Scenes/MainScene.unity index 4af830c..06db2a3 100644 --- a/UnityProject/Assets/Scenes/MainScene.unity +++ b/UnityProject/Assets/Scenes/MainScene.unity @@ -181,49 +181,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &437875427 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 437875429} - - component: {fileID: 437875428} - m_Layer: 0 - m_Name: Main - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &437875428 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 437875427} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5b54a31bc1a14c1abb51fe86c56c6227, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!4 &437875429 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 437875427} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &534669902 GameObject: m_ObjectHideFlags: 0 @@ -260,7 +217,7 @@ Camera: m_Enabled: 1 serializedVersion: 2 m_ClearFlags: 2 - m_BackGroundColor: {r: 0.3018868, g: 0.3018868, b: 0.3018868, a: 0} + m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} m_projectionMatrixMode: 1 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} @@ -299,45 +256,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 534669902} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -13.7} + m_LocalRotation: {x: 0, y: -0.015271054, z: 0, w: 0.9998834} + m_LocalPosition: {x: 1.645, y: -1, z: -5.95} 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!1 &848915471 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 848915472} - m_Layer: 0 - m_Name: KinectVisualization - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &848915472 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 848915471} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 2037885790} - - {fileID: 1780880771} - m_Father: {fileID: 0} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: -1.75, z: 0} --- !u!1 &1641055256 GameObject: m_ObjectHideFlags: 0 @@ -355,7 +280,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!120 &1641055257 LineRenderer: m_ObjectHideFlags: 0 @@ -579,188 +504,72 @@ MonoBehaviour: pdArraySize: 100 lineRenderer: {fileID: 1641055257} scale: 1 ---- !u!1 &1780880770 -GameObject: +--- !u!1001 &6127742206276435382 +PrefabInstance: m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1780880771} - - component: {fileID: 1780880774} - - component: {fileID: 1780880773} - - component: {fileID: 1780880772} - m_Layer: 0 - m_Name: PointCloud - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1780880771 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1780880770} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 848915472} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1780880772 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1780880770} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ffecec984845420991cec1a5fcf11959, type: 3} - m_Name: - m_EditorClassIdentifier: - kinectManagerBehaviour: {fileID: 437875428} - meshFilter: {fileID: 1780880773} - vertexModifier: {fileID: 4800000, guid: 3ad3d923f892ff94d9b9e114f6293260, type: 3} ---- !u!33 &1780880773 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1780880770} - m_Mesh: {fileID: 0} ---- !u!23 &1780880774 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1780880770} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 3f6444796bbb89e45a6a51b5bb0037f6, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - 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!1 &2037885789 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2037885790} - - component: {fileID: 2037885793} - - component: {fileID: 2037885792} - - component: {fileID: 2037885791} - m_Layer: 0 - m_Name: IRPanel - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &2037885790 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2037885789} - m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 848915472} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} ---- !u!114 &2037885791 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2037885789} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c0603bf64edb4c8885cefbc40ee206fe, type: 3} - m_Name: - m_EditorClassIdentifier: - kinectManagerBehaviour: {fileID: 437875428} - panel: {fileID: 2037885789} ---- !u!23 &2037885792 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2037885789} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: a8f5d1054ef74a44b9ad9a606a412c6a, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - 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 &2037885793 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2037885789} - m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4731626927875726491, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_Name + value: KinectVisualization + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4731626927875726468, guid: 2cf41770dc7914b46aa31a442508dd25, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 2cf41770dc7914b46aa31a442508dd25, type: 3} diff --git a/UnityProject/Assets/Scripts/VideoInput/KinectManagerBehaviour.cs b/UnityProject/Assets/Scripts/VideoInput/KinectManagerBehaviour.cs index a233231..846339e 100644 --- a/UnityProject/Assets/Scripts/VideoInput/KinectManagerBehaviour.cs +++ b/UnityProject/Assets/Scripts/VideoInput/KinectManagerBehaviour.cs @@ -1,5 +1,4 @@ -using System; -using UnityEngine; +using UnityEngine; namespace VideoInput { @@ -11,7 +10,6 @@ namespace VideoInput { var componentFactory = new ComponentFactory(); KinectSensor = componentFactory.CreateKinectSensor(); - } private void Update() diff --git a/UnityProject/Assets/Scripts/Visualizer/MeshController.cs b/UnityProject/Assets/Scripts/Visualizer/MeshController.cs deleted file mode 100644 index bbf6a8f..0000000 --- a/UnityProject/Assets/Scripts/Visualizer/MeshController.cs +++ /dev/null @@ -1,24 +0,0 @@ -using UnityEngine; - -namespace Visualizer -{ - public interface IMeshController - { - void Update(); - } - - public class MeshController : IMeshController - { - private Vector3[] points_; - - MeshController(int numPoints) - { - - } - - - public void Update() - { - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/Visualizer/MeshController.cs.meta b/UnityProject/Assets/Scripts/Visualizer/MeshController.cs.meta deleted file mode 100644 index 223b10d..0000000 --- a/UnityProject/Assets/Scripts/Visualizer/MeshController.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 83939e86f988414c8ababcc62ccc727d -timeCreated: 1562501315 \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs b/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs index d43f446..f18c869 100644 --- a/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs +++ b/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs @@ -1,4 +1,5 @@ using UnityEngine; +using UnityEngine.Rendering; using VideoInput; namespace Visualizer @@ -6,28 +7,37 @@ namespace Visualizer public class PointCloudBehaviour : MonoBehaviour { #pragma warning disable 649 + + [Header("Modifier Parameters")] + [SerializeField] private float zScale; + + [Header("Connections")] [SerializeField] private KinectManagerBehaviour kinectManagerBehaviour; [SerializeField] private MeshFilter meshFilter; #pragma warning restore 649 + + private Material material_; + private static readonly int Scale = Shader.PropertyToID("_Scale"); - private void Start() { var texture = kinectManagerBehaviour.KinectSensor.InfraredCamera.Data; var numPixels = texture.height * texture.width; - meshFilter.mesh = new Mesh - { - vertices = MakeVertices(texture), - uv = MakeTexCoord(texture) + meshFilter.mesh = new Mesh { + vertices = MakeVertices(texture), + uv = MakeTexCoord(texture), + indexFormat = IndexFormat.UInt32 }; meshFilter.mesh.SetIndices(MakeIndecies(numPixels), MeshTopology.Points, 0, false); - gameObject.GetComponent().material.mainTexture = kinectManagerBehaviour.KinectSensor.InfraredCamera.Data; + + material_ = GetComponent().material; + material_.mainTexture = kinectManagerBehaviour.KinectSensor.InfraredCamera.Data; } private void Update() { - + material_.SetFloat(Scale, zScale); } private Vector3[] MakeVertices(Texture2D texture) @@ -40,9 +50,7 @@ namespace Visualizer for (var j = 0; j < texture.width; ++j) { var wPhase = (float) j / texture.width; - vertices[offset + j].x = wPhase * 10f - 5f; - vertices[offset + j].y = hPhase * 10f - 5f; - vertices[offset + j].z = 0f; + vertices[offset + j] = new Vector3(wPhase * 10f - 5f, (hPhase * 10f - 5f) * -1f, 0f); } } return vertices; diff --git a/UnityProject/Assets/Shader.meta b/UnityProject/Assets/Shader.meta new file mode 100644 index 0000000..aa891d4 --- /dev/null +++ b/UnityProject/Assets/Shader.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 63a31322a10178141b1ce69a847c3c70 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Shader/Vertex Modifier.shader b/UnityProject/Assets/Shader/Vertex Modifier.shader index 4643042..f59d90d 100644 --- a/UnityProject/Assets/Shader/Vertex Modifier.shader +++ b/UnityProject/Assets/Shader/Vertex Modifier.shader @@ -1,26 +1,24 @@  Shader "Vertex Modifier" { Properties { _MainTex ("Texture", 2D) = "depth" {} - _Amount ("Height Adjustment", Float) = 1.0 + _Scale ("Scale", Float) = 1.0 } SubShader { Tags { "RenderType" = "Opaque" } + CGPROGRAM #pragma surface surf Lambert vertex:vert struct Input { float2 uv_MainTex; }; - // Access the shaderlab properties - float _Amount; + float _Scale; sampler2D _MainTex; - // Vertex modifier function void vert (inout appdata_full v){ - v.vertex.z += _Amount * tex2Dlod(_MainTex, v.texcoord).r; + v.vertex.z += _Scale * tex2Dlod(_MainTex, v.texcoord).r; } - // Surface shader function void surf (Input IN, inout SurfaceOutput o) { o.Albedo = float4(1.0f, 1.0f, 1.0f, 1.0f); }