This commit is contained in:
Chikashi Miyama 2019-12-12 17:48:03 +01:00
parent 5eca901d6e
commit 17b4217ce4
10 changed files with 494 additions and 12 deletions

View file

@ -103,6 +103,7 @@
<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\Kinect\MovementBakerRenderTexture.cs" />
<Compile Include="Assets\Scripts\Math\BodyHolder.cs" />
<Compile Include="Assets\Scripts\Math\Smoother.cs" />
<Compile Include="Assets\Scripts\Math\Threshold.cs" />

View file

@ -0,0 +1,259 @@
%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: Difference
m_Shader: {fileID: -6465566751694194690, guid: b5bf8137947871e429240f7781018331,
type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
MotionVector: User
disabledShaderPasses:
- DistortionVectors
- MOTIONVECTORS
- TransparentDepthPrepass
- TransparentDepthPostpass
- TransparentBackface
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- Texture2D_527D374F:
m_Texture: {fileID: 8400000, guid: f235609b825377142ab45895e91b6839, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- Texture2D_C0B45AA6:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _AnisotropyMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BaseColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BentNormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CoatMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DistortionVectorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissiveColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _HeightMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _IridescenceThicknessMap:
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}
- _MaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _NormalMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecularColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SubsurfaceMaskMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TangentMapOS:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ThicknessMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _TransmittanceColorMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AORemapMax: 1
- _AORemapMin: 0
- _ATDistance: 1
- _AlbedoAffectEmissive: 0
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _AlphaCutoffPostpass: 0.5
- _AlphaCutoffPrepass: 0.5
- _AlphaCutoffShadow: 0.5
- _AlphaDstBlend: 0
- _AlphaSrcBlend: 1
- _Anisotropy: 0
- _BlendMode: 0
- _CoatMask: 0
- _CullMode: 2
- _CullModeForward: 2
- _Cutoff: 0.5
- _DepthOffsetEnable: 0
- _DetailAlbedoScale: 1
- _DetailNormalScale: 1
- _DetailSmoothnessScale: 1
- _DiffusionProfile: 0
- _DiffusionProfileHash: 0
- _DisplacementLockObjectScale: 1
- _DisplacementLockTilingScale: 1
- _DisplacementMode: 0
- _DistortionBlendMode: 0
- _DistortionBlurBlendMode: 0
- _DistortionBlurDstBlend: 1
- _DistortionBlurRemapMax: 1
- _DistortionBlurRemapMin: 0
- _DistortionBlurScale: 1
- _DistortionBlurSrcBlend: 1
- _DistortionDepthTest: 1
- _DistortionDstBlend: 1
- _DistortionEnable: 0
- _DistortionScale: 1
- _DistortionSrcBlend: 1
- _DistortionVectorBias: -1
- _DistortionVectorScale: 2
- _DoubleSidedEnable: 0
- _DoubleSidedNormalMode: 1
- _DstBlend: 0
- _EmissiveColorMode: 1
- _EmissiveExposureWeight: 1
- _EmissiveIntensity: 1
- _EmissiveIntensityUnit: 0
- _EnableBlendModePreserveSpecularLighting: 1
- _EnableFogOnTransparent: 1
- _EnableGeometricSpecularAA: 0
- _EnableSpecularOcclusion: 0
- _EnergyConservingSpecularColor: 1
- _HdrpVersion: 2
- _HeightAmplitude: 0.02
- _HeightCenter: 0.5
- _HeightMapParametrization: 0
- _HeightMax: 1
- _HeightMin: -1
- _HeightOffset: 0
- _HeightPoMAmplitude: 2
- _HeightTessAmplitude: 2
- _HeightTessCenter: 0.5
- _InvTilingScale: 1
- _Ior: 1
- _IridescenceMask: 1
- _IridescenceThickness: 1
- _LinkDetailsWithBase: 1
- _MaterialID: 1
- _Metallic: 0
- _NormalMapSpace: 0
- _NormalScale: 1
- _PPDLodThreshold: 5
- _PPDMaxSamples: 15
- _PPDMinSamples: 5
- _PPDPrimitiveLength: 1
- _PPDPrimitiveWidth: 1
- _ReceivesSSR: 0
- _RefractionModel: 0
- _RenderQueueType: 1
- _RequireSplitLighting: 0
- _SSRefractionProjectionModel: 0
- _Smoothness: 0.5
- _SmoothnessRemapMax: 1
- _SmoothnessRemapMin: 0
- _SpecularAAScreenSpaceVariance: 0.1
- _SpecularAAThreshold: 0.2
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 32
- _StencilRefDistortionVec: 64
- _StencilRefGBuffer: 2
- _StencilRefMV: 160
- _StencilWriteMask: 3
- _StencilWriteMaskDepth: 48
- _StencilWriteMaskDistortionVec: 64
- _StencilWriteMaskGBuffer: 51
- _StencilWriteMaskMV: 176
- _SubsurfaceMask: 1
- _SupportDecals: 1
- _SurfaceType: 0
- _TexWorldScale: 1
- _TexWorldScaleEmissive: 1
- _Thickness: 1
- _ThicknessMultiplier: 1
- _TransmissionEnable: 1
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentDepthPostpassEnable: 0
- _TransparentDepthPrepassEnable: 0
- _TransparentSortPriority: 0
- _TransparentWritingMotionVec: 0
- _UVBase: 0
- _UVDetail: 0
- _UVEmissive: 0
- _UseEmissiveIntensity: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZTestModeDistortion: 4
- _ZTestTransparent: 4
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
- _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
- _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
- _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
- _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
- _UVDetailsMappingMask: {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}

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 312d9549de079824294680133ce5530a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View file

@ -8,12 +8,12 @@ float Factor;
[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
int xOffset = id.x * 64;
int yOffset = id.y * 53;
int xOffset = id.x * 256; // 2048 / 8
int yOffset = id.y * 192; // 1536 / 8
for(int localY = 0; localY < 53; ++localY)
for(int localY = 0; localY < 192; ++localY)
{
for(int localX = 0; localX < 64; ++localX)
for(int localX = 0; localX < 256; ++localX)
{
uint2 coordinate = uint2(xOffset + localX, yOffset + localY);
float inputValue = (float)Input[coordinate];

View file

@ -332,7 +332,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 48e1b0f548fe9b74c90eb10da5cffd13, type: 3}
m_Name:
m_EditorClassIdentifier:
_deviceSettings: {fileID: 11400000, guid: f8122729f4736dd4ab99617ee19feec3, type: 2}
_deviceSettings: {fileID: 11400000, guid: c681badc1a8be8243af1e0c53d337b50, type: 2}
_colorTexture: {fileID: 8400000, guid: 046aa26a9af8e164eb0b20672983a11f, type: 2}
_positionTexture: {fileID: 8400000, guid: f235609b825377142ab45895e91b6839, type: 2}
_shader: {fileID: 4800000, guid: c2bfd9668998b6848ac60594704c344c, type: 3}
@ -350,6 +350,7 @@ Transform:
- {fileID: 1154359618}
- {fileID: 1845254192}
- {fileID: 1831436208}
- {fileID: 1484861665}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -549,7 +550,7 @@ Transform:
m_GameObject: {fileID: 1331773691}
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_LocalScale: {x: 1, y: 1, z: 0}
m_Children: []
m_Father: {fileID: 1785581067}
m_RootOrder: 0
@ -632,6 +633,101 @@ VisualEffect:
m_Overridden: 1
m_Bool:
m_Array: []
--- !u!1 &1484861664
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1484861665}
- component: {fileID: 1484861668}
- component: {fileID: 1484861667}
- component: {fileID: 1484861666}
m_Layer: 0
m_Name: Movement
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1484861665
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1484861664}
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 6, y: -6, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 646155286}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!114 &1484861666
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1484861664}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f128963a36eb50343881d16cb76cdc89, type: 3}
m_Name:
m_EditorClassIdentifier:
source: {fileID: 8400000, guid: f235609b825377142ab45895e91b6839, type: 2}
result: {fileID: 8400000, guid: 47d2c97bffd32844a8e61b250da6b7e5, type: 2}
computeShader: {fileID: 7200000, guid: 603dbf231b79f4245b124e6f915e3bd5, type: 3}
factor: 1
--- !u!23 &1484861667
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1484861664}
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: 312d9549de079824294680133ce5530a, 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 &1484861668
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1484861664}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1 &1785581066
GameObject:
m_ObjectHideFlags: 0
@ -656,7 +752,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1785581066}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 6, y: -6, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1331773692}

