From fc5b6ef041e84f5172102ea25b226ccff916a929 Mon Sep 17 00:00:00 2001 From: Chikashi Miyama Date: Sun, 7 Jul 2019 17:56:52 +0200 Subject: [PATCH] point cloud in progress --- .../.idea.UnityProject/.idea/contentModel.xml | 5 + .../.idea.UnityProject/.idea/workspace.xml | 436 +++++++++++------- UnityProject/Assembly-CSharp.csproj | 3 + .../Materials/{DebugPanel.mat => IRPanel.mat} | 2 +- .../{DebugPanel.mat.meta => IRPanel.mat.meta} | 0 UnityProject/Assets/Materials/PointCloud.mat | 107 +++++ .../Assets/Materials/PointCloud.mat.meta | 8 + UnityProject/Assets/Scenes/MainScene.unity | 140 +++++- .../Scripts/Visualizer/IRPanelBehaviour.cs | 21 + .../Visualizer/IRPanelBehaviour.cs.meta | 3 + .../Scripts/Visualizer/MeshController.cs | 24 + .../Scripts/Visualizer/MeshController.cs.meta | 3 + .../Scripts/Visualizer/PointCloudBehaviour.cs | 68 ++- .../Visualizer/PointCloudBehaviour.cs.meta | 4 +- .../Assets/Shader/Vertex Modifier.shader | 29 ++ .../Assets/Shader/Vertex Modifier.shader.meta | 9 + UnityProject/UnityProject.userprefs | 12 + 17 files changed, 663 insertions(+), 211 deletions(-) rename UnityProject/Assets/Materials/{DebugPanel.mat => IRPanel.mat} (98%) rename UnityProject/Assets/Materials/{DebugPanel.mat.meta => IRPanel.mat.meta} (100%) create mode 100644 UnityProject/Assets/Materials/PointCloud.mat create mode 100644 UnityProject/Assets/Materials/PointCloud.mat.meta create mode 100644 UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs create mode 100644 UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs.meta create mode 100644 UnityProject/Assets/Scripts/Visualizer/MeshController.cs create mode 100644 UnityProject/Assets/Scripts/Visualizer/MeshController.cs.meta create mode 100644 UnityProject/Assets/Shader/Vertex Modifier.shader create mode 100644 UnityProject/Assets/Shader/Vertex Modifier.shader.meta create mode 100644 UnityProject/UnityProject.userprefs diff --git a/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml b/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml index 143b45c..6e4d621 100644 --- a/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml +++ b/UnityProject/.idea/.idea.UnityProject/.idea/contentModel.xml @@ -24,10 +24,15 @@ + + + + + diff --git a/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml b/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml index fd9831c..5651ca5 100644 --- a/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml +++ b/UnityProject/.idea/.idea.UnityProject/.idea/workspace.xml @@ -2,19 +2,18 @@ + + + + - + + - - - - - - - - + + @@ -292,6 +280,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -360,7 +374,7 @@ 1562417892841 - + 1562485186899 @@ -373,7 +387,7 @@ - @@ -388,14 +402,14 @@ - - + + - + @@ -407,7 +421,7 @@ - + @@ -445,6 +459,12 @@ + + + + + + @@ -662,20 +682,6 @@ - - - - - - - - - - - - - - @@ -795,34 +801,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -921,20 +899,124 @@ + + + + + + + + + + + + + + - - + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/UnityProject/Assembly-CSharp.csproj b/UnityProject/Assembly-CSharp.csproj index 421348e..b4f9d07 100644 --- a/UnityProject/Assembly-CSharp.csproj +++ b/UnityProject/Assembly-CSharp.csproj @@ -62,6 +62,8 @@ + + @@ -159,6 +161,7 @@ + C:/Users/chikashi/Development/Soundvision/UnityProject/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll diff --git a/UnityProject/Assets/Materials/DebugPanel.mat b/UnityProject/Assets/Materials/IRPanel.mat similarity index 98% rename from UnityProject/Assets/Materials/DebugPanel.mat rename to UnityProject/Assets/Materials/IRPanel.mat index ea809dd..d8d9c4e 100644 --- a/UnityProject/Assets/Materials/DebugPanel.mat +++ b/UnityProject/Assets/Materials/IRPanel.mat @@ -7,7 +7,7 @@ Material: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: DebugPanel + m_Name: IRPanel m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} m_ShaderKeywords: m_LightmapFlags: 4 diff --git a/UnityProject/Assets/Materials/DebugPanel.mat.meta b/UnityProject/Assets/Materials/IRPanel.mat.meta similarity index 100% rename from UnityProject/Assets/Materials/DebugPanel.mat.meta rename to UnityProject/Assets/Materials/IRPanel.mat.meta diff --git a/UnityProject/Assets/Materials/PointCloud.mat b/UnityProject/Assets/Materials/PointCloud.mat new file mode 100644 index 0000000..b5232d1 --- /dev/null +++ b/UnityProject/Assets/Materials/PointCloud.mat @@ -0,0 +1,107 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PointCloud + m_Shader: {fileID: 4800000, guid: 3ad3d923f892ff94d9b9e114f6293260, type: 3} + m_ShaderKeywords: _EMISSION _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF + m_LightmapFlags: 0 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _Amount: 1 + - _BlendOp: 0 + - _BumpScale: 1 + - _CameraFadingEnabled: 0 + - _CameraFarFadeDistance: 2 + - _CameraNearFadeDistance: 1 + - _ColorMask: 15 + - _ColorMode: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DistortionBlend: 0.5 + - _DistortionEnabled: 0 + - _DistortionStrength: 1 + - _DistortionStrengthScaled: 0 + - _DstBlend: 0 + - _EmissionEnabled: 0 + - _FlipbookMode: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 0 + - _LightingEnabled: 0 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _Shininess: 0.7 + - _SmoothnessTextureChannel: 0 + - _SoftParticlesEnabled: 0 + - _SoftParticlesFarFadeDistance: 1 + - _SoftParticlesNearFadeDistance: 0 + - _SpecularHighlights: 0 + - _SrcBlend: 1 + - _Stencil: 0 + - _StencilComp: 8 + - _StencilOp: 0 + - _StencilReadMask: 255 + - _StencilWriteMask: 255 + - _UVSec: 0 + - _UseUIAlphaClip: 0 + - _ZWrite: 1 + m_Colors: + - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0} + - _Emission: {r: 0, g: 0, b: 0, a: 0} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 0} + - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} + - _SpecColor: {r: 1, g: 1, b: 1, a: 1} diff --git a/UnityProject/Assets/Materials/PointCloud.mat.meta b/UnityProject/Assets/Materials/PointCloud.mat.meta new file mode 100644 index 0000000..0be1e43 --- /dev/null +++ b/UnityProject/Assets/Materials/PointCloud.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f6444796bbb89e45a6a51b5bb0037f6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Scenes/MainScene.unity b/UnityProject/Assets/Scenes/MainScene.unity index 50ea3c5..4af830c 100644 --- a/UnityProject/Assets/Scenes/MainScene.unity +++ b/UnityProject/Assets/Scenes/MainScene.unity @@ -259,8 +259,8 @@ Camera: m_GameObject: {fileID: 534669902} m_Enabled: 1 serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.3018868, g: 0.3018868, b: 0.3018868, a: 0} m_projectionMatrixMode: 1 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} @@ -274,7 +274,7 @@ Camera: height: 1 near clip plane: 0.3 far clip plane: 1000 - field of view: 60 + field of view: 78 orthographic: 0 orthographic size: 5 m_Depth: -1 @@ -315,9 +315,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 848915472} - - component: {fileID: 848915473} m_Layer: 0 - m_Name: PointCloud + m_Name: KinectVisualization m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -335,23 +334,10 @@ Transform: 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} ---- !u!114 &848915473 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 848915471} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c0603bf64edb4c8885cefbc40ee206fe, type: 3} - m_Name: - m_EditorClassIdentifier: - kinectManagerBehaviour: {fileID: 437875428} - debugPanel: {fileID: 2037885789} --- !u!1 &1641055256 GameObject: m_ObjectHideFlags: 0 @@ -369,7 +355,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!120 &1641055257 LineRenderer: m_ObjectHideFlags: 0 @@ -593,6 +579,99 @@ MonoBehaviour: pdArraySize: 100 lineRenderer: {fileID: 1641055257} scale: 1 +--- !u!1 &1780880770 +GameObject: + 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 @@ -604,13 +683,14 @@ GameObject: - component: {fileID: 2037885790} - component: {fileID: 2037885793} - component: {fileID: 2037885792} + - component: {fileID: 2037885791} m_Layer: 0 - m_Name: DebugPanel + m_Name: IRPanel m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &2037885790 Transform: m_ObjectHideFlags: 0 @@ -618,13 +698,27 @@ Transform: 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_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 diff --git a/UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs b/UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs new file mode 100644 index 0000000..042d47d --- /dev/null +++ b/UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs @@ -0,0 +1,21 @@ +using UnityEngine; +using VideoInput; + +namespace Visualizer +{ + class IRPanelBehaviour : MonoBehaviour + { + #pragma warning disable 649 + [SerializeField] private KinectManagerBehaviour kinectManagerBehaviour; + [SerializeField] private GameObject panel; + #pragma warning restore 649 + + private Renderer renderer_; + + void Start() + { + renderer_ = panel.GetComponent(); + renderer_.material.mainTexture = kinectManagerBehaviour.KinectSensor.InfraredCamera.Data; + } + } +} \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs.meta b/UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs.meta new file mode 100644 index 0000000..df6a3e3 --- /dev/null +++ b/UnityProject/Assets/Scripts/Visualizer/IRPanelBehaviour.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c0603bf64edb4c8885cefbc40ee206fe +timeCreated: 1562443930 \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/Visualizer/MeshController.cs b/UnityProject/Assets/Scripts/Visualizer/MeshController.cs new file mode 100644 index 0000000..bbf6a8f --- /dev/null +++ b/UnityProject/Assets/Scripts/Visualizer/MeshController.cs @@ -0,0 +1,24 @@ +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 new file mode 100644 index 0000000..223b10d --- /dev/null +++ b/UnityProject/Assets/Scripts/Visualizer/MeshController.cs.meta @@ -0,0 +1,3 @@ +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 a455790..d43f446 100644 --- a/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs +++ b/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs @@ -3,22 +3,74 @@ using VideoInput; namespace Visualizer { - class PointCloudBehaviour : MonoBehaviour + public class PointCloudBehaviour : MonoBehaviour { + #pragma warning disable 649 [SerializeField] private KinectManagerBehaviour kinectManagerBehaviour; - [SerializeField] private GameObject debugPanel; + [SerializeField] private MeshFilter meshFilter; + #pragma warning restore 649 - private Renderer renderer_; - - void Start() + + private void Start() { - renderer_ = debugPanel.GetComponent(); - renderer_.material.mainTexture = kinectManagerBehaviour.KinectSensor.InfraredCamera.Data; + var texture = kinectManagerBehaviour.KinectSensor.InfraredCamera.Data; + var numPixels = texture.height * texture.width; + + meshFilter.mesh = new Mesh + { + vertices = MakeVertices(texture), + uv = MakeTexCoord(texture) + }; + meshFilter.mesh.SetIndices(MakeIndecies(numPixels), MeshTopology.Points, 0, false); + gameObject.GetComponent().material.mainTexture = kinectManagerBehaviour.KinectSensor.InfraredCamera.Data; } - void Update() + private void Update() { + + } + + private Vector3[] MakeVertices(Texture2D texture) + { + var vertices = new Vector3[texture.width * texture.height]; + for (var i = 0; i < texture.height; ++i) + { + var offset = texture.width * i; + var hPhase = (float) i / texture.height; + 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; + } + } + return vertices; } + private Vector2[] MakeTexCoord(Texture2D texture) + { + var texCoords = new Vector2[texture.width * texture.height]; + for (var i = 0; i < texture.height; ++i) + { + var offset = texture.width * i; + var hPhase = (float) i / texture.height; + for (var j = 0; j < texture.width; ++j) + { + var wPhase = (float) j / texture.width; + texCoords[offset + j].x = wPhase; + texCoords[offset + j].y = hPhase; + } + } + return texCoords; + } + + private int[] MakeIndecies(int numPixels) + { + var array = new int[numPixels]; + for (var i = 0; i < numPixels; ++i) + array[i] = i; + return array; + } } } \ No newline at end of file diff --git a/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs.meta b/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs.meta index df6a3e3..94448de 100644 --- a/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs.meta +++ b/UnityProject/Assets/Scripts/Visualizer/PointCloudBehaviour.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: c0603bf64edb4c8885cefbc40ee206fe -timeCreated: 1562443930 \ No newline at end of file +guid: ffecec984845420991cec1a5fcf11959 +timeCreated: 1562500684 \ No newline at end of file diff --git a/UnityProject/Assets/Shader/Vertex Modifier.shader b/UnityProject/Assets/Shader/Vertex Modifier.shader new file mode 100644 index 0000000..4643042 --- /dev/null +++ b/UnityProject/Assets/Shader/Vertex Modifier.shader @@ -0,0 +1,29 @@ + Shader "Vertex Modifier" { + Properties { + _MainTex ("Texture", 2D) = "depth" {} + _Amount ("Height Adjustment", 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; + sampler2D _MainTex; + + // Vertex modifier function + void vert (inout appdata_full v){ + v.vertex.z += _Amount * 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); + } + ENDCG + } + } diff --git a/UnityProject/Assets/Shader/Vertex Modifier.shader.meta b/UnityProject/Assets/Shader/Vertex Modifier.shader.meta new file mode 100644 index 0000000..1c68271 --- /dev/null +++ b/UnityProject/Assets/Shader/Vertex Modifier.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3ad3d923f892ff94d9b9e114f6293260 +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/UnityProject.userprefs b/UnityProject/UnityProject.userprefs new file mode 100644 index 0000000..616559d --- /dev/null +++ b/UnityProject/UnityProject.userprefs @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file