update Particle with Kinect

master
uc-hoba 8 years ago
parent 82be25bd7e
commit f4a85669a5
  1. 311
      Unity_2018_Frozen/Assets/Frozen/Frozen.unity
  2. 33
      Unity_2018_Frozen/Assets/Frozen/FrozenCanvas.renderTexture
  3. 10
      Unity_2018_Frozen/Assets/Frozen/FrozenCanvas.renderTexture.meta
  4. 6
      Unity_2018_Frozen/Assets/Frozen/Material/Ground.mat
  5. 6
      Unity_2018_Frozen/Assets/Frozen/Material/Snowflake.mat
  6. 16
      Unity_2018_Frozen/Assets/Frozen/ParticleUniforms.asset
  7. 2
      Unity_2018_Frozen/Assets/Frozen/PostProcessingProfile.asset
  8. 10
      Unity_2018_Frozen/Assets/Frozen/Script.meta
  9. 115
      Unity_2018_Frozen/Assets/Frozen/Script/SnowflakeParticleUpdater.cs
  10. 13
      Unity_2018_Frozen/Assets/Frozen/Script/SnowflakeParticleUpdater.cs.meta
  11. 34
      Unity_2018_Frozen/Assets/Frozen/Shader/SnowflakeParticleUpdate.compute
  12. BIN
      Unity_2018_Frozen/Assets/Frozen/Texture/Frozen-CC065205.tif
  13. 87
      Unity_2018_Frozen/Assets/Frozen/Texture/Frozen-CC065205.tif.meta
  14. 41
      Unity_2018_Frozen/Assets/KinectOpticalFlow/KinectOpticalFlow.cs
  15. 20
      Unity_2018_Frozen/Assets/KinectOpticalFlow/KinectUpdateShader.compute
  16. 5
      Unity_2018_Frozen/ProjectSettings/EditorBuildSettings.asset
  17. 2
      Unity_2018_Frozen/ProjectSettings/GraphicsSettings.asset

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.060945295, g: 0.054545894, b: 0.039643742, a: 1} m_IndirectSpecularColor: {r: 0.021216419, g: 0.053037528, b: 0.08577963, a: 1}
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -236,7 +236,7 @@ Camera:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingPath: 3 m_RenderingPath: 1
m_TargetTexture: {fileID: 0} m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0 m_TargetDisplay: 0
m_TargetEye: 3 m_TargetEye: 3
@ -254,7 +254,7 @@ Transform:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 151858420} m_GameObject: {fileID: 151858420}
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: 1, z: -10} m_LocalPosition: {x: 0, y: 1, z: -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}
@ -544,17 +544,17 @@ MonoBehaviour:
m_GameObject: {fileID: 350883107} m_GameObject: {fileID: 350883107}
m_Enabled: 1 m_Enabled: 1
m_EditorHideFlags: 0 m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 364a6df5fc849f7448e97efcaa6cefdc, type: 3} m_Script: {fileID: 11500000, guid: 15ad9c9a8c81d2c4184b50d96a669c7d, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
reset: 0 reset: 0
maxParticles: 100000 maxParticles: 100000
particleBuffer: {fileID: 438615022} particleBuffer: {fileID: 438615022}
homeBuffer: {fileID: 1375512057}
homeVelocityBuffer: {fileID: 1924148042}
shader: {fileID: 7200000, guid: d6604fabdbb13e9428c849c59feccdac, type: 3} shader: {fileID: 7200000, guid: d6604fabdbb13e9428c849c59feccdac, type: 3}
uniformBuffer: {fileID: 441718966} uniformBuffer: {fileID: 441718966}
cosineGradient: {fileID: 11400000, guid: 2138651e11178d04ba510ef9164baf46, type: 2} cosineGradient: {fileID: 11400000, guid: 2138651e11178d04ba510ef9164baf46, type: 2}
kinectOpticalFlow: {fileID: 1848145251}
smokeFluidSim: {fileID: 774429923}
debug: debug:
--- !u!1 &368967883 --- !u!1 &368967883
GameObject: GameObject:
@ -649,14 +649,14 @@ Camera:
near clip plane: 0.3 near clip plane: 0.3
far clip plane: 1000 far clip plane: 1000
field of view: 60 field of view: 60
orthographic: 0 orthographic: 1
orthographic size: 5 orthographic size: 5
m_Depth: 0 m_Depth: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingPath: 3 m_RenderingPath: 1
m_TargetTexture: {fileID: 0} m_TargetTexture: {fileID: 8400000, guid: 6921d0717fba0654597a7ad3fb5c47e7, type: 2}
m_TargetDisplay: 1 m_TargetDisplay: 1
m_TargetEye: 3 m_TargetEye: 3
m_HDR: 1 m_HDR: 1
@ -672,13 +672,13 @@ Transform:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 368967883} m_GameObject: {fileID: 368967883}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: -0.08047724, y: 0.520406, z: -0.95207787} m_LocalPosition: {x: 0, y: 10, z: 0}
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}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &386695295 --- !u!1 &386695295
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -708,7 +708,7 @@ Transform:
- {fileID: 850228141} - {fileID: 850228141}
- {fileID: 1848145250} - {fileID: 1848145250}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &401185750 --- !u!1 &401185750
GameObject: GameObject:
@ -740,7 +740,7 @@ Transform:
- {fileID: 1579390333} - {fileID: 1579390333}
- {fileID: 343589999} - {fileID: 343589999}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &438615021 --- !u!1 &438615021
GameObject: GameObject:
@ -783,6 +783,100 @@ Transform:
m_Father: {fileID: 732632615} m_Father: {fileID: 732632615}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &439594035
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 439594039}
- component: {fileID: 439594038}
- component: {fileID: 439594037}
- component: {fileID: 439594036}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &439594036
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 439594035}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &439594037
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 439594035}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &439594038
Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 439594035}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 151858423}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &439594039
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 439594035}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 770059767}
m_Father: {fileID: 0}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!1 &441718963 --- !u!1 &441718963
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1047,7 +1141,7 @@ Transform:
m_LocalScale: {x: 2, y: 2, z: 2} m_LocalScale: {x: 2, y: 2, z: 2}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 8 m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &618046638 --- !u!1 &618046638
GameObject: GameObject:
@ -1139,8 +1233,75 @@ Transform:
- {fileID: 1375512056} - {fileID: 1375512056}
- {fileID: 1924148041} - {fileID: 1924148041}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 7 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &770059766
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 770059767}
- component: {fileID: 770059769}
- component: {fileID: 770059768}
m_Layer: 5
m_Name: RawImage
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &770059767
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 770059766}
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: 439594039}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 640, y: 360}
m_Pivot: {x: 1, y: 1}
--- !u!114 &770059768
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 770059766}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -98529514, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Texture: {fileID: 8400000, guid: 6921d0717fba0654597a7ad3fb5c47e7, type: 2}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!222 &770059769
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 770059766}
--- !u!1001 &774429922 --- !u!1001 &774429922
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1262,7 +1423,7 @@ Prefab:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11400000, guid: 0b40c0b4ea4208b4792d95085b850676, type: 2} - target: {fileID: 11400000, guid: 0b40c0b4ea4208b4792d95085b850676, type: 2}
propertyPath: doDraw propertyPath: doDraw
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 100000, guid: 0b40c0b4ea4208b4792d95085b850676, type: 2} - target: {fileID: 100000, guid: 0b40c0b4ea4208b4792d95085b850676, type: 2}
propertyPath: m_Layer propertyPath: m_Layer
@ -1564,7 +1725,7 @@ Light:
serializedVersion: 8 serializedVersion: 8
m_Type: 1 m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1 m_Intensity: 0.2
m_Range: 10 m_Range: 10
m_SpotAngle: 30 m_SpotAngle: 30
m_CookieSize: 10 m_CookieSize: 10
@ -1596,13 +1757,13 @@ Transform:
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1071731253} m_GameObject: {fileID: 1071731253}
m_LocalRotation: {x: 0.04213311, y: -0.2585727, z: 0.011289531, w: 0.96500653} m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalPosition: {x: 0, y: 10, z: 0}
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}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 5, y: -30, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!1 &1196719910 --- !u!1 &1196719910
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1724,6 +1885,50 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
bufferName: home_buffer bufferName: home_buffer
--- !u!1 &1390635887
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1390635888}
- component: {fileID: 1390635889}
m_Layer: 0
m_Name: Misc
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1390635888
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1390635887}
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: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1390635889
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1390635887}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 400c2cde369742e4690d5216c5c3b3c3, type: 3}
m_Name:
m_EditorClassIdentifier:
width: 1280
height: 720
fps: 60
fullscreen: 0
--- !u!1 &1430681566 --- !u!1 &1430681566
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1964,7 +2169,7 @@ MonoBehaviour:
- {fileID: 810572923} - {fileID: 810572923}
- {fileID: 563719738} - {fileID: 563719738}
updateShader: {fileID: 7200000, guid: 514ebfeae1aec6342b486c73b1fbfa32, type: 3} updateShader: {fileID: 7200000, guid: 514ebfeae1aec6342b486c73b1fbfa32, type: 3}
clearShader: {fileID: 7200000, guid: 5a8d2c045ee23f743a54f85301ca1c0b, type: 3} applyShader: {fileID: 7200000, guid: 5a8d2c045ee23f743a54f85301ca1c0b, type: 3}
flipX: 1 flipX: 1
clipMin: {x: -0.85, y: 0.3, z: 0} clipMin: {x: -0.85, y: 0.3, z: 0}
clipMax: {x: 0.71, y: 0.45, z: 1.63} clipMax: {x: 0.71, y: 0.45, z: 1.63}
@ -2018,3 +2223,65 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
bufferName: home_buffer bufferName: home_buffer
--- !u!1 &2129467936
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2129467939}
- component: {fileID: 2129467938}
- component: {fileID: 2129467937}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2129467937
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2129467936}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &2129467938
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2129467936}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &2129467939
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2129467936}
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: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

