add compute shader for creating movement/difference texture

This commit is contained in:
Chikashi Miyama 2019-11-04 22:39:02 +01:00
parent 0808bec831
commit 5d966194fa
17 changed files with 533 additions and 264 deletions

View file

@ -56,7 +56,6 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets\KinectPointCloud.cs" />
<Compile Include="Assets\Scenes\Examples\Composition\script\BallMapping.cs" /> <Compile Include="Assets\Scenes\Examples\Composition\script\BallMapping.cs" />
<Compile Include="Assets\Scenes\Examples\Composition\script\RmsAnalyzer.cs" /> <Compile Include="Assets\Scenes\Examples\Composition\script\RmsAnalyzer.cs" />
<Compile Include="Assets\Scenes\Examples\KinectSkeleton\script\RightHandFire.cs" /> <Compile Include="Assets\Scenes\Examples\KinectSkeleton\script\RightHandFire.cs" />
@ -77,9 +76,10 @@
<Compile Include="Assets\Scenes\Examples\TimbreID\script\IdToText.cs" /> <Compile Include="Assets\Scenes\Examples\TimbreID\script\IdToText.cs" />
<Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\FlareBind.cs" /> <Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\FlareBind.cs" />
<Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\SmokeBind.cs" /> <Compile Include="Assets\Scenes\Examples\VisualEffectGraph\script\SmokeBind.cs" />
<Compile Include="Assets\Scripts\Kinect\DifferenceTexture.cs" />
<Compile Include="Assets\Scripts\Kinect\KinectJointBind.cs" /> <Compile Include="Assets\Scripts\Kinect\KinectJointBind.cs" />
<Compile Include="Assets\Scripts\Kinect\KinectManagerBehaviour.cs" /> <Compile Include="Assets\Scripts\Kinect\KinectManagerBehaviour.cs" />
<Compile Include="Assets\Scripts\Kinect\KinectPointCloud.cs" />
<Compile Include="Assets\Scripts\Kinect\MovementBaker.cs" />
<Compile Include="Assets\Scripts\Math\BodyHolder.cs" /> <Compile Include="Assets\Scripts\Math\BodyHolder.cs" />
<Compile Include="Assets\Scripts\Math\Smoother.cs" /> <Compile Include="Assets\Scripts\Math\Smoother.cs" />
<Compile Include="Assets\Scripts\Math\Threshold.cs" /> <Compile Include="Assets\Scripts\Math\Threshold.cs" />
@ -109,8 +109,8 @@
<Compile Include="Assets\Scripts\TemplateLibrary\ChangeObserver.cs" /> <Compile Include="Assets\Scripts\TemplateLibrary\ChangeObserver.cs" />
<Compile Include="Assets\Scripts\Versioning\VersionToggleBehaviour.cs" /> <Compile Include="Assets\Scripts\Versioning\VersionToggleBehaviour.cs" />
<Compile Include="Assets\Scripts\Visualizer\CombMesh.cs" /> <Compile Include="Assets\Scripts\Visualizer\CombMesh.cs" />
<Compile Include="Assets\Scripts\Visualizer\IRPanelBehaviour.cs" />
<Compile Include="Assets\Scripts\Visualizer\SpectrumVisualizer.cs" /> <Compile Include="Assets\Scripts\Visualizer\SpectrumVisualizer.cs" />
<Compile Include="Assets\Scripts\Visualizer\TexturePanelBehaviour.cs" />
<Compile Include="Assets\Scripts\Visualizer\WaterfallVisualizer.cs" /> <Compile Include="Assets\Scripts\Visualizer\WaterfallVisualizer.cs" />
<Compile Include="Assets\Scripts\Visualizer\WaveformVisualizerBehaviour.cs" /> <Compile Include="Assets\Scripts\Visualizer\WaveformVisualizerBehaviour.cs" />
<Compile Include="Assets\ThridParty\KinectScript\CameraIntrinsics.cs" /> <Compile Include="Assets\ThridParty\KinectScript\CameraIntrinsics.cs" />
@ -209,6 +209,7 @@
<Compile Include="Assets\ThridParty\Windows\Kinect\TrackingState.cs" /> <Compile Include="Assets\ThridParty\Windows\Kinect\TrackingState.cs" />
<Compile Include="Assets\ThridParty\Windows\Kinect\Vector4.cs" /> <Compile Include="Assets\ThridParty\Windows\Kinect\Vector4.cs" />
<Compile Include="Assets\Tiling.cs" /> <Compile Include="Assets\Tiling.cs" />
<None Include="Assets\Resources\Shader\Difference.compute" />
<None Include="Assets\ThridParty\Assets\Construction_Site_Column\README_Import_to_2018-HDRP.txt" /> <None Include="Assets\ThridParty\Assets\Construction_Site_Column\README_Import_to_2018-HDRP.txt" />
<None Include="Assets\ThridParty\Assets\JapaneseHouse\ReadMe.txt" /> <None Include="Assets\ThridParty\Assets\JapaneseHouse\ReadMe.txt" />
<None Include="Assets\Resources\buildNumber.txt" /> <None Include="Assets\Resources\buildNumber.txt" />

