├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── EditorBuildSettings.asset ├── NetworkManager.asset ├── TimeManager.asset ├── UnityAdsSettings.asset ├── AudioManager.asset ├── EditorSettings.asset ├── TagManager.asset ├── UnityConnectSettings.asset ├── DynamicsManager.asset ├── NavMeshAreas.asset ├── QualitySettings.asset ├── Physics2DSettings.asset ├── GraphicsSettings.asset └── InputManager.asset ├── KinoDatamosh.unitypackage ├── Assets ├── Test │ ├── Texture │ │ ├── UV Test.png │ │ ├── LowManOcclusion.tif │ │ ├── LowManOcclusion.tif.meta │ │ └── UV Test.png.meta │ ├── Model │ │ ├── MazeLowMan.fbx │ │ ├── Materials │ │ │ ├── MazeLowMan.mat.meta │ │ │ ├── MazeLowMan2.mat.meta │ │ │ ├── MazeLowMan.mat │ │ │ └── MazeLowMan2.mat │ │ └── Materials.meta │ ├── Box.prefab.meta │ ├── Karate.unity.meta │ ├── Material │ │ ├── Box.mat.meta │ │ ├── Skybox.mat.meta │ │ ├── UV Test.mat.meta │ │ ├── Default.physicMaterial.meta │ │ ├── Default.physicMaterial │ │ ├── UV Test.mat │ │ ├── Box.mat │ │ └── Skybox.mat │ ├── Animation │ │ ├── Karate.controller.meta │ │ ├── Karate2.controller.meta │ │ ├── Karate.controller │ │ └── Karate2.controller │ ├── Animation.meta │ ├── Material.meta │ ├── Model.meta │ ├── Texture.meta │ ├── Spawner.cs.meta │ ├── CameraSwitcher.cs.meta │ ├── CameraSwitcher.cs │ ├── Spawner.cs │ └── Box.prefab ├── sIBL Archive │ ├── 20_Subway_Lights_Env.hdr │ ├── Acknowledgement.txt.meta │ ├── Acknowledgement.txt │ └── 20_Subway_Lights_Env.hdr.meta ├── ColorSuite │ ├── Shader │ │ ├── ColorSuite.shader.meta │ │ └── ColorSuite.shader │ ├── Editor.meta │ ├── Shader.meta │ ├── Editor │ │ ├── ColorSuiteEditor.cs.meta │ │ └── ColorSuiteEditor.cs │ ├── ColorSuite.cs.meta │ └── ColorSuite.cs ├── CMU Mocap │ ├── Acknowledgement.txt.meta │ └── Acknowledgement.txt ├── Kino.meta ├── Klak.meta ├── Test.meta ├── CMU Mocap.meta ├── Editor.meta ├── Klak │ ├── Math.meta │ ├── Editor.meta │ ├── Extension.meta │ ├── Motion.meta │ ├── Math │ │ ├── Editor.meta │ │ ├── Tween.cs.meta │ │ ├── BasicMath.cs.meta │ │ ├── Interpolator.cs.meta │ │ ├── Editor │ │ │ ├── InterpolatorConfigDrawer.cs.meta │ │ │ └── InterpolatorConfigDrawer.cs │ │ ├── BasicMath.cs │ │ ├── Interpolator.cs │ │ └── Tween.cs │ ├── Motion │ │ ├── Editor.meta │ │ ├── SmoothFollow.cs.meta │ │ ├── Editor │ │ │ ├── SmoothFollowEditor.cs.meta │ │ │ └── SmoothFollowEditor.cs │ │ └── SmoothFollow.cs │ ├── Editor │ │ ├── GUIHelper.cs.meta │ │ ├── ImageSequenceWindow.cs.meta │ │ ├── GUIHelper.cs │ │ └── ImageSequenceWindow.cs │ └── Extension │ │ ├── VectorMathExtension.cs.meta │ │ └── VectorMathExtension.cs ├── ColorSuite.meta ├── Kino Imported.meta ├── Kino │ ├── Datamosh.meta │ └── Datamosh │ │ ├── Editor.meta │ │ ├── Shader.meta │ │ ├── Shader │ │ ├── Datamosh.shader.meta │ │ └── Datamosh.shader │ │ ├── Editor │ │ ├── DatamoshEditor.cs.meta │ │ └── DatamoshEditor.cs │ │ ├── Datamosh.cs.meta │ │ └── Datamosh.cs ├── sIBL Archive.meta ├── Kino Imported │ ├── Obscurance.meta │ ├── Vignette.meta │ ├── Vignette │ │ ├── Editor.meta │ │ ├── Shader.meta │ │ ├── Shader │ │ │ ├── Vignette.shader.meta │ │ │ └── Vignette.shader │ │ ├── Editor │ │ │ ├── VignetteEditor.cs.meta │ │ │ └── VignetteEditor.cs │ │ ├── Vignette.cs.meta │ │ └── Vignette.cs │ └── Obscurance │ │ ├── Editor.meta │ │ ├── Script.meta │ │ ├── Shader.meta │ │ ├── Shader │ │ ├── Obscurance.cginc.meta │ │ ├── Obscurance.shader.meta │ │ ├── Obscurance.shader │ │ └── Obscurance.cginc │ │ ├── Editor │ │ ├── ObscuranceEditor.cs.meta │ │ └── ObscuranceEditor.cs │ │ ├── Script │ │ ├── PropertyObserver.cs.meta │ │ └── PropertyObserver.cs │ │ ├── Obscurance.cs.meta │ │ └── Obscurance.cs └── Editor │ ├── PackageTool.cs │ └── PackageTool.cs.meta ├── .gitattributes ├── .gitignore ├── LICENSE └── README.md /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.4.0b20 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /KinoDatamosh.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KinoDatamosh/HEAD/KinoDatamosh.unitypackage -------------------------------------------------------------------------------- /Assets/Test/Texture/UV Test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KinoDatamosh/HEAD/Assets/Test/Texture/UV Test.png -------------------------------------------------------------------------------- /Assets/Test/Model/MazeLowMan.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KinoDatamosh/HEAD/Assets/Test/Model/MazeLowMan.fbx -------------------------------------------------------------------------------- /Assets/Test/Texture/LowManOcclusion.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KinoDatamosh/HEAD/Assets/Test/Texture/LowManOcclusion.tif -------------------------------------------------------------------------------- /Assets/sIBL Archive/20_Subway_Lights_Env.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KinoDatamosh/HEAD/Assets/sIBL Archive/20_Subway_Lights_Env.hdr -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Shader/ColorSuite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc9775b65c52747e69fc4c854c00d696 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.016666668 7 | Maximum Allowed Timestep: 1 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /Assets/Test/Box.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92c1fe11845d34dbfbbecccd2ac1cf64 3 | timeCreated: 1465033166 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Karate.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4b8c9396191b4bcda0efaba7519bf7b 3 | timeCreated: 1463895342 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Material/Box.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5f24d4af4db24ffe9fd0cecc19e2db6 3 | timeCreated: 1465032352 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Material/Skybox.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 31de36dd7a8fc804e9103ee64eb3a25c 3 | timeCreated: 1463725466 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Material/UV Test.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a7c1a187c7d9dff42912cda56aecb26b 3 | timeCreated: 1463725529 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CMU Mocap/Acknowledgement.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 256db47c217b946e7bc54577f52b732e 3 | timeCreated: 1463907917 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Kino.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96d6f0c23b5b349a39907f19574573ef 3 | folderAsset: yes 4 | timeCreated: 1435811145 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Klak.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d80c83752a75c40649d0a3c49a424bd4 3 | folderAsset: yes 4 | timeCreated: 1452473625 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db3d2236a40093649a5ece79621b9963 3 | folderAsset: yes 4 | timeCreated: 1463725521 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/sIBL Archive/Acknowledgement.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60bb4480dbb174616bc9731e372b3406 3 | timeCreated: 1436690642 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CMU Mocap.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1162bd25c17a34ba09c4aa3987539772 3 | folderAsset: yes 4 | timeCreated: 1463907138 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0c5d47da68494d18b85891c89c243c3 3 | folderAsset: yes 4 | timeCreated: 1445739329 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Klak/Math.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb9dc05a19a2fad4caf8b1a87a2c484c 3 | folderAsset: yes 4 | timeCreated: 1452843589 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test/Animation/Karate.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13e8f86203d9f42d99d25886e9ec39f0 3 | timeCreated: 1463895409 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Animation/Karate2.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eeabd757be28f479fbbcbb526e8b34ed 3 | timeCreated: 1463897264 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ColorSuite.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d68d0d387bdc3647bbfbde848b4a3e7 3 | folderAsset: yes 4 | timeCreated: 1463727926 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 885b57c46ac1b41bd914befec266050d 3 | folderAsset: yes 4 | timeCreated: 1463714353 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33b7ee32b891649c9b34592a2f9518b9 3 | folderAsset: yes 4 | timeCreated: 1463486730 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Klak/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0965c0a5f97c14e31a16959dd1103305 3 | folderAsset: yes 4 | timeCreated: 1452484574 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Klak/Extension.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af303efbcda15c14abef72a3a904c771 3 | folderAsset: yes 4 | timeCreated: 1452843633 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Klak/Motion.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b04e253fd90e09646b7032c3100d8444 3 | folderAsset: yes 4 | timeCreated: 1452843621 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test/Animation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad9b02fff8d94464a8504746d4c9b006 3 | folderAsset: yes 4 | timeCreated: 1463728382 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test/Material.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9de3a98b354eaad4ca34c0e3524b99f5 3 | folderAsset: yes 4 | timeCreated: 1463728403 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test/Material/Default.physicMaterial.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49cb04b59209140ab87cba7e56b178e1 3 | timeCreated: 1465032513 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0119c6ecb19c50d4abd67d7fcca5f495 3 | folderAsset: yes 4 | timeCreated: 1463728387 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test/Model/Materials/MazeLowMan.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2e9cf99df2f91544a4c0d62fb55273c 3 | timeCreated: 1440254876 4 | licenseType: Store 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Model/Materials/MazeLowMan2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64176aba50bc6402c8fd96e1454ffc6e 3 | timeCreated: 1463897321 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Texture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6629655ada3ae6c4497f7fbce0335582 3 | folderAsset: yes 4 | timeCreated: 1463728394 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/sIBL Archive.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a96824f9803d243a38d56bc8eafbf755 3 | folderAsset: yes 4 | timeCreated: 1436690172 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3d58d1e162661ce45aad90c718879ece 3 | folderAsset: yes 4 | timeCreated: 1463727926 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b12eef35d3bfdd14f9e5300e1cc1db33 3 | folderAsset: yes 4 | timeCreated: 1463727926 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Klak/Math/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd47a5ebc73153e49b3e170cb40b85e3 3 | folderAsset: yes 4 | timeCreated: 1452853831 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Klak/Motion/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f2b8436fbb9bd045ab8bdccf8490ae1 3 | folderAsset: yes 4 | timeCreated: 1452853741 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7dae4842a870747de9617b3c18ba916e 3 | folderAsset: yes 4 | timeCreated: 1455515606 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d43a8ab8eb36c346bdf5c760580b019 3 | folderAsset: yes 4 | timeCreated: 1439534051 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 697d6445d1d644b80a2a33f719a81a0c 3 | folderAsset: yes 4 | timeCreated: 1463843600 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a84a8e36dc3847148680b51e5506967 3 | folderAsset: yes 4 | timeCreated: 1463486750 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test/Model/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42519b2745d2b71469d9d12e85b76520 3 | folderAsset: yes 4 | timeCreated: 1463728551 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/sIBL Archive/Acknowledgement.txt: -------------------------------------------------------------------------------- 1 | The HDR images in this directory are provided from sIBL Archive under the 2 | Creative Commons license (CC BY-NC-SA 3.0 US). Please see the page below for 3 | further details. 4 | 5 | http://www.hdrlabs.com/sibl/archive.html 6 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ad044d970086bc48b37420227aaa504 3 | folderAsset: yes 4 | timeCreated: 1439538202 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8e0d748f5d5fd8479f21c06cddbc912 3 | folderAsset: yes 4 | timeCreated: 1439534088 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5dce06de9574c40f782c3cdb4218f34e 3 | folderAsset: yes 4 | timeCreated: 1455515624 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Script.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7dde330d3542e44209291a0fb4cf460e 3 | folderAsset: yes 4 | timeCreated: 1456726545 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f6dbe2cc8ffe4604a9b907745b92da2 3 | folderAsset: yes 4 | timeCreated: 1455515619 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Shader/Datamosh.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 998cec7a45d274e3995fbccf2c4480bf 3 | timeCreated: 1463486684 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Shader/Vignette.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89a223cbeee1935419811f8736c0a9b3 3 | timeCreated: 1439534076 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Shader/Obscurance.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53ad5775ae0684d458bfbf2674b495e0 3 | timeCreated: 1463548334 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Shader/Obscurance.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7541b5f18b1224a81927d8b1184b122b 3 | timeCreated: 1455515931 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!292 &1 4 | UnityAdsSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_InitializeOnStartup: 1 8 | m_TestMode: 0 9 | m_EnabledPlatforms: 4294967295 10 | m_IosGameId: 11 | m_AndroidGameId: 12 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Editor/ColorSuiteEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f328b8677255d426a999185016ef88f2 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Editor/PackageTool.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | public class PackageTool 5 | { 6 | [MenuItem("Package/Update Package")] 7 | static void UpdatePackage() 8 | { 9 | AssetDatabase.ExportPackage("Assets/Kino", "KinoDatamosh.unitypackage", ExportPackageOptions.Recurse); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets/Klak/Math/Tween.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8d594ef0c2194bfcbb842c19f8df85d 3 | timeCreated: 1452474839 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Test/Spawner.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44ebf76b4133b49679daa0c5ac31b5c6 3 | timeCreated: 1465032913 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Editor/PackageTool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edd21b9740bd8482e9f2ed8da870d0e1 3 | timeCreated: 1445739337 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Math/BasicMath.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a93c590d9dab4415eadb92e108635e30 3 | timeCreated: 1453562143 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Test/CameraSwitcher.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab600dda86fac4c4db0fb7275fc9ed9e 3 | timeCreated: 1463905666 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Editor/GUIHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 419a4d015120b054b8e817a78d3e4712 3 | timeCreated: 1452781280 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Math/Interpolator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a20dd3f543e39e84583729e6e93c2911 3 | timeCreated: 1452744639 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Motion/SmoothFollow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e04f5e50cd25d4df6ad5fe43d1f88cca 3 | timeCreated: 1452473647 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Editor/DatamoshEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb7881a14b4c94d52b2e5e77821e6c90 3 | timeCreated: 1463843675 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Editor/ImageSequenceWindow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fb3fa56e3b2454553aef859ff356d123 3 | timeCreated: 1452500661 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Extension/VectorMathExtension.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b10930df277854f43b411412e91f9bf3 3 | timeCreated: 1452477818 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Motion/Editor/SmoothFollowEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3975fff25a95a4a7cb28c27879976139 3 | timeCreated: 1452484574 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Editor/VignetteEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01095d10408c28d429dcdb7841e375a5 3 | timeCreated: 1439538208 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Klak/Math/Editor/InterpolatorConfigDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb737738c6d26ed4891ed48e364e1041 3 | timeCreated: 1452747941 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/CMU Mocap/Acknowledgement.txt: -------------------------------------------------------------------------------- 1 | The motion-captured animation data in this directory is originally created by 2 | Carnegie Mellon University Graphics Lab. 3 | 4 | http://mocap.cs.cmu.edu 5 | 6 | cMonkeys converted these mocap data into FBX files for ease of importing into 7 | Unity. These FBX files are distributed on Unity Asset Store. 8 | 9 | http://u3d.as/8An 10 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Editor/ObscuranceEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4c34df7fb8f94f15bbe24c63dbe9df0 3 | timeCreated: 1455515930 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Script/PropertyObserver.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 150e73556e4cb49d7b7b6a41ada61e06 3 | timeCreated: 1456723172 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/ColorSuite/ColorSuite.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 10593b7d510b64560a297a8af1356dcb 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: dc9775b65c52747e69fc4c854c00d696, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Test/Material/Default.physicMaterial: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!134 &13400000 4 | PhysicMaterial: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: Default 9 | dynamicFriction: 0.6 10 | staticFriction: 0.6 11 | bounciness: 0.95 12 | frictionCombine: 0 13 | bounceCombine: 0 14 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Datamosh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cdbbfa0d5bee14ea1bb3a8762969e899 3 | timeCreated: 1463486917 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 998cec7a45d274e3995fbccf2c4480bf, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Vignette.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fc18a55c333d51489e5ee49b3cbff50 3 | timeCreated: 1439534795 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 89a223cbeee1935419811f8736c0a9b3, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Obscurance.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d901ddf32d7c84ed4b0f84623ef3a7a0 3 | timeCreated: 1456469754 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _aoShader: {fileID: 4800000, guid: 7541b5f18b1224a81927d8b1184b122b, type: 3} 9 | - _quadMesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_WebSecurityEmulationEnabled: 0 10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d 11 | m_DefaultBehaviorMode: 0 12 | m_SpritePackerMode: 2 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | CrashReportingSettings: 11 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 12 | m_Enabled: 0 13 | UnityPurchasingSettings: 14 | m_Enabled: 0 15 | m_TestMode: 0 16 | UnityAnalyticsSettings: 17 | m_Enabled: 0 18 | m_InitializeOnStartup: 1 19 | m_TestMode: 0 20 | m_TestEventUrl: 21 | m_TestConfigUrl: 22 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 13400000, guid: 49cb04b59209140ab87cba7e56b178e1, type: 2} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_SolverIterationCount: 6 13 | m_SolverVelocityIterations: 1 14 | m_QueriesHitTriggers: 1 15 | m_EnableAdaptiveForce: 0 16 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 17 | -------------------------------------------------------------------------------- /Assets/Test/CameraSwitcher.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | public class CameraSwitcher : MonoBehaviour 5 | { 6 | [SerializeField] Transform[] _targetList; 7 | [SerializeField] float _interval = 3.0f; 8 | 9 | float Interval { 10 | get { return Mathf.Max(1.0f / 30, _interval); } 11 | } 12 | 13 | int _targetIndex; 14 | 15 | IEnumerator Start() 16 | { 17 | while (true) 18 | { 19 | yield return new WaitForSeconds(Interval); 20 | SwitchCamera(); 21 | KickGlitch(); 22 | } 23 | } 24 | 25 | void SwitchCamera() 26 | { 27 | _targetIndex = (_targetIndex + 1) % _targetList.Length; 28 | 29 | var follow = GetComponent(); 30 | follow.target = _targetList[_targetIndex]; 31 | follow.Snap(); 32 | 33 | transform.localRotation = Quaternion.Euler( 34 | Random.Range(-20.0f, 20.0f), 35 | Random.Range(-180.0f, 180.0f), 36 | Random.Range(-30.0f, 30.0f) 37 | ); 38 | } 39 | 40 | void KickGlitch() 41 | { 42 | FindObjectOfType().Glitch(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshAreas: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | 6 | # Autogenerated VS/MD solution and project files 7 | *.csproj 8 | *.unityproj 9 | *.sln 10 | *.suo 11 | *.tmp 12 | *.user 13 | *.userprefs 14 | *.pidb 15 | *.booproj 16 | 17 | # Unity3D generated meta files 18 | *.pidb.meta 19 | 20 | # Unity3D Generated File On Crash Reports 21 | sysinfo.txt 22 | 23 | # ========================= 24 | # Operating System Files 25 | # ========================= 26 | 27 | # OSX 28 | # ========================= 29 | 30 | .DS_Store 31 | .AppleDouble 32 | .LSOverride 33 | 34 | # Thumbnails 35 | ._* 36 | 37 | # Files that might appear in the root of a volume 38 | .DocumentRevisions-V100 39 | .fseventsd 40 | .Spotlight-V100 41 | .TemporaryItems 42 | .Trashes 43 | .VolumeIcon.icns 44 | 45 | # Directories potentially created on remote AFP share 46 | .AppleDB 47 | .AppleDesktop 48 | Network Trash Folder 49 | Temporary Items 50 | .apdisk 51 | 52 | # Windows 53 | # ========================= 54 | 55 | # Windows image file caches 56 | Thumbs.db 57 | ehthumbs.db 58 | 59 | # Folder config file 60 | Desktop.ini 61 | 62 | # Recycle Bin used on file shares 63 | $RECYCLE.BIN/ 64 | 65 | # Windows Installer files 66 | *.cab 67 | *.msi 68 | *.msm 69 | *.msp 70 | 71 | # Windows shortcuts 72 | *.lnk 73 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Kino/Datamosh 2 | ============= 3 | 4 | *Datamosh* is a post-processing effect that simulates [video compression 5 | artifacts][Wikipedia], specifically one called [datamoshing][KnowYourMeme]. 6 | 7 | ![Gif][Gif1] 8 | ![Gif][Gif2] 9 | 10 | *Datamosh* is part of the *Kino* effect suite. See the [GitHub repositories] 11 | [Kino] for other effects included in the suite. 12 | 13 | System Requirements 14 | ------------------- 15 | 16 | - Unity 5.4 or later versions 17 | 18 | *Datamosh* requires [motion vectors][MotionVectors] that is newly introduced in 19 | Unity 5.4. Motion vector rendering is only supported on the platforms that has 20 | RGHalf texture format support. This requirement must be met in most of the 21 | desktop/console platforms, but rarely supported in the mobile platforms. 22 | 23 | [Wikipedia]: https://en.wikipedia.org/wiki/Compression_artifact 24 | [KnowYourMeme]: http://knowyourmeme.com/memes/datamoshing 25 | [Gif1]: https://66.media.tumblr.com/6bf2ae7d3af6d38a61f1c57ca86556aa/tumblr_o8azn6iSbB1qio469o1_400.gif 26 | [Gif2]: https://67.media.tumblr.com/60652235832a915be25bb32979c13f09/tumblr_o8azn6iSbB1qio469o2_400.gif 27 | [Kino]: https://github.com/search?q=kino+user%3Akeijiro&type=Repositories 28 | [MotionVectors]: http://docs.unity3d.com/540/Documentation/ScriptReference/DepthTextureMode.MotionVectors.html 29 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 0 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Good 11 | pixelLightCount: 2 12 | shadows: 2 13 | shadowResolution: 1 14 | shadowProjection: 1 15 | shadowCascades: 2 16 | shadowDistance: 10 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 2 21 | textureQuality: 0 22 | anisotropicTextures: 1 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 1 26 | realtimeReflectionProbes: 1 27 | billboardsFaceCameraPosition: 1 28 | vSyncCount: 1 29 | lodBias: 1 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 256 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | m_PerPlatformDefaultQuality: 36 | Android: 0 37 | Nintendo 3DS: 0 38 | PS3: 0 39 | PS4: 0 40 | PSM: 0 41 | PSP2: 0 42 | Samsung TV: 0 43 | Standalone: 0 44 | Tizen: 0 45 | Web: 0 46 | WebGL: 0 47 | WiiU: 0 48 | Windows Store Apps: 0 49 | XBOX360: 0 50 | XboxOne: 0 51 | iPhone: 0 52 | tvOS: 0 53 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ContactArrowScale: 0.2 29 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 30 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 31 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 32 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 33 | -------------------------------------------------------------------------------- /Assets/Test/Texture/LowManOcclusion.tif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2db9b49529685fe43bd5a18a16c1511d 3 | timeCreated: 1443706821 4 | licenseType: Store 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | spriteMode: 0 41 | spriteExtrude: 1 42 | spriteMeshType: 1 43 | alignment: 0 44 | spritePivot: {x: .5, y: .5} 45 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 46 | spritePixelsToUnits: 100 47 | alphaIsTransparency: 0 48 | textureType: -1 49 | buildTargetSettings: [] 50 | spriteSheet: 51 | sprites: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Test/Texture/UV Test.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8560d420cafabc24a96f9719e811b213 3 | timeCreated: 1453256715 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: 2 33 | aniso: 3 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: .5, y: .5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 0 49 | textureType: -1 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /Assets/sIBL Archive/20_Subway_Lights_Env.hdr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1369ccb1c34454cc2967c59f41afb9ca 3 | timeCreated: 1463897715 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: 7 | 8900000: generatedCubemap 8 | serializedVersion: 2 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | linearTexture: 0 13 | correctGamma: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | cubemapConvolutionSteps: 7 28 | cubemapConvolutionExponent: 1.5 29 | seamlessCubemap: 0 30 | textureFormat: -3 31 | maxTextureSize: 2048 32 | textureSettings: 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapMode: 1 37 | nPOTScale: 1 38 | lightmap: 0 39 | rGBM: 0 40 | compressionQuality: 50 41 | allowsAlphaSplitting: 0 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: 0.5, y: 0.5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaIsTransparency: 0 50 | spriteTessellationDetail: -1 51 | textureType: 3 52 | buildTargetSettings: [] 53 | spriteSheet: 54 | sprites: [] 55 | outline: [] 56 | spritePackingTag: 57 | userData: 58 | assetBundleName: 59 | assetBundleVariant: 60 | -------------------------------------------------------------------------------- /Assets/Test/Spawner.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | 5 | public class Spawner : MonoBehaviour 6 | { 7 | [SerializeField] GameObject _prefab; 8 | [SerializeField] int _instanceCount = 10; 9 | [SerializeField] float _interval = 0.5f; 10 | [SerializeField] float _velocity = 5; 11 | [SerializeField] Bounds _range = new Bounds(Vector3.zero, Vector3.one); 12 | 13 | IEnumerator Start() 14 | { 15 | var queue = new Queue(); 16 | 17 | while (true) 18 | { 19 | while (queue.Count >= _instanceCount) 20 | Destroy(queue.Dequeue()); 21 | 22 | queue.Enqueue(Spawn()); 23 | 24 | yield return new WaitForSeconds(_interval); 25 | } 26 | } 27 | 28 | GameObject Spawn() 29 | { 30 | var pos = new Vector3(Random.value, Random.value, Random.value); 31 | 32 | pos = Vector3.Scale((pos - Vector3.one * 0.5f), _range.size); 33 | pos += Vector3.Scale(Vector3.one, _range.center); 34 | 35 | pos = transform.TransformPoint(pos); 36 | 37 | var go = (GameObject)Instantiate(_prefab, pos, Random.rotation); 38 | 39 | var rb = go.GetComponent(); 40 | rb.velocity = Random.insideUnitSphere * _velocity; 41 | 42 | return go; 43 | } 44 | 45 | void OnDrawGizmos() 46 | { 47 | Gizmos.color = Color.yellow; 48 | Gizmos.matrix = transform.localToWorldMatrix; 49 | Gizmos.DrawWireCube(_range.center, _range.size); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Assets/Klak/Editor/GUIHelper.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEditor; 26 | 27 | namespace Klak 28 | { 29 | public static class GUIHelper 30 | { 31 | public static void ShowInputValueNote() 32 | { 33 | EditorGUILayout.HelpBox( 34 | "Receives float values from the inputValue property.", 35 | MessageType.None); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Assets/Klak/Math/BasicMath.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | 26 | namespace Klak.Math 27 | { 28 | static class BasicMath 29 | { 30 | public static float Lerp(float a, float b, float mix) 31 | { 32 | return a * (1 - mix) + b * mix; 33 | } 34 | public static Vector3 Lerp(Vector3 a, Vector3 b, float mix) 35 | { 36 | return a * (1 - mix) + b * mix; 37 | } 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Editor/VignetteEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoVignette - Natural vignetting effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | using UnityEditor; 25 | 26 | namespace Kino 27 | { 28 | [CanEditMultipleObjects] 29 | [CustomEditor(typeof(Vignette))] 30 | public class VignetteEditor : Editor 31 | { 32 | SerializedProperty _falloff; 33 | 34 | void OnEnable() 35 | { 36 | _falloff = serializedObject.FindProperty("_falloff"); 37 | } 38 | 39 | public override void OnInspectorGUI() 40 | { 41 | serializedObject.Update(); 42 | 43 | EditorGUILayout.PropertyField(_falloff); 44 | 45 | serializedObject.ApplyModifiedProperties(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/Klak/Extension/VectorMathExtension.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | 26 | namespace Klak.VectorMathExtension 27 | { 28 | /// Extension methods for Vector4 29 | static class Vector4Extension 30 | { 31 | public static Quaternion ToQuaternion(this Vector4 v) 32 | { 33 | return new Quaternion(v.x, v.y, v.z, v.w); 34 | } 35 | 36 | public static Quaternion ToNormalizedQuaternion(this Vector4 v) 37 | { 38 | v = Vector4.Normalize(v); 39 | return new Quaternion(v.x, v.y, v.z, v.w); 40 | } 41 | } 42 | 43 | /// Extension methods for Quaternion 44 | static class QuaternionExtension 45 | { 46 | public static Vector4 ToVector4(this Quaternion q) 47 | { 48 | return new Vector4(q.x, q.y, q.z, q.w); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Assets/Test/Animation/Karate.controller: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!91 &9100000 4 | AnimatorController: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: Karate 9 | serializedVersion: 5 10 | m_AnimatorParameters: [] 11 | m_AnimatorLayers: 12 | - serializedVersion: 5 13 | m_Name: Base Layer 14 | m_StateMachine: {fileID: 1107000010473707886} 15 | m_Mask: {fileID: 0} 16 | m_Motions: [] 17 | m_Behaviours: [] 18 | m_BlendingMode: 0 19 | m_SyncedLayerIndex: -1 20 | m_DefaultWeight: 0 21 | m_IKPass: 0 22 | m_SyncedLayerAffectsTiming: 0 23 | m_Controller: {fileID: 9100000} 24 | --- !u!1102 &1102000012988485426 25 | AnimatorState: 26 | serializedVersion: 5 27 | m_ObjectHideFlags: 1 28 | m_PrefabParentObject: {fileID: 0} 29 | m_PrefabInternal: {fileID: 0} 30 | m_Name: 135_01 31 | m_Speed: 1.2 32 | m_CycleOffset: 0 33 | m_Transitions: [] 34 | m_StateMachineBehaviours: [] 35 | m_Position: {x: 50, y: 50, z: 0} 36 | m_IKOnFeet: 1 37 | m_WriteDefaultValues: 1 38 | m_Mirror: 0 39 | m_SpeedParameterActive: 0 40 | m_MirrorParameterActive: 0 41 | m_CycleOffsetParameterActive: 0 42 | m_Motion: {fileID: 7400000, guid: c5ecb056713efd14db83b1315790ec0a, type: 3} 43 | m_Tag: 44 | m_SpeedParameter: 45 | m_MirrorParameter: 46 | m_CycleOffsetParameter: 47 | --- !u!1107 &1107000010473707886 48 | AnimatorStateMachine: 49 | serializedVersion: 5 50 | m_ObjectHideFlags: 1 51 | m_PrefabParentObject: {fileID: 0} 52 | m_PrefabInternal: {fileID: 0} 53 | m_Name: Base Layer 54 | m_ChildStates: 55 | - serializedVersion: 1 56 | m_State: {fileID: 1102000012988485426} 57 | m_Position: {x: 24, y: 192, z: 0} 58 | m_ChildStateMachines: [] 59 | m_AnyStateTransitions: [] 60 | m_EntryTransitions: [] 61 | m_StateMachineTransitions: {} 62 | m_StateMachineBehaviours: [] 63 | m_AnyStatePosition: {x: 50, y: 20, z: 0} 64 | m_EntryPosition: {x: 50, y: 120, z: 0} 65 | m_ExitPosition: {x: 800, y: 120, z: 0} 66 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} 67 | m_DefaultState: {fileID: 1102000012988485426} 68 | -------------------------------------------------------------------------------- /Assets/Test/Animation/Karate2.controller: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!91 &9100000 4 | AnimatorController: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: Karate2 9 | serializedVersion: 5 10 | m_AnimatorParameters: [] 11 | m_AnimatorLayers: 12 | - serializedVersion: 5 13 | m_Name: Base Layer 14 | m_StateMachine: {fileID: 1107000010473707886} 15 | m_Mask: {fileID: 0} 16 | m_Motions: [] 17 | m_Behaviours: [] 18 | m_BlendingMode: 0 19 | m_SyncedLayerIndex: -1 20 | m_DefaultWeight: 0 21 | m_IKPass: 0 22 | m_SyncedLayerAffectsTiming: 0 23 | m_Controller: {fileID: 9100000} 24 | --- !u!1102 &1102000012988485426 25 | AnimatorState: 26 | serializedVersion: 5 27 | m_ObjectHideFlags: 1 28 | m_PrefabParentObject: {fileID: 0} 29 | m_PrefabInternal: {fileID: 0} 30 | m_Name: 135_01 31 | m_Speed: 1.5 32 | m_CycleOffset: 0 33 | m_Transitions: [] 34 | m_StateMachineBehaviours: [] 35 | m_Position: {x: 50, y: 50, z: 0} 36 | m_IKOnFeet: 1 37 | m_WriteDefaultValues: 1 38 | m_Mirror: 0 39 | m_SpeedParameterActive: 0 40 | m_MirrorParameterActive: 0 41 | m_CycleOffsetParameterActive: 0 42 | m_Motion: {fileID: 7400000, guid: c5ecb056713efd14db83b1315790ec0a, type: 3} 43 | m_Tag: 44 | m_SpeedParameter: 45 | m_MirrorParameter: 46 | m_CycleOffsetParameter: 47 | --- !u!1107 &1107000010473707886 48 | AnimatorStateMachine: 49 | serializedVersion: 5 50 | m_ObjectHideFlags: 1 51 | m_PrefabParentObject: {fileID: 0} 52 | m_PrefabInternal: {fileID: 0} 53 | m_Name: Base Layer 54 | m_ChildStates: 55 | - serializedVersion: 1 56 | m_State: {fileID: 1102000012988485426} 57 | m_Position: {x: 24, y: 192, z: 0} 58 | m_ChildStateMachines: [] 59 | m_AnyStateTransitions: [] 60 | m_EntryTransitions: [] 61 | m_StateMachineTransitions: {} 62 | m_StateMachineBehaviours: [] 63 | m_AnyStatePosition: {x: 50, y: 20, z: 0} 64 | m_EntryPosition: {x: 50, y: 120, z: 0} 65 | m_ExitPosition: {x: 800, y: 120, z: 0} 66 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} 67 | m_DefaultState: {fileID: 1102000012988485426} 68 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Shader/Vignette.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoVignette - Natural vignetting effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | Shader "Hidden/Kino/Vignette" 24 | { 25 | Properties 26 | { 27 | _MainTex ("-", 2D) = "" {} 28 | } 29 | 30 | CGINCLUDE 31 | 32 | #include "UnityCG.cginc" 33 | 34 | sampler2D _MainTex; 35 | float2 _Aspect; 36 | float _Falloff; 37 | 38 | half4 frag(v2f_img i) : SV_Target 39 | { 40 | float2 coord = (i.uv - 0.5) * _Aspect * 2; 41 | float rf = sqrt(dot(coord, coord)) * _Falloff; 42 | float rf2_1 = rf * rf + 1.0; 43 | float e = 1.0 / (rf2_1 * rf2_1); 44 | 45 | half4 src = tex2D(_MainTex, i.uv); 46 | return half4(src.rgb * e, src.a); 47 | } 48 | 49 | ENDCG 50 | 51 | SubShader 52 | { 53 | Pass 54 | { 55 | ZTest Always Cull Off ZWrite Off 56 | CGPROGRAM 57 | #pragma vertex vert_img 58 | #pragma fragment frag 59 | ENDCG 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 7 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_ShaderSettings_Tier1: 40 | useCascadedShadowMaps: 1 41 | useSinglePassStereoRendering: 0 42 | standardShaderQuality: 2 43 | useReflectionProbeBoxProjection: 1 44 | useReflectionProbeBlending: 1 45 | m_ShaderSettings_Tier2: 46 | useCascadedShadowMaps: 1 47 | useSinglePassStereoRendering: 0 48 | standardShaderQuality: 2 49 | useReflectionProbeBoxProjection: 1 50 | useReflectionProbeBlending: 1 51 | m_ShaderSettings_Tier3: 52 | useCascadedShadowMaps: 1 53 | useSinglePassStereoRendering: 0 54 | standardShaderQuality: 2 55 | useReflectionProbeBoxProjection: 1 56 | useReflectionProbeBlending: 1 57 | m_BuildTargetShaderSettings: [] 58 | m_LightmapStripping: 0 59 | m_FogStripping: 0 60 | m_LightmapKeepPlain: 1 61 | m_LightmapKeepDirCombined: 1 62 | m_LightmapKeepDirSeparate: 1 63 | m_LightmapKeepDynamicPlain: 1 64 | m_LightmapKeepDynamicDirCombined: 1 65 | m_LightmapKeepDynamicDirSeparate: 1 66 | m_FogKeepLinear: 1 67 | m_FogKeepExp: 1 68 | m_FogKeepExp2: 1 69 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Vignette/Vignette.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoVignette - Natural vignetting effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | 25 | namespace Kino 26 | { 27 | [ExecuteInEditMode] 28 | [RequireComponent(typeof(Camera))] 29 | [AddComponentMenu("Kino Image Effects/Vignette")] 30 | public class Vignette : MonoBehaviour 31 | { 32 | #region Public Properties 33 | 34 | // Natural vignetting falloff 35 | [SerializeField, Range(0.0f, 1.0f)] 36 | float _falloff = 0.5f; 37 | 38 | public float intensity { 39 | get { return _falloff; } 40 | set { _falloff = value; } 41 | } 42 | 43 | #endregion 44 | 45 | #region Private Properties 46 | 47 | [SerializeField] Shader _shader; 48 | Material _material; 49 | 50 | #endregion 51 | 52 | #region MonoBehaviour Functions 53 | 54 | void OnRenderImage(RenderTexture source, RenderTexture destination) 55 | { 56 | if (_material == null) 57 | { 58 | _material = new Material(_shader); 59 | _material.hideFlags = HideFlags.DontSave; 60 | } 61 | 62 | var cam = GetComponent(); 63 | _material.SetVector("_Aspect", new Vector2(cam.aspect, 1)); 64 | _material.SetFloat("_Falloff", _falloff); 65 | 66 | Graphics.Blit(source, destination, _material, 0); 67 | } 68 | 69 | #endregion 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Script/PropertyObserver.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Obscurance - SSAO (screen-space ambient obscurance) effect for Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | 26 | namespace Kino 27 | { 28 | public partial class Obscurance : MonoBehaviour 29 | { 30 | // Observer class that detects changes on properties 31 | struct PropertyObserver 32 | { 33 | // Obscurance properties 34 | bool _downsampling; 35 | OcclusionSource _occlusionSource; 36 | bool _ambientOnly; 37 | 38 | // Camera properties 39 | int _pixelWidth; 40 | int _pixelHeight; 41 | 42 | // Check if it has to reset itself for property changes. 43 | public bool CheckNeedsReset(Obscurance target, Camera camera) 44 | { 45 | return 46 | _downsampling != target.downsampling || 47 | _occlusionSource != target.occlusionSource || 48 | _ambientOnly != target.ambientOnly || 49 | _pixelWidth != camera.pixelWidth || 50 | _pixelHeight != camera.pixelHeight; 51 | } 52 | 53 | // Update the internal state. 54 | public void Update(Obscurance target, Camera camera) 55 | { 56 | _downsampling = target.downsampling; 57 | _occlusionSource = target.occlusionSource; 58 | _ambientOnly = target.ambientOnly; 59 | _pixelWidth = camera.pixelWidth; 60 | _pixelHeight = camera.pixelHeight; 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Editor/DatamoshEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Datamosh - Glitch effect simulating video compression artifacts 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEditor; 26 | 27 | namespace Kino 28 | { 29 | [CanEditMultipleObjects] 30 | [CustomEditor(typeof(Datamosh))] 31 | public class DatamoshEditor : Editor 32 | { 33 | SerializedProperty _blockSize; 34 | SerializedProperty _entropy; 35 | SerializedProperty _noiseContrast; 36 | SerializedProperty _velocityScale; 37 | SerializedProperty _diffusion; 38 | 39 | void OnEnable() 40 | { 41 | _blockSize = serializedObject.FindProperty("_blockSize"); 42 | _entropy = serializedObject.FindProperty("_entropy"); 43 | _noiseContrast = serializedObject.FindProperty("_noiseContrast"); 44 | _velocityScale = serializedObject.FindProperty("_velocityScale"); 45 | _diffusion = serializedObject.FindProperty("_diffusion"); 46 | } 47 | 48 | public override void OnInspectorGUI() 49 | { 50 | serializedObject.Update(); 51 | 52 | EditorGUILayout.PropertyField(_blockSize); 53 | EditorGUILayout.PropertyField(_entropy); 54 | EditorGUILayout.PropertyField(_noiseContrast); 55 | EditorGUILayout.PropertyField(_velocityScale); 56 | EditorGUILayout.PropertyField(_diffusion); 57 | 58 | serializedObject.ApplyModifiedProperties(); 59 | 60 | EditorGUI.BeginDisabledGroup(!EditorApplication.isPlaying); 61 | 62 | if (GUILayout.Button("Glitch!")) 63 | foreach (Datamosh d in targets) d.Glitch(); 64 | 65 | if (GUILayout.Button("Clear")) 66 | foreach (Datamosh d in targets) d.Reset(); 67 | 68 | EditorGUI.EndDisabledGroup (); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/Test/Box.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1001 &100100000 4 | Prefab: 5 | m_ObjectHideFlags: 1 6 | serializedVersion: 2 7 | m_Modification: 8 | m_TransformParent: {fileID: 0} 9 | m_Modifications: [] 10 | m_RemovedComponents: [] 11 | m_ParentPrefab: {fileID: 0} 12 | m_RootGameObject: {fileID: 1000013404500428} 13 | m_IsPrefabParent: 1 14 | --- !u!1 &1000013404500428 15 | GameObject: 16 | m_ObjectHideFlags: 0 17 | m_PrefabParentObject: {fileID: 0} 18 | m_PrefabInternal: {fileID: 100100000} 19 | serializedVersion: 4 20 | m_Component: 21 | - 4: {fileID: 4000013510145654} 22 | - 33: {fileID: 33000010335190090} 23 | - 65: {fileID: 65000010002266404} 24 | - 23: {fileID: 23000013701425442} 25 | - 54: {fileID: 54000012576663662} 26 | m_Layer: 0 27 | m_Name: Box 28 | m_TagString: Untagged 29 | m_Icon: {fileID: 0} 30 | m_NavMeshLayer: 0 31 | m_StaticEditorFlags: 0 32 | m_IsActive: 1 33 | --- !u!4 &4000013510145654 34 | Transform: 35 | m_ObjectHideFlags: 1 36 | m_PrefabParentObject: {fileID: 0} 37 | m_PrefabInternal: {fileID: 100100000} 38 | m_GameObject: {fileID: 1000013404500428} 39 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 40 | m_LocalPosition: {x: 0, y: 1, z: 0} 41 | m_LocalScale: {x: 0.3, y: 0.3, z: 0.3} 42 | m_Children: [] 43 | m_Father: {fileID: 0} 44 | m_RootOrder: 0 45 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 46 | --- !u!23 &23000013701425442 47 | MeshRenderer: 48 | m_ObjectHideFlags: 1 49 | m_PrefabParentObject: {fileID: 0} 50 | m_PrefabInternal: {fileID: 100100000} 51 | m_GameObject: {fileID: 1000013404500428} 52 | m_Enabled: 1 53 | m_CastShadows: 1 54 | m_ReceiveShadows: 1 55 | m_MotionVectors: 1 56 | m_LightProbeUsage: 1 57 | m_ReflectionProbeUsage: 1 58 | m_Materials: 59 | - {fileID: 2100000, guid: f5f24d4af4db24ffe9fd0cecc19e2db6, type: 2} 60 | m_SubsetIndices: 61 | m_StaticBatchRoot: {fileID: 0} 62 | m_ProbeAnchor: {fileID: 0} 63 | m_LightProbeVolumeOverride: {fileID: 0} 64 | m_ScaleInLightmap: 1 65 | m_PreserveUVs: 1 66 | m_IgnoreNormalsForChartDetection: 0 67 | m_ImportantGI: 0 68 | m_SelectedWireframeHidden: 0 69 | m_MinimumChartSize: 4 70 | m_AutoUVMaxDistance: 0.5 71 | m_AutoUVMaxAngle: 89 72 | m_LightmapParameters: {fileID: 0} 73 | m_SortingLayerID: 0 74 | m_SortingOrder: 0 75 | --- !u!33 &33000010335190090 76 | MeshFilter: 77 | m_ObjectHideFlags: 1 78 | m_PrefabParentObject: {fileID: 0} 79 | m_PrefabInternal: {fileID: 100100000} 80 | m_GameObject: {fileID: 1000013404500428} 81 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 82 | --- !u!54 &54000012576663662 83 | Rigidbody: 84 | m_ObjectHideFlags: 1 85 | m_PrefabParentObject: {fileID: 0} 86 | m_PrefabInternal: {fileID: 100100000} 87 | m_GameObject: {fileID: 1000013404500428} 88 | serializedVersion: 2 89 | m_Mass: 1 90 | m_Drag: 0 91 | m_AngularDrag: 0.05 92 | m_UseGravity: 1 93 | m_IsKinematic: 0 94 | m_Interpolate: 0 95 | m_Constraints: 0 96 | m_CollisionDetection: 0 97 | --- !u!65 &65000010002266404 98 | BoxCollider: 99 | m_ObjectHideFlags: 1 100 | m_PrefabParentObject: {fileID: 0} 101 | m_PrefabInternal: {fileID: 100100000} 102 | m_GameObject: {fileID: 1000013404500428} 103 | m_Material: {fileID: 0} 104 | m_IsTrigger: 0 105 | m_Enabled: 1 106 | serializedVersion: 2 107 | m_Size: {x: 1, y: 1, z: 1} 108 | m_Center: {x: 0, y: 0, z: 0} 109 | -------------------------------------------------------------------------------- /Assets/Test/Material/UV Test.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: UV Test 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | - first: 19 | name: _BumpMap 20 | second: 21 | m_Texture: {fileID: 0} 22 | m_Scale: {x: 1, y: 1} 23 | m_Offset: {x: 0, y: 0} 24 | - first: 25 | name: _DetailAlbedoMap 26 | second: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - first: 31 | name: _DetailMask 32 | second: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - first: 37 | name: _DetailNormalMap 38 | second: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - first: 43 | name: _EmissionMap 44 | second: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 4, y: 4} 47 | m_Offset: {x: 0, y: 0} 48 | - first: 49 | name: _MainTex 50 | second: 51 | m_Texture: {fileID: 2800000, guid: 8560d420cafabc24a96f9719e811b213, type: 3} 52 | m_Scale: {x: 4, y: 4} 53 | m_Offset: {x: 0, y: 0} 54 | - first: 55 | name: _MetallicGlossMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - first: 61 | name: _OcclusionMap 62 | second: 63 | m_Texture: {fileID: 0} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - first: 67 | name: _ParallaxMap 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | m_Floats: 73 | - first: 74 | name: _BumpScale 75 | second: 1 76 | - first: 77 | name: _Cutoff 78 | second: 0.5 79 | - first: 80 | name: _DetailNormalMapScale 81 | second: 1 82 | - first: 83 | name: _DstBlend 84 | second: 0 85 | - first: 86 | name: _GlossMapScale 87 | second: 1 88 | - first: 89 | name: _Glossiness 90 | second: 0.5 91 | - first: 92 | name: _GlossyReflections 93 | second: 1 94 | - first: 95 | name: _Metallic 96 | second: 0 97 | - first: 98 | name: _Mode 99 | second: 0 100 | - first: 101 | name: _OcclusionStrength 102 | second: 1 103 | - first: 104 | name: _Parallax 105 | second: 0.02 106 | - first: 107 | name: _SmoothnessTextureChannel 108 | second: 0 109 | - first: 110 | name: _SpecularHighlights 111 | second: 1 112 | - first: 113 | name: _SrcBlend 114 | second: 1 115 | - first: 116 | name: _UVSec 117 | second: 0 118 | - first: 119 | name: _ZWrite 120 | second: 1 121 | m_Colors: 122 | - first: 123 | name: _Color 124 | second: {r: 1, g: 1, b: 1, a: 1} 125 | - first: 126 | name: _EmissionColor 127 | second: {r: 0, g: 0, b: 0, a: 1} 128 | -------------------------------------------------------------------------------- /Assets/Test/Material/Box.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Box 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | - first: 19 | name: _BumpMap 20 | second: 21 | m_Texture: {fileID: 0} 22 | m_Scale: {x: 1, y: 1} 23 | m_Offset: {x: 0, y: 0} 24 | - first: 25 | name: _DetailAlbedoMap 26 | second: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - first: 31 | name: _DetailMask 32 | second: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - first: 37 | name: _DetailNormalMap 38 | second: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - first: 43 | name: _EmissionMap 44 | second: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 0.25, y: 0.25} 47 | m_Offset: {x: 0, y: 0} 48 | - first: 49 | name: _MainTex 50 | second: 51 | m_Texture: {fileID: 2800000, guid: 8560d420cafabc24a96f9719e811b213, type: 3} 52 | m_Scale: {x: 0.25, y: 0.25} 53 | m_Offset: {x: 0, y: 0} 54 | - first: 55 | name: _MetallicGlossMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - first: 61 | name: _OcclusionMap 62 | second: 63 | m_Texture: {fileID: 0} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - first: 67 | name: _ParallaxMap 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | m_Floats: 73 | - first: 74 | name: _BumpScale 75 | second: 1 76 | - first: 77 | name: _Cutoff 78 | second: 0.5 79 | - first: 80 | name: _DetailNormalMapScale 81 | second: 1 82 | - first: 83 | name: _DstBlend 84 | second: 0 85 | - first: 86 | name: _GlossMapScale 87 | second: 1 88 | - first: 89 | name: _Glossiness 90 | second: 0 91 | - first: 92 | name: _GlossyReflections 93 | second: 1 94 | - first: 95 | name: _Metallic 96 | second: 0 97 | - first: 98 | name: _Mode 99 | second: 0 100 | - first: 101 | name: _OcclusionStrength 102 | second: 1 103 | - first: 104 | name: _Parallax 105 | second: 0.02 106 | - first: 107 | name: _SmoothnessTextureChannel 108 | second: 0 109 | - first: 110 | name: _SpecularHighlights 111 | second: 1 112 | - first: 113 | name: _SrcBlend 114 | second: 1 115 | - first: 116 | name: _UVSec 117 | second: 0 118 | - first: 119 | name: _ZWrite 120 | second: 1 121 | m_Colors: 122 | - first: 123 | name: _Color 124 | second: {r: 1, g: 1, b: 1, a: 1} 125 | - first: 126 | name: _EmissionColor 127 | second: {r: 0, g: 0, b: 0, a: 1} 128 | -------------------------------------------------------------------------------- /Assets/Klak/Math/Editor/InterpolatorConfigDrawer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEditor; 26 | 27 | namespace Klak.Math 28 | { 29 | using Config = FloatInterpolator.Config; 30 | 31 | [CustomPropertyDrawer(typeof(Config))] 32 | class FloatInterpolatorConfigDrawer : PropertyDrawer 33 | { 34 | static GUIContent _textSpeed = new GUIContent("Speed"); 35 | 36 | bool CheckShouldExpand(SerializedProperty property) 37 | { 38 | var type = property.FindPropertyRelative("_interpolationType"); 39 | return type.hasMultipleDifferentValues || 40 | type.enumValueIndex != (int)Config.InterpolationType.Direct; 41 | } 42 | 43 | public override float GetPropertyHeight(SerializedProperty property, GUIContent label) 44 | { 45 | var lineHeight = EditorGUIUtility.singleLineHeight; 46 | var lineSpace = EditorGUIUtility.standardVerticalSpacing; 47 | return CheckShouldExpand(property) ? 48 | lineHeight * 2 + lineSpace : lineHeight; 49 | } 50 | 51 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) 52 | { 53 | EditorGUI.BeginProperty(position, label, property); 54 | 55 | const int indentWidth = 16; 56 | var lineHeight = EditorGUIUtility.singleLineHeight; 57 | var lineSpace = EditorGUIUtility.standardVerticalSpacing; 58 | 59 | // these controls have single line height 60 | position.height = lineHeight; 61 | 62 | // interpolation type 63 | var type = property.FindPropertyRelative("_interpolationType"); 64 | EditorGUI.PropertyField(position, type, label); 65 | 66 | if (CheckShouldExpand(property)) 67 | { 68 | // indent the line 69 | position.width -= indentWidth; 70 | position.x += indentWidth; 71 | EditorGUIUtility.labelWidth -= indentWidth; 72 | 73 | // go to the next line 74 | position.y += lineHeight + lineSpace; 75 | 76 | // interpolation speed 77 | var speed = property.FindPropertyRelative("_interpolationSpeed"); 78 | EditorGUI.PropertyField(position, speed, _textSpeed); 79 | } 80 | 81 | EditorGUI.EndProperty(); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Assets/Klak/Motion/Editor/SmoothFollowEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEditor; 26 | 27 | namespace Klak.Motion 28 | { 29 | [CanEditMultipleObjects] 30 | [CustomEditor(typeof(SmoothFollow))] 31 | public class SmoothFollowEditor : Editor 32 | { 33 | SerializedProperty _interpolator; 34 | SerializedProperty _target; 35 | SerializedProperty _positionSpeed; 36 | SerializedProperty _rotationSpeed; 37 | SerializedProperty _jumpDistance; 38 | SerializedProperty _jumpAngle; 39 | 40 | static GUIContent _textAngle = new GUIContent("Angle"); 41 | static GUIContent _textDistance = new GUIContent("Distance"); 42 | static GUIContent _textPosition = new GUIContent("Position"); 43 | static GUIContent _textRotation = new GUIContent("Rotation"); 44 | 45 | void OnEnable() 46 | { 47 | _interpolator = serializedObject.FindProperty("_interpolator"); 48 | _target = serializedObject.FindProperty("_target"); 49 | _positionSpeed = serializedObject.FindProperty("_positionSpeed"); 50 | _rotationSpeed = serializedObject.FindProperty("_rotationSpeed"); 51 | _jumpDistance = serializedObject.FindProperty("_jumpDistance"); 52 | _jumpAngle = serializedObject.FindProperty("_jumpAngle"); 53 | } 54 | 55 | public override void OnInspectorGUI() 56 | { 57 | serializedObject.Update(); 58 | 59 | EditorGUILayout.PropertyField(_interpolator); 60 | EditorGUILayout.PropertyField(_target); 61 | 62 | EditorGUILayout.Space(); 63 | 64 | EditorGUILayout.LabelField("Interpolation Speed", EditorStyles.boldLabel); 65 | EditorGUILayout.PropertyField(_positionSpeed, _textPosition); 66 | EditorGUILayout.PropertyField(_rotationSpeed, _textRotation); 67 | 68 | EditorGUILayout.Space(); 69 | 70 | EditorGUILayout.LabelField("Random Jump", EditorStyles.boldLabel); 71 | EditorGUILayout.PropertyField(_jumpDistance, _textDistance); 72 | EditorGUILayout.PropertyField(_jumpAngle, _textAngle); 73 | 74 | if (EditorApplication.isPlaying && GUILayout.Button("Jump!")) 75 | foreach (SmoothFollow sf in targets) 76 | sf.JumpRandomly(); 77 | 78 | serializedObject.ApplyModifiedProperties(); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Assets/Test/Model/Materials/MazeLowMan.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: MazeLowMan 10 | m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | - first: 19 | name: _BumpMap 20 | second: 21 | m_Texture: {fileID: 0} 22 | m_Scale: {x: 1, y: 1} 23 | m_Offset: {x: 0, y: 0} 24 | - first: 25 | name: _DetailAlbedoMap 26 | second: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - first: 31 | name: _DetailMask 32 | second: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - first: 37 | name: _DetailNormalMap 38 | second: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - first: 43 | name: _EmissionMap 44 | second: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - first: 49 | name: _MainTex 50 | second: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - first: 55 | name: _MetallicGlossMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - first: 61 | name: _OcclusionMap 62 | second: 63 | m_Texture: {fileID: 2800000, guid: 2db9b49529685fe43bd5a18a16c1511d, type: 3} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - first: 67 | name: _ParallaxMap 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - first: 73 | name: _SpecGlossMap 74 | second: 75 | m_Texture: {fileID: 0} 76 | m_Scale: {x: 1, y: 1} 77 | m_Offset: {x: 0, y: 0} 78 | m_Floats: 79 | - first: 80 | name: _BumpScale 81 | second: 1 82 | - first: 83 | name: _Cutoff 84 | second: 0.5 85 | - first: 86 | name: _DetailNormalMapScale 87 | second: 1 88 | - first: 89 | name: _DstBlend 90 | second: 0 91 | - first: 92 | name: _GlossMapScale 93 | second: 1 94 | - first: 95 | name: _Glossiness 96 | second: 0.32 97 | - first: 98 | name: _GlossyReflections 99 | second: 1 100 | - first: 101 | name: _Metallic 102 | second: 0 103 | - first: 104 | name: _Mode 105 | second: 0 106 | - first: 107 | name: _OcclusionStrength 108 | second: 1 109 | - first: 110 | name: _Parallax 111 | second: 0.02 112 | - first: 113 | name: _SmoothnessTextureChannel 114 | second: 0 115 | - first: 116 | name: _SpecularHighlights 117 | second: 1 118 | - first: 119 | name: _SrcBlend 120 | second: 1 121 | - first: 122 | name: _UVSec 123 | second: 0 124 | - first: 125 | name: _ZWrite 126 | second: 1 127 | m_Colors: 128 | - first: 129 | name: _Color 130 | second: {r: 0.6691177, g: 0.1771194, b: 0.1771194, a: 1} 131 | - first: 132 | name: _EmissionColor 133 | second: {r: 0, g: 0, b: 0, a: 1} 134 | - first: 135 | name: _SpecColor 136 | second: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 1} 137 | -------------------------------------------------------------------------------- /Assets/Test/Model/Materials/MazeLowMan2.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: MazeLowMan2 10 | m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | - first: 19 | name: _BumpMap 20 | second: 21 | m_Texture: {fileID: 0} 22 | m_Scale: {x: 1, y: 1} 23 | m_Offset: {x: 0, y: 0} 24 | - first: 25 | name: _DetailAlbedoMap 26 | second: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - first: 31 | name: _DetailMask 32 | second: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - first: 37 | name: _DetailNormalMap 38 | second: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - first: 43 | name: _EmissionMap 44 | second: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - first: 49 | name: _MainTex 50 | second: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - first: 55 | name: _MetallicGlossMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - first: 61 | name: _OcclusionMap 62 | second: 63 | m_Texture: {fileID: 2800000, guid: 2db9b49529685fe43bd5a18a16c1511d, type: 3} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - first: 67 | name: _ParallaxMap 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - first: 73 | name: _SpecGlossMap 74 | second: 75 | m_Texture: {fileID: 0} 76 | m_Scale: {x: 1, y: 1} 77 | m_Offset: {x: 0, y: 0} 78 | m_Floats: 79 | - first: 80 | name: _BumpScale 81 | second: 1 82 | - first: 83 | name: _Cutoff 84 | second: 0.5 85 | - first: 86 | name: _DetailNormalMapScale 87 | second: 1 88 | - first: 89 | name: _DstBlend 90 | second: 0 91 | - first: 92 | name: _GlossMapScale 93 | second: 1 94 | - first: 95 | name: _Glossiness 96 | second: 0.32 97 | - first: 98 | name: _GlossyReflections 99 | second: 1 100 | - first: 101 | name: _Metallic 102 | second: 0 103 | - first: 104 | name: _Mode 105 | second: 0 106 | - first: 107 | name: _OcclusionStrength 108 | second: 1 109 | - first: 110 | name: _Parallax 111 | second: 0.02 112 | - first: 113 | name: _SmoothnessTextureChannel 114 | second: 0 115 | - first: 116 | name: _SpecularHighlights 117 | second: 1 118 | - first: 119 | name: _SrcBlend 120 | second: 1 121 | - first: 122 | name: _UVSec 123 | second: 0 124 | - first: 125 | name: _ZWrite 126 | second: 1 127 | m_Colors: 128 | - first: 129 | name: _Color 130 | second: {r: 0.17711936, g: 0.38409793, b: 0.6691177, a: 1} 131 | - first: 132 | name: _EmissionColor 133 | second: {r: 0, g: 0, b: 0, a: 1} 134 | - first: 135 | name: _SpecColor 136 | second: {r: 0.11764706, g: 0.11764706, b: 0.11764706, a: 1} 137 | -------------------------------------------------------------------------------- /Assets/Test/Material/Skybox.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Skybox 10 | m_Shader: {fileID: 103, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _EMISSION 12 | m_LightmapFlags: 1 13 | m_CustomRenderQueue: 1000 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | - first: 19 | name: _BumpMap 20 | second: 21 | m_Texture: {fileID: 0} 22 | m_Scale: {x: 1, y: 1} 23 | m_Offset: {x: 0, y: 0} 24 | - first: 25 | name: _DetailAlbedoMap 26 | second: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - first: 31 | name: _DetailMask 32 | second: 33 | m_Texture: {fileID: 0} 34 | m_Scale: {x: 1, y: 1} 35 | m_Offset: {x: 0, y: 0} 36 | - first: 37 | name: _DetailNormalMap 38 | second: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - first: 43 | name: _EmissionMap 44 | second: 45 | m_Texture: {fileID: 0} 46 | m_Scale: {x: 1, y: 1} 47 | m_Offset: {x: 0, y: 0} 48 | - first: 49 | name: _MainTex 50 | second: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - first: 55 | name: _MetallicGlossMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | - first: 61 | name: _OcclusionMap 62 | second: 63 | m_Texture: {fileID: 0} 64 | m_Scale: {x: 1, y: 1} 65 | m_Offset: {x: 0, y: 0} 66 | - first: 67 | name: _ParallaxMap 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | - first: 73 | name: _Tex 74 | second: 75 | m_Texture: {fileID: 8900000, guid: 1369ccb1c34454cc2967c59f41afb9ca, type: 3} 76 | m_Scale: {x: 1, y: 1} 77 | m_Offset: {x: 0, y: 0} 78 | m_Floats: 79 | - first: 80 | name: _BumpScale 81 | second: 1 82 | - first: 83 | name: _Cutoff 84 | second: 0.5 85 | - first: 86 | name: _DetailNormalMapScale 87 | second: 1 88 | - first: 89 | name: _DstBlend 90 | second: 0 91 | - first: 92 | name: _Exposure 93 | second: 1.3 94 | - first: 95 | name: _GlossMapScale 96 | second: 1 97 | - first: 98 | name: _Glossiness 99 | second: 0.5 100 | - first: 101 | name: _GlossyReflections 102 | second: 1 103 | - first: 104 | name: _Metallic 105 | second: 0 106 | - first: 107 | name: _Mode 108 | second: 0 109 | - first: 110 | name: _OcclusionStrength 111 | second: 1 112 | - first: 113 | name: _Parallax 114 | second: 0.02 115 | - first: 116 | name: _Rotation 117 | second: 0 118 | - first: 119 | name: _SmoothnessTextureChannel 120 | second: 0 121 | - first: 122 | name: _SpecularHighlights 123 | second: 1 124 | - first: 125 | name: _SrcBlend 126 | second: 1 127 | - first: 128 | name: _UVSec 129 | second: 0 130 | - first: 131 | name: _ZWrite 132 | second: 1 133 | m_Colors: 134 | - first: 135 | name: _Color 136 | second: {r: 1, g: 1, b: 1, a: 1} 137 | - first: 138 | name: _EmissionColor 139 | second: {r: 0, g: 0, b: 0, a: 1} 140 | - first: 141 | name: _Tint 142 | second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} 143 | -------------------------------------------------------------------------------- /Assets/Klak/Math/Interpolator.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using System; 26 | 27 | namespace Klak.Math 28 | { 29 | public struct FloatInterpolator 30 | { 31 | #region Nested Public Classes 32 | 33 | [Serializable] 34 | public class Config 35 | { 36 | public enum InterpolationType { 37 | Direct, Exponential, DampedSpring 38 | } 39 | 40 | [SerializeField] 41 | InterpolationType _interpolationType 42 | = InterpolationType.DampedSpring; 43 | 44 | public InterpolationType interpolationType { 45 | get { return _interpolationType; } 46 | set { _interpolationType = value; } 47 | } 48 | 49 | public bool enabled { 50 | get { return interpolationType != InterpolationType.Direct; } 51 | } 52 | 53 | [SerializeField, Range(0.1f, 50)] 54 | float _interpolationSpeed = 5; 55 | 56 | public float interpolationSpeed { 57 | get { return _interpolationSpeed; } 58 | set { _interpolationSpeed = value; } 59 | } 60 | } 61 | 62 | #endregion 63 | 64 | #region Private Members 65 | 66 | float _velocity; 67 | 68 | #endregion 69 | 70 | #region Public Properties And Methods 71 | 72 | public Config config { get; set; } 73 | public float currentValue { get; set; } 74 | public float targetValue { get; set; } 75 | 76 | public FloatInterpolator(float initialValue, Config config) 77 | { 78 | this.config = config; 79 | currentValue = targetValue =initialValue; 80 | _velocity = 0; 81 | } 82 | 83 | public float Step(float targetValue) 84 | { 85 | this.targetValue = targetValue; 86 | return Step(); 87 | } 88 | 89 | public float Step() 90 | { 91 | if (config.interpolationType == Config.InterpolationType.Exponential) 92 | { 93 | currentValue = ETween.Step( 94 | currentValue, targetValue, config.interpolationSpeed); 95 | } 96 | else if (config.interpolationType == Config.InterpolationType.DampedSpring) 97 | { 98 | currentValue = DTween.Step( 99 | currentValue, targetValue, ref _velocity, config.interpolationSpeed); 100 | } 101 | else 102 | { 103 | currentValue = targetValue; 104 | } 105 | return currentValue; 106 | } 107 | 108 | #endregion 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Editor/ObscuranceEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Obscurance - SSAO (screen-space ambient obscurance) effect for Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEditor; 26 | 27 | namespace Kino 28 | { 29 | [CanEditMultipleObjects] 30 | [CustomEditor(typeof(Obscurance))] 31 | public class ObscuranceEditor : Editor 32 | { 33 | SerializedProperty _intensity; 34 | SerializedProperty _radius; 35 | SerializedProperty _sampleCount; 36 | SerializedProperty _sampleCountValue; 37 | SerializedProperty _downsampling; 38 | SerializedProperty _occlusionSource; 39 | SerializedProperty _ambientOnly; 40 | 41 | static GUIContent _textValue = new GUIContent("Value"); 42 | 43 | static string _textNoGBuffer = 44 | "G-buffer is currently unavailable. " + 45 | "Change Renderring Path in camera settings to Deferred."; 46 | 47 | static string _textNoAmbientOnly = 48 | "The ambient-only mode is currently disabled; " + 49 | "it requires G-buffer source and HDR rendering."; 50 | 51 | void OnEnable() 52 | { 53 | _intensity = serializedObject.FindProperty("_intensity"); 54 | _radius = serializedObject.FindProperty("_radius"); 55 | _sampleCount = serializedObject.FindProperty("_sampleCount"); 56 | _sampleCountValue = serializedObject.FindProperty("_sampleCountValue"); 57 | _downsampling = serializedObject.FindProperty("_downsampling"); 58 | _occlusionSource = serializedObject.FindProperty("_occlusionSource"); 59 | _ambientOnly = serializedObject.FindProperty("_ambientOnly"); 60 | } 61 | 62 | public override void OnInspectorGUI() 63 | { 64 | var obscurance = (Obscurance)target; 65 | 66 | serializedObject.Update(); 67 | 68 | EditorGUILayout.PropertyField(_intensity); 69 | EditorGUILayout.PropertyField(_radius); 70 | EditorGUILayout.PropertyField(_sampleCount); 71 | 72 | if (_sampleCount.hasMultipleDifferentValues || 73 | _sampleCount.enumValueIndex == (int)Obscurance.SampleCount.Variable) 74 | { 75 | EditorGUI.indentLevel++; 76 | EditorGUILayout.PropertyField(_sampleCountValue, _textValue); 77 | EditorGUI.indentLevel--; 78 | } 79 | 80 | EditorGUILayout.PropertyField(_downsampling); 81 | EditorGUILayout.PropertyField(_occlusionSource); 82 | 83 | if (!_occlusionSource.hasMultipleDifferentValues) 84 | if (_occlusionSource.enumValueIndex != (int)obscurance.occlusionSource) 85 | EditorGUILayout.HelpBox(_textNoGBuffer, MessageType.Warning); 86 | 87 | EditorGUILayout.PropertyField(_ambientOnly); 88 | 89 | if (!_ambientOnly.hasMultipleDifferentValues) 90 | if (_ambientOnly.boolValue != obscurance.ambientOnly) 91 | EditorGUILayout.HelpBox(_textNoAmbientOnly, MessageType.Warning); 92 | 93 | serializedObject.ApplyModifiedProperties(); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Editor/ColorSuiteEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014, 2015 Keijiro Takahashi 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | // this software and associated documentation files (the "Software"), to deal in 6 | // the Software without restriction, including without limitation the rights to 7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | // the Software, and to permit persons to whom the Software is furnished to do so, 9 | // subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in all 12 | // copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | // 21 | using UnityEngine; 22 | using UnityEditor; 23 | using System.Collections; 24 | 25 | [CustomEditor(typeof(ColorSuite)), CanEditMultipleObjects] 26 | public class ColorSuiteEditor : Editor 27 | { 28 | SerializedProperty propColorTemp; 29 | SerializedProperty propColorTint; 30 | 31 | SerializedProperty propToneMapping; 32 | SerializedProperty propExposure; 33 | 34 | SerializedProperty propSaturation; 35 | 36 | SerializedProperty propRCurve; 37 | SerializedProperty propGCurve; 38 | SerializedProperty propBCurve; 39 | SerializedProperty propCCurve; 40 | 41 | SerializedProperty propDitherMode; 42 | 43 | GUIContent labelColorTemp; 44 | GUIContent labelColorTint; 45 | 46 | void OnEnable() 47 | { 48 | propColorTemp = serializedObject.FindProperty("_colorTemp"); 49 | propColorTint = serializedObject.FindProperty("_colorTint"); 50 | 51 | propToneMapping = serializedObject.FindProperty("_toneMapping"); 52 | propExposure = serializedObject.FindProperty("_exposure"); 53 | 54 | propSaturation = serializedObject.FindProperty("_saturation"); 55 | 56 | propRCurve = serializedObject.FindProperty("_rCurve"); 57 | propGCurve = serializedObject.FindProperty("_gCurve"); 58 | propBCurve = serializedObject.FindProperty("_bCurve"); 59 | propCCurve = serializedObject.FindProperty("_cCurve"); 60 | 61 | propDitherMode = serializedObject.FindProperty("_ditherMode"); 62 | 63 | labelColorTemp = new GUIContent("Color Temperature"); 64 | labelColorTint = new GUIContent("Tint (green-purple)"); 65 | } 66 | 67 | public override void OnInspectorGUI() 68 | { 69 | serializedObject.Update(); 70 | 71 | EditorGUILayout.PropertyField(propToneMapping); 72 | if (propToneMapping.hasMultipleDifferentValues || propToneMapping.boolValue) 73 | { 74 | EditorGUILayout.Slider(propExposure, 0, 5); 75 | if (QualitySettings.activeColorSpace != ColorSpace.Linear) 76 | EditorGUILayout.HelpBox("Linear space lighting should be enabled for tone mapping.", MessageType.Warning); 77 | } 78 | 79 | EditorGUILayout.Space(); 80 | 81 | EditorGUILayout.Slider(propColorTemp, -1.0f, 1.0f, labelColorTemp); 82 | EditorGUILayout.Slider(propColorTint, -1.0f, 1.0f, labelColorTint); 83 | 84 | EditorGUILayout.Space(); 85 | 86 | EditorGUILayout.Slider(propSaturation, 0, 2); 87 | 88 | EditorGUILayout.LabelField("Curves (R, G, B, Combined)"); 89 | EditorGUILayout.BeginHorizontal(); 90 | var doubleHeight = GUILayout.Height(EditorGUIUtility.singleLineHeight * 2); 91 | EditorGUILayout.PropertyField(propRCurve, GUIContent.none, doubleHeight); 92 | EditorGUILayout.PropertyField(propGCurve, GUIContent.none, doubleHeight); 93 | EditorGUILayout.PropertyField(propBCurve, GUIContent.none, doubleHeight); 94 | EditorGUILayout.PropertyField(propCCurve, GUIContent.none, doubleHeight); 95 | EditorGUILayout.EndHorizontal(); 96 | 97 | EditorGUILayout.Space(); 98 | 99 | EditorGUILayout.PropertyField(propDitherMode); 100 | 101 | serializedObject.ApplyModifiedProperties(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Shader/Obscurance.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Obscurance - SSAO (screen-space ambient obscurance) effect for Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | Shader "Hidden/Kino/Obscurance" 25 | { 26 | Properties 27 | { 28 | _MainTex("", 2D) = ""{} 29 | _ObscuranceTexture("", 2D) = ""{} 30 | } 31 | SubShader 32 | { 33 | // 0: Occlusion estimation with CameraDepthTexture 34 | Pass 35 | { 36 | ZTest Always Cull Off ZWrite Off 37 | CGPROGRAM 38 | #define SOURCE_DEPTH 1 39 | #include "Obscurance.cginc" 40 | #pragma vertex vert_img 41 | #pragma fragment frag_ao 42 | #pragma target 3.0 43 | ENDCG 44 | } 45 | // 1: Occlusion estimation with CameraDepthNormalsTexture 46 | Pass 47 | { 48 | ZTest Always Cull Off ZWrite Off 49 | CGPROGRAM 50 | #define SOURCE_DEPTHNORMALS 1 51 | #include "Obscurance.cginc" 52 | #pragma vertex vert_img 53 | #pragma fragment frag_ao 54 | #pragma target 3.0 55 | ENDCG 56 | } 57 | // 2: Occlusion estimation with G-Buffer 58 | Pass 59 | { 60 | ZTest Always Cull Off ZWrite Off 61 | CGPROGRAM 62 | #define SOURCE_GBUFFER 1 63 | #include "Obscurance.cginc" 64 | #pragma vertex vert_img 65 | #pragma fragment frag_ao 66 | #pragma target 3.0 67 | ENDCG 68 | } 69 | // 3: Noise reduction (first pass) with CameraDepthNormalsTexture 70 | Pass 71 | { 72 | ZTest Always Cull Off ZWrite Off 73 | CGPROGRAM 74 | #define SOURCE_DEPTHNORMALS 1 75 | #include "Obscurance.cginc" 76 | #pragma vertex vert_img 77 | #pragma fragment frag_blur1 78 | #pragma target 3.0 79 | ENDCG 80 | } 81 | // 4: Noise reduction (first pass) with G Buffer 82 | Pass 83 | { 84 | ZTest Always Cull Off ZWrite Off 85 | CGPROGRAM 86 | #define SOURCE_GBUFFER 1 87 | #include "Obscurance.cginc" 88 | #pragma vertex vert_img 89 | #pragma fragment frag_blur1 90 | #pragma target 3.0 91 | ENDCG 92 | } 93 | // 5: Noise reduction (second pass) with CameraDepthNormalsTexture 94 | Pass 95 | { 96 | ZTest Always Cull Off ZWrite Off 97 | CGPROGRAM 98 | #define SOURCE_DEPTHNORMALS 1 99 | #include "Obscurance.cginc" 100 | #pragma vertex vert_img 101 | #pragma fragment frag_blur2 102 | #pragma target 3.0 103 | ENDCG 104 | } 105 | // 6: Noise reduction (second pass) with G Buffer 106 | Pass 107 | { 108 | ZTest Always Cull Off ZWrite Off 109 | CGPROGRAM 110 | #define SOURCE_GBUFFER 1 111 | #include "Obscurance.cginc" 112 | #pragma vertex vert_img 113 | #pragma fragment frag_blur2 114 | #pragma target 3.0 115 | ENDCG 116 | } 117 | // 7: Occlusion combiner 118 | Pass 119 | { 120 | ZTest Always Cull Off ZWrite Off 121 | CGPROGRAM 122 | #include "Obscurance.cginc" 123 | #pragma vertex vert_multitex 124 | #pragma fragment frag_combine 125 | #pragma target 3.0 126 | ENDCG 127 | } 128 | // 8: Occlusion combiner for the ambient-only mode 129 | Pass 130 | { 131 | Blend Zero OneMinusSrcColor, Zero OneMinusSrcAlpha 132 | ZTest Always Cull Off ZWrite Off 133 | CGPROGRAM 134 | #include "Obscurance.cginc" 135 | #pragma vertex vert_gbuffer 136 | #pragma fragment frag_gbuffer_combine 137 | #pragma target 3.0 138 | ENDCG 139 | } 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /Assets/Klak/Editor/ImageSequenceWindow.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEditor; 26 | using System.IO; 27 | 28 | namespace Klak 29 | { 30 | public class ImageSequenceWindow : EditorWindow 31 | { 32 | #region Private Variables 33 | 34 | // recorder settings 35 | int _frameRate = 30; 36 | int _superSampling = 1; 37 | bool _autoRecord; 38 | 39 | // recorder state 40 | bool _isRecording; 41 | int _frameCount; 42 | int _previousFrame; 43 | 44 | #endregion 45 | 46 | #region Recorder Functions 47 | 48 | void InitializeRecorder() 49 | { 50 | _isRecording = false; 51 | if (_autoRecord) StartRecord(); 52 | } 53 | 54 | void StartRecord() 55 | { 56 | _frameCount = -1; 57 | _isRecording = true; 58 | } 59 | 60 | void EndRecord() 61 | { 62 | Time.captureFramerate = 0; 63 | _isRecording = false; 64 | } 65 | 66 | void StepRecorder() 67 | { 68 | if (_frameCount == 0) 69 | { 70 | Directory.CreateDirectory("Capture"); 71 | Time.captureFramerate = _frameRate; 72 | } 73 | else if (_frameCount > 0) 74 | { 75 | var name = "Capture/frame" + _frameCount.ToString("0000") + ".png"; 76 | Application.CaptureScreenshot(name, _superSampling); 77 | } 78 | _frameCount++; 79 | } 80 | 81 | #endregion 82 | 83 | #region EditorWindow Functions 84 | 85 | [MenuItem ("Window/Image Sequence")] 86 | static void Init() 87 | { 88 | var instance = CreateInstance(); 89 | instance.minSize = instance.maxSize = 90 | new Vector2(20, 6) * EditorGUIUtility.singleLineHeight; 91 | instance.titleContent = new GUIContent("Image Sequence"); 92 | instance.ShowUtility(); 93 | } 94 | 95 | void OnEnable() 96 | { 97 | EditorApplication.playmodeStateChanged += OnPlaymodeChanged; 98 | } 99 | 100 | void OnDisable() 101 | { 102 | EditorApplication.playmodeStateChanged -= OnPlaymodeChanged; 103 | } 104 | 105 | void OnPlaymodeChanged() 106 | { 107 | // detecting a start of the play mode 108 | if (!Application.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode) 109 | InitializeRecorder(); 110 | Repaint(); 111 | } 112 | 113 | void OnGUI() 114 | { 115 | _frameRate = EditorGUILayout.IntSlider("Frame Rate", _frameRate, 1, 120); 116 | _superSampling = EditorGUILayout.IntSlider("Supersampling", _superSampling, 1, 4); 117 | _autoRecord = EditorGUILayout.Toggle("Auto Recording", _autoRecord); 118 | 119 | if (EditorApplication.isPlaying) 120 | { 121 | var fatButton = GUILayout.Height(30); 122 | 123 | if (!_isRecording) 124 | { 125 | if (GUILayout.Button("REC", fatButton)) StartRecord(); 126 | } 127 | else 128 | { 129 | var time = (float)_frameCount / _frameRate; 130 | var label = "STOP (" + time.ToString("0.0") + "s)"; 131 | if (GUILayout.Button(label, fatButton)) EndRecord(); 132 | } 133 | } 134 | } 135 | 136 | void Update() 137 | { 138 | var frame = Time.frameCount; 139 | if (_previousFrame != frame) 140 | { 141 | if (Application.isPlaying && _isRecording) 142 | { 143 | StepRecorder(); 144 | Repaint(); 145 | } 146 | _previousFrame = frame; 147 | } 148 | } 149 | 150 | #endregion 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /Assets/Klak/Motion/SmoothFollow.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using Klak.Math; 26 | using Klak.VectorMathExtension; 27 | 28 | namespace Klak.Motion 29 | { 30 | /// Follows a given transform smoothly 31 | [AddComponentMenu("Klak/Motion/Smooth Follow")] 32 | public class SmoothFollow : MonoBehaviour 33 | { 34 | #region Nested Classes 35 | 36 | public enum Interpolator { 37 | Exponential, Spring, DampedSpring 38 | } 39 | 40 | #endregion 41 | 42 | #region Editable Properties 43 | 44 | [SerializeField] 45 | Interpolator _interpolator = Interpolator.DampedSpring; 46 | 47 | [SerializeField] 48 | Transform _target; 49 | 50 | [SerializeField, Range(0, 10)] 51 | float _positionSpeed = 2; 52 | 53 | [SerializeField, Range(0, 10)] 54 | float _rotationSpeed = 2; 55 | 56 | [SerializeField] 57 | float _jumpDistance = 1; 58 | 59 | [SerializeField, Range(0, 360)] 60 | float _jumpAngle = 60; 61 | 62 | #endregion 63 | 64 | #region Public Properties And Methods 65 | 66 | public Interpolator interpolationType { 67 | get { return _interpolator; } 68 | set { _interpolator = value; } 69 | } 70 | 71 | public Transform target { 72 | get { return _target; } 73 | set { _target = value; } 74 | } 75 | 76 | public float positionSpeed { 77 | get { return _positionSpeed; } 78 | set { _positionSpeed = value; } 79 | } 80 | 81 | public float rotationSpeed { 82 | get { return _rotationSpeed; } 83 | set { _rotationSpeed = value; } 84 | } 85 | 86 | public float jumpDistance { 87 | get { return _jumpDistance; } 88 | set { _jumpDistance = value; } 89 | } 90 | 91 | public float jumpAngle { 92 | get { return _jumpAngle; } 93 | set { _jumpAngle = value; } 94 | } 95 | 96 | public void Snap() 97 | { 98 | if (_positionSpeed > 0) transform.position = target.position; 99 | if (_rotationSpeed > 0) transform.rotation = target.rotation; 100 | } 101 | 102 | public void JumpRandomly() 103 | { 104 | var r1 = Random.Range(0.5f, 1.0f); 105 | var r2 = Random.Range(0.5f, 1.0f); 106 | 107 | var dp = Random.onUnitSphere * _jumpDistance * r1; 108 | var dr = Quaternion.AngleAxis(_jumpAngle * r2, Random.onUnitSphere); 109 | 110 | transform.position = dp + target.position; 111 | transform.rotation = dr * target.rotation; 112 | } 113 | 114 | #endregion 115 | 116 | #region Private Properties And Functions 117 | 118 | Vector3 _vposition; 119 | Vector4 _vrotation; 120 | 121 | Vector3 SpringPosition(Vector3 current, Vector3 target) 122 | { 123 | _vposition = ETween.Step(_vposition, Vector3.zero, 1 + _positionSpeed * 0.5f); 124 | _vposition += (target - current) * (_positionSpeed * 0.1f); 125 | return current + _vposition * Time.deltaTime; 126 | } 127 | 128 | Quaternion SpringRotation(Quaternion current, Quaternion target) 129 | { 130 | var v_current = current.ToVector4(); 131 | var v_target = target.ToVector4(); 132 | _vrotation = ETween.Step(_vrotation, Vector4.zero, 1 + _rotationSpeed * 0.5f); 133 | _vrotation += (v_target - v_current) * (_rotationSpeed * 0.1f); 134 | return (v_current + _vrotation * Time.deltaTime).ToNormalizedQuaternion(); 135 | } 136 | 137 | #endregion 138 | 139 | #region MonoBehaviour Functions 140 | 141 | void Update() 142 | { 143 | if (_interpolator == Interpolator.Exponential) 144 | { 145 | if (_positionSpeed > 0) 146 | transform.position = ETween.Step(transform.position, target.position, _positionSpeed); 147 | if (_rotationSpeed > 0) 148 | transform.rotation = ETween.Step(transform.rotation, target.rotation, _rotationSpeed); 149 | } 150 | else if (_interpolator == Interpolator.DampedSpring) 151 | { 152 | if (_positionSpeed > 0) 153 | transform.position = DTween.Step(transform.position, target.position, ref _vposition, _positionSpeed); 154 | if (_rotationSpeed > 0) 155 | transform.rotation = DTween.Step(transform.rotation, target.rotation, ref _vrotation, _rotationSpeed); 156 | } 157 | else 158 | { 159 | if (_positionSpeed > 0) 160 | transform.position = SpringPosition(transform.position, target.position); 161 | if (_rotationSpeed > 0) 162 | transform.rotation = SpringRotation(transform.rotation, target.rotation); 163 | } 164 | } 165 | 166 | #endregion 167 | } 168 | } 169 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Shader/Datamosh.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Datamosh - Glitch effect simulating video compression artifacts 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | Shader "Hidden/Kino/Datamosh" 25 | { 26 | Properties 27 | { 28 | _MainTex("", 2D) = ""{} 29 | _WorkTex("", 2D) = ""{} 30 | _DispTex("", 2D) = ""{} 31 | } 32 | 33 | CGINCLUDE 34 | 35 | #include "UnityCG.cginc" 36 | 37 | sampler2D _MainTex; 38 | float4 _MainTex_TexelSize; 39 | 40 | sampler2D _WorkTex; 41 | float4 _WorkTex_TexelSize; 42 | 43 | sampler2D _DispTex; 44 | float4 _DispTex_TexelSize; 45 | 46 | sampler2D_half _CameraMotionVectorsTexture; 47 | float4 _CameraMotionVectorsTexture_TexelSize; 48 | 49 | float _BlockSize; 50 | float _Quality; 51 | float _Contrast; 52 | float _Velocity; 53 | float _Diffusion; 54 | 55 | // PRNG 56 | float UVRandom(float2 uv) 57 | { 58 | float f = dot(float2(12.9898, 78.233), uv); 59 | return frac(43758.5453 * sin(f)); 60 | } 61 | 62 | // Vertex shader for multi texturing 63 | struct v2f_multitex 64 | { 65 | float4 pos : SV_POSITION; 66 | float2 uv0 : TEXCOORD0; 67 | float2 uv1 : TEXCOORD1; 68 | }; 69 | 70 | v2f_multitex vert_multitex(appdata_full v) 71 | { 72 | v2f_multitex o; 73 | o.pos = mul(UNITY_MATRIX_MVP, v.vertex); 74 | o.uv0 = v.texcoord.xy; 75 | o.uv1 = v.texcoord.xy; 76 | #if UNITY_UV_STARTS_AT_TOP 77 | if (_MainTex_TexelSize.y < 0.0) 78 | o.uv1.y = 1.0 - v.texcoord.y; 79 | #endif 80 | return o; 81 | } 82 | 83 | // Initialization shader 84 | half4 frag_init(v2f_img i) : SV_Target 85 | { 86 | return 0; 87 | } 88 | 89 | // Displacement buffer updating shader 90 | half4 frag_update(v2f_img i) : SV_Target 91 | { 92 | float2 uv = i.uv; 93 | float2 t0 = float2(_Time.y, 0); 94 | 95 | // Random numbers 96 | float3 rand = float3( 97 | UVRandom(uv + t0.xy), 98 | UVRandom(uv + t0.yx), 99 | UVRandom(uv.yx - t0.xx) 100 | ); 101 | 102 | // Motion vector 103 | half2 mv = tex2D(_CameraMotionVectorsTexture, uv).rg; 104 | mv *= _Velocity; 105 | 106 | // Normalized screen space -> Pixel coordinates 107 | mv = mv * _ScreenParams.xy; 108 | 109 | // Small random displacement (diffusion) 110 | mv += (rand.xy - 0.5) * _Diffusion; 111 | 112 | // Pixel perfect snapping 113 | mv = round(mv); 114 | 115 | // Accumulates the amount of motion. 116 | half acc = tex2D(_MainTex, i.uv).a; 117 | half mv_len = length(mv); 118 | // - Simple update 119 | half acc_update = acc + min(mv_len, _BlockSize) * 0.005; 120 | acc_update += rand.z * lerp(-0.02, 0.02, _Quality); 121 | // - Reset to random level 122 | half acc_reset = rand.z * 0.5 + _Quality; 123 | // - Reset if the amount of motion is larger than the block size. 124 | acc = saturate(mv_len > _BlockSize ? acc_reset : acc_update); 125 | 126 | // Pixel coordinates -> Normalized screen space 127 | mv *= (_ScreenParams.zw - 1); 128 | 129 | // Random number (changing by motion) 130 | half mrand = UVRandom(uv + mv_len); 131 | 132 | return half4(mv, mrand, acc); 133 | } 134 | 135 | // Moshing shader 136 | half4 frag_mosh(v2f_multitex i) : SV_Target 137 | { 138 | // Color from the original image 139 | half4 src = tex2D(_MainTex, i.uv1); 140 | 141 | // Displacement vector (x, y, random, acc) 142 | half4 disp = tex2D(_DispTex, i.uv0); 143 | 144 | // Color from the working buffer (slightly scaled to make it blurred) 145 | half3 work = tex2D(_WorkTex, i.uv1 - disp.xy * 0.98).rgb; 146 | 147 | // Generate some pseudo random numbers. 148 | float4 rand = frac(float4(1, 17.37135, 841.4272, 3305.121) * disp.z); 149 | 150 | // Generate noise patterns that look like DCT bases. 151 | // - Frequency 152 | float2 uv = i.uv1 * _DispTex_TexelSize.zw * (rand.x * 80 / _Contrast); 153 | // - Basis wave (vertical or horizontal) 154 | float dct = cos(lerp(uv.x, uv.y, 0.5 < rand.y)); 155 | // - Random amplitude (the high freq, the less amp) 156 | dct *= rand.z * (1 - rand.x) * _Contrast; 157 | 158 | // Conditional weighting 159 | // - DCT-ish noise: acc > 0.5 160 | float cw = (disp.w > 0.5) * dct; 161 | // - Original image: rand < (Q * 0.8 + 0.2) && acc == 1.0 162 | cw = lerp(cw, 1, rand.w < lerp(0.2, 1, _Quality) * (disp.w > 0.999)); 163 | // - If the conditions above are not met, choose work. 164 | 165 | return half4(lerp(work, src.rgb, cw), src.a); 166 | } 167 | 168 | ENDCG 169 | 170 | SubShader 171 | { 172 | Cull Off ZWrite Off ZTest Always 173 | Pass 174 | { 175 | CGPROGRAM 176 | #pragma vertex vert_img 177 | #pragma fragment frag_init 178 | #pragma target 3.0 179 | ENDCG 180 | } 181 | Pass 182 | { 183 | CGPROGRAM 184 | #pragma vertex vert_img 185 | #pragma fragment frag_update 186 | #pragma target 3.0 187 | ENDCG 188 | } 189 | Pass 190 | { 191 | CGPROGRAM 192 | #pragma vertex vert_multitex 193 | #pragma fragment frag_mosh 194 | #pragma target 3.0 195 | ENDCG 196 | } 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Shader/ColorSuite.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014, 2015 Keijiro Takahashi 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | // this software and associated documentation files (the "Software"), to deal in 6 | // the Software without restriction, including without limitation the rights to 7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | // the Software, and to permit persons to whom the Software is furnished to do so, 9 | // subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in all 12 | // copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | // 21 | 22 | Shader "Hidden/ColorSuite" 23 | { 24 | Properties 25 | { 26 | _MainTex ("-", 2D) = ""{} 27 | _Curves ("-", 2D) = ""{} 28 | _Exposure ("-", Float) = 1.0 29 | _Saturation ("-", Float) = 1.0 30 | _Balance ("-", Vector) = (1, 1, 1, 0) 31 | } 32 | 33 | CGINCLUDE 34 | 35 | // Multi-compilation options. 36 | #pragma multi_compile COLORSPACE_SRGB COLORSPACE_LINEAR 37 | #pragma multi_compile BALANCING_OFF BALANCING_ON 38 | #pragma multi_compile TONEMAPPING_OFF TONEMAPPING_ON 39 | #pragma multi_compile DITHER_OFF DITHER_ORDERED DITHER_TRIANGULAR 40 | 41 | #include "UnityCG.cginc" 42 | 43 | sampler2D _MainTex; 44 | float2 _MainTex_TexelSize; 45 | sampler2D _Curves; 46 | float _Exposure; 47 | float _Saturation; 48 | float4 _Balance; 49 | 50 | #if COLORSPACE_LINEAR 51 | 52 | // Color space conversion between sRGB and linear space. 53 | // http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html 54 | 55 | float3 srgb_to_linear(float3 c) 56 | { 57 | return c * (c * (c * 0.305306011 + 0.682171111) + 0.012522878); 58 | } 59 | 60 | float3 linear_to_srgb(float3 c) 61 | { 62 | return max(1.055 * pow(c, 0.416666667) - 0.055, 0.0); 63 | } 64 | 65 | #endif 66 | 67 | #if BALANCING_ON 68 | 69 | // Color space conversion between linear RGB and LMS 70 | // based on the CIECAM02 model (CAT02). 71 | // http://en.wikipedia.org/wiki/LMS_color_space#CAT02 72 | 73 | float3 lrgb_to_lms(float3 c) 74 | { 75 | float3x3 m = { 76 | 3.90405e-1f, 5.49941e-1f, 8.92632e-3f, 77 | 7.08416e-2f, 9.63172e-1f, 1.35775e-3f, 78 | 2.31082e-2f, 1.28021e-1f, 9.36245e-1f 79 | }; 80 | return mul(m, c); 81 | } 82 | 83 | float3 lms_to_lrgb(float3 c) 84 | { 85 | float3x3 m = { 86 | 2.85847e+0f, -1.62879e+0f, -2.48910e-2f, 87 | -2.10182e-1f, 1.15820e+0f, 3.24281e-4f, 88 | -4.18120e-2f, -1.18169e-1f, 1.06867e+0f 89 | }; 90 | return mul(m, c); 91 | } 92 | 93 | // Color balance function. 94 | // - The gamma compression/expansion equation used in this function 95 | // differs from the standard sRGB-Linear conversion. 96 | 97 | float3 apply_balance(float3 c) 98 | { 99 | #if !COLORSPACE_LINEAR 100 | // Do the gamma expansion before applying the color balance. 101 | c = pow(c, 2.2); 102 | #endif 103 | 104 | // Apply the color balance in the LMS color space. 105 | c = lms_to_lrgb(lrgb_to_lms(c) * _Balance); 106 | 107 | // It may return a minus value, which should be cropped out. 108 | c = max(c, 0.0); 109 | 110 | #if !COLORSPACE_LINEAR 111 | // Gamma compression. 112 | c = pow(c, 1.0 / 2.2); 113 | #endif 114 | 115 | return c; 116 | } 117 | 118 | #endif 119 | 120 | #if TONEMAPPING_ON 121 | 122 | // John Hable's filmic tone mapping operator. 123 | // http://filmicgames.com/archives/6 124 | 125 | float3 hable_op(float3 c) 126 | { 127 | float A = 0.15; 128 | float B = 0.50; 129 | float C = 0.10; 130 | float D = 0.20; 131 | float E = 0.02; 132 | float F = 0.30; 133 | return ((c * (c * A + B * C) + D * E) / (c * (c * A + B) + D * F)) - E / F; 134 | } 135 | 136 | float3 tone_mapping(float3 c) 137 | { 138 | c *= _Exposure * 4; 139 | c = hable_op(c) / hable_op(11.2); 140 | return pow(c, 1 / 2.2); 141 | } 142 | 143 | #endif 144 | 145 | // Color saturation. 146 | 147 | float luma(float3 c) 148 | { 149 | return 0.212 * c.r + 0.701 * c.g + 0.087 * c.b; 150 | } 151 | 152 | float3 apply_saturation(float3 c) 153 | { 154 | return lerp((float3)luma(c), c, _Saturation); 155 | } 156 | 157 | // RGB curves. 158 | 159 | float3 apply_curves(float3 c) 160 | { 161 | float4 r = tex2D(_Curves, float2(c.r, 0)); 162 | float4 g = tex2D(_Curves, float2(c.g, 0)); 163 | float4 b = tex2D(_Curves, float2(c.b, 0)); 164 | return float3(r.r * r.a, g.g * g.a, b.b * b.a); 165 | } 166 | 167 | #if DITHER_ORDERED 168 | 169 | // Interleaved gradient function from CoD AW. 170 | // http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare 171 | 172 | float interleaved_gradient(float2 uv) 173 | { 174 | float3 magic = float3(0.06711056, 0.00583715, 52.9829189); 175 | return frac(magic.z * frac(dot(uv, magic.xy))); 176 | } 177 | 178 | float3 dither(float2 uv) 179 | { 180 | return (float3)(interleaved_gradient(uv / _MainTex_TexelSize) / 255); 181 | } 182 | 183 | #endif 184 | 185 | #if DITHER_TRIANGULAR 186 | 187 | // Triangular PDF. 188 | 189 | float nrand(float2 uv) 190 | { 191 | return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453); 192 | } 193 | 194 | float3 dither(float2 uv) 195 | { 196 | float r = nrand(uv) + nrand(uv + (float2)1.1) - 0.5; 197 | return (float3)(r / 255); 198 | } 199 | 200 | #endif 201 | 202 | float4 frag(v2f_img i) : SV_Target 203 | { 204 | float4 source = tex2D(_MainTex, i.uv); 205 | float3 rgb = source.rgb; 206 | 207 | #if BALANCING_ON 208 | rgb = apply_balance(rgb); 209 | #endif 210 | 211 | #if COLORSPACE_LINEAR 212 | #if TONEMAPPING_ON 213 | // Apply the tone mapping. 214 | rgb = tone_mapping(rgb); 215 | #else 216 | // Convert the color into the sRGB color space. 217 | rgb = linear_to_srgb(rgb); 218 | #endif 219 | #endif 220 | 221 | // Color saturation. 222 | rgb = apply_saturation(rgb); 223 | 224 | // RGB curves. 225 | rgb = apply_curves(rgb); 226 | 227 | #if !DITHER_OFF 228 | rgb += dither(i.uv); 229 | #endif 230 | 231 | #if COLORSPACE_LINEAR 232 | // Take the color back into the linear color space. 233 | rgb = srgb_to_linear(rgb); 234 | #endif 235 | 236 | return float4(rgb, source.a); 237 | } 238 | 239 | ENDCG 240 | 241 | Subshader 242 | { 243 | Pass 244 | { 245 | ZTest Always Cull Off ZWrite Off 246 | Fog { Mode off } 247 | CGPROGRAM 248 | #pragma target 3.0 249 | #pragma glsl 250 | #pragma vertex vert_img 251 | #pragma fragment frag 252 | ENDCG 253 | } 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /Assets/Kino/Datamosh/Datamosh.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Datamosh - Glitch effect simulating video compression artifacts 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | 26 | namespace Kino 27 | { 28 | [RequireComponent(typeof(Camera))] 29 | public class Datamosh : MonoBehaviour 30 | { 31 | #region Public properties and methods 32 | 33 | /// Size of compression macroblock. 34 | public int blockSize { 35 | get { return Mathf.Max(4, _blockSize) ; } 36 | set { _blockSize = value; } 37 | } 38 | 39 | [SerializeField] 40 | [Tooltip("Size of compression macroblock.")] 41 | int _blockSize = 16; 42 | 43 | /// Entropy coefficient. The larger value makes the stronger noise. 44 | public float entropy { 45 | get { return _entropy; } 46 | set { _entropy = value; } 47 | } 48 | 49 | [SerializeField, Range(0, 1)] 50 | [Tooltip("Entropy coefficient. The larger value makes the stronger noise.")] 51 | float _entropy = 0.5f; 52 | 53 | /// Contrast of stripe-shaped noise. 54 | public float noiseContrast { 55 | get { return _noiseContrast; } 56 | set { _noiseContrast = value; } 57 | } 58 | 59 | [SerializeField, Range(0.5f, 4.0f)] 60 | [Tooltip("Contrast of stripe-shaped noise.")] 61 | float _noiseContrast = 1; 62 | 63 | /// Scale factor for velocity vectors. 64 | public float velocityScale { 65 | get { return _velocityScale; } 66 | set { _velocityScale = value; } 67 | } 68 | 69 | [SerializeField, Range(0, 2)] 70 | [Tooltip("Scale factor for velocity vectors.")] 71 | float _velocityScale = 0.8f; 72 | 73 | /// Amount of random displacement. 74 | public float diffusion { 75 | get { return _diffusion; } 76 | set { _diffusion = value; } 77 | } 78 | 79 | [SerializeField, Range(0, 2)] 80 | [Tooltip("Amount of random displacement.")] 81 | float _diffusion = 0.4f; 82 | 83 | /// Start glitching. 84 | public void Glitch() 85 | { 86 | _sequence = 1; 87 | } 88 | 89 | /// Stop glitching. 90 | public void Reset() 91 | { 92 | _sequence = 0; 93 | } 94 | 95 | #endregion 96 | 97 | #region Private properties 98 | 99 | [SerializeField] 100 | Shader _shader; 101 | 102 | Material _material; 103 | 104 | RenderTexture _workBuffer; // working buffer 105 | RenderTexture _dispBuffer; // displacement buffer 106 | 107 | int _sequence; 108 | int _lastFrame; 109 | 110 | RenderTexture NewWorkBuffer(RenderTexture source) 111 | { 112 | return RenderTexture.GetTemporary(source.width, source.height); 113 | } 114 | 115 | RenderTexture NewDispBuffer(RenderTexture source) 116 | { 117 | var rt = RenderTexture.GetTemporary( 118 | source.width / _blockSize, 119 | source.height / _blockSize, 120 | 0, RenderTextureFormat.ARGBHalf 121 | ); 122 | rt.filterMode = FilterMode.Point; 123 | return rt; 124 | } 125 | 126 | void ReleaseBuffer(RenderTexture buffer) 127 | { 128 | if (buffer != null) RenderTexture.ReleaseTemporary(buffer); 129 | } 130 | 131 | #endregion 132 | 133 | #region MonoBehaviour functions 134 | 135 | void OnEnable() 136 | { 137 | _material = new Material(Shader.Find("Hidden/Kino/Datamosh")); 138 | _material.hideFlags = HideFlags.DontSave; 139 | 140 | GetComponent().depthTextureMode |= 141 | DepthTextureMode.Depth | DepthTextureMode.MotionVectors; 142 | 143 | _sequence = 0; 144 | } 145 | 146 | void OnDisable() 147 | { 148 | ReleaseBuffer(_workBuffer); 149 | _workBuffer = null; 150 | 151 | ReleaseBuffer(_dispBuffer); 152 | _dispBuffer = null; 153 | 154 | DestroyImmediate(_material); 155 | _material = null; 156 | } 157 | 158 | void OnRenderImage(RenderTexture source, RenderTexture destination) 159 | { 160 | _material.SetFloat("_BlockSize", _blockSize); 161 | _material.SetFloat("_Quality", 1 - _entropy); 162 | _material.SetFloat("_Contrast", _noiseContrast); 163 | _material.SetFloat("_Velocity", _velocityScale); 164 | _material.SetFloat("_Diffusion", _diffusion); 165 | 166 | if (_sequence == 0) 167 | { 168 | // Step 0: no effect, just keep the last frame. 169 | 170 | // Update the working buffer with the current frame. 171 | ReleaseBuffer(_workBuffer); 172 | _workBuffer = NewWorkBuffer(source); 173 | Graphics.Blit(source, _workBuffer); 174 | 175 | // Blit without effect. 176 | Graphics.Blit(source, destination); 177 | } 178 | else if (_sequence == 1) 179 | { 180 | // Step 1: start effect, no moshing. 181 | 182 | // Initialize the displacement buffer. 183 | ReleaseBuffer(_dispBuffer); 184 | _dispBuffer = NewDispBuffer(source); 185 | Graphics.Blit(null, _dispBuffer, _material, 0); 186 | 187 | // Simply blit the working buffer because motion vectors 188 | // might not be ready (because of camera switching). 189 | Graphics.Blit(_workBuffer, destination); 190 | 191 | _sequence++; 192 | } 193 | else 194 | { 195 | // Step 2: apply effect. 196 | 197 | if (Time.frameCount != _lastFrame) 198 | { 199 | // Update the displaceent buffer. 200 | var newDisp = NewDispBuffer(source); 201 | Graphics.Blit(_dispBuffer, newDisp, _material, 1); 202 | ReleaseBuffer(_dispBuffer); 203 | _dispBuffer = newDisp; 204 | 205 | // Moshing! 206 | var newWork = NewWorkBuffer(source); 207 | _material.SetTexture("_WorkTex", _workBuffer); 208 | _material.SetTexture("_DispTex", _dispBuffer); 209 | Graphics.Blit(source, newWork, _material, 2); 210 | ReleaseBuffer(_workBuffer); 211 | _workBuffer = newWork; 212 | 213 | _lastFrame = Time.frameCount; 214 | } 215 | 216 | // Blit the result. 217 | Graphics.Blit(_workBuffer, destination); 218 | } 219 | } 220 | 221 | #endregion 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /Assets/Klak/Math/Tween.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Klak - Utilities for creative coding with Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using Klak.VectorMathExtension; 26 | 27 | namespace Klak.Math 28 | { 29 | /// Exponential interpolation 30 | static class ETween 31 | { 32 | #region Static Functions 33 | 34 | public static float Step( 35 | float current, float target, float omega) 36 | { 37 | var exp = Mathf.Exp(-omega * Time.deltaTime); 38 | return Mathf.Lerp(target, current, exp); 39 | } 40 | 41 | public static float StepAngle( 42 | float current, float target, float omega) 43 | { 44 | var exp = Mathf.Exp(-omega * Time.deltaTime); 45 | var delta = Mathf.DeltaAngle(current, target); 46 | return target - delta * exp; 47 | } 48 | 49 | public static Vector3 Step( 50 | Vector3 current, Vector3 target, float omega) 51 | { 52 | var exp = Mathf.Exp(-omega * Time.deltaTime); 53 | return Vector3.Lerp(target, current, exp); 54 | } 55 | 56 | public static Quaternion Step( 57 | Quaternion current, Quaternion target, float omega) 58 | { 59 | if (current == target) return target; 60 | var exp = Mathf.Exp(-omega * Time.deltaTime); 61 | return Quaternion.Lerp(target, current, exp); 62 | 63 | } 64 | 65 | #endregion 66 | } 67 | 68 | /// Interpolation with critically damped spring model 69 | struct DTween 70 | { 71 | #region Static Functions 72 | 73 | public static float Step( 74 | float current, float target, ref float velocity, float omega) 75 | { 76 | var dt = Time.deltaTime; 77 | var n1 = velocity - (current - target) * (omega * omega * dt); 78 | var n2 = 1 + omega * dt; 79 | velocity = n1 / (n2 * n2); 80 | return current + velocity * dt; 81 | } 82 | 83 | public static Vector2 Step( 84 | Vector2 current, Vector2 target, ref Vector2 velocity, float omega) 85 | { 86 | var dt = Time.deltaTime; 87 | var n1 = velocity - (current - target) * (omega * omega * dt); 88 | var n2 = 1 + omega * dt; 89 | velocity = n1 / (n2 * n2); 90 | return current + velocity * dt; 91 | } 92 | 93 | public static Vector3 Step( 94 | Vector3 current, Vector3 target, ref Vector3 velocity, float omega) 95 | { 96 | var dt = Time.deltaTime; 97 | var n1 = velocity - (current - target) * (omega * omega * dt); 98 | var n2 = 1 + omega * dt; 99 | velocity = n1 / (n2 * n2); 100 | return current + velocity * dt; 101 | } 102 | 103 | public static Vector4 Step( 104 | Vector4 current, Vector4 target, ref Vector4 velocity, float omega) 105 | { 106 | var dt = Time.deltaTime; 107 | var n1 = velocity - (current - target) * (omega * omega * dt); 108 | var n2 = 1 + omega * dt; 109 | velocity = n1 / (n2 * n2); 110 | return current + velocity * dt; 111 | } 112 | 113 | public static Quaternion Step( 114 | Quaternion current, Quaternion target, 115 | ref Vector4 velocity, float omega) 116 | { 117 | var vcurrent = current.ToVector4(); 118 | var vtarget = target.ToVector4(); 119 | // We can use either of vtarget/-vtarget. Use closer one. 120 | if (Vector4.Dot(vcurrent, vtarget) < 0) vtarget = -vtarget; 121 | var dt = Time.deltaTime; 122 | var n1 = velocity - (vcurrent - vtarget) * (omega * omega * dt); 123 | var n2 = 1 + omega * dt; 124 | velocity = n1 / (n2 * n2); 125 | return (vcurrent + velocity * dt).ToNormalizedQuaternion(); 126 | } 127 | 128 | #endregion 129 | 130 | #region Struct Implementation 131 | 132 | public float position; 133 | public float velocity; 134 | public float omega; 135 | 136 | public DTween(float position, float omega) 137 | { 138 | this.position = position; 139 | this.velocity = 0; 140 | this.omega = omega; 141 | } 142 | 143 | public void Step(float target) 144 | { 145 | position = Step(position, target, ref velocity, omega); 146 | } 147 | 148 | public static implicit operator float(DTween m) 149 | { 150 | return m.position; 151 | } 152 | 153 | #endregion 154 | } 155 | 156 | /// Interpolation with critically damped spring model 157 | struct DTweenVector2 158 | { 159 | public Vector2 position; 160 | public Vector2 velocity; 161 | public float omega; 162 | 163 | public DTweenVector2(Vector2 position, float omega) 164 | { 165 | this.position = position; 166 | this.velocity = Vector2.zero; 167 | this.omega = omega; 168 | } 169 | 170 | public void Step(Vector2 target) 171 | { 172 | position = DTween.Step(position, target, ref velocity, omega); 173 | } 174 | 175 | public static implicit operator Vector2(DTweenVector2 m) 176 | { 177 | return m.position; 178 | } 179 | } 180 | 181 | /// Interpolation with critically damped spring model 182 | struct DTweenVector3 183 | { 184 | public Vector3 position; 185 | public Vector3 velocity; 186 | public float omega; 187 | 188 | public DTweenVector3(Vector3 position, float omega) 189 | { 190 | this.position = position; 191 | this.velocity = Vector3.zero; 192 | this.omega = omega; 193 | } 194 | 195 | public void Step(Vector3 target) 196 | { 197 | position = DTween.Step(position, target, ref velocity, omega); 198 | } 199 | 200 | public static implicit operator Vector3(DTweenVector3 m) 201 | { 202 | return m.position; 203 | } 204 | } 205 | 206 | /// Interpolation with critically damped spring model 207 | struct DTweenQuaternion 208 | { 209 | public Quaternion rotation; 210 | public Vector4 velocity; 211 | public float omega; 212 | 213 | public DTweenQuaternion(Quaternion rotation, float omega) 214 | { 215 | this.rotation = rotation; 216 | this.velocity = Vector4.zero; 217 | this.omega = omega; 218 | } 219 | 220 | public void Step(Quaternion target) 221 | { 222 | rotation = DTween.Step(rotation, target, ref velocity, omega); 223 | } 224 | 225 | public static implicit operator Quaternion(DTweenQuaternion m) 226 | { 227 | return m.rotation; 228 | } 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /Assets/ColorSuite/ColorSuite.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014, 2015 Keijiro Takahashi 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | // this software and associated documentation files (the "Software"), to deal in 6 | // the Software without restriction, including without limitation the rights to 7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | // the Software, and to permit persons to whom the Software is furnished to do so, 9 | // subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in all 12 | // copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | // 21 | using UnityEngine; 22 | using System.Collections; 23 | 24 | [ExecuteInEditMode] 25 | [ImageEffectTransformsToLDR] 26 | [RequireComponent(typeof(Camera))] 27 | [AddComponentMenu("Image Effects/Color Adjustments/Color Suite")] 28 | public class ColorSuite : MonoBehaviour 29 | { 30 | #region Public Properties 31 | 32 | // White balance. 33 | [SerializeField] float _colorTemp = 0.0f; 34 | [SerializeField] float _colorTint = 0.0f; 35 | 36 | public float colorTemp { 37 | get { return _colorTemp; } 38 | set { _colorTemp = value; } 39 | } 40 | public float colorTint { 41 | get { return _colorTint; } 42 | set { _colorTint = value; } 43 | } 44 | 45 | // Tone mapping. 46 | [SerializeField] bool _toneMapping = false; 47 | [SerializeField] float _exposure = 1.0f; 48 | 49 | public bool toneMapping { 50 | get { return _toneMapping; } 51 | set { _toneMapping = value; } 52 | } 53 | public float exposure { 54 | get { return _exposure; } 55 | set { _exposure = value; } 56 | } 57 | 58 | // Color saturation. 59 | [SerializeField] float _saturation = 1.0f; 60 | 61 | public float saturation { 62 | get { return _saturation; } 63 | set { _saturation = value; } 64 | } 65 | 66 | // Curves. 67 | [SerializeField] AnimationCurve _rCurve = AnimationCurve.Linear(0, 0, 1, 1); 68 | [SerializeField] AnimationCurve _gCurve = AnimationCurve.Linear(0, 0, 1, 1); 69 | [SerializeField] AnimationCurve _bCurve = AnimationCurve.Linear(0, 0, 1, 1); 70 | [SerializeField] AnimationCurve _cCurve = AnimationCurve.Linear(0, 0, 1, 1); 71 | 72 | public AnimationCurve redCurve { 73 | get { return _rCurve; } 74 | set { _rCurve = value; UpdateLUT(); } 75 | } 76 | public AnimationCurve greenCurve { 77 | get { return _gCurve; } 78 | set { _gCurve = value; UpdateLUT(); } 79 | } 80 | public AnimationCurve blueCurve { 81 | get { return _bCurve; } 82 | set { _bCurve = value; UpdateLUT(); } 83 | } 84 | public AnimationCurve rgbCurve { 85 | get { return _cCurve; } 86 | set { _cCurve = value; UpdateLUT(); } 87 | } 88 | 89 | // Dithering. 90 | public enum DitherMode { Off, Ordered, Triangular } 91 | [SerializeField] DitherMode _ditherMode = DitherMode.Off; 92 | 93 | public DitherMode ditherMode { 94 | get { return _ditherMode; } 95 | set { _ditherMode = value; } 96 | } 97 | 98 | #endregion 99 | 100 | #region Internal Properties 101 | 102 | // Reference to the shader. 103 | [SerializeField] Shader shader; 104 | 105 | // Temporary objects. 106 | Material _material; 107 | Texture2D _lutTexture; 108 | 109 | #endregion 110 | 111 | #region Local Functions 112 | 113 | // RGBM encoding. 114 | static Color EncodeRGBM(float r, float g, float b) 115 | { 116 | var a = Mathf.Max(Mathf.Max(r, g), Mathf.Max(b, 1e-6f)); 117 | a = Mathf.Ceil(a * 255) / 255; 118 | return new Color(r / a, g / a, b / a, a); 119 | } 120 | 121 | // An analytical model of chromaticity of the standard illuminant, by Judd et al. 122 | // http://en.wikipedia.org/wiki/Standard_illuminant#Illuminant_series_D 123 | // Slightly modifed to adjust it with the D65 white point (x=0.31271, y=0.32902). 124 | static float StandardIlluminantY(float x) 125 | { 126 | return 2.87f * x - 3.0f * x * x - 0.27509507f; 127 | } 128 | 129 | // CIE xy chromaticity to CAT02 LMS. 130 | // http://en.wikipedia.org/wiki/LMS_color_space#CAT02 131 | static Vector3 CIExyToLMS(float x, float y) 132 | { 133 | var Y = 1.0f; 134 | var X = Y * x / y; 135 | var Z = Y * (1.0f - x - y) / y; 136 | 137 | var L = 0.7328f * X + 0.4296f * Y - 0.1624f * Z; 138 | var M = -0.7036f * X + 1.6975f * Y + 0.0061f * Z; 139 | var S = 0.0030f * X + 0.0136f * Y + 0.9834f * Z; 140 | 141 | return new Vector3(L, M, S); 142 | } 143 | 144 | #endregion 145 | 146 | #region Private Methods 147 | 148 | // Set up the temporary assets. 149 | void Setup() 150 | { 151 | if (_material == null) 152 | { 153 | _material = new Material(shader); 154 | _material.hideFlags = HideFlags.DontSave; 155 | } 156 | 157 | if (_lutTexture == null) 158 | { 159 | _lutTexture = new Texture2D(512, 1, TextureFormat.ARGB32, false, true); 160 | _lutTexture.hideFlags = HideFlags.DontSave; 161 | _lutTexture.wrapMode = TextureWrapMode.Clamp; 162 | UpdateLUT(); 163 | } 164 | } 165 | 166 | // Update the LUT texture. 167 | void UpdateLUT() 168 | { 169 | for (var x = 0; x < _lutTexture.width; x++) 170 | { 171 | var u = 1.0f / (_lutTexture.width - 1) * x; 172 | var r = _cCurve.Evaluate(_rCurve.Evaluate(u)); 173 | var g = _cCurve.Evaluate(_gCurve.Evaluate(u)); 174 | var b = _cCurve.Evaluate(_bCurve.Evaluate(u)); 175 | _lutTexture.SetPixel(x, 0, EncodeRGBM(r, g, b)); 176 | } 177 | _lutTexture.Apply(); 178 | } 179 | 180 | // Calculate the color balance coefficients. 181 | Vector3 CalculateColorBalance() 182 | { 183 | // Get the CIE xy chromaticity of the reference white point. 184 | // Note: 0.31271 = x value on the D65 white point 185 | var x = 0.31271f - _colorTemp * (_colorTemp < 0.0f ? 0.1f : 0.05f); 186 | var y = StandardIlluminantY(x) + _colorTint * 0.05f; 187 | 188 | // Calculate the coefficients in the LMS space. 189 | var w1 = new Vector3(0.949237f, 1.03542f, 1.08728f); // D65 white point 190 | var w2 = CIExyToLMS(x, y); 191 | return new Vector3(w1.x / w2.x, w1.y / w2.y, w1.z / w2.z); 192 | } 193 | 194 | #endregion 195 | 196 | #region Monobehaviour Functions 197 | 198 | void Start() 199 | { 200 | Setup(); 201 | } 202 | 203 | void OnValidate() 204 | { 205 | Setup(); 206 | UpdateLUT(); 207 | } 208 | 209 | void Reset() 210 | { 211 | Setup(); 212 | UpdateLUT(); 213 | } 214 | 215 | void OnRenderImage(RenderTexture source, RenderTexture destination) 216 | { 217 | var linear = QualitySettings.activeColorSpace == ColorSpace.Linear; 218 | 219 | Setup(); 220 | 221 | if (linear) 222 | _material.EnableKeyword("COLORSPACE_LINEAR"); 223 | else 224 | _material.DisableKeyword("COLORSPACE_LINEAR"); 225 | 226 | if (_colorTemp != 0.0f || _colorTint != 0.0f) 227 | { 228 | _material.EnableKeyword("BALANCING_ON"); 229 | _material.SetVector("_Balance", CalculateColorBalance()); 230 | } 231 | else 232 | _material.DisableKeyword("BALANCING_ON"); 233 | 234 | if (_toneMapping && linear) 235 | { 236 | _material.EnableKeyword("TONEMAPPING_ON"); 237 | _material.SetFloat("_Exposure", _exposure); 238 | } 239 | else 240 | _material.DisableKeyword("TONEMAPPING_ON"); 241 | 242 | _material.SetTexture("_Curves", _lutTexture); 243 | _material.SetFloat("_Saturation", _saturation); 244 | 245 | if (_ditherMode == DitherMode.Ordered) 246 | { 247 | _material.EnableKeyword("DITHER_ORDERED"); 248 | _material.DisableKeyword("DITHER_TRIANGULAR"); 249 | } 250 | else if (_ditherMode == DitherMode.Triangular) 251 | { 252 | _material.DisableKeyword("DITHER_ORDERED"); 253 | _material.EnableKeyword("DITHER_TRIANGULAR"); 254 | } 255 | else 256 | { 257 | _material.DisableKeyword("DITHER_ORDERED"); 258 | _material.DisableKeyword("DITHER_TRIANGULAR"); 259 | } 260 | 261 | Graphics.Blit(source, destination, _material); 262 | } 263 | 264 | #endregion 265 | } 266 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Shader/Obscurance.cginc: -------------------------------------------------------------------------------- 1 | // Upgrade NOTE: commented out 'float4x4 _WorldToCamera', a built-in variable 2 | // Upgrade NOTE: replaced '_WorldToCamera' with 'unity_WorldToCamera' 3 | 4 | // -------- 5 | // Additional options for further customization 6 | // -------- 7 | 8 | // By default, a fixed sampling pattern is used in the AO estimator. 9 | // Although this gives preferable results in most cases, a completely 10 | // random sampling pattern could give aesthetically good results in some 11 | // cases. Comment out the line below to use the random pattern instead of 12 | // the fixed one. 13 | #define FIX_SAMPLING_PATTERN 1 14 | 15 | // The constant below determines the contrast of occlusion. Altough this 16 | // allows intentional over/under occlusion, currently is not exposed to the 17 | // editor, because it’s thought to be rarely useful. 18 | static const float kContrast = 0.6; 19 | 20 | // The constant below controls the geometry-awareness of the blur filter. 21 | // The higher value, the more sensitive it is. 22 | static const float kGeometry = 50; 23 | 24 | // The constants below are used in the AO estimator. Beta is mainly used 25 | // for suppressing self-shadowing noise, and Epsilon is used to prevent 26 | // calculation underflow. See the paper (Morgan 2011 http://goo.gl/2iz3P) 27 | // for further details of these constants. 28 | static const float kBeta = 0.002; 29 | static const float kEpsilon = 1e-4; 30 | 31 | // -------- 32 | 33 | #include "UnityCG.cginc" 34 | 35 | // Global shader properties 36 | sampler2D _CameraGBufferTexture2; 37 | sampler2D_float _CameraDepthTexture; 38 | sampler2D _CameraDepthNormalsTexture; 39 | // float4x4 _WorldToCamera; 40 | 41 | // Source texture properties 42 | sampler2D _MainTex; 43 | float4 _MainTex_TexelSize; 44 | sampler2D _ObscuranceTexture; 45 | 46 | // Material shader properties 47 | int _SampleCount; 48 | half _Intensity; 49 | float _Radius; 50 | float _TargetScale; 51 | float2 _BlurVector; 52 | 53 | // Utility for sin/cos 54 | float2 CosSin(float theta) 55 | { 56 | float sn, cs; 57 | sincos(theta, sn, cs); 58 | return float2(cs, sn); 59 | } 60 | 61 | // Gamma encoding function for AO value 62 | // (do nothing if in the linear mode) 63 | half EncodeAO(half x) 64 | { 65 | // Gamma encoding 66 | half x_g = 1 - pow(1 - x, 1 / 2.2); 67 | // ColorSpaceLuminance.w is 0 (gamma) or 1 (linear). 68 | return lerp(x_g, x, unity_ColorSpaceLuminance.w); 69 | } 70 | 71 | // Pseudo random number generator with 2D argument 72 | float UVRandom(float u, float v) 73 | { 74 | float f = dot(float2(12.9898, 78.233), float2(u, v)); 75 | return frac(43758.5453 * sin(f)); 76 | } 77 | 78 | // Interleaved gradient function from Jimenez 2014 http://goo.gl/eomGso 79 | float GradientNoise(float2 uv) 80 | { 81 | uv = floor(uv * _ScreenParams.xy); 82 | float f = dot(float2(0.06711056f, 0.00583715f), uv); 83 | return frac(52.9829189f * frac(f)); 84 | } 85 | 86 | // Boundary check for depth sampler 87 | // (returns a very large value if it lies out of bounds) 88 | float CheckBounds(float2 uv, float d) 89 | { 90 | float ob = any(uv < 0) + any(uv > 1); 91 | #if defined(UNITY_REVERSED_Z) 92 | ob += (d <= 0.00001); 93 | #else 94 | ob += (d >= 0.99999); 95 | #endif 96 | return ob * 1e8; 97 | } 98 | 99 | // Depth/normal sampling functions 100 | float SampleDepth(float2 uv) 101 | { 102 | #if SOURCE_GBUFFER || SOURCE_DEPTH 103 | float d = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 104 | return LinearEyeDepth(d) + CheckBounds(uv, d); 105 | #else 106 | float4 cdn = tex2D(_CameraDepthNormalsTexture, uv); 107 | float d = DecodeFloatRG(cdn.zw); 108 | return d * _ProjectionParams.z + CheckBounds(uv, d); 109 | #endif 110 | } 111 | 112 | float3 SampleNormal(float2 uv) 113 | { 114 | #if SOURCE_GBUFFER 115 | float3 norm = tex2D(_CameraGBufferTexture2, uv).xyz * 2 - 1; 116 | return mul((float3x3)unity_WorldToCamera, norm); 117 | #else 118 | float4 cdn = tex2D(_CameraDepthNormalsTexture, uv); 119 | return DecodeViewNormalStereo(cdn) * float3(1, 1, -1); 120 | #endif 121 | } 122 | 123 | float SampleDepthNormal(float2 uv, out float3 normal) 124 | { 125 | #if SOURCE_GBUFFER || SOURCE_DEPTH 126 | normal = SampleNormal(uv); 127 | return SampleDepth(uv); 128 | #else 129 | float4 cdn = tex2D(_CameraDepthNormalsTexture, uv); 130 | normal = DecodeViewNormalStereo(cdn) * float3(1, 1, -1); 131 | float d = DecodeFloatRG(cdn.zw); 132 | return d * _ProjectionParams.z + CheckBounds(uv, d); 133 | #endif 134 | } 135 | 136 | // Reconstruct view-space position from UV and depth. 137 | // p11_22 = (unity_CameraProjection._11, unity_CameraProjection._22) 138 | // p13_31 = (unity_CameraProjection._13, unity_CameraProjection._23) 139 | float3 ReconstructViewPos(float2 uv, float depth, float2 p11_22, float2 p13_31) 140 | { 141 | return float3((uv * 2 - 1 - p13_31) / p11_22, 1) * depth; 142 | } 143 | 144 | // Normal vector comparer (for geometry-aware weighting) 145 | half CompareNormal(half3 d1, half3 d2) 146 | { 147 | return pow((dot(d1, d2) + 1) * 0.5, kGeometry); 148 | } 149 | 150 | // Final combiner function 151 | half3 CombineObscurance(half3 src, half3 ao) 152 | { 153 | return lerp(src, 0, EncodeAO(ao)); 154 | } 155 | 156 | // Sample point picker 157 | float3 PickSamplePoint(float2 uv, float index) 158 | { 159 | // Uniformaly distributed points on a unit sphere http://goo.gl/X2F1Ho 160 | #if FIX_SAMPLING_PATTERN 161 | float gn = GradientNoise(uv * _TargetScale); 162 | float u = frac(UVRandom(0, index) + gn) * 2 - 1; 163 | float theta = (UVRandom(1, index) + gn) * UNITY_PI * 2; 164 | #else 165 | float u = UVRandom(uv.x + _Time.x, uv.y + index) * 2 - 1; 166 | float theta = UVRandom(-uv.x - _Time.x, uv.y + index) * UNITY_PI * 2; 167 | #endif 168 | float3 v = float3(CosSin(theta) * sqrt(1 - u * u), u); 169 | // Make them distributed between [0, _Radius] 170 | float l = sqrt((index + 1) / _SampleCount) * _Radius; 171 | return v * l; 172 | } 173 | 174 | // Obscurance estimator function 175 | float EstimateObscurance(float2 uv) 176 | { 177 | // Parameters used in coordinate conversion 178 | float3x3 proj = (float3x3)unity_CameraProjection; 179 | float2 p11_22 = float2(unity_CameraProjection._11, unity_CameraProjection._22); 180 | float2 p13_31 = float2(unity_CameraProjection._13, unity_CameraProjection._23); 181 | 182 | // View space normal and depth 183 | float3 norm_o; 184 | float depth_o = SampleDepthNormal(uv, norm_o); 185 | 186 | #if SOURCE_DEPTHNORMALS 187 | // Offset the depth value to avoid precision error. 188 | // (depth in the DepthNormals mode has only 16-bit precision) 189 | depth_o -= _ProjectionParams.z / 65536; 190 | #endif 191 | 192 | // Reconstruct the view-space position. 193 | float3 vpos_o = ReconstructViewPos(uv, depth_o, p11_22, p13_31); 194 | 195 | // Distance-based AO estimator based on Morgan 2011 http://goo.gl/2iz3P 196 | float ao = 0.0; 197 | 198 | for (int s = 0; s < _SampleCount; s++) 199 | { 200 | // Sample point 201 | #if SHADER_API_D3D11 202 | // This 'floor(1.0001 * s)' operation is needed to avoid a NVidia 203 | // shader issue. This issue is only observed on DX11. 204 | float3 v_s1 = PickSamplePoint(uv, floor(1.0001 * s)); 205 | #else 206 | float3 v_s1 = PickSamplePoint(uv, s); 207 | #endif 208 | v_s1 = faceforward(v_s1, -norm_o, v_s1); 209 | float3 vpos_s1 = vpos_o + v_s1; 210 | 211 | // Reproject the sample point 212 | float3 spos_s1 = mul(proj, vpos_s1); 213 | float2 uv_s1 = (spos_s1.xy / vpos_s1.z + 1) * 0.5; 214 | 215 | // Depth at the sample point 216 | float depth_s1 = SampleDepth(uv_s1); 217 | 218 | // Relative position of the sample point 219 | float3 vpos_s2 = ReconstructViewPos(uv_s1, depth_s1, p11_22, p13_31); 220 | float3 v_s2 = vpos_s2 - vpos_o; 221 | 222 | // Estimate the obscurance value 223 | float a1 = max(dot(v_s2, norm_o) - kBeta * depth_o, 0); 224 | float a2 = dot(v_s2, v_s2) + kEpsilon; 225 | ao += a1 / a2; 226 | } 227 | 228 | ao *= _Radius; // intensity normalization 229 | 230 | // Apply other parameters. 231 | return pow(ao * _Intensity / _SampleCount, kContrast); 232 | } 233 | 234 | // Geometry-aware separable blur filter (large kernel) 235 | half SeparableBlurLarge(sampler2D tex, float2 uv, float2 delta) 236 | { 237 | #if !SHADER_API_MOBILE 238 | // 9-tap Gaussian blur with adaptive sampling 239 | float2 uv1a = uv - delta; 240 | float2 uv1b = uv + delta; 241 | float2 uv2a = uv - delta * 2; 242 | float2 uv2b = uv + delta * 2; 243 | float2 uv3a = uv - delta * 3.2307692308; 244 | float2 uv3b = uv + delta * 3.2307692308; 245 | 246 | half3 n0 = SampleNormal(uv); 247 | 248 | half w0 = 0.37004405286; 249 | half w1a = CompareNormal(n0, SampleNormal(uv1a)) * 0.31718061674; 250 | half w1b = CompareNormal(n0, SampleNormal(uv1b)) * 0.31718061674; 251 | half w2a = CompareNormal(n0, SampleNormal(uv2a)) * 0.19823788546; 252 | half w2b = CompareNormal(n0, SampleNormal(uv2b)) * 0.19823788546; 253 | half w3a = CompareNormal(n0, SampleNormal(uv3a)) * 0.11453744493; 254 | half w3b = CompareNormal(n0, SampleNormal(uv3b)) * 0.11453744493; 255 | 256 | half s = tex2D(_MainTex, uv).r * w0; 257 | s += tex2D(_MainTex, uv1a).r * w1a; 258 | s += tex2D(_MainTex, uv1b).r * w1b; 259 | s += tex2D(_MainTex, uv2a).r * w2a; 260 | s += tex2D(_MainTex, uv2b).r * w2b; 261 | s += tex2D(_MainTex, uv3a).r * w3a; 262 | s += tex2D(_MainTex, uv3b).r * w3b; 263 | 264 | return s / (w0 + w1a + w1b + w2a + w2b + w3a + w3b); 265 | #else 266 | // 9-tap Gaussian blur with linear sampling 267 | // (less quality but slightly fast) 268 | float2 uv1a = uv - delta * 1.3846153846; 269 | float2 uv1b = uv + delta * 1.3846153846; 270 | float2 uv2a = uv - delta * 3.2307692308; 271 | float2 uv2b = uv + delta * 3.2307692308; 272 | 273 | half3 n0 = SampleNormal(uv); 274 | 275 | half w0 = 0.2270270270; 276 | half w1a = CompareNormal(n0, SampleNormal(uv1a)) * 0.3162162162; 277 | half w1b = CompareNormal(n0, SampleNormal(uv1b)) * 0.3162162162; 278 | half w2a = CompareNormal(n0, SampleNormal(uv2a)) * 0.0702702703; 279 | half w2b = CompareNormal(n0, SampleNormal(uv2b)) * 0.0702702703; 280 | 281 | half s = tex2D(_MainTex, uv).r * w0; 282 | s += tex2D(_MainTex, uv1a).r * w1a; 283 | s += tex2D(_MainTex, uv1b).r * w1b; 284 | s += tex2D(_MainTex, uv2a).r * w2a; 285 | s += tex2D(_MainTex, uv2b).r * w2b; 286 | 287 | return s / (w0 + w1a + w1b + w2a + w2b); 288 | #endif 289 | } 290 | 291 | // Geometry-aware separable blur filter (small kernel) 292 | half SeparableBlurSmall(sampler2D tex, float2 uv, float2 delta) 293 | { 294 | float2 uv1 = uv - delta; 295 | float2 uv2 = uv + delta; 296 | 297 | half3 n0 = SampleNormal(uv); 298 | 299 | half w0 = 2; 300 | half w1 = CompareNormal(n0, SampleNormal(uv1)); 301 | half w2 = CompareNormal(n0, SampleNormal(uv2)); 302 | 303 | half s = tex2D(_MainTex, uv).r * w0; 304 | s += tex2D(_MainTex, uv1).r * w1; 305 | s += tex2D(_MainTex, uv2).r * w2; 306 | 307 | return s / (w0 + w1 + w2); 308 | } 309 | 310 | // Pass 0: Obscurance estimation 311 | half4 frag_ao(v2f_img i) : SV_Target 312 | { 313 | return EstimateObscurance(i.uv); 314 | } 315 | 316 | // Pass 1: Geometry-aware separable blur (1st iteration) 317 | half4 frag_blur1(v2f_img i) : SV_Target 318 | { 319 | float2 delta = _MainTex_TexelSize.xy * _BlurVector; 320 | return SeparableBlurLarge(_MainTex, i.uv, delta); 321 | } 322 | 323 | // Pass 2: Geometry-aware separable blur (2nd iteration) 324 | half4 frag_blur2(v2f_img i) : SV_Target 325 | { 326 | float2 delta = _MainTex_TexelSize.xy * _BlurVector; 327 | return SeparableBlurSmall(_MainTex, i.uv, delta); 328 | } 329 | 330 | // Pass 3: Combiner for the forward mode 331 | struct v2f_multitex 332 | { 333 | float4 pos : SV_POSITION; 334 | float2 uv0 : TEXCOORD0; 335 | float2 uv1 : TEXCOORD1; 336 | }; 337 | 338 | v2f_multitex vert_multitex(appdata_img v) 339 | { 340 | // Handles vertically-flipped case. 341 | float vflip = sign(_MainTex_TexelSize.y); 342 | 343 | v2f_multitex o; 344 | o.pos = mul(UNITY_MATRIX_MVP, v.vertex); 345 | o.uv0 = v.texcoord.xy; 346 | o.uv1 = (v.texcoord.xy - 0.5) * float2(1, vflip) + 0.5; 347 | return o; 348 | } 349 | 350 | half4 frag_combine(v2f_multitex i) : SV_Target 351 | { 352 | half4 src = tex2D(_MainTex, i.uv0); 353 | half ao = tex2D(_ObscuranceTexture, i.uv1).r; 354 | return half4(CombineObscurance(src.rgb, ao), src.a); 355 | } 356 | 357 | // Pass 4: Combiner for the ambient-only mode 358 | v2f_img vert_gbuffer(appdata_img v) 359 | { 360 | v2f_img o; 361 | o.pos = v.vertex * float4(2, 2, 0, 0) + float4(0, 0, 0, 1); 362 | #if UNITY_UV_STARTS_AT_TOP 363 | o.uv = v.texcoord * float2(1, -1) + float2(0, 1); 364 | #else 365 | o.uv = v.texcoord; 366 | #endif 367 | return o; 368 | } 369 | 370 | #if !SHADER_API_GLES // excluding the MRT pass under GLES2 371 | 372 | struct CombinerOutput 373 | { 374 | half4 gbuffer0 : SV_Target0; 375 | half4 gbuffer3 : SV_Target1; 376 | }; 377 | 378 | CombinerOutput frag_gbuffer_combine(v2f_img i) 379 | { 380 | half ao = tex2D(_ObscuranceTexture, i.uv).r; 381 | CombinerOutput o; 382 | o.gbuffer0 = half4(0, 0, 0, ao); 383 | o.gbuffer3 = half4((half3)EncodeAO(ao), 0); 384 | return o; 385 | } 386 | 387 | #else 388 | 389 | fixed4 frag_gbuffer_combine(v2f_img i) : SV_Target0 390 | { 391 | return 0; 392 | } 393 | 394 | #endif 395 | -------------------------------------------------------------------------------- /Assets/Kino Imported/Obscurance/Obscurance.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Obscurance - SSAO (screen-space ambient obscurance) effect for Unity 3 | // 4 | // Copyright (C) 2016 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEngine.Rendering; 26 | 27 | namespace Kino 28 | { 29 | [ExecuteInEditMode] 30 | [RequireComponent(typeof(Camera))] 31 | [AddComponentMenu("Kino Image Effects/Obscurance")] 32 | public partial class Obscurance : MonoBehaviour 33 | { 34 | #region Public Properties 35 | 36 | /// Degree of darkness produced by the effect. 37 | public float intensity { 38 | get { return _intensity; } 39 | set { _intensity = value; } 40 | } 41 | 42 | [SerializeField, Range(0, 4), Tooltip( 43 | "Degree of darkness produced by the effect.")] 44 | float _intensity = 1; 45 | 46 | /// Radius of sample points, which affects extent of darkened areas. 47 | public float radius { 48 | get { return Mathf.Max(_radius, 1e-4f); } 49 | set { _radius = value; } 50 | } 51 | 52 | [SerializeField, Tooltip( 53 | "Radius of sample points, which affects extent of darkened areas.")] 54 | float _radius = 0.3f; 55 | 56 | /// Number of sample points, which affects quality and performance. 57 | public SampleCount sampleCount { 58 | get { return _sampleCount; } 59 | set { _sampleCount = value; } 60 | } 61 | 62 | public enum SampleCount { Lowest, Low, Medium, High, Variable } 63 | 64 | [SerializeField, Tooltip( 65 | "Number of sample points, which affects quality and performance.")] 66 | SampleCount _sampleCount = SampleCount.Medium; 67 | 68 | /// Determines the sample count when SampleCount.Variable is used. 69 | /// In other cases, it returns the preset value of the current setting. 70 | public int sampleCountValue { 71 | get { 72 | switch (_sampleCount) { 73 | case SampleCount.Lowest: return 3; 74 | case SampleCount.Low: return 6; 75 | case SampleCount.Medium: return 12; 76 | case SampleCount.High: return 20; 77 | } 78 | return Mathf.Clamp(_sampleCountValue, 1, 256); 79 | } 80 | set { _sampleCountValue = value; } 81 | } 82 | 83 | [SerializeField] 84 | int _sampleCountValue = 24; 85 | 86 | /// Halves the resolution of the effect to increase performance. 87 | public bool downsampling { 88 | get { return _downsampling; } 89 | set { _downsampling = value; } 90 | } 91 | 92 | [SerializeField, Tooltip( 93 | "Halves the resolution of the effect to increase performance.")] 94 | bool _downsampling = false; 95 | 96 | /// Source buffer used for obscurance estimation. 97 | public OcclusionSource occlusionSource { 98 | get { 99 | var isGBuffer = _occlusionSource == OcclusionSource.GBuffer; 100 | if (isGBuffer && !IsGBufferAvailable) 101 | // An unavailable source was chosen: 102 | // fallback to DepthNormalsTexture. 103 | return OcclusionSource.DepthNormalsTexture; 104 | else 105 | return _occlusionSource; 106 | } 107 | set { _occlusionSource = value; } 108 | } 109 | 110 | public enum OcclusionSource { 111 | DepthTexture, DepthNormalsTexture, GBuffer 112 | } 113 | 114 | [SerializeField, Tooltip( 115 | "Source buffer used for obscurance estimation")] 116 | OcclusionSource _occlusionSource = OcclusionSource.GBuffer; 117 | 118 | /// Enables the ambient-only mode in that the effect only affects 119 | /// ambient lighting. This mode is only available with G-buffer source 120 | /// and HDR rendering. 121 | public bool ambientOnly { 122 | get { 123 | return _ambientOnly && targetCamera.hdr && 124 | occlusionSource == OcclusionSource.GBuffer; 125 | } 126 | set { _ambientOnly = value; } 127 | } 128 | 129 | [SerializeField, Tooltip( 130 | "If checked, the effect only affects ambient lighting.")] 131 | bool _ambientOnly = false; 132 | 133 | #endregion 134 | 135 | #region Private Properties 136 | 137 | // AO shader material 138 | Material aoMaterial { 139 | get { 140 | if (_aoMaterial == null) { 141 | var shader = Shader.Find("Hidden/Kino/Obscurance"); 142 | _aoMaterial = new Material(shader); 143 | _aoMaterial.hideFlags = HideFlags.DontSave; 144 | } 145 | return _aoMaterial; 146 | } 147 | } 148 | 149 | [SerializeField] Shader _aoShader; 150 | Material _aoMaterial; 151 | 152 | // Command buffer for the AO pass 153 | CommandBuffer aoCommands { 154 | get { 155 | if (_aoCommands == null) { 156 | _aoCommands = new CommandBuffer(); 157 | _aoCommands.name = "Kino.Obscurance"; 158 | } 159 | return _aoCommands; 160 | } 161 | } 162 | 163 | CommandBuffer _aoCommands; 164 | 165 | // Target camera 166 | Camera targetCamera { 167 | get { return GetComponent(); } 168 | } 169 | 170 | // Property observer 171 | PropertyObserver propertyObserver { get; set; } 172 | 173 | // Check if the G-buffer is available 174 | bool IsGBufferAvailable { 175 | get { 176 | var path = targetCamera.actualRenderingPath; 177 | return path == RenderingPath.DeferredShading; 178 | } 179 | } 180 | 181 | // Reference to the quad mesh in the built-in assets 182 | // (used in MRT blitting) 183 | [SerializeField] Mesh _quadMesh; 184 | 185 | #endregion 186 | 187 | #region Effect Passes 188 | 189 | // Build commands for the AO pass (used in the ambient-only mode). 190 | void BuildAOCommands() 191 | { 192 | var cb = aoCommands; 193 | 194 | var tw = targetCamera.pixelWidth; 195 | var th = targetCamera.pixelHeight; 196 | var ts = downsampling ? 2 : 1; 197 | var format = RenderTextureFormat.R8; 198 | var rwMode = RenderTextureReadWrite.Linear; 199 | var filter = FilterMode.Bilinear; 200 | 201 | // AO buffer 202 | var m = aoMaterial; 203 | var rtMask = Shader.PropertyToID("_ObscuranceTexture"); 204 | cb.GetTemporaryRT( 205 | rtMask, tw / ts, th / ts, 0, filter, format, rwMode 206 | ); 207 | 208 | // AO estimation 209 | cb.Blit(null, rtMask, m, 2); 210 | 211 | // Blur buffer 212 | var rtBlur = Shader.PropertyToID("_ObscuranceBlurTexture"); 213 | 214 | // 1st blur iteration (large kernel) 215 | cb.GetTemporaryRT(rtBlur, tw, th, 0, filter, format, rwMode); 216 | cb.SetGlobalVector("_BlurVector", Vector2.right * 2); 217 | cb.Blit(rtMask, rtBlur, m, 4); 218 | cb.ReleaseTemporaryRT(rtMask); 219 | 220 | cb.GetTemporaryRT(rtMask, tw, th, 0, filter, format, rwMode); 221 | cb.SetGlobalVector("_BlurVector", Vector2.up * 2 * ts); 222 | cb.Blit(rtBlur, rtMask, m, 4); 223 | cb.ReleaseTemporaryRT(rtBlur); 224 | 225 | // 2nd blur iteration (small kernel) 226 | cb.GetTemporaryRT(rtBlur, tw, th, 0, filter, format, rwMode); 227 | cb.SetGlobalVector("_BlurVector", Vector2.right * ts); 228 | cb.Blit(rtMask, rtBlur, m, 6); 229 | cb.ReleaseTemporaryRT(rtMask); 230 | 231 | cb.GetTemporaryRT(rtMask, tw, th, 0, filter, format, rwMode); 232 | cb.SetGlobalVector("_BlurVector", Vector2.up * ts); 233 | cb.Blit(rtBlur, rtMask, m, 6); 234 | cb.ReleaseTemporaryRT(rtBlur); 235 | 236 | // Combine AO to the G-buffer. 237 | var mrt = new RenderTargetIdentifier[] { 238 | BuiltinRenderTextureType.GBuffer0, // Albedo, Occ 239 | BuiltinRenderTextureType.CameraTarget // Ambient 240 | }; 241 | cb.SetGlobalTexture(rtMask, rtMask); 242 | cb.SetRenderTarget(mrt, BuiltinRenderTextureType.CameraTarget); 243 | cb.DrawMesh(_quadMesh, Matrix4x4.identity, m, 0, 8); 244 | 245 | cb.ReleaseTemporaryRT(rtMask); 246 | } 247 | 248 | // Execute the AO pass immediately (used in the forward mode). 249 | void ExecuteAOPass(RenderTexture source, RenderTexture destination) 250 | { 251 | var tw = source.width; 252 | var th = source.height; 253 | var ts = downsampling ? 2 : 1; 254 | var format = RenderTextureFormat.R8; 255 | var rwMode = RenderTextureReadWrite.Linear; 256 | var useGBuffer = occlusionSource == OcclusionSource.GBuffer; 257 | 258 | // AO buffer 259 | var m = aoMaterial; 260 | var rtMask = RenderTexture.GetTemporary( 261 | tw / ts, th / ts, 0, format, rwMode 262 | ); 263 | 264 | // AO estimation 265 | Graphics.Blit(null, rtMask, m, (int)occlusionSource); 266 | 267 | // 1st blur iteration (large kernel) 268 | var rtBlur = RenderTexture.GetTemporary(tw, th, 0, format, rwMode); 269 | m.SetVector("_BlurVector", Vector2.right * 2); 270 | Graphics.Blit(rtMask, rtBlur, m, useGBuffer ? 4 : 3); 271 | RenderTexture.ReleaseTemporary(rtMask); 272 | 273 | rtMask = RenderTexture.GetTemporary(tw, th, 0, format, rwMode); 274 | m.SetVector("_BlurVector", Vector2.up * 2 * ts); 275 | Graphics.Blit(rtBlur, rtMask, m, useGBuffer ? 4 : 3); 276 | RenderTexture.ReleaseTemporary(rtBlur); 277 | 278 | // 2nd blur iteration (small kernel) 279 | rtBlur = RenderTexture.GetTemporary(tw, th, 0, format, rwMode); 280 | m.SetVector("_BlurVector", Vector2.right * ts); 281 | Graphics.Blit(rtMask, rtBlur, m, useGBuffer ? 6 : 5); 282 | RenderTexture.ReleaseTemporary(rtMask); 283 | 284 | rtMask = RenderTexture.GetTemporary(tw, th, 0, format, rwMode); 285 | m.SetVector("_BlurVector", Vector2.up * ts); 286 | Graphics.Blit(rtBlur, rtMask, m, useGBuffer ? 6 : 5); 287 | RenderTexture.ReleaseTemporary(rtBlur); 288 | 289 | // Combine AO with the source. 290 | m.SetTexture("_ObscuranceTexture", rtMask); 291 | Graphics.Blit(source, destination, m, 7); 292 | 293 | RenderTexture.ReleaseTemporary(rtMask); 294 | } 295 | 296 | // Update the common material properties. 297 | void UpdateMaterialProperties() 298 | { 299 | var m = aoMaterial; 300 | m.SetFloat("_Intensity", intensity); 301 | m.SetFloat("_Radius", radius); 302 | m.SetFloat("_TargetScale", downsampling ? 0.5f : 1); 303 | m.SetInt("_SampleCount", sampleCountValue); 304 | } 305 | 306 | #endregion 307 | 308 | #region MonoBehaviour Functions 309 | 310 | void OnEnable() 311 | { 312 | // Register the command buffer if in the ambient-only mode. 313 | if (ambientOnly) targetCamera.AddCommandBuffer( 314 | CameraEvent.BeforeReflections, aoCommands 315 | ); 316 | 317 | // Enable depth textures which the occlusion source requires. 318 | if (occlusionSource == OcclusionSource.DepthTexture) 319 | targetCamera.depthTextureMode |= DepthTextureMode.Depth; 320 | 321 | if (occlusionSource != OcclusionSource.GBuffer) 322 | targetCamera.depthTextureMode |= DepthTextureMode.DepthNormals; 323 | } 324 | 325 | void OnDisable() 326 | { 327 | // Destroy all the temporary resources. 328 | if (_aoMaterial != null) DestroyImmediate(_aoMaterial); 329 | _aoMaterial = null; 330 | 331 | if (_aoCommands != null) targetCamera.RemoveCommandBuffer( 332 | CameraEvent.BeforeReflections, _aoCommands 333 | ); 334 | _aoCommands = null; 335 | } 336 | 337 | void Update() 338 | { 339 | if (propertyObserver.CheckNeedsReset(this, targetCamera)) 340 | { 341 | // Reinitialize all the resources by disabling/enabling itself. 342 | // This is not very efficient way but just works... 343 | OnDisable(); 344 | OnEnable(); 345 | 346 | // Build the command buffer if in the ambient-only mode. 347 | if (ambientOnly) 348 | { 349 | aoCommands.Clear(); 350 | BuildAOCommands(); 351 | } 352 | 353 | propertyObserver.Update(this, targetCamera); 354 | } 355 | 356 | // Update the material properties (later used in the AO commands). 357 | if (ambientOnly) UpdateMaterialProperties(); 358 | } 359 | 360 | [ImageEffectOpaque] 361 | void OnRenderImage(RenderTexture source, RenderTexture destination) 362 | { 363 | if (ambientOnly) 364 | { 365 | // Do nothing in the ambient-only mode. 366 | Graphics.Blit(source, destination); 367 | } 368 | else 369 | { 370 | // Execute the AO pass. 371 | UpdateMaterialProperties(); 372 | ExecuteAOPass(source, destination); 373 | } 374 | } 375 | 376 | #endregion 377 | } 378 | } 379 | --------------------------------------------------------------------------------