@ -0,0 +1,33 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: FrozenCanvas
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 3840
m_Height: 2160
m_AntiAliasing: 1
m_DepthFormat: 0
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6921d0717fba0654597a7ad3fb5c47e7
timeCreated: 1519894816
licenseType: Free
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:

@ -8,8 +8,8 @@ Material:
m_PrefabInternal: {fileID: 0} m_PrefabInternal: {fileID: 0}
m_Name: Ground m_Name: Ground
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: m_ShaderKeywords: _EMISSION
m_LightmapFlags: 4 m_LightmapFlags: 1
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: -1 m_CustomRenderQueue: -1
@ -72,5 +72,5 @@ Material:
- _UVSec: 0 - _UVSec: 0
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0.9019608} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

@ -41,7 +41,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 2800000, guid: f59ee687c02517e45819a3f0bcf97b7f, type: 3} m_Texture: {fileID: 2800000, guid: 6dc1e348a9a1d8340b408bdddc7a63f8, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MetallicGlossMap: - _MetallicGlossMap:
@ -64,7 +64,7 @@ Material:
- _CameraNearFadeDistance: 1 - _CameraNearFadeDistance: 1
- _ColorMode: 0 - _ColorMode: 0
- _Cull: 0 - _Cull: 0
- _Cutoff: 0.068 - _Cutoff: 0.5
- _DetailNormalMapScale: 1 - _DetailNormalMapScale: 1
- _DistortionBlend: 0.5 - _DistortionBlend: 0.5
- _DistortionEnabled: 0 - _DistortionEnabled: 0
@ -91,7 +91,7 @@ Material:
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0} - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 5.153, g: 5.153, b: 5.153, a: 1} - _Color: {r: 5.168, g: 5.168, b: 5.168, a: 1}
- _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0} - _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0.787, g: 0.787, b: 0.787, a: 1} - _EmissionColor: {r: 0.787, g: 0.787, b: 0.787, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}