View file

@ -1,10 +1,5 @@
fileFormatVersion: 2
<<<<<<< HEAD:UnityProject/Assets/Scenes/Examples/Azure/AzureDemo.unity.meta
guid: d2b605d5e6f33cb43a6b49852af3bc24
=======
guid: df11262fc1b053a488b5cfbf724e4cda
folderAsset: yes
>>>>>>> refs/heads/master:UnityProject/Assets/Scenes/Examples/Azure.meta
DefaultImporter:
externalObjects: {}
userData:

View file

@ -0,0 +1,48 @@
using System;
using UnityEngine;
using UnityEngine.Events;
namespace cylvester
{
public class MovementBakerRenderTexture : MonoBehaviour
{
[SerializeField] private RenderTexture input;
[SerializeField] private ComputeShader computeShader;
[SerializeField] private float factor = 1;
private RenderTexture resultTexture_;
private RenderTexture previousFrameTexture_;
private int kernelHandle_;
private Renderer renderer_;
private void Start()
{
resultTexture_ = new RenderTexture(input.width, input.height, 0, input.graphicsFormat) { enableRandomWrite = true };
resultTexture_.Create();
previousFrameTexture_ = new RenderTexture(input.width, input.height, 0, input.graphicsFormat) { enableRandomWrite = true };
previousFrameTexture_.Create();
kernelHandle_ = computeShader.FindKernel("CSMain");
renderer_ = GetComponent<Renderer>();
}
private void Update()
{
computeShader.SetTexture(kernelHandle_, "Input", input);
computeShader.SetTexture(kernelHandle_, "Previous", previousFrameTexture_);
computeShader.SetTexture(kernelHandle_, "Result", resultTexture_);
computeShader.SetFloat("Factor", factor);
computeShader.Dispatch(kernelHandle_, 1, 1, 1);
renderer_.material.SetTexture("_differenceTexture", resultTexture_);
}
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f128963a36eb50343881d16cb76cdc89
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View file

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