View file

@ -15,7 +15,7 @@ MonoBehaviour:
m_Parent: {fileID: 114350483966674976} m_Parent: {fileID: 114350483966674976}
m_Children: m_Children:
- {fileID: 8926484042661614936} - {fileID: 8926484042661614936}
m_UIPosition: {x: 1430, y: -170} m_UIPosition: {x: 983, y: -160}
m_UICollapsed: 0 m_UICollapsed: 0
m_UISuperCollapsed: 0 m_UISuperCollapsed: 0
m_InputSlots: [] m_InputSlots: []
@ -168,7 +168,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: -928 x: -928
y: -494 y: -494
width: 2734 width: 2287
height: 2266 height: 2266
--- !u!114 &114350483966674976 --- !u!114 &114350483966674976
MonoBehaviour: MonoBehaviour:
@ -599,7 +599,7 @@ MonoBehaviour:
- {fileID: 8926484042661614948} - {fileID: 8926484042661614948}
- {fileID: 8926484042661614967} - {fileID: 8926484042661614967}
- {fileID: 8926484042661614760} - {fileID: 8926484042661614760}
m_UIPosition: {x: 954, y: 109} m_UIPosition: {x: 954, y: 254}
m_UICollapsed: 0 m_UICollapsed: 0
m_UISuperCollapsed: 0 m_UISuperCollapsed: 0
m_InputSlots: m_InputSlots:
@ -1067,7 +1067,7 @@ VisualEffectResource:
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 7 data[3]: 1
- op: 1 - op: 1
valueIndex: 6 valueIndex: 6
data[0]: -1 data[0]: -1
@ -1079,7 +1079,7 @@ VisualEffectResource:
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 1 data[3]: 7
- op: 1 - op: 1
valueIndex: 8 valueIndex: 8
data[0]: -1 data[0]: -1
@ -1121,7 +1121,7 @@ VisualEffectResource:
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 13 data[3]: 14
- op: 1 - op: 1
valueIndex: 15 valueIndex: 15
data[0]: -1 data[0]: -1
@ -1133,7 +1133,7 @@ VisualEffectResource:
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 14 data[3]: 13
- op: 1 - op: 1
valueIndex: 17 valueIndex: 17
data[0]: -1 data[0]: -1
@ -1142,22 +1142,22 @@ VisualEffectResource:
data[3]: 13 data[3]: 13
- op: 57 - op: 57
valueIndex: 18 valueIndex: 18
data[0]: 16 data[0]: 14
data[1]: -1
data[2]: -1
data[3]: 0
- op: 56
valueIndex: 19
data[0]: 11
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 0 data[3]: 0
- op: 1 - op: 1
valueIndex: 23 valueIndex: 19
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 2 data[3]: 2
- op: 56
valueIndex: 21
data[0]: 11
data[1]: -1
data[2]: -1
data[3]: 0
- op: 56 - op: 56
valueIndex: 25 valueIndex: 25
data[0]: 13 data[0]: 13
@ -1175,63 +1175,57 @@ VisualEffectResource:
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 1 data[3]: 3
- op: 56
valueIndex: 32
data[0]: 14
data[1]: -1
data[2]: -1
data[3]: 2
- op: 6 - op: 6
valueIndex: 36 valueIndex: 34
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: -1 data[3]: -1
- op: 1 - op: 1
valueIndex: 37 valueIndex: 35
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 1 data[3]: 1
- op: 56 - op: 56
valueIndex: 38 valueIndex: 36
data[0]: 12 data[0]: 12
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 3 data[3]: 2
- op: 1 - op: 1
valueIndex: 42 valueIndex: 40
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 7 data[3]: 7
- op: 56 - op: 56
valueIndex: 43 valueIndex: 41
data[0]: 17 data[0]: 15
data[1]: -1
data[2]: -1
data[3]: 3
- op: 56
valueIndex: 45
data[0]: 16
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 4 data[3]: 4
- op: 1 - op: 1
valueIndex: 47 valueIndex: 49
data[0]: -1
data[1]: -1
data[2]: -1
data[3]: 3
- op: 1
valueIndex: 50
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 3 data[3]: 3
- op: 56 - op: 56
valueIndex: 53 valueIndex: 52
data[0]: 15 data[0]: 17
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
data[3]: 5 data[3]: 5
- op: 9 - op: 9
valueIndex: 57 valueIndex: 56
data[0]: -1 data[0]: -1
data[1]: -1 data[1]: -1
data[2]: -1 data[2]: -1
@ -1248,7 +1242,7 @@ VisualEffectResource:
m_Value: 452 m_Value: 452
- m_ExpressionIndex: 4 - m_ExpressionIndex: 4
m_Value: 1 m_Value: 1
- m_ExpressionIndex: 7 - m_ExpressionIndex: 5
m_Value: 0 m_Value: 0
- m_ExpressionIndex: 8 - m_ExpressionIndex: 8
m_Value: 256 m_Value: 256
@ -1256,22 +1250,20 @@ VisualEffectResource:
m_Value: 226 m_Value: 226
- m_ExpressionIndex: 10 - m_ExpressionIndex: 10
m_Value: -5 m_Value: -5
- m_ExpressionIndex: 23 - m_ExpressionIndex: 25
m_Value: 13885440
- m_ExpressionIndex: 26
m_Value: 0.1 m_Value: 0.1
m_Vector2f: m_Vector2f:
m_Array: m_Array:
- m_ExpressionIndex: 20 - m_ExpressionIndex: 19
m_Value: {x: 8, y: 8} m_Value: {x: 8, y: 8}
- m_ExpressionIndex: 22 - m_ExpressionIndex: 22
m_Value: {x: 0.125, y: 0.125} m_Value: {x: 0.125, y: 0.125}
m_Vector3f: m_Vector3f:
m_Array: m_Array:
- m_ExpressionIndex: 23
m_Value: {x: 0, y: 0, z: 0}
- m_ExpressionIndex: 30 - m_ExpressionIndex: 30
m_Value: {x: 1, y: 1, z: 1} m_Value: {x: 1, y: 1, z: 1}
- m_ExpressionIndex: 31
m_Value: {x: 0, y: 0, z: 0}
m_Vector4f: m_Vector4f:
m_Array: [] m_Array: []
m_Uint: m_Uint:
@ -1406,7 +1398,7 @@ VisualEffectResource:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
- m_ExpressionIndex: 14 - m_ExpressionIndex: 15
m_Value: m_Value:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
@ -1440,41 +1432,7 @@ VisualEffectResource:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
- m_ExpressionIndex: 15 - m_ExpressionIndex: 16
m_Value:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.6529541
value: 0.21612549
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
- m_ExpressionIndex: 17
m_Value: m_Value:
serializedVersion: 2 serializedVersion: 2
m_Curve: m_Curve:
@ -1517,9 +1475,43 @@ VisualEffectResource:
m_PreInfinity: 2 m_PreInfinity: 2
m_PostInfinity: 2 m_PostInfinity: 2
m_RotationOrder: 4 m_RotationOrder: 4
- m_ExpressionIndex: 17
m_Value:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 0.6529541
value: 0.21612549
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
m_Gradient: m_Gradient:
m_Array: m_Array:
- m_ExpressionIndex: 16 - m_ExpressionIndex: 14
m_Value: m_Value:
serializedVersion: 2 serializedVersion: 2
key0: {r: 0.3372549, g: 0.83137256, b: 1, a: 1} key0: {r: 0.3372549, g: 0.83137256, b: 1, a: 1}
@ -1551,19 +1543,19 @@ VisualEffectResource:
m_NumAlphaKeys: 2 m_NumAlphaKeys: 2
m_NamedObject: m_NamedObject:
m_Array: m_Array:
- m_ExpressionIndex: 5
m_Value: {fileID: 0}
- m_ExpressionIndex: 6 - m_ExpressionIndex: 6
m_Value: {fileID: 0} m_Value: {fileID: 0}
- m_ExpressionIndex: 28 - m_ExpressionIndex: 7
m_Value: {fileID: 0}
- m_ExpressionIndex: 27
m_Value: {fileID: 2800000, guid: 0bd50cf212584ed41991d99dbc392d8e, type: 3} m_Value: {fileID: 2800000, guid: 0bd50cf212584ed41991d99dbc392d8e, type: 3}
m_Bool: m_Bool:
m_Array: [] m_Array: []
m_ExposedExpressions: m_ExposedExpressions:
- nameId: CachedTexture - nameId: CachedTexture
index: 6 index: 7
- nameId: DepthImage - nameId: DepthImage
index: 5 index: 6
m_Buffers: m_Buffers:
- type: 1 - type: 1
size: 152739840 size: 152739840
@ -1722,16 +1714,7 @@ VisualEffectResource:
- nameId: spawner_output - nameId: spawner_output
index: 1 index: 1
values: [] values: []
tasks: tasks: []
- type: 268435456
buffers: []
temporaryBuffers: []
values:
- nameId: Rate
index: 23
params: []
processor: {fileID: 0}
shaderSourceIndex: -1
- type: 1 - type: 1
flags: 3 flags: 3
capacity: 13885440 capacity: 13885440
@ -1755,7 +1738,7 @@ VisualEffectResource:
index: 7 index: 7
values: values:
- nameId: bounds_center - nameId: bounds_center
index: 31 index: 23
- nameId: bounds_size - nameId: bounds_size
index: 30 index: 30
tasks: tasks:
@ -1774,16 +1757,16 @@ VisualEffectResource:
- nameId: Velocity_x_b - nameId: Velocity_x_b
index: 29 index: 29
- nameId: Velocity_y_b - nameId: Velocity_y_b
index: 24 index: 28
- nameId: Velocity_z_b - nameId: Velocity_z_b
index: 27 index: 26
- nameId: texture_b - nameId: texture_b
index: 6 index: 7
- nameId: texture_c - nameId: texture_c
index: 5 index: 6
params: params:
- nameId: bounds_center - nameId: bounds_center
index: 31 index: 23
- nameId: bounds_size - nameId: bounds_size
index: 30 index: 30
processor: {fileID: 0} processor: {fileID: 0}
@ -1799,7 +1782,7 @@ VisualEffectResource:
temporaryBuffers: [] temporaryBuffers: []
values: values:
- nameId: deltaTime_a - nameId: deltaTime_a
index: 25 index: 24
params: [] params: []
processor: {fileID: 0} processor: {fileID: 0}
shaderSourceIndex: 1 shaderSourceIndex: 1
@ -1816,7 +1799,7 @@ VisualEffectResource:
temporaryBuffers: [] temporaryBuffers: []
values: values:
- nameId: localToWorld - nameId: localToWorld
index: 33 index: 32
params: [] params: []
processor: {fileID: 0} processor: {fileID: 0}
shaderSourceIndex: 3 shaderSourceIndex: 3
@ -1831,15 +1814,15 @@ VisualEffectResource:
temporaryBuffers: [] temporaryBuffers: []
values: values:
- nameId: Scale_x_b - nameId: Scale_x_b
index: 32 index: 31
- nameId: Scale_y_b - nameId: Scale_y_b
index: 19 index: 20
- nameId: Scale_z_b - nameId: Scale_z_b
index: 21 index: 21
- nameId: gradient_c - nameId: gradient_c
index: 18 index: 18
- nameId: mainTexture - nameId: mainTexture
index: 28 index: 27
params: params:
- nameId: sortPriority - nameId: sortPriority
index: 0 index: 0
@ -4109,7 +4092,7 @@ MonoBehaviour:
m_InputSlots: m_InputSlots:
- {fileID: 8926484042661614937} - {fileID: 8926484042661614937}
m_OutputSlots: [] m_OutputSlots: []
m_Disabled: 0 m_Disabled: 1
--- !u!114 &8926484042661614937 --- !u!114 &8926484042661614937
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4134,7 +4117,7 @@ MonoBehaviour:
m_Type: m_Type:
m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, m_SerializableType: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 PublicKeyToken=b77a5c561934e089
m_SerializableObject: 1.388544E+07 m_SerializableObject: 1.388522E+07
m_Space: 2147483647 m_Space: 2147483647
m_Property: m_Property:
name: Rate name: Rate