@ -13,18 +13,18 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
numRate: 1 numRate: 1
movement: 1 movement: 1
geomSize: 0.037 geomSize: 0.2
velocityDamping: 1 velocityDamping: 0.95
lifeDuration: 0 lifeDuration: 7
lifeVariation: 0 lifeVariation: 0
convergence: 0.053 convergence: 0
homeStrength: 0.116 homeStrength: 0
noiseStrength: 0.126 noiseStrength: 0.037
noiseSeed: 0.5 noiseSeed: 0.5
noiseTimeScale: 1 noiseTimeScale: 1
noiseFrequency: 0.29 noiseFrequency: 0.29
forceDirection: {x: 0, y: -1, z: 0} forceDirection: {x: 0, y: -1, z: 0}
forceStrength: 0.015 forceStrength: 0.05
impulsePosition: {x: 0, y: 0, z: 0} impulsePosition: {x: 0, y: 0, z: 0}
impulseRadius: 3 impulseRadius: 3
impulseStrength: -1 impulseStrength: 1

@ -33,7 +33,7 @@ MonoBehaviour:
value: 1 value: 1
intensity: intensity:
overrideState: 1 overrideState: 1
value: 3 value: 1
threshold: threshold:
overrideState: 1 overrideState: 1
value: 1.1 value: 1.1

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6635fe3fb7aa6f747bbde014546ee9ad
folderAsset: yes
timeCreated: 1519889654
licenseType: Free
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -0,0 +1,115 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UltraCombos.Frozen
{
public class SnowflakeParticleUpdater : MonoBehaviour
{
public bool reset = false;
[Range(1, 1 << 20)]
public int maxParticles = 1 << 15;
public StructuredBuffer particleBuffer = null;
List<Particle> buffer_data = null;
public ComputeShader shader = null;
ComputeBuffer args_buffer = null;
public UniformStructuredBuffer uniformBuffer;
ParticleUniforms uniforms = null;
public Klak.Chromatics.CosineGradient cosineGradient = null;
bool is_initialized = false;
[SerializeField]
KinectOpticalFlow kinectOpticalFlow;
[SerializeField]
FluidSim3DProject.SmokeFluidSim smokeFluidSim;
[SerializeField]
string debug;
private void Start()
{
uniforms = uniformBuffer.uniform as ParticleUniforms;
StartCoroutine(Initialize());
}
private void FixedUpdate()
{
if (is_initialized == false)
return;
if (reset)
{
reset = false;
OnReset();
}
UpdateParticle(Time.fixedDeltaTime);
}
private void OnDestroy()
{
Utilities.Release(ref args_buffer);
}
private void OnReset()
{
particleBuffer.SetData(buffer_data);
}
private IEnumerator Initialize()
{
#if false
{
uint[] args = new uint[3] { (uint)Mathf.CeilToInt((float)maxHomes / WORK_GROUP_SIZE), 1, 1 };
home_args_buffer = new ComputeBuffer(1, args.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
home_args_buffer.SetData(args);
}
#endif
{
args_buffer = shader.CreateIndirectComputeArgsBuffer(maxParticles, 1, 1);
}
{
buffer_data = new List<Particle>();
yield return Utilities.GetRandomParticleData(maxParticles, buffer_data);
}
is_initialized = true;
OnReset();
}
private void UpdateParticle(float time_step)
{
{
shader.SetFloat("timeStep", time_step);
shader.SetFloat("timeValue", Utilities.GetTimeValue());
shader.SetInt("home_count", kinectOpticalFlow.HomeCount);
shader.SetFloat("bufferCount", particleBuffer.count);
if (cosineGradient != null)
{
shader.SetVector("coeffsA", cosineGradient.coeffsA);
shader.SetVector("coeffsB", cosineGradient.coeffsB);
shader.SetVector("coeffsC", cosineGradient.coeffsC2);
shader.SetVector("coeffsD", cosineGradient.coeffsD2);
}
shader.SetVector("FluidGridDim", smokeFluidSim.GridDim);
shader.SetVector("FluidGridRoot", smokeFluidSim.GridRoot);
shader.SetVector("FluidGridSize", smokeFluidSim.GridSize);
shader.SetBuffer(0, particleBuffer.bufferName, particleBuffer.obj);
shader.SetBuffer(0, uniformBuffer.bufferName, uniformBuffer.obj);
shader.SetBuffer(0, "home_position_buffer", kinectOpticalFlow.HomePositionBuffer);
shader.SetBuffer(0, "home_velocity_buffer", kinectOpticalFlow.HomeVelocityBuffer);
shader.SetBuffer(0, "fluid_velocity_buffer", smokeFluidSim.VelocityBuffer);
shader.DispatchIndirect(0, args_buffer);
}
}
}
}

@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 15ad9c9a8c81d2c4184b50d96a669c7d
timeCreated: 1519889674
licenseType: Free
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

@ -15,27 +15,31 @@ CBUFFER_START(Variables)
float3 coeffsB; float3 coeffsB;
float3 coeffsC; float3 coeffsC;
float3 coeffsD; float3 coeffsD;
float4 FluidGridDim;
float4 FluidGridRoot;
float4 FluidGridSize;
CBUFFER_END CBUFFER_END
RWStructuredBuffer<Particle> ssbo; RWStructuredBuffer<Particle> ssbo;
RWStructuredBuffer<ParticleUniforms> uniform_buffer; RWStructuredBuffer<ParticleUniforms> uniform_buffer;
RWStructuredBuffer<float4> home_buffer; RWStructuredBuffer<float4> home_position_buffer;
RWStructuredBuffer<float4> home_velocity_buffer; RWStructuredBuffer<float4> home_velocity_buffer;
RWStructuredBuffer<float3> fluid_velocity_buffer;
[numthreads(WORK_GROUP_SIZE, 1, 1)] [numthreads(WORK_GROUP_SIZE, 1, 1)]
void CSMain(uint3 id : SV_DispatchThreadID) void CSMain(uint3 id : SV_DispatchThreadID)
{ {
uint idx = id.x; uint idx = id.x;
Particle p = ssbo[idx]; Particle p = ssbo[idx];
float4 home = (home_count > 0) ? home_buffer[p.seed * home_count] : float4(0, 0, 0, 1); float4 home_position = (home_count > 0) ? home_position_buffer[p.seed * home_count] : float4(0, 0, 0, 1);
float4 home_velcity = (home_count > 0) ? home_velocity_buffer[p.seed * home_count] : float4(0, 0, 0, 1); float4 home_velocity = (home_count > 0) ? home_velocity_buffer[p.seed * home_count] : float4(0, 0, 0, 1);
ParticleUniforms uni = uniform_buffer[0]; ParticleUniforms uni = uniform_buffer[0];
float factor = p.color.a; float factor = p.color.a;
float3 acc = float3(0, 0, 0); float3 acc = float3(0, 0, 0);
float3 F = float3(0, 0, 0); float3 F = float3(0, 0, 0);
//if (lifeDuration > 0.1f) if (home_count > 0)
{ {
float duration = uni.lifeDuration * (1.0f + factor * uni.lifeVariation); float duration = uni.lifeDuration * (1.0f + factor * uni.lifeVariation);
float current_life = p.life * duration + timeStep; float current_life = p.life * duration + timeStep;
@ -50,9 +54,9 @@ void CSMain(uint3 id : SV_DispatchThreadID)
{ {
current_life -= duration; current_life -= duration;
//if (isEmit == 0 && current_life > 0.0) current_life -= duration; //if (isEmit == 0 && current_life > 0.0) current_life -= duration;
p.position = home.xyz; p.position = home_position.xyz;
p.color.rgb = float3(1, 1, 1); p.color.rgb = float3(1, 1, 1);
p.velocity = home_velcity.xyz * uni.forceStrength * 100.0f; p.velocity = home_velocity.xyz * 20.0f * pow(length(home_velocity.xyz), 2.0f);
//p.velocity = forceDirection * 3.0f; //p.velocity = forceDirection * 3.0f;
} }
p.life = current_life / duration; p.life = current_life / duration;
@ -94,10 +98,18 @@ void CSMain(uint3 id : SV_DispatchThreadID)
// impulse // impulse
{ {
F = uni.impulsePosition - p.position; //F = uni.impulsePosition - p.position;
float mag = F.x*F.x + F.y*F.y + F.z*F.z; //float mag = F.x*F.x + F.y*F.y + F.z*F.z;
float rad2 = uni.impulseRadius * uni.impulseRadius; //float rad2 = uni.impulseRadius * uni.impulseRadius;
acc += F * exp(-mag / rad2) * uni.impulseStrength; //acc += F * exp(-mag / rad2) * uni.impulseStrength;
}
// fluid
{
float3 dim = ((p.position - FluidGridRoot) / FluidGridSize) * FluidGridDim;
int idx = (int)dim.x + (int)dim.y * FluidGridDim.x + (int)dim.z * FluidGridDim.x * FluidGridDim.y;
float3 F = fluid_velocity_buffer[idx].xyz * 1.0f;
acc += F * uni.impulseStrength;
} }
// cosine gradient // cosine gradient
@ -148,7 +160,7 @@ void CSMain(uint3 id : SV_DispatchThreadID)
pos = p.position; pos = p.position;
if (pos.y < 0.0f) if (pos.y < 0.0f)
{ {
p.velocity.y = abs(p.velocity.y); p.velocity.y = abs(p.velocity.y) * 0.8f;
p.position.y = 0.0f; p.position.y = 0.0f;
} }
} }

@ -0,0 +1,87 @@
fileFormatVersion: 2
guid: 6dc1e348a9a1d8340b408bdddc7a63f8
timeCreated: 1519893270
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

@ -46,8 +46,13 @@ namespace UltraCombos
[SerializeField] [SerializeField]
string debugInfo; string debugInfo;
ComputeBuffer home_buffer; ComputeBuffer home_position_buffer;
int home_count; public ComputeBuffer HomePositionBuffer { get { return home_position_buffer; } }
ComputeBuffer home_velocity_buffer;
public ComputeBuffer HomeVelocityBuffer { get { return home_velocity_buffer; } }
ComputeBuffer count_buffer;
int home_count = 0;
public int HomeCount { get { return home_count; } }
private void Start() private void Start()
@ -64,7 +69,9 @@ namespace UltraCombos
} }
{ {
home_buffer = new ComputeBuffer(512 * 424, sizeof(float) * 4, ComputeBufferType.Append); home_position_buffer = new ComputeBuffer(512 * 424, sizeof(float) * 4, ComputeBufferType.Append);
home_velocity_buffer = new ComputeBuffer(512 * 424, sizeof(float) * 4, ComputeBufferType.Append);
count_buffer = new ComputeBuffer(1, sizeof(int), ComputeBufferType.Raw);
} }
} }
@ -72,15 +79,7 @@ namespace UltraCombos
{ {
if (args_buffer == null) if (args_buffer == null)
{ {
#if false
int work_group_size = 512;
int num_groups = (width * height + work_group_size - 1) / work_group_size;
uint[] args = new uint[3] { (uint)num_groups, 1, 1 };
args_buffer = new ComputeBuffer(1, args.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
args_buffer.SetData(args);
#else
args_buffer = updateShader.CreateIndirectComputeArgsBuffer(width * height, 1, 1); args_buffer = updateShader.CreateIndirectComputeArgsBuffer(width * height, 1, 1);
#endif
} }
// update // update
@ -105,21 +104,25 @@ namespace UltraCombos
foreach (var buf in kinectBuffers) foreach (var buf in kinectBuffers)
updateShader.SetBuffer(0, buf.bufferName, buf.obj); updateShader.SetBuffer(0, buf.bufferName, buf.obj);
updateShader.SetBuffer(0, "KinectGridBuffer", kinect_grid_buffer); updateShader.SetBuffer(0, "KinectGridBuffer", kinect_grid_buffer);
updateShader.SetBuffer(0, "HomePositionBuffer", home_position_buffer);
updateShader.SetBuffer(0, "HomeVelocityBuffer", home_velocity_buffer);
updateShader.DispatchIndirect(0, args_buffer); updateShader.DispatchIndirect(0, args_buffer);
} }
{
ComputeBuffer.CopyCount(home_position_buffer, count_buffer, 0);
var data = new int[count_buffer.count];
count_buffer.GetData(data);
home_count = data[0];
debugInfo = string.Format("{0}", home_count);
home_position_buffer.SetCounterValue(0);
home_velocity_buffer.SetCounterValue(0);
}
if (clear_grid_buffer_args_buffer == null) if (clear_grid_buffer_args_buffer == null)
{ {
#if false
uint work_group_size = 8;
Vector3 dim = fluidSimulation.GridDim;
uint[] args = new uint[3] { (uint)dim.x / work_group_size, (uint)dim.y / work_group_size, (uint)dim.z / work_group_size };
clear_grid_buffer_args_buffer = new ComputeBuffer(1, args.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
clear_grid_buffer_args_buffer.SetData(args);
#else
Vector3Int dim = Vector3Int.FloorToInt(fluidSimulation.GridDim); Vector3Int dim = Vector3Int.FloorToInt(fluidSimulation.GridDim);
clear_grid_buffer_args_buffer = applyShader.CreateIndirectComputeArgsBuffer(dim.x, dim.y, dim.z); clear_grid_buffer_args_buffer = applyShader.CreateIndirectComputeArgsBuffer(dim.x, dim.y, dim.z);
#endif
} }
{ {

@ -5,6 +5,9 @@ RWStructuredBuffer<float4> KinectPositionBuffer;
RWStructuredBuffer<float4> KinectVelocityBuffer; RWStructuredBuffer<float4> KinectVelocityBuffer;
RWStructuredBuffer<float4> KinectGridBuffer; RWStructuredBuffer<float4> KinectGridBuffer;
AppendStructuredBuffer<float4> HomePositionBuffer;
AppendStructuredBuffer<float4> HomeVelocityBuffer;
Texture2D<float4> PositionTexture; Texture2D<float4> PositionTexture;
Texture2D<float4> VelocityTexture; Texture2D<float4> VelocityTexture;
@ -47,24 +50,17 @@ void CSMain (uint3 id : SV_DispatchThreadID)
grid_index = (int)grid_pos.x + (int)grid_pos.y * FluidDim.x + (int)grid_pos.z * FluidDim.x * FluidDim.y; grid_index = (int)grid_pos.x + (int)grid_pos.y * FluidDim.x + (int)grid_pos.z * FluidDim.x * FluidDim.y;
KinectGridBuffer[grid_index] += float4(vel.xyz, 1); KinectGridBuffer[grid_index] += float4(vel.xyz, 1);
//const int layer = 0; if (pos_mag > 1.0f)
//for (int i = 0; i < layer; i++) {
//{ HomePositionBuffer.Append(float4(pos.xyz, 0));
// grid_index += FluidDim.x * FluidDim.y; HomeVelocityBuffer.Append(float4(vel.xyz, 0));
// KinectGridBuffer[grid_index] += float4(vel.xyz, 1); }
//}
///PositionBuffer.Append(float4(pos.xyz, grid_index));
///VelocityBuffer.Append(float4(vel.xyz, 0));
} }
KinectPositionBuffer[id.x] = float4(pos.xyz, grid_index); KinectPositionBuffer[id.x] = float4(pos.xyz, grid_index);
KinectVelocityBuffer[id.x] = float4((pos_mag == 0.0f) ? float3(0, 0, 0) : vel.xyz, 0); KinectVelocityBuffer[id.x] = float4((pos_mag == 0.0f) ? float3(0, 0, 0) : vel.xyz, 0);
//FullPositionBuffer[id.x] = float4(pos.xyz, grid_index);
//FullVelocityBuffer[id.x] = float4((pos_mag == 0.0f) ? float3(0, 0, 0) : vel.xyz, 0);
} }
//PositionBuffer.Append(float4(0, 0, 0, 1));
//Result[id.xy] = float4(id.x & id.y, (id.x & 15)/15.0, (id.y & 15)/15.0, 0.0);
} }

@ -4,4 +4,7 @@
EditorBuildSettings: EditorBuildSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Scenes: [] m_Scenes:
- enabled: 1
path: Assets/Frozen/Frozen.unity
guid: 34b4afb9026442541b75a5cc9009882b

@ -35,6 +35,8 @@ GraphicsSettings:
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: [] m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0} type: 0}

Loading…
Cancel
Save