View file

@ -1,33 +0,0 @@
using UnityEngine;
using UnityEngine.Experimental.VFX;
namespace cylvester
{
public class KinectPointCloud : MonoBehaviour
{
[SerializeField] private VisualEffect visualEffect;
private Texture2D cachedTexture_;
private Texture2D data_;
public void Start()
{
cachedTexture_ = new Texture2D(512, 424, TextureFormat.R16, false);
data_ = new Texture2D(512, 424, TextureFormat.R16, false);
}
public void Update()
{
//Graphics.CopyTexture(data_, cachedTexture_);
}
public void OnInfraredFrameReceived( Texture2D data)
{
data_ = data;
visualEffect.SetTexture("DepthImage", data_);
visualEffect.SetTexture("CachedTexture", cachedTexture_);
}
}
}

View file

@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Chikashi m_Name: Chikashi
m_Shader: {fileID: -6465566751694194690, guid: dba87f2457ea73049a3530f73e8006e2, m_Shader: {fileID: -6465566751694194690, guid: 7c4fb62383d9e1a4e92bfb5939d1e04e,
type: 3} type: 3}
m_ShaderKeywords: m_ShaderKeywords:
m_LightmapFlags: 4 m_LightmapFlags: 4
@ -19,6 +19,7 @@ Material:
MotionVector: User MotionVector: User
disabledShaderPasses: disabledShaderPasses:
- MOTIONVECTORS - MOTIONVECTORS
- DistortionVectors
m_SavedProperties: m_SavedProperties:
serializedVersion: 3 serializedVersion: 3
m_TexEnvs: m_TexEnvs:
@ -46,6 +47,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _DepthImage:
m_Texture: {fileID: 2800000, guid: 85240a94ab2a5144db2b4a8a66e53e3f, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap: - _DetailMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -78,6 +83,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MyTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap: - _NormalMap:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
@ -114,6 +123,10 @@ Material:
m_Texture: {fileID: 0} m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _UnlitColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: m_Floats:
- _AORemapMax: 1 - _AORemapMax: 1
- _AORemapMin: 0 - _AORemapMin: 0
@ -143,16 +156,17 @@ Material:
- _DisplacementMode: 0 - _DisplacementMode: 0
- _DistortionBlendMode: 0 - _DistortionBlendMode: 0
- _DistortionBlurBlendMode: 0 - _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 0 - _DistortionBlurDstBlend: 1
- _DistortionBlurRemapMax: 1 - _DistortionBlurRemapMax: 1
- _DistortionBlurRemapMin: 0 - _DistortionBlurRemapMin: 0
- _DistortionBlurScale: 1 - _DistortionBlurScale: 1
- _DistortionBlurSrcBlend: 0 - _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 1 - _DistortionDepthTest: 1
- _DistortionDstBlend: 0 - _DistortionDstBlend: 1
- _DistortionEnable: 0 - _DistortionEnable: 0
- _DistortionOnly: 0
- _DistortionScale: 1 - _DistortionScale: 1
- _DistortionSrcBlend: 0 - _DistortionSrcBlend: 1
- _DistortionVectorBias: -1 - _DistortionVectorBias: -1
- _DistortionVectorScale: 2 - _DistortionVectorScale: 2
- _DoubleSidedEnable: 0 - _DoubleSidedEnable: 0
@ -177,6 +191,7 @@ Material:
- _HeightPoMAmplitude: 2 - _HeightPoMAmplitude: 2
- _HeightTessAmplitude: 2 - _HeightTessAmplitude: 2
- _HeightTessCenter: 0.5 - _HeightTessCenter: 0.5
- _IncludeIndirectLighting: 1
- _InvTilingScale: 1 - _InvTilingScale: 1
- _Ior: 1 - _Ior: 1
- _IridescenceMask: 1 - _IridescenceMask: 1
@ -200,16 +215,16 @@ Material:
- _SpecularAAScreenSpaceVariance: 0.1 - _SpecularAAScreenSpaceVariance: 0.1
- _SpecularAAThreshold: 0.2 - _SpecularAAThreshold: 0.2
- _SrcBlend: 1 - _SrcBlend: 1
- _StencilRef: 2 - _StencilRef: 0
- _StencilRefDepth: 0 - _StencilRefDepth: 32
- _StencilRefDistortionVec: 64 - _StencilRefDistortionVec: 64
- _StencilRefGBuffer: 2 - _StencilRefGBuffer: 2
- _StencilRefMV: 128 - _StencilRefMV: 160
- _StencilWriteMask: 3 - _StencilWriteMask: 3
- _StencilWriteMaskDepth: 32 - _StencilWriteMaskDepth: 48
- _StencilWriteMaskDistortionVec: 64 - _StencilWriteMaskDistortionVec: 64
- _StencilWriteMaskGBuffer: 3 - _StencilWriteMaskGBuffer: 3
- _StencilWriteMaskMV: 128 - _StencilWriteMaskMV: 176
- _SubsurfaceMask: 1 - _SubsurfaceMask: 1
- _SupportDecals: 1 - _SupportDecals: 1
- _SurfaceType: 0 - _SurfaceType: 0
@ -229,15 +244,15 @@ Material:
- _UVEmissive: 0 - _UVEmissive: 0
- _UseEmissiveIntensity: 0 - _UseEmissiveIntensity: 0
- _UseShadowThreshold: 0 - _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 4 - _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4 - _ZTestGBuffer: 4
- _ZTestModeDistortion: 8 - _ZTestModeDistortion: 4
- _ZTestTransparent: 4 - _ZTestTransparent: 4
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0} - _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 0, g: 0, b: 0, a: 1}
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0} - _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
@ -251,3 +266,4 @@ Material:
- _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0} - _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMask: {r: 1, g: 0, b: 0, a: 0} - _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
- _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0} - _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
- _UnlitColor: {r: 1, g: 1, b: 1, a: 1}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 98f772ab36cc0884e88b75ad1e51887b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,26 @@
#pragma kernel CSMain
Texture2D<float> Input;
RWTexture2D<float> Previous;
RWTexture2D<float> Result;
float Factor;
[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
int xOffset = id.x * 64;
int yOffset = id.y * 53;
for(int localY = 0; localY < 53; ++localY)
{
for(int localX = 0; localX < 64; ++localX)
{
uint2 coordinate = uint2(xOffset + localX, yOffset + localY);
float inputValue = (float)Input[coordinate];
float previousValue = (float)Previous[coordinate];
Result[coordinate] = abs(inputValue - previousValue) / Factor;
Previous[coordinate] = Input[coordinate];
}
}
}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 603dbf231b79f4245b124e6f915e3bd5
ComputeShaderImporter:
externalObjects: {}
currentAPIMask: 4
userData:
assetBundleName:
assetBundleVariant:

View file

@ -154,7 +154,7 @@ MonoBehaviour:
m_PersistentCalls: m_PersistentCalls:
m_Calls: m_Calls:
- m_Target: {fileID: 583502371} - m_Target: {fileID: 583502371}
m_MethodName: OnInfraredFrameReceived m_MethodName: OnTextureReceived
m_Mode: 0 m_Mode: 0
m_Arguments: m_Arguments:
m_ObjectArgument: {fileID: 0} m_ObjectArgument: {fileID: 0}
@ -175,6 +175,17 @@ MonoBehaviour:
m_StringArgument: m_StringArgument:
m_BoolArgument: 0 m_BoolArgument: 0
m_CallState: 2 m_CallState: 2
- m_Target: {fileID: 564551240}
m_MethodName: OnInfraredFrameReceived
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
skeleton: 1 skeleton: 1
skeletonDataReceived: skeletonDataReceived:
m_PersistentCalls: m_PersistentCalls:
@ -215,6 +226,7 @@ Transform:
m_Children: m_Children:
- {fileID: 839221371} - {fileID: 839221371}
- {fileID: 583502374} - {fileID: 583502374}
- {fileID: 564551239}
- {fileID: 479263793} - {fileID: 479263793}
- {fileID: 1806371279} - {fileID: 1806371279}
- {fileID: 2145444544} - {fileID: 2145444544}
@ -264,8 +276,129 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 238320196} m_Father: {fileID: 238320196}
m_RootOrder: 2 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &564551235
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 564551239}
- component: {fileID: 564551238}
- component: {fileID: 564551237}
- component: {fileID: 564551240}
- component: {fileID: 564551236}
m_Layer: 0
m_Name: MovementPanel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &564551236
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 564551235}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0603bf64edb4c8885cefbc40ee206fe, type: 3}
m_Name:
m_EditorClassIdentifier:
panel: {fileID: 564551235}
--- !u!23 &564551237
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 564551235}
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_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 &564551238
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 564551235}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &564551239
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 564551235}
m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071068}
m_LocalPosition: {x: -25, y: -10, z: 22.9}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 238320196}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!114 &564551240
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 564551235}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0392de87fccb6346bc6b0c1a48a8855, type: 3}
m_Name:
m_EditorClassIdentifier:
DifferenceTextureReceived:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 564551236}
m_MethodName: OnTextureReceived
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
computeShader: {fileID: 7200000, guid: 603dbf231b79f4245b124e6f915e3bd5, type: 3}
factor: 1
--- !u!1 &583502370 --- !u!1 &583502370
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -279,7 +412,7 @@ GameObject:
- component: {fileID: 583502372} - component: {fileID: 583502372}
- component: {fileID: 583502371} - component: {fileID: 583502371}
m_Layer: 0 m_Layer: 0
m_Name: Plane m_Name: InfraredPanel
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -604,7 +737,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 238320196} m_Father: {fileID: 238320196}
m_RootOrder: 3 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1806371280 --- !u!114 &1806371280
MonoBehaviour: MonoBehaviour:
@ -697,7 +830,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1931119204} m_GameObject: {fileID: 1931119204}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -31.11} m_LocalPosition: {x: 0, y: 0, z: -20.5}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -1005,8 +1138,8 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 2145444544} - component: {fileID: 2145444544}
- component: {fileID: 2145444546}
- component: {fileID: 2145444545} - component: {fileID: 2145444545}
- component: {fileID: 2145444546}
- component: {fileID: 2145444547} - component: {fileID: 2145444547}
m_Layer: 0 m_Layer: 0
m_Name: KinectPointCloud m_Name: KinectPointCloud
@ -1027,26 +1160,34 @@ Transform:
m_LocalScale: {x: 5, y: 5, z: 5} m_LocalScale: {x: 5, y: 5, z: 5}
m_Children: [] m_Children: []
m_Father: {fileID: 238320196} m_Father: {fileID: 238320196}
m_RootOrder: 4 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!73398921 &2145444545 --- !u!33 &2145444545
VFXRenderer: MeshFilter:
m_ObjectHideFlags: 2 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2145444543}
m_Mesh: {fileID: 0}
--- !u!23 &2145444546
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2145444543} m_GameObject: {fileID: 2145444543}
m_Enabled: 1 m_Enabled: 1
m_CastShadows: 0 m_CastShadows: 1
m_ReceiveShadows: 0 m_ReceiveShadows: 1
m_DynamicOccludee: 1 m_DynamicOccludee: 1
m_MotionVectors: 0 m_MotionVectors: 1
m_LightProbeUsage: 0 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 0 m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_RendererPriority: 0 m_RendererPriority: 0
m_Materials: m_Materials:
- {fileID: 0} - {fileID: 2100000, guid: 2588e55c48fb56d48a952db53af26dfd, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
@ -1067,49 +1208,6 @@ VFXRenderer:
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!2083052967 &2145444546
VisualEffect:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2145444543}
m_Enabled: 1
m_Asset: {fileID: 8926484042661614526, guid: 3a4d3d5be59a1e049aa7f5a5df312385, type: 3}
m_StartSeed: 0
m_ResetSeedOnPlay: 1
m_PropertySheet:
m_Float:
m_Array: []
m_Vector2f:
m_Array: []
m_Vector3f:
m_Array: []
m_Vector4f:
m_Array: []
m_Uint:
m_Array: []
m_Int:
m_Array: []
m_Matrix4x4f:
m_Array: []
m_AnimationCurve:
m_Array: []
m_Gradient:
m_Array: []
m_NamedObject:
m_Array:
- m_Value: {fileID: 0}
m_Name: DepthImage
m_Overridden: 1
- m_Value: {fileID: 0}
m_Name: CahcedTexture
m_Overridden: 1
- m_Value: {fileID: 0}
m_Name: CachedTexture
m_Overridden: 1
m_Bool:
m_Array: []
--- !u!114 &2145444547 --- !u!114 &2145444547
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1122,4 +1220,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3f9b3ce38c9309e4c939678d9d08a9ec, type: 3} m_Script: {fileID: 11500000, guid: 3f9b3ce38c9309e4c939678d9d08a9ec, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
visualEffect: {fileID: 2145444546} meshFilter: {fileID: 2145444545}

View file

@ -1,42 +0,0 @@
using System;
using UnityEngine;
using UnityEngine.Events;
namespace cylvester
{
[Serializable]
class UnityDifferenceTextureEvent : UnityEvent<Texture2D> { }
public class DifferenceTexture : MonoBehaviour
{
[SerializeField] private UnityDifferenceTextureEvent DifferenceTextureReceived;
private Texture2D cache_;
private Texture2D difference_;
private readonly int size_ = 512 * 424 * 2;
private void Start()
{
cache_ = new Texture2D(512, 424, TextureFormat.R16, false);
difference_ = new Texture2D(512, 424, TextureFormat.R16, false);
}
public void OnInfraredFrameReceived(Texture2D texture)
{
var rawDifference = difference_.GetPixels();
var rawNewTexture = texture.GetRawTextureData();
var rawOldTexture = cache_.GetRawTextureData();
// perhaps the fastest way to calculate on CPU
for (var i = 0; i < rawDifference.Length; ++i)
difference_.Apply();
Graphics.CopyTexture(texture, cache_);
DifferenceTextureReceived.Invoke(difference_);
}
}
}

View file

@ -0,0 +1,52 @@
using UnityEngine;
namespace cylvester
{
public class KinectPointCloud : MonoBehaviour
{
[SerializeField] private MeshFilter meshFilter;
private void Start()
{
var mesh = new Mesh {vertices = CreatePlane(512, 424)};
mesh.SetIndices(CreateIndices(512 * 424), MeshTopology.Points, 0);
meshFilter.mesh = mesh;
}
private Vector3[] CreatePlane(int columns, int rows)
{
var plane = new Vector3[columns * rows];
var count = 0;
for (var i = 0; i < rows; ++i)
{
var y = (float) i / (rows - 1) * 2f - 1f;
for (var j = 0; j < columns; ++j)
{
var x = (float) j / (columns - 1) * 2f - 1f;
plane[count] = new Vector3(x, y, 0f);
count++;
}
}
return plane;
}
private int[] CreateIndices(int num)
{
var indices = new int[num];
for (var i = 0; i < num; ++i)
indices[i] = i;
return indices;
}
public void OnInfraredFrameReceived( Texture2D data)
{
}
}
}

View file

@ -0,0 +1,46 @@
using System;
using UnityEngine;
using UnityEngine.Events;
namespace cylvester
{
[Serializable]
class UnityMovementTextureEvent : UnityEvent<Texture> { }
public class MovementBaker : MonoBehaviour
{
[SerializeField] private UnityMovementTextureEvent DifferenceTextureReceived;
[SerializeField] private ComputeShader computeShader;
[SerializeField] private float factor = 1;
private RenderTexture resultTexture_;
private RenderTexture previousFrameTexture_;
private int kernelHandle_;
private void Start()
{
resultTexture_ = new RenderTexture(512, 424, 0, RenderTextureFormat.R16) {enableRandomWrite = true};
resultTexture_.Create();
previousFrameTexture_ = new RenderTexture(512, 424, 0, RenderTextureFormat.R16) {enableRandomWrite = true};
previousFrameTexture_.Create();
kernelHandle_ = computeShader.FindKernel("CSMain");
}
public void OnInfraredFrameReceived(Texture2D texture)
{
computeShader.SetTexture(kernelHandle_, "Input", texture);
computeShader.SetTexture(kernelHandle_, "Previous", previousFrameTexture_);
computeShader.SetTexture(kernelHandle_, "Result", resultTexture_);
computeShader.SetFloat("Factor", factor);
computeShader.Dispatch(kernelHandle_, 1, 1, 1);
DifferenceTextureReceived.Invoke(resultTexture_);
}
}
}

View file

@ -2,7 +2,7 @@ using UnityEngine;
namespace cylvester namespace cylvester
{ {
class IRPanelBehaviour : MonoBehaviour class TexturePanelBehaviour : MonoBehaviour
{ {
[SerializeField] private GameObject panel = null; [SerializeField] private GameObject panel = null;
@ -14,7 +14,7 @@ namespace cylvester
renderer_ = panel.GetComponent<Renderer>(); renderer_ = panel.GetComponent<Renderer>();
} }
public void OnInfraredFrameReceived(Texture2D texture) public void OnTextureReceived(Texture texture)
{ {
renderer_.material.SetTexture(KinectTexture, texture); renderer_.material.SetTexture(KinectTexture, texture);
} }

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 7c4fb62383d9e1a4e92bfb5939d1e04e
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}