├── .gitattributes ├── .gitignore ├── Assets ├── CubeCluster.meta ├── CubeCluster │ ├── CubeCluster.asset │ ├── CubeCluster.asset.meta │ ├── CubeClusterMesh.cs │ ├── CubeClusterMesh.cs.meta │ ├── CubeClusterRenderer.cs │ ├── CubeClusterRenderer.cs.meta │ ├── Editor.meta │ ├── Editor │ │ ├── CubeClusterMeshEditor.cs │ │ └── CubeClusterMeshEditor.cs.meta │ ├── Shader.meta │ └── Shader │ │ ├── CubeCluster.shader │ │ ├── CubeCluster.shader.meta │ │ ├── SimplexNoiseExt3D.cginc │ │ └── SimplexNoiseExt3D.cginc.meta ├── Funnel.meta ├── Funnel │ ├── Editor.meta │ ├── Editor │ │ ├── FunnelEditor.cs │ │ └── FunnelEditor.cs.meta │ ├── Funnel.cs │ ├── Funnel.cs.meta │ ├── Plugins.meta │ ├── Plugins │ │ ├── Funnel.bundle.meta │ │ └── Funnel.bundle │ │ │ ├── Contents.meta │ │ │ └── Contents │ │ │ ├── Info.plist │ │ │ ├── Info.plist.meta │ │ │ ├── MacOS.meta │ │ │ ├── MacOS │ │ │ ├── Funnel │ │ │ └── Funnel.meta │ │ │ ├── Resources.meta │ │ │ └── Resources │ │ │ ├── en.lproj.meta │ │ │ └── en.lproj │ │ │ ├── InfoPlist.strings │ │ │ └── InfoPlist.strings.meta │ ├── Shader.meta │ └── Shader │ │ ├── Gamma.shader │ │ └── Gamma.shader.meta ├── Gasta.meta ├── Gasta │ ├── Acknowledgement.txt │ ├── Acknowledgement.txt.meta │ ├── hdriReflection.hdr │ └── hdriReflection.hdr.meta ├── Kino.meta ├── Kino │ ├── Bloom.meta │ ├── Bloom │ │ ├── Bloom.cs │ │ ├── Bloom.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── BloomEditor.cs │ │ │ ├── BloomEditor.cs.meta │ │ │ ├── BloomGraphDrawer.cs │ │ │ └── BloomGraphDrawer.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Bloom.shader │ │ │ └── Bloom.shader.meta │ ├── Obscurance.meta │ └── Obscurance │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── ObscuranceEditor.cs │ │ └── ObscuranceEditor.cs.meta │ │ ├── Obscurance.cs │ │ ├── Obscurance.cs.meta │ │ ├── Script.meta │ │ ├── Script │ │ ├── PropertyObserver.cs │ │ └── PropertyObserver.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ ├── Obscurance.shader │ │ └── Obscurance.shader.meta ├── Kvant.meta ├── Kvant │ ├── Spray.meta │ └── Spray │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── SprayEditor.cs │ │ ├── SprayEditor.cs.meta │ │ ├── SpraySurfaceMaterialEditor.cs │ │ ├── SpraySurfaceMaterialEditor.cs.meta │ │ ├── SprayUnlitMaterialEditor.cs │ │ └── SprayUnlitMaterialEditor.cs.meta │ │ ├── Models.meta │ │ ├── Models │ │ ├── Asteroids.fbx │ │ ├── Asteroids.fbx.meta │ │ ├── Confetti.fbx │ │ ├── Confetti.fbx.meta │ │ ├── Leaves.fbx │ │ ├── Leaves.fbx.meta │ │ ├── Shapes.fbx │ │ ├── Shapes.fbx.meta │ │ ├── Shards.fbx │ │ └── Shards.fbx.meta │ │ ├── Scripts.meta │ │ ├── Scripts │ │ ├── BulkMesh.cs │ │ └── BulkMesh.cs.meta │ │ ├── Shaders.meta │ │ ├── Shaders │ │ ├── Common.cginc │ │ ├── Common.cginc.meta │ │ ├── Debug.shader │ │ ├── Debug.shader.meta │ │ ├── Default Spray.mat │ │ ├── Default Spray.mat.meta │ │ ├── Kernel.shader │ │ ├── Kernel.shader.meta │ │ ├── Opaque.shader │ │ ├── Opaque.shader.meta │ │ ├── SimplexNoiseGrad3D.cginc │ │ ├── SimplexNoiseGrad3D.cginc.meta │ │ ├── Unlit.shader │ │ └── Unlit.shader.meta │ │ ├── Spray.cs │ │ └── Spray.cs.meta ├── Main.unity ├── Main.unity.meta ├── Material.meta ├── Material │ ├── Skybox.mat │ ├── Skybox.mat.meta │ ├── Wall.mat │ └── Wall.mat.meta ├── Model.meta ├── Model │ ├── Shapes.fbx │ └── Shapes.fbx.meta ├── Particle System.meta ├── Particle System │ ├── Cube Cluster.controller │ ├── Cube Cluster.controller.meta │ ├── CubeCluster.anim │ ├── CubeCluster.anim.meta │ ├── Shard.mat │ └── Shard.mat.meta ├── ScreenOverlay.meta ├── ScreenOverlay │ ├── Logo.png │ ├── Logo.png.meta │ ├── Mask.png │ ├── Mask.png.meta │ ├── ScreenOverlay.cs │ ├── ScreenOverlay.cs.meta │ ├── ScreenOverlay.shader │ └── ScreenOverlay.shader.meta ├── Texture.meta └── Texture │ ├── BrushedMetalNormal.tif │ ├── BrushedMetalNormal.tif.meta │ ├── BrushedMetalSpecular.tif │ ├── BrushedMetalSpecular.tif.meta │ ├── Icon.png │ └── Icon.png.meta ├── Extras ├── Logo.png └── UnityCubes.mad ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityAdsSettings.asset └── UnityConnectSettings.asset └── README.md /.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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Unity 2 | Library 3 | Temp 4 | *.pidb 5 | *.userprefs 6 | 7 | # Misc 8 | *.swp 9 | *.lnk 10 | .DS_Store 11 | Thumbs.db 12 | -------------------------------------------------------------------------------- /Assets/CubeCluster.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7491bf2cd3fec46edbe7788ad23b3993 3 | folderAsset: yes 4 | timeCreated: 1459222520 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CubeCluster/CubeCluster.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4b2ab016fd8c4c6694c5ed8826f8316 3 | timeCreated: 1459225289 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/CubeCluster/CubeClusterMesh.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | namespace UnityLogo 5 | { 6 | public class CubeClusterMesh : ScriptableObject 7 | { 8 | #region Public properties 9 | 10 | [SerializeField, Range(4, 10)] 11 | int _columnCount = 5; 12 | 13 | public int columnCount { 14 | get { return _columnCount; } 15 | } 16 | 17 | [SerializeField] 18 | Mesh _originalMesh; 19 | 20 | public Mesh originalMesh { 21 | get { return _originalMesh; } 22 | } 23 | 24 | [SerializeField, HideInInspector] 25 | Mesh _mesh; 26 | 27 | public Mesh sharedMesh { 28 | get { return _mesh; } 29 | } 30 | 31 | #endregion 32 | 33 | #region Public methods 34 | 35 | public void RebuildMesh() 36 | { 37 | if (_mesh == null) 38 | { 39 | Debug.LogError("Mesh asset is missing."); 40 | return; 41 | } 42 | 43 | _mesh.Clear(); 44 | 45 | // Vertex and index arrays. 46 | var vtxList = new List(); 47 | var nrmList = new List(); 48 | var tanList = new List(); 49 | var uv0List = new List(); 50 | var uv1List = new List(); 51 | var idxList = new List(); 52 | 53 | // Create the first instance. 54 | vtxList.AddRange(_originalMesh.vertices); 55 | nrmList.AddRange(_originalMesh.normals); 56 | tanList.AddRange(_originalMesh.tangents); 57 | uv0List.AddRange(_originalMesh.uv); 58 | idxList.AddRange(_originalMesh.GetIndices(0)); 59 | 60 | var vcount = vtxList.Count; 61 | var icount = idxList.Count; 62 | 63 | for (var i = 0; i < vcount; i++) 64 | uv1List.Add(Vector3.zero); 65 | 66 | // Appends clones to the arrays. 67 | for (var u = 0; u < columnCount; u++) 68 | { 69 | for (var v = 0; v < columnCount; v++) 70 | { 71 | for (var w = 0; w < columnCount; w++) 72 | { 73 | if (u == 0 && v == 0 && w == 0) continue; 74 | 75 | var uv1 = new Vector3( 76 | (float)u / columnCount, 77 | (float)v / columnCount, 78 | (float)w / columnCount 79 | ); 80 | 81 | var idxoffs = vtxList.Count; 82 | 83 | vtxList.AddRange(vtxList.GetRange(0, vcount)); 84 | nrmList.AddRange(nrmList.GetRange(0, vcount)); 85 | tanList.AddRange(tanList.GetRange(0, vcount)); 86 | uv0List.AddRange(uv0List.GetRange(0, vcount)); 87 | 88 | for (var i = 0; i < vcount; i++) 89 | uv1List.Add(uv1); 90 | 91 | for (var i = 0; i < icount; i++) 92 | idxList.Add(idxList[i] + idxoffs); 93 | } 94 | } 95 | } 96 | 97 | // Rebuild the mesh object. 98 | _mesh.SetVertices(vtxList); 99 | _mesh.SetNormals(nrmList); 100 | _mesh.SetTangents(tanList); 101 | _mesh.SetUVs(0, uv0List); 102 | _mesh.SetUVs(1, uv1List); 103 | _mesh.SetIndices(idxList.ToArray(), MeshTopology.Triangles, 0); 104 | 105 | _mesh.bounds = new Bounds(Vector3.zero, Vector3.one * 1000); 106 | 107 | _mesh.Optimize(); 108 | _mesh.UploadMeshData(true); 109 | } 110 | 111 | #endregion 112 | 113 | #region ScriptableObject functions 114 | 115 | void OnEnable() 116 | { 117 | if (_mesh == null) 118 | { 119 | _mesh = new Mesh(); 120 | _mesh.name = "CubeCluster"; 121 | } 122 | } 123 | 124 | #endregion 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /Assets/CubeCluster/CubeClusterMesh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e97a7f7cc42324163aafb0d349c7c403 3 | timeCreated: 1459225279 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _originalMesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 9 | - _mesh: {instanceID: 0} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/CubeCluster/CubeClusterRenderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | namespace UnityLogo 5 | { 6 | [ExecuteInEditMode] 7 | public class CubeClusterRenderer : MonoBehaviour 8 | { 9 | #region Exposed properties 10 | 11 | [SerializeField, Range(0, 1)] 12 | float _phase; 13 | 14 | [Space] 15 | 16 | [SerializeField] 17 | float _transition = 0.1f; 18 | 19 | [Space] 20 | 21 | [SerializeField, ColorUsage(false)] 22 | Color _color; 23 | 24 | [SerializeField] 25 | CubeClusterMesh _mesh; 26 | 27 | [SerializeField] 28 | Texture _metallicMap; 29 | 30 | [SerializeField] 31 | Texture _normalMap; 32 | 33 | [SerializeField] 34 | float _textureScale = 1; 35 | 36 | #endregion 37 | 38 | #region Private resources 39 | 40 | [SerializeField, HideInInspector] Shader _shader; 41 | Material _material; 42 | 43 | #endregion 44 | 45 | #region Private members 46 | 47 | float[] _randomParams = new float[8]; 48 | Color _emissionColor; 49 | float _time; 50 | 51 | #endregion 52 | 53 | #region Public methods 54 | 55 | public void ResetParams() 56 | { 57 | for (var i = 0; i < 8; i++) 58 | _randomParams[i] = Random.value > 0.66f ? 1 : 0; 59 | 60 | _emissionColor = Color.HSVToRGB(Random.value, 0.5f, 1); 61 | 62 | _time = 0; 63 | } 64 | 65 | #endregion 66 | 67 | #region MonoBehaviour functions 68 | 69 | void OnEnable() 70 | { 71 | _material = new Material(Shader.Find("UnityLogo/CubeCluster")); 72 | _material.hideFlags = HideFlags.DontSave; 73 | } 74 | 75 | void OnDisable() 76 | { 77 | DestroyImmediate(_material); 78 | _material = null; 79 | } 80 | 81 | void Start() 82 | { 83 | ResetParams(); 84 | } 85 | 86 | void Update() 87 | { 88 | _material.SetColor("_Color", _color); 89 | _material.SetTexture("_MainTex", _metallicMap); 90 | _material.SetTexture("_BumpMap", _normalMap); 91 | _material.SetFloat("_BumpScale", 1); 92 | _material.SetColor("_Emission", _emissionColor); 93 | 94 | _material.SetFloat("_Size", 1.0f / _mesh.columnCount); 95 | _material.SetFloat("_TextureScale", _textureScale); 96 | 97 | _material.SetFloat("_RTime", _time); 98 | _material.SetFloat("_Phase", _phase); 99 | _material.SetFloat("_Transition", _transition); 100 | 101 | _material.SetVector("_Params1", new Vector4( 102 | _randomParams[0], 103 | _randomParams[1], 104 | _randomParams[2], 105 | _randomParams[3] 106 | )); 107 | 108 | _material.SetVector("_Params2", new Vector4( 109 | _randomParams[4], 110 | _randomParams[5], 111 | _randomParams[6], 112 | _randomParams[7] 113 | )); 114 | 115 | Graphics.DrawMesh( 116 | _mesh.sharedMesh, transform.localToWorldMatrix, _material, 117 | gameObject.layer 118 | ); 119 | 120 | _time += Time.deltaTime; 121 | } 122 | 123 | #endregion 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /Assets/CubeCluster/CubeClusterRenderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc25ac8d039114093aab62baa8e91acb 3 | timeCreated: 1459225613 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _mesh: {fileID: 11400000, guid: a4b2ab016fd8c4c6694c5ed8826f8316, type: 2} 9 | - _shader: {fileID: 4800000, guid: 343f08e6067e54be2a1c62cfb2015f2f, type: 3} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/CubeCluster/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4840d66d56184edcabab33c89784616 3 | folderAsset: yes 4 | timeCreated: 1459222532 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CubeCluster/Editor/CubeClusterMeshEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.IO; 4 | 5 | namespace UnityLogo 6 | { 7 | [CustomEditor(typeof(CubeClusterMesh))] 8 | public class CubeClusterMeshEditor : Editor 9 | { 10 | SerializedProperty _columnCount; 11 | SerializedProperty _originalMesh; 12 | 13 | void OnEnable() 14 | { 15 | _columnCount = serializedObject.FindProperty("_columnCount"); 16 | _originalMesh = serializedObject.FindProperty("_originalMesh"); 17 | } 18 | 19 | public override void OnInspectorGUI() 20 | { 21 | serializedObject.Update(); 22 | 23 | EditorGUI.BeginChangeCheck(); 24 | EditorGUILayout.PropertyField(_columnCount); 25 | EditorGUILayout.PropertyField(_originalMesh); 26 | var rebuild = EditorGUI.EndChangeCheck(); 27 | 28 | serializedObject.ApplyModifiedProperties(); 29 | 30 | if (rebuild) 31 | foreach (var t in targets) 32 | ((CubeClusterMesh)t).RebuildMesh(); 33 | } 34 | 35 | [MenuItem("Assets/Create/CubeClusterMesh")] 36 | public static void CreateCubeClusterMeshAsset() 37 | { 38 | // Make a proper path from the current selection. 39 | var path = AssetDatabase.GetAssetPath(Selection.activeObject); 40 | if (string.IsNullOrEmpty(path)) 41 | path = "Assets"; 42 | else if (Path.GetExtension(path) != "") 43 | path = path.Replace(Path.GetFileName(path), ""); 44 | var assetPathName = AssetDatabase.GenerateUniqueAssetPath(path + "/CubeCluster.asset"); 45 | 46 | // Create an asset. 47 | var asset = ScriptableObject.CreateInstance(); 48 | AssetDatabase.CreateAsset(asset, assetPathName); 49 | AssetDatabase.AddObjectToAsset(asset.sharedMesh, asset); 50 | 51 | // Build an initial mesh for the asset. 52 | asset.RebuildMesh(); 53 | 54 | // Save the generated mesh asset. 55 | AssetDatabase.SaveAssets(); 56 | 57 | // Tweak the selection. 58 | EditorUtility.FocusProjectWindow(); 59 | Selection.activeObject = asset; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/CubeCluster/Editor/CubeClusterMeshEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 857610745489e40aa8074be01d3b63b4 3 | timeCreated: 1459222539 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/CubeCluster/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e291788a0e85549c582b080561f790d5 3 | folderAsset: yes 4 | timeCreated: 1459222537 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CubeCluster/Shader/CubeCluster.shader: -------------------------------------------------------------------------------- 1 | Shader "UnityLogo/CubeCluster" 2 | { 3 | Properties 4 | { 5 | _Color("", Color) = (1, 1, 1, 1) 6 | _MainTex("", 2D) = "white" {} 7 | _BumpMap("", 2D) = "bump"{} 8 | _BumpScale("", Float) = 1 9 | _Emission("", Color) = (1, 1, 1, 1) 10 | } 11 | SubShader 12 | { 13 | Tags { "RenderType"="Opaque" } 14 | 15 | CGPROGRAM 16 | 17 | #pragma surface surf Standard vertex:vert nolightmap addshadow 18 | #pragma target 3.0 19 | 20 | #include "SimplexNoiseExt3D.cginc" 21 | 22 | fixed4 _Color; 23 | sampler2D _MainTex; 24 | sampler2D _BumpMap; 25 | half _BumpScale; 26 | half4 _Emission; 27 | 28 | float _Size; 29 | float _TextureScale; 30 | 31 | float _RTime; 32 | float _Phase; 33 | float _Transition; 34 | 35 | float4 _Params1; 36 | float4 _Params2; 37 | 38 | struct Input 39 | { 40 | float2 uv_MainTex; 41 | float4 color : COLOR; 42 | }; 43 | 44 | // PRNG 45 | float UVRand(float u, float v) 46 | { 47 | return frac(sin(dot(float2(u, v), float2(12.9898, 78.233))) * 43758.5453); 48 | } 49 | 50 | // Quaternion multiplication 51 | // http://mathworld.wolfram.com/Quaternion.html 52 | float4 qmul(float4 q1, float4 q2) 53 | { 54 | return float4( 55 | q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), 56 | q1.w * q2.w - dot(q1.xyz, q2.xyz) 57 | ); 58 | } 59 | 60 | // Uniformaly distributed points on a unit sphere 61 | // http://mathworld.wolfram.com/SpherePointPicking.html 62 | float3 random_point_on_sphere(float seed1, float seed2) 63 | { 64 | float u = UVRand(seed1, seed2) * 2 - 1; 65 | float theta = UVRand(seed1 + 0.333, seed2) * UNITY_PI * 2; 66 | float u2 = sqrt(1 - u * u); 67 | return float3(u2 * cos(theta), u2 * sin(theta), u); 68 | } 69 | 70 | // Vector rotation with a quaternion 71 | // http://mathworld.wolfram.com/Quaternion.html 72 | float3 rotate_vector(float3 v, float4 r) 73 | { 74 | float4 r_c = r * float4(-1, -1, -1, 1); 75 | return qmul(r, qmul(float4(v, 0), r_c)).xyz; 76 | } 77 | 78 | // A given angle of rotation about a given aixs 79 | float4 rotation_angle_axis(float angle, float3 axis) 80 | { 81 | float sn, cs; 82 | sincos(angle * 0.5, sn, cs); 83 | return float4(axis * sn, cs); 84 | } 85 | 86 | static const float kCycle = 18; 87 | static const float kTransition = 4; 88 | 89 | void vert(inout appdata_full v) 90 | { 91 | float3 vpos = v.vertex.xyz; 92 | float3 uvw = v.texcoord1.xyz; 93 | float id = dot(uvw, float3(24.13, 5.87, 1)) / 30; 94 | 95 | float phase = _Phase; 96 | phase *= 1 + _Transition * 2; // make transition margin 97 | phase -= id * _Transition; // bias with object id 98 | phase = saturate(phase); // clamp with 0-1 99 | 100 | const float eps = 1e-5; 101 | float dft1 = pow(max(eps, 1 - sin(phase * UNITY_PI)), 2); 102 | float dft2 = pow(max(eps, 1 - sin(phase * UNITY_PI)), 9); 103 | 104 | // base animations 105 | float3 offs = _Size * 0.5 + uvw - 0.5; 106 | float scale = (dft2 + 1) / 2 * _Size; 107 | float4 rot = float4(0, 0, 0, 1); 108 | 109 | { 110 | float dft = (1 - dft1) * (_Params1.x > 0.9); 111 | float3 crd = uvw * 1.6 + float3(0, 0, _RTime) * 1.2; 112 | scale *= 1 + snoise(crd) * 0.4 * dft; 113 | } 114 | { 115 | float dft = (1 - dft1) * (_Params1.y > 0.9); 116 | float3 crd = uvw * 1.4 + float3(0, 0, _RTime) * 0.5; 117 | offs += snoise_grad(crd) * 0.02 * dft; 118 | } 119 | { 120 | float dft = (1 - dft1) * (_Params1.z > 0.9); 121 | float3 axis = random_point_on_sphere(id, 0); 122 | float angle = UVRand(id, 1) * 3 + 1; 123 | rot = qmul(rot, rotation_angle_axis(angle * dft, axis)); 124 | } 125 | { 126 | float dft = (1 - dft1) * (_Params1.w > 0.9); 127 | float3 axis = random_point_on_sphere(id, 13); 128 | float angle = snoise(uvw * 0.3 + float3(_RTime * 0.3, 0, 0)) * 5; 129 | rot = qmul(rot, rotation_angle_axis(angle * dft, axis)); 130 | } 131 | { 132 | float dft = saturate(_Params1.x - dft1); 133 | float3 pt = float3(UVRand(id, 6), UVRand(id, 7), UVRand(id, 8)); 134 | offs = lerp(offs, pt * 0.8 - 0.4, dft); 135 | } 136 | { 137 | float dft = saturate(_Params1.y - dft1); 138 | float3 orbit = float3(UVRand(id, 2), UVRand(id, 3), UVRand(id, 4)); 139 | orbit = sin((orbit + 1) * (_RTime + 13)) * 0.4; 140 | offs = lerp(offs, orbit, dft); 141 | } 142 | { 143 | float dft = saturate(_Params1.z - dft1); 144 | float sn, cs; 145 | float r = _RTime * (0.5 + UVRand(id, 12) * 2); 146 | sincos(r, sn, cs); 147 | float3 pt = float3(offs.x, offs.y * cs - offs.z * sn, offs.y * sn + offs.z * cs); 148 | offs = lerp(offs, pt, dft); 149 | rot = lerp(rot, qmul(rot, rotation_angle_axis(r, float3(1, 0, 0))), dft); 150 | rot = normalize(rot); 151 | } 152 | 153 | // apply modification 154 | v.vertex.xyz = rotate_vector(vpos, rot) * scale + offs; 155 | v.normal = rotate_vector(v.normal, rot); 156 | v.color = dft2 * _Emission * 3; 157 | 158 | // texture coordnate 159 | v.texcoord.xy *= _TextureScale; 160 | v.texcoord.xy += float2(UVRand(id, 30), UVRand(id, 31)); 161 | } 162 | 163 | void surf(Input IN, inout SurfaceOutputStandard o) 164 | { 165 | float2 uv = IN.uv_MainTex.xy; 166 | 167 | o.Albedo = _Color.rgb; 168 | o.Alpha = _Color.a; 169 | 170 | float4 mt = tex2D(_MainTex, uv); 171 | o.Metallic = mt.r; 172 | o.Smoothness = mt.a; 173 | 174 | fixed4 nrm = tex2D(_BumpMap, uv); 175 | o.Normal = UnpackScaleNormal(nrm, _BumpScale); 176 | 177 | o.Emission = IN.color; 178 | } 179 | ENDCG 180 | } 181 | FallBack "Diffuse" 182 | } 183 | -------------------------------------------------------------------------------- /Assets/CubeCluster/Shader/CubeCluster.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 343f08e6067e54be2a1c62cfb2015f2f 3 | timeCreated: 1459222502 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/CubeCluster/Shader/SimplexNoiseExt3D.cginc: -------------------------------------------------------------------------------- 1 | // 2 | // Noise Shader Library for Unity - https://github.com/keijiro/NoiseShader 3 | // 4 | // Original work (webgl-noise) Copyright (C) 2011 Ashima Arts. 5 | // Translation and modification was made by Keijiro Takahashi. 6 | // 7 | // This shader is based on the webgl-noise GLSL shader. For further details 8 | // of the original shader, please see the following description from the 9 | // original source code. 10 | // 11 | 12 | // 13 | // Description : Array and textureless GLSL 2D/3D/4D simplex 14 | // noise functions. 15 | // Author : Ian McEwan, Ashima Arts. 16 | // Maintainer : ijm 17 | // Lastmod : 20110822 (ijm) 18 | // License : Copyright (C) 2011 Ashima Arts. All rights reserved. 19 | // Distributed under the MIT License. See LICENSE file. 20 | // https://github.com/ashima/webgl-noise 21 | // 22 | 23 | float3 mod289(float3 x) 24 | { 25 | return x - floor(x / 289.0) * 289.0; 26 | } 27 | 28 | float4 mod289(float4 x) 29 | { 30 | return x - floor(x / 289.0) * 289.0; 31 | } 32 | 33 | float4 permute(float4 x) 34 | { 35 | return mod289((x * 34.0 + 1.0) * x); 36 | } 37 | 38 | float4 taylorInvSqrt(float4 r) 39 | { 40 | return 1.79284291400159 - r * 0.85373472095314; 41 | } 42 | 43 | float snoise(float3 v) 44 | { 45 | const float2 C = float2(1.0 / 6.0, 1.0 / 3.0); 46 | 47 | // First corner 48 | float3 i = floor(v + dot(v, C.yyy)); 49 | float3 x0 = v - i + dot(i, C.xxx); 50 | 51 | // Other corners 52 | float3 g = step(x0.yzx, x0.xyz); 53 | float3 l = 1.0 - g; 54 | float3 i1 = min(g.xyz, l.zxy); 55 | float3 i2 = max(g.xyz, l.zxy); 56 | 57 | // x1 = x0 - i1 + 1.0 * C.xxx; 58 | // x2 = x0 - i2 + 2.0 * C.xxx; 59 | // x3 = x0 - 1.0 + 3.0 * C.xxx; 60 | float3 x1 = x0 - i1 + C.xxx; 61 | float3 x2 = x0 - i2 + C.yyy; 62 | float3 x3 = x0 - 0.5; 63 | 64 | // Permutations 65 | i = mod289(i); // Avoid truncation effects in permutation 66 | float4 p = 67 | permute(permute(permute(i.z + float4(0.0, i1.z, i2.z, 1.0)) 68 | + i.y + float4(0.0, i1.y, i2.y, 1.0)) 69 | + i.x + float4(0.0, i1.x, i2.x, 1.0)); 70 | 71 | // Gradients: 7x7 points over a square, mapped onto an octahedron. 72 | // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) 73 | float4 j = p - 49.0 * floor(p / 49.0); // mod(p,7*7) 74 | 75 | float4 x_ = floor(j / 7.0); 76 | float4 y_ = floor(j - 7.0 * x_); // mod(j,N) 77 | 78 | float4 x = (x_ * 2.0 + 0.5) / 7.0 - 1.0; 79 | float4 y = (y_ * 2.0 + 0.5) / 7.0 - 1.0; 80 | 81 | float4 h = 1.0 - abs(x) - abs(y); 82 | 83 | float4 b0 = float4(x.xy, y.xy); 84 | float4 b1 = float4(x.zw, y.zw); 85 | 86 | //float4 s0 = float4(lessThan(b0, 0.0)) * 2.0 - 1.0; 87 | //float4 s1 = float4(lessThan(b1, 0.0)) * 2.0 - 1.0; 88 | float4 s0 = floor(b0) * 2.0 + 1.0; 89 | float4 s1 = floor(b1) * 2.0 + 1.0; 90 | float4 sh = -step(h, 0.0); 91 | 92 | float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; 93 | float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; 94 | 95 | float3 g0 = float3(a0.xy, h.x); 96 | float3 g1 = float3(a0.zw, h.y); 97 | float3 g2 = float3(a1.xy, h.z); 98 | float3 g3 = float3(a1.zw, h.w); 99 | 100 | // Normalise gradients 101 | float4 norm = taylorInvSqrt(float4(dot(g0, g0), dot(g1, g1), dot(g2, g2), dot(g3, g3))); 102 | g0 *= norm.x; 103 | g1 *= norm.y; 104 | g2 *= norm.z; 105 | g3 *= norm.w; 106 | 107 | // Mix final noise value 108 | float4 m = max(0.6 - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0); 109 | m = m * m; 110 | m = m * m; 111 | 112 | float4 px = float4(dot(x0, g0), dot(x1, g1), dot(x2, g2), dot(x3, g3)); 113 | return 42.0 * dot(m, px); 114 | } 115 | 116 | float3 snoise_grad(float3 v) 117 | { 118 | const float2 C = float2(1.0 / 6.0, 1.0 / 3.0); 119 | 120 | // First corner 121 | float3 i = floor(v + dot(v, C.yyy)); 122 | float3 x0 = v - i + dot(i, C.xxx); 123 | 124 | // Other corners 125 | float3 g = step(x0.yzx, x0.xyz); 126 | float3 l = 1.0 - g; 127 | float3 i1 = min(g.xyz, l.zxy); 128 | float3 i2 = max(g.xyz, l.zxy); 129 | 130 | // x1 = x0 - i1 + 1.0 * C.xxx; 131 | // x2 = x0 - i2 + 2.0 * C.xxx; 132 | // x3 = x0 - 1.0 + 3.0 * C.xxx; 133 | float3 x1 = x0 - i1 + C.xxx; 134 | float3 x2 = x0 - i2 + C.yyy; 135 | float3 x3 = x0 - 0.5; 136 | 137 | // Permutations 138 | i = mod289(i); // Avoid truncation effects in permutation 139 | float4 p = 140 | permute(permute(permute(i.z + float4(0.0, i1.z, i2.z, 1.0)) 141 | + i.y + float4(0.0, i1.y, i2.y, 1.0)) 142 | + i.x + float4(0.0, i1.x, i2.x, 1.0)); 143 | 144 | // Gradients: 7x7 points over a square, mapped onto an octahedron. 145 | // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) 146 | float4 j = p - 49.0 * floor(p / 49.0); // mod(p,7*7) 147 | 148 | float4 x_ = floor(j / 7.0); 149 | float4 y_ = floor(j - 7.0 * x_); // mod(j,N) 150 | 151 | float4 x = (x_ * 2.0 + 0.5) / 7.0 - 1.0; 152 | float4 y = (y_ * 2.0 + 0.5) / 7.0 - 1.0; 153 | 154 | float4 h = 1.0 - abs(x) - abs(y); 155 | 156 | float4 b0 = float4(x.xy, y.xy); 157 | float4 b1 = float4(x.zw, y.zw); 158 | 159 | //float4 s0 = float4(lessThan(b0, 0.0)) * 2.0 - 1.0; 160 | //float4 s1 = float4(lessThan(b1, 0.0)) * 2.0 - 1.0; 161 | float4 s0 = floor(b0) * 2.0 + 1.0; 162 | float4 s1 = floor(b1) * 2.0 + 1.0; 163 | float4 sh = -step(h, 0.0); 164 | 165 | float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; 166 | float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; 167 | 168 | float3 g0 = float3(a0.xy, h.x); 169 | float3 g1 = float3(a0.zw, h.y); 170 | float3 g2 = float3(a1.xy, h.z); 171 | float3 g3 = float3(a1.zw, h.w); 172 | 173 | // Normalise gradients 174 | float4 norm = taylorInvSqrt(float4(dot(g0, g0), dot(g1, g1), dot(g2, g2), dot(g3, g3))); 175 | g0 *= norm.x; 176 | g1 *= norm.y; 177 | g2 *= norm.z; 178 | g3 *= norm.w; 179 | 180 | // Compute gradient of noise function at P 181 | float4 m = max(0.6 - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0); 182 | float4 m2 = m * m; 183 | float4 m3 = m2 * m; 184 | float4 m4 = m2 * m2; 185 | float3 grad = 186 | -6.0 * m3.x * x0 * dot(x0, g0) + m4.x * g0 + 187 | -6.0 * m3.y * x1 * dot(x1, g1) + m4.y * g1 + 188 | -6.0 * m3.z * x2 * dot(x2, g2) + m4.z * g2 + 189 | -6.0 * m3.w * x3 * dot(x3, g3) + m4.w * g3; 190 | return 42.0 * grad; 191 | } 192 | -------------------------------------------------------------------------------- /Assets/CubeCluster/Shader/SimplexNoiseExt3D.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c6974a4a257f4e2b853353c1ce2a288 3 | timeCreated: 1459230346 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Funnel.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b0d821b98205447f8b3416624c39779 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Funnel/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3acb20be3063642f89507bac7a94e504 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Funnel/Editor/FunnelEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Funnel - Syphon server plugin for Unity 3 | // 4 | // Copyright (C) 2013-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 | 25 | using UnityEngine; 26 | using UnityEditor; 27 | 28 | namespace Funnel 29 | { 30 | [CustomEditor(typeof(Funnel))] 31 | class FunnelEditor : Editor 32 | { 33 | SerializedProperty _screenWidth; 34 | SerializedProperty _screenHeight; 35 | SerializedProperty _antiAliasing; 36 | SerializedProperty _discardAlpha; 37 | SerializedProperty _renderMode; 38 | 39 | static GUIContent[] _aaLabels = { 40 | new GUIContent("Off"), 41 | new GUIContent("x2"), 42 | new GUIContent("x4"), 43 | new GUIContent("x8") 44 | }; 45 | 46 | static int[] _aaValues = {1, 2, 4, 8}; 47 | 48 | void OnEnable() 49 | { 50 | _screenWidth = serializedObject.FindProperty("_screenWidth"); 51 | _screenHeight = serializedObject.FindProperty("_screenHeight"); 52 | _antiAliasing = serializedObject.FindProperty("_antiAliasing"); 53 | _discardAlpha = serializedObject.FindProperty("_discardAlpha"); 54 | _renderMode = serializedObject.FindProperty("_renderMode"); 55 | } 56 | 57 | public override void OnInspectorGUI() 58 | { 59 | serializedObject.Update(); 60 | 61 | EditorGUILayout.PropertyField(_screenWidth); 62 | EditorGUILayout.PropertyField(_screenHeight); 63 | EditorGUILayout.IntPopup(_antiAliasing, _aaLabels, _aaValues); 64 | EditorGUILayout.PropertyField(_discardAlpha); 65 | EditorGUILayout.PropertyField(_renderMode); 66 | 67 | serializedObject.ApplyModifiedProperties(); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Assets/Funnel/Editor/FunnelEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b24d32daa7ac84b93a3ffe6d791d3951 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Funnel/Funnel.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Funnel - Syphon server plugin for Unity 3 | // 4 | // Copyright (C) 2013-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 | 25 | using UnityEngine; 26 | using System.Runtime.InteropServices; 27 | 28 | namespace Funnel 29 | { 30 | [ExecuteInEditMode] 31 | [RequireComponent(typeof(Camera))] 32 | [AddComponentMenu("Rendering/Syphon/Funnel")] 33 | public class Funnel : MonoBehaviour 34 | { 35 | #region Exposed properties 36 | 37 | /// Width of the screen to be sent 38 | public int screenWidth { 39 | get { return Mathf.Clamp(_screenWidth, 8, 8192); } 40 | set { _screenWidth = value; } 41 | } 42 | [SerializeField] int _screenWidth = 1280; 43 | 44 | /// Height of the screen to be sent 45 | public int screenHeight { 46 | get { return Mathf.Clamp(_screenHeight, 8, 8192); } 47 | set { _screenHeight = value; } 48 | } 49 | [SerializeField] int _screenHeight = 720; 50 | 51 | /// Anti-aliasing (MSAA) option 52 | public int antiAliasing { 53 | get { return _antiAliasing; } 54 | set { _antiAliasing = value; } 55 | } 56 | [SerializeField] int _antiAliasing = 1; 57 | 58 | /// Discards alpha channel before sending 59 | public bool discardAlpha { 60 | get { return _discardAlpha; } 61 | set { _discardAlpha = value; } 62 | } 63 | [SerializeField] bool _discardAlpha = true; 64 | 65 | /// Determines how to handle the rendered screen 66 | public RenderMode renderMode { 67 | get { return _renderMode; } 68 | set { _renderMode = value; } 69 | } 70 | [SerializeField] RenderMode _renderMode = RenderMode.RenderToTarget; 71 | public enum RenderMode { SendOnly, RenderToTarget, PreviewOnGameView } 72 | 73 | /// Screen render target 74 | public Texture renderTexture { 75 | get { return _renderTexture; } 76 | } 77 | RenderTexture _renderTexture; // should not be serialized 78 | 79 | #endregion 80 | 81 | #region Private members 82 | 83 | // Slot index counter 84 | static int _slotCount = 0; 85 | 86 | // Server slot index 87 | int _slotIndex; 88 | 89 | // Gamma correction shader 90 | [SerializeField] Shader _gammaShader; 91 | Material _gammaMaterial; 92 | 93 | // Material with lazy shader initialization 94 | Material gammaMaterial { 95 | get { 96 | if (_gammaMaterial == null) { 97 | _gammaMaterial = new Material(_gammaShader); 98 | _gammaMaterial.hideFlags = HideFlags.DontSave; 99 | } 100 | return _gammaMaterial; 101 | } 102 | } 103 | 104 | // Detects changes on the screen settings. 105 | bool ScreenSettingsChanged { 106 | get { 107 | return _renderTexture && ( 108 | _renderTexture.width != screenWidth || 109 | _renderTexture.height != screenHeight || 110 | _renderTexture.antiAliasing != antiAliasing 111 | ); 112 | } 113 | } 114 | 115 | #endregion 116 | 117 | #region Native plugin interface 118 | 119 | [DllImport("Funnel", EntryPoint="FunnelSetFrame")] 120 | static extern void SetSourceFrame( 121 | int slotIndex, string frameName, 122 | System.IntPtr texture, int width, int height, 123 | bool linearToSrgb, bool discardAlpha 124 | ); 125 | 126 | [DllImport("Funnel")] 127 | static extern System.IntPtr GetRenderEventFunc(); 128 | 129 | static void InvokePublishEvent(int slot) 130 | { 131 | const int publishEventID = 0x10000; 132 | GL.IssuePluginEvent(GetRenderEventFunc(), publishEventID + slot); 133 | } 134 | 135 | static void InvokeReleaseEvent(int slot) 136 | { 137 | const int releaseEventID = 0x20000; 138 | GL.IssuePluginEvent(GetRenderEventFunc(), releaseEventID + slot); 139 | } 140 | 141 | #endregion 142 | 143 | #region MonoBehaviour functions 144 | 145 | void OnEnable() 146 | { 147 | // Grab a new slot. 148 | _slotIndex = _slotCount++; 149 | 150 | // Create a render target. 151 | _renderTexture = new RenderTexture(screenWidth, screenHeight, 24); 152 | _renderTexture.hideFlags = HideFlags.DontSave; 153 | _renderTexture.antiAliasing = antiAliasing; 154 | 155 | // Override the camera. 156 | var camera = GetComponent(); 157 | camera.targetTexture = _renderTexture; 158 | camera.ResetAspect(); 159 | } 160 | 161 | void OnDisable() 162 | { 163 | // Release the slot. 164 | InvokeReleaseEvent(_slotIndex); 165 | 166 | // Release the camera. 167 | var camera = GetComponent(); 168 | camera.targetTexture = null; 169 | camera.ResetAspect(); 170 | 171 | // Release temporary assets. 172 | if (_gammaMaterial) DestroyImmediate(_gammaMaterial); 173 | if (_renderTexture) DestroyImmediate(_renderTexture); 174 | _gammaMaterial = null; 175 | _renderTexture = null; 176 | } 177 | 178 | void Update() 179 | { 180 | // Update the render target when the screen settings are changed. 181 | if (ScreenSettingsChanged) 182 | { 183 | var camera = GetComponent(); 184 | 185 | // Detach the render rexture temporarily because changes on 186 | // camera target texture is not allowed. 187 | camera.targetTexture = null; 188 | 189 | _renderTexture.Release(); 190 | 191 | _renderTexture.width = screenWidth; 192 | _renderTexture.height = screenHeight; 193 | _renderTexture.antiAliasing = antiAliasing; 194 | 195 | camera.targetTexture = _renderTexture; 196 | 197 | GetComponent().ResetAspect(); 198 | } 199 | } 200 | 201 | void OnRenderImage(RenderTexture source, RenderTexture destination) 202 | { 203 | var linear = QualitySettings.activeColorSpace == ColorSpace.Linear; 204 | 205 | // Screen blit 206 | if (_renderMode == RenderMode.PreviewOnGameView && linear) 207 | Graphics.Blit(source, destination, gammaMaterial, 0); 208 | else if (_renderMode != RenderMode.SendOnly) 209 | Graphics.Blit(source, destination); 210 | 211 | // Publish the content of the source buffer. 212 | SetSourceFrame( 213 | _slotIndex, gameObject.name, 214 | source.GetNativeTexturePtr(), source.width, source.height, 215 | linear, _discardAlpha); 216 | 217 | InvokePublishEvent(_slotIndex); 218 | } 219 | 220 | void OnGUI() 221 | { 222 | // Blit the render texture if preview is enabled. 223 | if (_renderMode != RenderMode.PreviewOnGameView) return; 224 | var rect = new Rect(0, 0, Screen.width, Screen.height); 225 | GUI.DrawTexture(rect, _renderTexture, ScaleMode.ScaleToFit, false); 226 | } 227 | 228 | #endregion 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /Assets/Funnel/Funnel.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d3c0b01ad228439a9d89134216071c6 3 | timeCreated: 1455282019 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _gammaShader: {fileID: 4800000, guid: 61221cb867c7a439fba6da3231ff64f7, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fea9c7c417c747829db5502aaed08bb 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d9b2b6862d5647d09a2d838aaa77143 3 | folderAsset: yes 4 | PluginImporter: 5 | serializedVersion: 1 6 | iconMap: {} 7 | executionOrder: {} 8 | isPreloaded: 0 9 | platformData: 10 | Android: 11 | enabled: 0 12 | settings: 13 | CPU: AnyCPU 14 | Any: 15 | enabled: 0 16 | settings: {} 17 | Editor: 18 | enabled: 1 19 | settings: 20 | CPU: x86_64 21 | DefaultValueInitialized: true 22 | OS: OSX 23 | Linux: 24 | enabled: 1 25 | settings: 26 | CPU: x86 27 | Linux64: 28 | enabled: 1 29 | settings: 30 | CPU: x86_64 31 | LinuxUniversal: 32 | enabled: 1 33 | settings: 34 | CPU: AnyCPU 35 | OSXIntel: 36 | enabled: 0 37 | settings: 38 | CPU: None 39 | OSXIntel64: 40 | enabled: 1 41 | settings: 42 | CPU: AnyCPU 43 | OSXUniversal: 44 | enabled: 1 45 | settings: 46 | CPU: x86_64 47 | SamsungTV: 48 | enabled: 0 49 | settings: 50 | STV_MODEL: STANDARD_13 51 | Win: 52 | enabled: 1 53 | settings: 54 | CPU: AnyCPU 55 | Win64: 56 | enabled: 1 57 | settings: 58 | CPU: AnyCPU 59 | iOS: 60 | enabled: 0 61 | settings: 62 | CompileFlags: 63 | FrameworkDependencies: 64 | userData: 65 | assetBundleName: 66 | assetBundleVariant: 67 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e72a2de6825ea44cfbdd93f16e3da79b 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildMachineOSBuild 6 | 15E33e 7 | CFBundleDevelopmentRegion 8 | English 9 | CFBundleExecutable 10 | Funnel 11 | CFBundleIdentifier 12 | jp.radiumsoftware.Funnel 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | Funnel 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.2 21 | CFBundleSignature 22 | ???? 23 | CFBundleSupportedPlatforms 24 | 25 | MacOSX 26 | 27 | CFBundleVersion 28 | 1.2 29 | CFPlugInDynamicRegisterFunction 30 | 31 | CFPlugInDynamicRegistration 32 | NO 33 | CFPlugInFactories 34 | 35 | 00000000-0000-0000-0000-000000000000 36 | MyFactoryFunction 37 | 38 | CFPlugInTypes 39 | 40 | 00000000-0000-0000-0000-000000000000 41 | 42 | 00000000-0000-0000-0000-000000000000 43 | 44 | 45 | CFPlugInUnloadFunction 46 | 47 | DTCompiler 48 | com.apple.compilers.llvm.clang.1_0 49 | DTPlatformBuild 50 | 7C1002 51 | DTPlatformVersion 52 | GM 53 | DTSDKBuild 54 | 15C43 55 | DTSDKName 56 | macosx10.11 57 | DTXcode 58 | 0721 59 | DTXcodeBuild 60 | 7C1002 61 | NSHumanReadableCopyright 62 | Copyright © 2014-2016 Keijiro Takahashi. All rights reserved. 63 | 64 | 65 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/Info.plist.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2b50d7fc66a9420b9640136b6d4c2a5 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/MacOS.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 486368f43103a4f0d8bc85921baaa3fc 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/MacOS/Funnel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Funnel/Plugins/Funnel.bundle/Contents/MacOS/Funnel -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/MacOS/Funnel.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 721f46fc520f244579028c66996c13f7 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e3ee57554fab4b10a982a630b3e7f4a 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/Resources/en.lproj.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 314e90848bdcf42b19a0c67556833ee5 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/Resources/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Funnel/Plugins/Funnel.bundle/Contents/Resources/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Assets/Funnel/Plugins/Funnel.bundle/Contents/Resources/en.lproj/InfoPlist.strings.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04791fbbaf85f4dfdb7df9d1d1efefe0 3 | DefaultImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Funnel/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bd1add3945c574dbe98c9e991e126df4 3 | folderAsset: yes 4 | timeCreated: 1455281941 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Funnel/Shader/Gamma.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Funnel - Syphon server plugin for Unity 3 | // 4 | // Copyright (C) 2013-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 | 25 | Shader "Hidden/Funnel/Gamma" 26 | { 27 | Properties 28 | { 29 | _MainTex("", 2D) = ""{} 30 | } 31 | 32 | CGINCLUDE 33 | 34 | #include "UnityCG.cginc" 35 | 36 | sampler2D _MainTex; 37 | 38 | half4 frag_encode(v2f_img i) : SV_Target 39 | { 40 | half4 c = tex2D(_MainTex, i.uv); 41 | c.rgb = LinearToGammaSpace(c.rgb); 42 | return c; 43 | } 44 | 45 | ENDCG 46 | 47 | SubShader 48 | { 49 | Pass 50 | { 51 | ZTest Always Cull Off ZWrite Off 52 | Fog { Mode off } 53 | CGPROGRAM 54 | #pragma vertex vert_img 55 | #pragma fragment frag_encode 56 | ENDCG 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Assets/Funnel/Shader/Gamma.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61221cb867c7a439fba6da3231ff64f7 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Gasta.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c6c21fdaa5ec43144b629d46c5dee773 3 | folderAsset: yes 4 | timeCreated: 1451204066 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Gasta/Acknowledgement.txt: -------------------------------------------------------------------------------- 1 | The HDRI file in this directory is made by Nicola Gastaldi. 2 | http://www.gasta.org/wordpress/free-hdri-studio/ 3 | -------------------------------------------------------------------------------- /Assets/Gasta/Acknowledgement.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab0e4627c2428c049a0121250e72c0a0 3 | timeCreated: 1451204097 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Gasta/hdriReflection.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Gasta/hdriReflection.hdr -------------------------------------------------------------------------------- /Assets/Gasta/hdriReflection.hdr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a09fc921d4a0f81449d9cf205595eb62 3 | timeCreated: 1451203965 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: .25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | cubemapConvolutionSteps: 8 28 | cubemapConvolutionExponent: 1.5 29 | seamlessCubemap: 0 30 | textureFormat: -1 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: .5, y: .5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaIsTransparency: 0 50 | textureType: 3 51 | buildTargetSettings: [] 52 | spriteSheet: 53 | sprites: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /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/Kino/Bloom.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ecdb90abc15fe42bca3b67047f7fd9df 3 | folderAsset: yes 4 | timeCreated: 1445666754 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Bloom.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Bloom v2 - Bloom filter for Unity 3 | // 4 | // Copyright (C) 2015, 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 | [ExecuteInEditMode] 29 | [RequireComponent(typeof(Camera))] 30 | [AddComponentMenu("Kino Image Effects/Bloom")] 31 | public class Bloom : MonoBehaviour 32 | { 33 | #region Public Properties 34 | 35 | /// Prefilter threshold (gamma-encoded) 36 | /// Filters out pixels under this level of brightness. 37 | public float thresholdGamma { 38 | get { return Mathf.Max(_threshold, 0); } 39 | set { _threshold = value; } 40 | } 41 | 42 | /// Prefilter threshold (linearly-encoded) 43 | /// Filters out pixels under this level of brightness. 44 | public float thresholdLinear { 45 | get { return GammaToLinear(thresholdGamma); } 46 | set { _threshold = LinearToGamma(value); } 47 | } 48 | 49 | [SerializeField] 50 | [Tooltip("Filters out pixels under this level of brightness.")] 51 | float _threshold = 0.8f; 52 | 53 | /// Soft-knee coefficient 54 | /// Makes transition between under/over-threshold gradual. 55 | public float softKnee { 56 | get { return _softKnee; } 57 | set { _softKnee = value; } 58 | } 59 | 60 | [SerializeField, Range(0, 1)] 61 | [Tooltip("Makes transition between under/over-threshold gradual.")] 62 | float _softKnee = 0.5f; 63 | 64 | /// Bloom radius 65 | /// Changes extent of veiling effects in a screen 66 | /// resolution-independent fashion. 67 | public float radius { 68 | get { return _radius; } 69 | set { _radius = value; } 70 | } 71 | 72 | [SerializeField, Range(1, 7)] 73 | [Tooltip("Changes extent of veiling effects\n" + 74 | "in a screen resolution-independent fashion.")] 75 | float _radius = 2.5f; 76 | 77 | /// Bloom intensity 78 | /// Blend factor of the result image. 79 | public float intensity { 80 | get { return Mathf.Max(_intensity, 0); } 81 | set { _intensity = value; } 82 | } 83 | 84 | [SerializeField] 85 | [Tooltip("Blend factor of the result image.")] 86 | float _intensity = 0.8f; 87 | 88 | /// High quality mode 89 | /// Controls filter quality and buffer resolution. 90 | public bool highQuality { 91 | get { return _highQuality; } 92 | set { _highQuality = value; } 93 | } 94 | 95 | [SerializeField] 96 | [Tooltip("Controls filter quality and buffer resolution.")] 97 | bool _highQuality = true; 98 | 99 | /// Anti-flicker filter 100 | /// Reduces flashing noise with an additional filter. 101 | [SerializeField] 102 | [Tooltip("Reduces flashing noise with an additional filter.")] 103 | bool _antiFlicker = true; 104 | 105 | public bool antiFlicker { 106 | get { return _antiFlicker; } 107 | set { _antiFlicker = value; } 108 | } 109 | 110 | #endregion 111 | 112 | #region Private Members 113 | 114 | [SerializeField, HideInInspector] 115 | Shader _shader; 116 | 117 | Material _material; 118 | 119 | const int kMaxIterations = 16; 120 | RenderTexture[] _blurBuffer1 = new RenderTexture[kMaxIterations]; 121 | RenderTexture[] _blurBuffer2 = new RenderTexture[kMaxIterations]; 122 | 123 | float LinearToGamma(float x) 124 | { 125 | #if UNITY_5_3_OR_NEWER 126 | return Mathf.LinearToGammaSpace(x); 127 | #else 128 | if (x <= 0.0031308f) 129 | return 12.92f * x; 130 | else 131 | return 1.055f * Mathf.Pow(x, 1 / 2.4f) - 0.055f; 132 | #endif 133 | } 134 | 135 | float GammaToLinear(float x) 136 | { 137 | #if UNITY_5_3_OR_NEWER 138 | return Mathf.GammaToLinearSpace(x); 139 | #else 140 | if (x <= 0.04045f) 141 | return x / 12.92f; 142 | else 143 | return Mathf.Pow((x + 0.055f) / 1.055f, 2.4f); 144 | #endif 145 | } 146 | 147 | #endregion 148 | 149 | #region MonoBehaviour Functions 150 | 151 | void OnEnable() 152 | { 153 | var shader = _shader ? _shader : Shader.Find("Hidden/Kino/Bloom"); 154 | _material = new Material(shader); 155 | _material.hideFlags = HideFlags.DontSave; 156 | } 157 | 158 | void OnDisable() 159 | { 160 | DestroyImmediate(_material); 161 | } 162 | 163 | void OnRenderImage(RenderTexture source, RenderTexture destination) 164 | { 165 | var useRGBM = Application.isMobilePlatform; 166 | var isGamma = QualitySettings.activeColorSpace == ColorSpace.Gamma; 167 | 168 | // source texture size 169 | var tw = source.width; 170 | var th = source.height; 171 | 172 | // halve the texture size for the low quality mode 173 | if (!_highQuality) 174 | { 175 | tw /= 2; 176 | th /= 2; 177 | } 178 | 179 | // blur buffer format 180 | var rtFormat = useRGBM ? 181 | RenderTextureFormat.Default : RenderTextureFormat.DefaultHDR; 182 | 183 | // determine the iteration count 184 | var logh = Mathf.Log(th, 2) + _radius - 8; 185 | var logh_i = (int)logh; 186 | var iterations = Mathf.Clamp(logh_i, 1, kMaxIterations); 187 | 188 | // update the shader properties 189 | var lthresh = thresholdLinear; 190 | _material.SetFloat("_Threshold", lthresh); 191 | 192 | var knee = lthresh * _softKnee + 1e-5f; 193 | var curve = new Vector3(lthresh - knee, knee * 2, 0.25f / knee); 194 | _material.SetVector("_Curve", curve); 195 | 196 | var pfo = !_highQuality && _antiFlicker; 197 | _material.SetFloat("_PrefilterOffs", pfo ? -0.5f : 0.0f); 198 | 199 | _material.SetFloat("_SampleScale", 0.5f + logh - logh_i); 200 | _material.SetFloat("_Intensity", intensity); 201 | 202 | if (_highQuality) 203 | _material.EnableKeyword("HIGH_QUALITY"); 204 | else 205 | _material.DisableKeyword("HIGH_QUALITY"); 206 | 207 | if (_antiFlicker) 208 | _material.EnableKeyword("ANTI_FLICKER"); 209 | else 210 | _material.DisableKeyword("ANTI_FLICKER"); 211 | 212 | if (isGamma) 213 | { 214 | _material.DisableKeyword("LINEAR_COLOR"); 215 | _material.EnableKeyword("GAMMA_COLOR"); 216 | } 217 | else 218 | { 219 | _material.EnableKeyword("LINEAR_COLOR"); 220 | _material.DisableKeyword("GAMMA_COLOR"); 221 | } 222 | 223 | // prefilter pass 224 | var prefiltered = RenderTexture.GetTemporary(tw, th, 0, rtFormat); 225 | Graphics.Blit(source, prefiltered, _material, 0); 226 | 227 | // construct a mip pyramid 228 | var last = prefiltered; 229 | for (var level = 0; level < iterations; level++) 230 | { 231 | _blurBuffer1[level] = RenderTexture.GetTemporary( 232 | last.width / 2, last.height / 2, 0, rtFormat 233 | ); 234 | 235 | var pass = (level == 0) ? 1 : 2; 236 | Graphics.Blit(last, _blurBuffer1[level], _material, pass); 237 | 238 | last = _blurBuffer1[level]; 239 | } 240 | 241 | // upsample and combine loop 242 | for (var level = iterations - 2; level >= 0; level--) 243 | { 244 | var basetex = _blurBuffer1[level]; 245 | _material.SetTexture("_BaseTex", basetex); 246 | 247 | _blurBuffer2[level] = RenderTexture.GetTemporary( 248 | basetex.width, basetex.height, 0, rtFormat 249 | ); 250 | 251 | Graphics.Blit(last, _blurBuffer2[level], _material, 3); 252 | last = _blurBuffer2[level]; 253 | } 254 | 255 | // finish process 256 | _material.SetTexture("_BaseTex", source); 257 | Graphics.Blit(last, destination, _material, 4); 258 | 259 | // release the temporary buffers 260 | for (var i = 0; i < kMaxIterations; i++) 261 | { 262 | if (_blurBuffer1[i] != null) 263 | RenderTexture.ReleaseTemporary(_blurBuffer1[i]); 264 | 265 | if (_blurBuffer2[i] != null) 266 | RenderTexture.ReleaseTemporary(_blurBuffer2[i]); 267 | 268 | _blurBuffer1[i] = null; 269 | _blurBuffer2[i] = null; 270 | } 271 | 272 | RenderTexture.ReleaseTemporary(prefiltered); 273 | } 274 | 275 | #endregion 276 | } 277 | } 278 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Bloom.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6363bba448bf64e60a763433f9ddf81b 3 | timeCreated: 1445671165 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 5a711a01011934ebcb58ef5ad52159d6, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e7e3e77db40c4cba83bb3a6ab440084 3 | folderAsset: yes 4 | timeCreated: 1445666764 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Editor/BloomEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Bloom v2 - Bloom filter for Unity 3 | // 4 | // Copyright (C) 2015, 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(Bloom))] 31 | public class BloomEditor : Editor 32 | { 33 | BloomGraphDrawer _graph; 34 | 35 | SerializedProperty _threshold; 36 | SerializedProperty _softKnee; 37 | SerializedProperty _radius; 38 | SerializedProperty _intensity; 39 | SerializedProperty _highQuality; 40 | SerializedProperty _antiFlicker; 41 | 42 | static GUIContent _textThreshold = new GUIContent("Threshold (gamma)"); 43 | 44 | void OnEnable() 45 | { 46 | _graph = new BloomGraphDrawer(); 47 | _threshold = serializedObject.FindProperty("_threshold"); 48 | _softKnee = serializedObject.FindProperty("_softKnee"); 49 | _radius = serializedObject.FindProperty("_radius"); 50 | _intensity = serializedObject.FindProperty("_intensity"); 51 | _highQuality = serializedObject.FindProperty("_highQuality"); 52 | _antiFlicker = serializedObject.FindProperty("_antiFlicker"); 53 | } 54 | 55 | public override void OnInspectorGUI() 56 | { 57 | serializedObject.Update(); 58 | 59 | if (!serializedObject.isEditingMultipleObjects) { 60 | EditorGUILayout.Space(); 61 | _graph.Prepare((Bloom)target); 62 | _graph.DrawGraph(); 63 | EditorGUILayout.Space(); 64 | } 65 | 66 | EditorGUILayout.PropertyField(_threshold, _textThreshold); 67 | EditorGUILayout.PropertyField(_softKnee); 68 | EditorGUILayout.PropertyField(_intensity); 69 | EditorGUILayout.PropertyField(_radius); 70 | EditorGUILayout.PropertyField(_highQuality); 71 | EditorGUILayout.PropertyField(_antiFlicker); 72 | 73 | serializedObject.ApplyModifiedProperties(); 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Editor/BloomEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 036bc30d96c3349ce86bfc8d95667da7 3 | timeCreated: 1435816745 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/Bloom/Editor/BloomGraphDrawer.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Bloom v2 - Bloom filter for Unity 3 | // 4 | // Copyright (C) 2015, 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 | // Class used for drawing the brightness response curve 30 | public class BloomGraphDrawer 31 | { 32 | #region Public Methods 33 | 34 | // Update internal state with a given bloom instance. 35 | public void Prepare(Bloom bloom) 36 | { 37 | if (bloom.GetComponent().hdr) 38 | { 39 | _rangeX = 6; 40 | _rangeY = 1.5f; 41 | } 42 | else 43 | { 44 | _rangeX = 1; 45 | _rangeY = 1; 46 | } 47 | 48 | _threshold = bloom.thresholdLinear; 49 | _knee = bloom.softKnee * _threshold + 1e-5f; 50 | 51 | // Intensity is capped to prevent sampling errors. 52 | _intensity = Mathf.Min(bloom.intensity, 10); 53 | } 54 | 55 | // Draw the graph at the current position. 56 | public void DrawGraph() 57 | { 58 | _rectGraph = GUILayoutUtility.GetRect(128, 80); 59 | 60 | // Background 61 | DrawRect(0, 0, _rangeX, _rangeY, 0.1f, 0.4f); 62 | 63 | // Soft-knee range 64 | DrawRect(_threshold - _knee, 0, _threshold + _knee, _rangeY, 0.25f, -1); 65 | 66 | // Horizontal lines 67 | for (var i = 1; i < _rangeY; i++) 68 | DrawLine(0, i, _rangeX, i, 0.4f); 69 | 70 | // Vertical lines 71 | for (var i = 1; i < _rangeX; i++) 72 | DrawLine(i, 0, i, _rangeY, 0.4f); 73 | 74 | // Label 75 | Handles.Label( 76 | PointInRect(0, _rangeY) + Vector3.right, 77 | "Brightness Response (linear)", EditorStyles.miniLabel 78 | ); 79 | 80 | // Threshold line 81 | DrawLine(_threshold, 0, _threshold, _rangeY, 0.6f); 82 | 83 | // Response curve 84 | var vcount = 0; 85 | while (vcount < _curveResolution) 86 | { 87 | var x = _rangeX * vcount / (_curveResolution - 1); 88 | var y = ResponseFunction(x); 89 | if (y < _rangeY) 90 | { 91 | _curveVertices[vcount++] = PointInRect(x, y); 92 | } 93 | else 94 | { 95 | if (vcount > 1) 96 | { 97 | // Extend the last segment to the top edge of the rect. 98 | var v1 = _curveVertices[vcount - 2]; 99 | var v2 = _curveVertices[vcount - 1]; 100 | var clip = (_rectGraph.y - v1.y) / (v2.y - v1.y); 101 | _curveVertices[vcount - 1] = v1 + (v2 - v1) * clip; 102 | } 103 | break; 104 | } 105 | } 106 | 107 | if (vcount > 1) 108 | { 109 | Handles.color = Color.white * 0.9f; 110 | Handles.DrawAAPolyLine(2.0f, vcount, _curveVertices); 111 | } 112 | } 113 | 114 | #endregion 115 | 116 | #region Response Function 117 | 118 | float _threshold; 119 | float _knee; 120 | float _intensity; 121 | 122 | float ResponseFunction(float x) 123 | { 124 | var rq = Mathf.Clamp(x - _threshold + _knee, 0, _knee * 2); 125 | rq = rq * rq * 0.25f / _knee; 126 | return Mathf.Max(rq, x - _threshold) * _intensity; 127 | } 128 | 129 | #endregion 130 | 131 | #region Graph Functions 132 | 133 | // Number of vertices in curve 134 | const int _curveResolution = 96; 135 | 136 | // Vertex buffers 137 | Vector3[] _rectVertices = new Vector3[4]; 138 | Vector3[] _lineVertices = new Vector3[2]; 139 | Vector3[] _curveVertices = new Vector3[_curveResolution]; 140 | 141 | Rect _rectGraph; 142 | float _rangeX; 143 | float _rangeY; 144 | 145 | // Transform a point into the graph rect. 146 | Vector3 PointInRect(float x, float y) 147 | { 148 | x = Mathf.Lerp(_rectGraph.x, _rectGraph.xMax, x / _rangeX); 149 | y = Mathf.Lerp(_rectGraph.yMax, _rectGraph.y, y / _rangeY); 150 | return new Vector3(x, y, 0); 151 | } 152 | 153 | // Draw a line in the graph rect. 154 | void DrawLine(float x1, float y1, float x2, float y2, float grayscale) 155 | { 156 | _lineVertices[0] = PointInRect(x1, y1); 157 | _lineVertices[1] = PointInRect(x2, y2); 158 | Handles.color = Color.white * grayscale; 159 | Handles.DrawAAPolyLine(2.0f, _lineVertices); 160 | } 161 | 162 | // Draw a rect in the graph rect. 163 | void DrawRect(float x1, float y1, float x2, float y2, float fill, float line) 164 | { 165 | _rectVertices[0] = PointInRect(x1, y1); 166 | _rectVertices[1] = PointInRect(x2, y1); 167 | _rectVertices[2] = PointInRect(x2, y2); 168 | _rectVertices[3] = PointInRect(x1, y2); 169 | 170 | Handles.DrawSolidRectangleWithOutline( 171 | _rectVertices, 172 | fill < 0 ? Color.clear : Color.white * fill, 173 | line < 0 ? Color.clear : Color.white * line 174 | ); 175 | } 176 | 177 | #endregion 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Editor/BloomGraphDrawer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4afcb2949e7fb42679b587b8848b7e02 3 | timeCreated: 1457674915 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/Bloom/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f44dd1607e93a4131a4003b39c363e93 3 | folderAsset: yes 4 | timeCreated: 1445666764 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Shader/Bloom.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Kino/Bloom v2 - Bloom filter for Unity 3 | // 4 | // Copyright (C) 2015, 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/Bloom" 25 | { 26 | Properties 27 | { 28 | _MainTex("", 2D) = "" {} 29 | _BaseTex("", 2D) = "" {} 30 | } 31 | 32 | CGINCLUDE 33 | 34 | #include "UnityCG.cginc" 35 | 36 | #pragma multi_compile _ HIGH_QUALITY 37 | #pragma multi_compile _ ANTI_FLICKER 38 | #pragma multi_compile LINEAR_COLOR GAMMA_COLOR 39 | 40 | // Mobile: use RGBM instead of float/half RGB 41 | #define USE_RGBM defined(SHADER_API_MOBILE) 42 | 43 | sampler2D _MainTex; 44 | sampler2D _BaseTex; 45 | float2 _MainTex_TexelSize; 46 | float2 _BaseTex_TexelSize; 47 | 48 | float _PrefilterOffs; 49 | half _Threshold; 50 | half3 _Curve; 51 | float _SampleScale; 52 | half _Intensity; 53 | 54 | // Brightness function 55 | half Brightness(half3 c) 56 | { 57 | return max(max(c.r, c.g), c.b); 58 | } 59 | 60 | // 3-tap median filter 61 | half3 Median(half3 a, half3 b, half3 c) 62 | { 63 | return a + b + c - min(min(a, b), c) - max(max(a, b), c); 64 | } 65 | 66 | // Clamp HDR value within a safe range 67 | half3 SafeHDR(half3 c) { return min(c, 65000); } 68 | half4 SafeHDR(half4 c) { return min(c, 65000); } 69 | 70 | // RGBM encoding/decoding 71 | half4 EncodeHDR(float3 rgb) 72 | { 73 | #if USE_RGBM 74 | rgb *= 1.0 / 8; 75 | float m = max(max(rgb.r, rgb.g), max(rgb.b, 1e-6)); 76 | m = ceil(m * 255) / 255; 77 | return half4(rgb / m, m); 78 | #else 79 | return half4(rgb, 0); 80 | #endif 81 | } 82 | 83 | float3 DecodeHDR(half4 rgba) 84 | { 85 | #if USE_RGBM 86 | return rgba.rgb * rgba.a * 8; 87 | #else 88 | return rgba.rgb; 89 | #endif 90 | } 91 | 92 | // Downsample with a 4x4 box filter 93 | half3 DownsampleFilter(float2 uv) 94 | { 95 | float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1); 96 | 97 | half3 s; 98 | s = DecodeHDR(tex2D(_MainTex, uv + d.xy)); 99 | s += DecodeHDR(tex2D(_MainTex, uv + d.zy)); 100 | s += DecodeHDR(tex2D(_MainTex, uv + d.xw)); 101 | s += DecodeHDR(tex2D(_MainTex, uv + d.zw)); 102 | 103 | return s * (1.0 / 4); 104 | } 105 | 106 | #if ANTI_FLICKER 107 | 108 | // Downsample with a 4x4 box filter + anti-flicker filter 109 | half3 DownsampleAntiFlickerFilter(float2 uv) 110 | { 111 | float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1); 112 | 113 | half3 s1 = DecodeHDR(tex2D(_MainTex, uv + d.xy)); 114 | half3 s2 = DecodeHDR(tex2D(_MainTex, uv + d.zy)); 115 | half3 s3 = DecodeHDR(tex2D(_MainTex, uv + d.xw)); 116 | half3 s4 = DecodeHDR(tex2D(_MainTex, uv + d.zw)); 117 | 118 | // Karis's luma weighted average (using brightness instead of luma) 119 | half s1w = 1 / (Brightness(s1) + 1); 120 | half s2w = 1 / (Brightness(s2) + 1); 121 | half s3w = 1 / (Brightness(s3) + 1); 122 | half s4w = 1 / (Brightness(s4) + 1); 123 | half one_div_wsum = 1 / (s1w + s2w + s3w + s4w); 124 | 125 | return (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * one_div_wsum; 126 | } 127 | 128 | #endif 129 | 130 | half3 UpsampleFilter(float2 uv) 131 | { 132 | #if HIGH_QUALITY 133 | // 9-tap bilinear upsampler (tent filter) 134 | float4 d = _MainTex_TexelSize.xyxy * float4(1, 1, -1, 0) * _SampleScale; 135 | 136 | half3 s; 137 | s = DecodeHDR(tex2D(_MainTex, uv - d.xy)); 138 | s += DecodeHDR(tex2D(_MainTex, uv - d.wy)) * 2; 139 | s += DecodeHDR(tex2D(_MainTex, uv - d.zy)); 140 | 141 | s += DecodeHDR(tex2D(_MainTex, uv + d.zw)) * 2; 142 | s += DecodeHDR(tex2D(_MainTex, uv )) * 4; 143 | s += DecodeHDR(tex2D(_MainTex, uv + d.xw)) * 2; 144 | 145 | s += DecodeHDR(tex2D(_MainTex, uv + d.zy)); 146 | s += DecodeHDR(tex2D(_MainTex, uv + d.wy)) * 2; 147 | s += DecodeHDR(tex2D(_MainTex, uv + d.xy)); 148 | 149 | return s * (1.0 / 16); 150 | #else 151 | // 4-tap bilinear upsampler 152 | float4 d = _MainTex_TexelSize.xyxy * float4(-1, -1, +1, +1) * (_SampleScale * 0.5); 153 | 154 | half3 s; 155 | s = DecodeHDR(tex2D(_MainTex, uv + d.xy)); 156 | s += DecodeHDR(tex2D(_MainTex, uv + d.zy)); 157 | s += DecodeHDR(tex2D(_MainTex, uv + d.xw)); 158 | s += DecodeHDR(tex2D(_MainTex, uv + d.zw)); 159 | 160 | return s * (1.0 / 4); 161 | #endif 162 | } 163 | 164 | // 165 | // Vertex shader 166 | // 167 | 168 | struct v2f_multitex 169 | { 170 | float4 pos : SV_POSITION; 171 | float2 uvMain : TEXCOORD0; 172 | float2 uvBase : TEXCOORD1; 173 | }; 174 | 175 | v2f_multitex vert_multitex(appdata_full v) 176 | { 177 | v2f_multitex o; 178 | o.pos = mul(UNITY_MATRIX_MVP, v.vertex); 179 | o.uvMain = v.texcoord.xy; 180 | o.uvBase = v.texcoord.xy; 181 | #if UNITY_UV_STARTS_AT_TOP 182 | if (_BaseTex_TexelSize.y < 0.0) 183 | o.uvBase.y = 1.0 - v.texcoord.y; 184 | #endif 185 | return o; 186 | } 187 | 188 | // 189 | // fragment shader 190 | // 191 | 192 | half4 frag_prefilter(v2f_img i) : SV_Target 193 | { 194 | float2 uv = i.uv + _MainTex_TexelSize.xy * _PrefilterOffs; 195 | 196 | #if ANTI_FLICKER 197 | float3 d = _MainTex_TexelSize.xyx * float3(1, 1, 0); 198 | half4 s0 = SafeHDR(tex2D(_MainTex, uv)); 199 | half3 s1 = SafeHDR(tex2D(_MainTex, uv - d.xz).rgb); 200 | half3 s2 = SafeHDR(tex2D(_MainTex, uv + d.xz).rgb); 201 | half3 s3 = SafeHDR(tex2D(_MainTex, uv - d.zy).rgb); 202 | half3 s4 = SafeHDR(tex2D(_MainTex, uv + d.zy).rgb); 203 | half3 m = Median(Median(s0.rgb, s1, s2), s3, s4); 204 | #else 205 | half4 s0 = SafeHDR(tex2D(_MainTex, uv)); 206 | half3 m = s0.rgb; 207 | #endif 208 | 209 | #if GAMMA_COLOR 210 | m = GammaToLinearSpace(m); 211 | #endif 212 | // Pixel brightness 213 | half br = Brightness(m); 214 | 215 | // Under-threshold part: quadratic curve 216 | half rq = clamp(br - _Curve.x, 0, _Curve.y); 217 | rq = _Curve.z * rq * rq; 218 | 219 | // Combine and apply the brightness response curve. 220 | m *= max(rq, br - _Threshold) / (br + 1e-5); 221 | 222 | return EncodeHDR(m); 223 | } 224 | 225 | half4 frag_downsample1(v2f_img i) : SV_Target 226 | { 227 | #if ANTI_FLICKER 228 | return EncodeHDR(DownsampleAntiFlickerFilter(i.uv)); 229 | #else 230 | return EncodeHDR(DownsampleFilter(i.uv)); 231 | #endif 232 | } 233 | 234 | half4 frag_downsample2(v2f_img i) : SV_Target 235 | { 236 | return EncodeHDR(DownsampleFilter(i.uv)); 237 | } 238 | 239 | half4 frag_upsample(v2f_multitex i) : SV_Target 240 | { 241 | half3 base = DecodeHDR(tex2D(_BaseTex, i.uvBase)); 242 | half3 blur = UpsampleFilter(i.uvMain); 243 | return EncodeHDR(base + blur); 244 | } 245 | 246 | half4 frag_upsample_final(v2f_multitex i) : SV_Target 247 | { 248 | half4 base = tex2D(_BaseTex, i.uvBase); 249 | half3 blur = UpsampleFilter(i.uvMain); 250 | #if GAMMA_COLOR 251 | base.rgb = GammaToLinearSpace(base.rgb); 252 | #endif 253 | half3 cout = base.rgb + blur * _Intensity; 254 | #if GAMMA_COLOR 255 | cout = LinearToGammaSpace(cout); 256 | #endif 257 | return half4(cout, base.a); 258 | } 259 | 260 | ENDCG 261 | SubShader 262 | { 263 | Pass 264 | { 265 | ZTest Always Cull Off ZWrite Off 266 | CGPROGRAM 267 | #pragma vertex vert_img 268 | #pragma fragment frag_prefilter 269 | #pragma target 3.0 270 | ENDCG 271 | } 272 | Pass 273 | { 274 | ZTest Always Cull Off ZWrite Off 275 | CGPROGRAM 276 | #pragma vertex vert_img 277 | #pragma fragment frag_downsample1 278 | #pragma target 3.0 279 | ENDCG 280 | } 281 | Pass 282 | { 283 | ZTest Always Cull Off ZWrite Off 284 | CGPROGRAM 285 | #pragma vertex vert_img 286 | #pragma fragment frag_downsample2 287 | #pragma target 3.0 288 | ENDCG 289 | } 290 | Pass 291 | { 292 | ZTest Always Cull Off ZWrite Off 293 | CGPROGRAM 294 | #pragma vertex vert_multitex 295 | #pragma fragment frag_upsample 296 | #pragma target 3.0 297 | ENDCG 298 | } 299 | Pass 300 | { 301 | ZTest Always Cull Off ZWrite Off 302 | CGPROGRAM 303 | #pragma vertex vert_multitex 304 | #pragma fragment frag_upsample_final 305 | #pragma target 3.0 306 | ENDCG 307 | } 308 | } 309 | } 310 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Shader/Bloom.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a711a01011934ebcb58ef5ad52159d6 3 | timeCreated: 1435809878 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/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/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/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 _blurIterations; 38 | SerializedProperty _downsampling; 39 | SerializedProperty _ambientOnly; 40 | 41 | static GUIContent _textValue = new GUIContent("Value"); 42 | 43 | static string _textNoAmbientOnly = 44 | "The ambient-only mode is currently disabled; " + 45 | "it needs deferred shading and HDR rendering."; 46 | 47 | void OnEnable() 48 | { 49 | _intensity = serializedObject.FindProperty("_intensity"); 50 | _radius = serializedObject.FindProperty("_radius"); 51 | _sampleCount = serializedObject.FindProperty("_sampleCount"); 52 | _sampleCountValue = serializedObject.FindProperty("_sampleCountValue"); 53 | _blurIterations = serializedObject.FindProperty("_blurIterations"); 54 | _downsampling = serializedObject.FindProperty("_downsampling"); 55 | _ambientOnly = serializedObject.FindProperty("_ambientOnly"); 56 | } 57 | 58 | public override void OnInspectorGUI() 59 | { 60 | serializedObject.Update(); 61 | 62 | EditorGUILayout.PropertyField(_intensity); 63 | EditorGUILayout.PropertyField(_radius); 64 | EditorGUILayout.PropertyField(_sampleCount); 65 | 66 | if (_sampleCount.hasMultipleDifferentValues || 67 | _sampleCount.enumValueIndex == (int)Obscurance.SampleCount.Variable) 68 | { 69 | EditorGUI.indentLevel++; 70 | EditorGUILayout.PropertyField(_sampleCountValue, _textValue); 71 | EditorGUI.indentLevel--; 72 | } 73 | 74 | EditorGUILayout.PropertyField(_blurIterations); 75 | EditorGUILayout.PropertyField(_downsampling); 76 | EditorGUILayout.PropertyField(_ambientOnly); 77 | 78 | if (!_ambientOnly.hasMultipleDifferentValues) 79 | if (_ambientOnly.boolValue != ((Obscurance)target).ambientOnly) 80 | EditorGUILayout.HelpBox(_textNoAmbientOnly, MessageType.Info); 81 | 82 | serializedObject.ApplyModifiedProperties(); 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Assets/Kino/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/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 | -------------------------------------------------------------------------------- /Assets/Kino/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/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 | int _blurIterations; 35 | bool _downsampling; 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 | _blurIterations != target.blurIterations || 47 | _downsampling != target.downsampling || 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 | _blurIterations = target.blurIterations; 57 | _downsampling = target.downsampling; 58 | _ambientOnly = target.ambientOnly; 59 | _pixelWidth = camera.pixelWidth; 60 | _pixelHeight = camera.pixelHeight; 61 | } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Assets/Kino/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/Kino/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/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 | -------------------------------------------------------------------------------- /Assets/Kvant.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8be732b80b8b445e5bd196d2b01ed59c 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8d8b6795231e4940a433f488cefc64f 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70139d3c834e741809a21785374d28a3 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Editor/SprayEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Custom editor class for Spray 3 | // 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | namespace Kvant 8 | { 9 | [CanEditMultipleObjects] 10 | [CustomEditor(typeof(Spray))] 11 | public class SprayEditor : Editor 12 | { 13 | SerializedProperty _maxParticles; 14 | SerializedProperty _emitterCenter; 15 | SerializedProperty _emitterSize; 16 | SerializedProperty _throttle; 17 | 18 | SerializedProperty _life; 19 | SerializedProperty _lifeRandomness; 20 | 21 | SerializedProperty _initialVelocity; 22 | SerializedProperty _directionSpread; 23 | SerializedProperty _speedRandomness; 24 | 25 | SerializedProperty _acceleration; 26 | SerializedProperty _drag; 27 | 28 | SerializedProperty _spin; 29 | SerializedProperty _speedToSpin; 30 | SerializedProperty _spinRandomness; 31 | 32 | SerializedProperty _noiseAmplitude; 33 | SerializedProperty _noiseFrequency; 34 | SerializedProperty _noiseMotion; 35 | 36 | SerializedProperty _shapes; 37 | SerializedProperty _scale; 38 | SerializedProperty _scaleRandomness; 39 | SerializedProperty _material; 40 | SerializedProperty _castShadows; 41 | SerializedProperty _receiveShadows; 42 | 43 | SerializedProperty _randomSeed; 44 | SerializedProperty _debug; 45 | 46 | static GUIContent _textCenter = new GUIContent("Center"); 47 | static GUIContent _textSize = new GUIContent("Size"); 48 | static GUIContent _textMotion = new GUIContent("Motion"); 49 | static GUIContent _textAmplitude = new GUIContent("Amplitude"); 50 | static GUIContent _textFrequency = new GUIContent("Frequency"); 51 | 52 | void OnEnable() 53 | { 54 | _maxParticles = serializedObject.FindProperty("_maxParticles"); 55 | _emitterCenter = serializedObject.FindProperty("_emitterCenter"); 56 | _emitterSize = serializedObject.FindProperty("_emitterSize"); 57 | _throttle = serializedObject.FindProperty("_throttle"); 58 | 59 | _life = serializedObject.FindProperty("_life"); 60 | _lifeRandomness = serializedObject.FindProperty("_lifeRandomness"); 61 | 62 | _initialVelocity = serializedObject.FindProperty("_initialVelocity"); 63 | _directionSpread = serializedObject.FindProperty("_directionSpread"); 64 | _speedRandomness = serializedObject.FindProperty("_speedRandomness"); 65 | 66 | _acceleration = serializedObject.FindProperty("_acceleration"); 67 | _drag = serializedObject.FindProperty("_drag"); 68 | 69 | _spin = serializedObject.FindProperty("_spin"); 70 | _speedToSpin = serializedObject.FindProperty("_speedToSpin"); 71 | _spinRandomness = serializedObject.FindProperty("_spinRandomness"); 72 | 73 | _noiseAmplitude = serializedObject.FindProperty("_noiseAmplitude"); 74 | _noiseFrequency = serializedObject.FindProperty("_noiseFrequency"); 75 | _noiseMotion = serializedObject.FindProperty("_noiseMotion"); 76 | 77 | _shapes = serializedObject.FindProperty("_shapes"); 78 | _scale = serializedObject.FindProperty("_scale"); 79 | _scaleRandomness = serializedObject.FindProperty("_scaleRandomness"); 80 | _material = serializedObject.FindProperty("_material"); 81 | _castShadows = serializedObject.FindProperty("_castShadows"); 82 | _receiveShadows = serializedObject.FindProperty("_receiveShadows"); 83 | 84 | _randomSeed = serializedObject.FindProperty("_randomSeed"); 85 | _debug = serializedObject.FindProperty("_debug"); 86 | } 87 | 88 | public override void OnInspectorGUI() 89 | { 90 | var targetSpray = target as Spray; 91 | 92 | serializedObject.Update(); 93 | 94 | EditorGUI.BeginChangeCheck(); 95 | 96 | EditorGUILayout.PropertyField(_maxParticles); 97 | if (!_maxParticles.hasMultipleDifferentValues) { 98 | var note = "Allocated: " + targetSpray.maxParticles; 99 | EditorGUILayout.LabelField(" ", note, EditorStyles.miniLabel); 100 | } 101 | 102 | if (EditorGUI.EndChangeCheck()) 103 | targetSpray.NotifyConfigChange(); 104 | 105 | EditorGUILayout.LabelField("Emitter", EditorStyles.boldLabel); 106 | EditorGUILayout.PropertyField(_emitterCenter, _textCenter); 107 | EditorGUILayout.PropertyField(_emitterSize, _textSize); 108 | EditorGUILayout.PropertyField(_throttle); 109 | 110 | EditorGUILayout.Space(); 111 | 112 | EditorGUILayout.PropertyField(_life); 113 | EditorGUILayout.PropertyField(_lifeRandomness); 114 | 115 | EditorGUILayout.Space(); 116 | 117 | EditorGUILayout.LabelField("Velocity", EditorStyles.boldLabel); 118 | EditorGUILayout.PropertyField(_initialVelocity); 119 | EditorGUILayout.PropertyField(_directionSpread); 120 | EditorGUILayout.PropertyField(_speedRandomness); 121 | 122 | EditorGUILayout.Space(); 123 | 124 | EditorGUILayout.PropertyField(_acceleration); 125 | EditorGUILayout.PropertyField(_drag); 126 | 127 | EditorGUILayout.Space(); 128 | 129 | EditorGUILayout.LabelField("Rotation", EditorStyles.boldLabel); 130 | EditorGUILayout.PropertyField(_spin); 131 | EditorGUILayout.PropertyField(_speedToSpin); 132 | EditorGUILayout.PropertyField(_spinRandomness); 133 | 134 | EditorGUILayout.Space(); 135 | 136 | EditorGUILayout.LabelField("Turbulent Noise", EditorStyles.boldLabel); 137 | EditorGUILayout.PropertyField(_noiseAmplitude, _textAmplitude); 138 | EditorGUILayout.PropertyField(_noiseFrequency, _textFrequency); 139 | EditorGUILayout.PropertyField(_noiseMotion, _textMotion); 140 | 141 | EditorGUILayout.Space(); 142 | 143 | EditorGUI.BeginChangeCheck(); 144 | 145 | EditorGUILayout.PropertyField(_shapes, true); 146 | 147 | if (EditorGUI.EndChangeCheck()) 148 | targetSpray.NotifyConfigChange(); 149 | 150 | EditorGUILayout.PropertyField(_scale); 151 | EditorGUILayout.PropertyField(_scaleRandomness); 152 | 153 | EditorGUILayout.PropertyField(_material); 154 | EditorGUILayout.PropertyField(_castShadows); 155 | EditorGUILayout.PropertyField(_receiveShadows); 156 | 157 | EditorGUILayout.Space(); 158 | 159 | EditorGUILayout.PropertyField(_randomSeed); 160 | EditorGUILayout.PropertyField(_debug); 161 | 162 | serializedObject.ApplyModifiedProperties(); 163 | } 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Editor/SprayEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd3967327cd1140d2a02f9e31639ced5 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Editor/SpraySurfaceMaterialEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Custom material editor for surface shaders 3 | // 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | namespace Kvant 8 | { 9 | public class SpraySurfaceMaterialEditor : ShaderGUI 10 | { 11 | MaterialProperty _colorMode; 12 | MaterialProperty _color; 13 | MaterialProperty _color2; 14 | MaterialProperty _metallic; 15 | MaterialProperty _smoothness; 16 | MaterialProperty _albedoMap; 17 | MaterialProperty _normalMap; 18 | MaterialProperty _normalScale; 19 | MaterialProperty _occlusionMap; 20 | MaterialProperty _occlusionStr; 21 | MaterialProperty _emission; 22 | 23 | static GUIContent _albedoText = new GUIContent("Albedo"); 24 | static GUIContent _normalMapText = new GUIContent("Normal Map"); 25 | static GUIContent _occlusionText = new GUIContent("Occlusion"); 26 | 27 | bool _initial = true; 28 | 29 | void FindProperties(MaterialProperty[] props) 30 | { 31 | _colorMode = FindProperty("_ColorMode", props); 32 | _color = FindProperty("_Color", props); 33 | _color2 = FindProperty("_Color2", props); 34 | _metallic = FindProperty("_Metallic", props); 35 | _smoothness = FindProperty("_Smoothness", props); 36 | _albedoMap = FindProperty("_MainTex", props); 37 | _normalMap = FindProperty("_NormalMap", props); 38 | _normalScale = FindProperty("_NormalScale", props); 39 | _occlusionMap = FindProperty("_OcclusionMap", props); 40 | _occlusionStr = FindProperty("_OcclusionStr", props); 41 | _emission = FindProperty("_Emission", props); 42 | } 43 | 44 | public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) 45 | { 46 | FindProperties(properties); 47 | 48 | if (ShaderPropertiesGUI(materialEditor) || _initial) 49 | foreach (Material m in materialEditor.targets) 50 | SetMaterialKeywords(m); 51 | 52 | _initial = false; 53 | } 54 | 55 | bool ShaderPropertiesGUI(MaterialEditor materialEditor) 56 | { 57 | EditorGUI.BeginChangeCheck(); 58 | 59 | materialEditor.ShaderProperty(_colorMode, "Color Mode"); 60 | 61 | if (_colorMode.floatValue > 0) 62 | { 63 | var rect = EditorGUILayout.GetControlRect(); 64 | rect.x += EditorGUIUtility.labelWidth; 65 | rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2; 66 | materialEditor.ShaderProperty(rect, _color, ""); 67 | rect.x += rect.width + 4; 68 | materialEditor.ShaderProperty(rect, _color2, ""); 69 | } 70 | else 71 | { 72 | materialEditor.ShaderProperty(_color, " "); 73 | } 74 | 75 | EditorGUILayout.Space(); 76 | 77 | materialEditor.ShaderProperty(_metallic, "Metallic"); 78 | materialEditor.ShaderProperty(_smoothness, "Smoothness"); 79 | 80 | EditorGUILayout.Space(); 81 | 82 | materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null); 83 | materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, _normalMap.textureValue ? _normalScale : null); 84 | materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue ? _occlusionStr : null); 85 | materialEditor.TextureScaleOffsetProperty(_albedoMap); 86 | 87 | EditorGUILayout.Space(); 88 | 89 | materialEditor.ShaderProperty(_emission, "Emission"); 90 | 91 | return EditorGUI.EndChangeCheck(); 92 | } 93 | 94 | static void SetMaterialKeywords(Material material) 95 | { 96 | SetKeyword(material, "_ALBEDOMAP", material.GetTexture("_MainTex")); 97 | SetKeyword(material, "_NORMALMAP", material.GetTexture("_NormalMap")); 98 | SetKeyword(material, "_OCCLUSIONMAP", material.GetTexture("_OcclusionMap")); 99 | 100 | var emissive = material.GetColor("_Emission").maxColorComponent > 0.1f / 255; 101 | SetKeyword(material, "_EMISSION", emissive); 102 | } 103 | 104 | static void SetKeyword(Material m, string keyword, bool state) 105 | { 106 | if (state) 107 | m.EnableKeyword(keyword); 108 | else 109 | m.DisableKeyword(keyword); 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Editor/SpraySurfaceMaterialEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 57e69d2410e474bff9be8f1e1f7739b4 3 | timeCreated: 1434293333 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/Kvant/Spray/Editor/SprayUnlitMaterialEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Custom material editor for unlit shaders 3 | // 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | namespace Kvant 8 | { 9 | public class SprayUnlitMaterialEditor : ShaderGUI 10 | { 11 | MaterialProperty _blendMode; 12 | MaterialProperty _colorMode; 13 | MaterialProperty _color; 14 | MaterialProperty _color2; 15 | MaterialProperty _mainTex; 16 | 17 | bool _initial = true; 18 | 19 | void FindProperties(MaterialProperty[] props) 20 | { 21 | _blendMode = FindProperty("_BlendMode", props); 22 | _colorMode = FindProperty("_ColorMode", props); 23 | _color = FindProperty("_Color", props); 24 | _color2 = FindProperty("_Color2", props); 25 | _mainTex = FindProperty("_MainTex", props); 26 | } 27 | 28 | public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) 29 | { 30 | FindProperties(properties); 31 | 32 | if (ShaderPropertiesGUI(materialEditor) || _initial) 33 | foreach (Material m in materialEditor.targets) 34 | SetMaterialKeywords(m); 35 | 36 | _initial = false; 37 | } 38 | 39 | bool ShaderPropertiesGUI(MaterialEditor materialEditor) 40 | { 41 | EditorGUI.BeginChangeCheck(); 42 | 43 | materialEditor.ShaderProperty(_blendMode, "Blend Mode"); 44 | materialEditor.ShaderProperty(_colorMode, "Color Mode"); 45 | 46 | if (_colorMode.floatValue > 0) 47 | { 48 | var rect = EditorGUILayout.GetControlRect(); 49 | rect.x += EditorGUIUtility.labelWidth; 50 | rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2; 51 | materialEditor.ShaderProperty(rect, _color, ""); 52 | rect.x += rect.width + 4; 53 | materialEditor.ShaderProperty(rect, _color2, ""); 54 | } 55 | else 56 | { 57 | materialEditor.ShaderProperty(_color, " "); 58 | } 59 | 60 | materialEditor.ShaderProperty(_mainTex, "Texture"); 61 | 62 | return EditorGUI.EndChangeCheck(); 63 | } 64 | 65 | static void SetMaterialKeywords(Material material) 66 | { 67 | SetKeyword(material, "_MAINTEX", material.GetTexture("_MainTex")); 68 | } 69 | 70 | static void SetKeyword(Material m, string keyword, bool state) 71 | { 72 | if (state) 73 | m.EnableKeyword(keyword); 74 | else 75 | m.DisableKeyword(keyword); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Editor/SprayUnlitMaterialEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcabe894f84074e83b632988310ff1a8 3 | timeCreated: 1434365767 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/Kvant/Spray/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e5d7e63a889f847e5aa6472f5aa71db9 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Asteroids.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Kvant/Spray/Models/Asteroids.fbx -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Asteroids.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19fd098692a084a2494eaf1819ef7336 3 | timeCreated: 1434459955 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Asteroid 1 9 | 100002: Asteroid 2 10 | 100004: Asteroid 3 11 | 100006: Asteroid 4 12 | 100008: //RootNode 13 | 400000: Asteroid 1 14 | 400002: Asteroid 2 15 | 400004: Asteroid 3 16 | 400006: Asteroid 4 17 | 400008: //RootNode 18 | 2300000: Asteroid 1 19 | 2300002: Asteroid 2 20 | 2300004: Asteroid 3 21 | 2300006: Asteroid 4 22 | 3300000: Asteroid 1 23 | 3300002: Asteroid 2 24 | 3300004: Asteroid 3 25 | 3300006: Asteroid 4 26 | 4300000: Asteroid 4 27 | 4300002: Asteroid 3 28 | 4300004: Asteroid 2 29 | 4300006: Asteroid 1 30 | materials: 31 | importMaterials: 0 32 | materialName: 0 33 | materialSearch: 1 34 | animations: 35 | legacyGenerateAnimations: 4 36 | bakeSimulation: 0 37 | optimizeGameObjects: 0 38 | motionNodeName: 39 | animationImportErrors: 40 | animationImportWarnings: 41 | animationRetargetingWarnings: 42 | animationDoRetargetingWarnings: 0 43 | animationCompression: 1 44 | animationRotationError: .5 45 | animationPositionError: .5 46 | animationScaleError: .5 47 | animationWrapMode: 0 48 | extraExposedTransformPaths: [] 49 | clipAnimations: [] 50 | isReadable: 1 51 | meshes: 52 | lODScreenPercentages: [] 53 | globalScale: .200000003 54 | meshCompression: 0 55 | addColliders: 0 56 | importBlendShapes: 0 57 | swapUVChannels: 0 58 | generateSecondaryUV: 0 59 | useFileUnits: 1 60 | optimizeMeshForGPU: 1 61 | keepQuads: 0 62 | weldVertices: 1 63 | secondaryUVAngleDistortion: 8 64 | secondaryUVAreaDistortion: 15.000001 65 | secondaryUVHardAngle: 88 66 | secondaryUVPackMargin: 4 67 | useFileScale: 1 68 | tangentSpace: 69 | normalSmoothAngle: 60 70 | splitTangentsAcrossUV: 1 71 | normalImportMode: 0 72 | tangentImportMode: 1 73 | importAnimation: 1 74 | copyAvatar: 0 75 | humanDescription: 76 | human: [] 77 | skeleton: [] 78 | armTwist: .5 79 | foreArmTwist: .5 80 | upperLegTwist: .5 81 | legTwist: .5 82 | armStretch: .0500000007 83 | legStretch: .0500000007 84 | feetSpacing: 0 85 | rootMotionBoneName: 86 | lastHumanDescriptionAvatarSource: {instanceID: 0} 87 | animationType: 0 88 | additionalBone: 0 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Confetti.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Kvant/Spray/Models/Confetti.fbx -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Confetti.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2435b8e088489402c9a997107b5922e9 3 | timeCreated: 1434634532 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 100002: Confetti 1 10 | 100004: Confetti 2 11 | 100006: Confetti 3 12 | 100008: Confetti 4 13 | 400000: //RootNode 14 | 400002: Confetti 1 15 | 400004: Confetti 2 16 | 400006: Confetti 3 17 | 400008: Confetti 4 18 | 2300000: Confetti 1 19 | 2300002: Confetti 2 20 | 2300004: Confetti 3 21 | 2300006: Confetti 4 22 | 3300000: Confetti 1 23 | 3300002: Confetti 2 24 | 3300004: Confetti 3 25 | 3300006: Confetti 4 26 | 4300000: Confetti 4 27 | 4300002: Confetti 2 28 | 4300004: Confetti 1 29 | 4300006: Confetti 3 30 | materials: 31 | importMaterials: 0 32 | materialName: 0 33 | materialSearch: 1 34 | animations: 35 | legacyGenerateAnimations: 4 36 | bakeSimulation: 0 37 | optimizeGameObjects: 0 38 | motionNodeName: 39 | animationImportErrors: 40 | animationImportWarnings: 41 | animationRetargetingWarnings: 42 | animationDoRetargetingWarnings: 0 43 | animationCompression: 1 44 | animationRotationError: .5 45 | animationPositionError: .5 46 | animationScaleError: .5 47 | animationWrapMode: 0 48 | extraExposedTransformPaths: [] 49 | clipAnimations: [] 50 | isReadable: 1 51 | meshes: 52 | lODScreenPercentages: [] 53 | globalScale: .0500000007 54 | meshCompression: 0 55 | addColliders: 0 56 | importBlendShapes: 0 57 | swapUVChannels: 0 58 | generateSecondaryUV: 0 59 | useFileUnits: 1 60 | optimizeMeshForGPU: 1 61 | keepQuads: 0 62 | weldVertices: 1 63 | secondaryUVAngleDistortion: 8 64 | secondaryUVAreaDistortion: 15.000001 65 | secondaryUVHardAngle: 88 66 | secondaryUVPackMargin: 4 67 | useFileScale: 1 68 | tangentSpace: 69 | normalSmoothAngle: 60 70 | splitTangentsAcrossUV: 1 71 | normalImportMode: 0 72 | tangentImportMode: 1 73 | importAnimation: 1 74 | copyAvatar: 0 75 | humanDescription: 76 | human: [] 77 | skeleton: [] 78 | armTwist: .5 79 | foreArmTwist: .5 80 | upperLegTwist: .5 81 | legTwist: .5 82 | armStretch: .0500000007 83 | legStretch: .0500000007 84 | feetSpacing: 0 85 | rootMotionBoneName: 86 | lastHumanDescriptionAvatarSource: {instanceID: 0} 87 | animationType: 0 88 | additionalBone: 0 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Leaves.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Kvant/Spray/Models/Leaves.fbx -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Leaves.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7977aa2e23a3b4949b0dec50b282bc9b 3 | timeCreated: 1434625434 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 100002: Leaf 1 10 | 100004: Leaf 2 11 | 100006: Leaf 3 12 | 100008: Leaf 4 13 | 100010: Leaf 5 14 | 400000: //RootNode 15 | 400002: Leaf 1 16 | 400004: Leaf 2 17 | 400006: Leaf 3 18 | 400008: Leaf 4 19 | 400010: Leaf 5 20 | 2300000: //RootNode 21 | 2300002: Leaf 1 22 | 2300004: Leaf 2 23 | 2300006: Leaf 3 24 | 2300008: Leaf 4 25 | 2300010: Leaf 5 26 | 3300000: //RootNode 27 | 3300002: Leaf 1 28 | 3300004: Leaf 2 29 | 3300006: Leaf 3 30 | 3300008: Leaf 4 31 | 3300010: Leaf 5 32 | 4300000: Leaf 33 | 4300002: Leaf 3 34 | 4300004: Leaf 2 35 | 4300006: Leaf 1 36 | 4300008: Leaf 5 37 | 4300010: Leaf 4 38 | materials: 39 | importMaterials: 0 40 | materialName: 0 41 | materialSearch: 1 42 | animations: 43 | legacyGenerateAnimations: 4 44 | bakeSimulation: 0 45 | optimizeGameObjects: 0 46 | motionNodeName: 47 | animationImportErrors: 48 | animationImportWarnings: 49 | animationRetargetingWarnings: 50 | animationDoRetargetingWarnings: 0 51 | animationCompression: 1 52 | animationRotationError: .5 53 | animationPositionError: .5 54 | animationScaleError: .5 55 | animationWrapMode: 0 56 | extraExposedTransformPaths: [] 57 | clipAnimations: [] 58 | isReadable: 1 59 | meshes: 60 | lODScreenPercentages: [] 61 | globalScale: .100000001 62 | meshCompression: 0 63 | addColliders: 0 64 | importBlendShapes: 0 65 | swapUVChannels: 0 66 | generateSecondaryUV: 0 67 | useFileUnits: 1 68 | optimizeMeshForGPU: 1 69 | keepQuads: 0 70 | weldVertices: 1 71 | secondaryUVAngleDistortion: 8 72 | secondaryUVAreaDistortion: 15.000001 73 | secondaryUVHardAngle: 88 74 | secondaryUVPackMargin: 4 75 | useFileScale: 1 76 | tangentSpace: 77 | normalSmoothAngle: 60 78 | splitTangentsAcrossUV: 1 79 | normalImportMode: 0 80 | tangentImportMode: 1 81 | importAnimation: 1 82 | copyAvatar: 0 83 | humanDescription: 84 | human: [] 85 | skeleton: [] 86 | armTwist: .5 87 | foreArmTwist: .5 88 | upperLegTwist: .5 89 | legTwist: .5 90 | armStretch: .0500000007 91 | legStretch: .0500000007 92 | feetSpacing: 0 93 | rootMotionBoneName: 94 | lastHumanDescriptionAvatarSource: {instanceID: 0} 95 | animationType: 0 96 | additionalBone: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Shapes.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Kvant/Spray/Models/Shapes.fbx -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Shapes.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9693308a3efbb4f70b2e2ca1df26b2e9 3 | timeCreated: 1449461373 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 100002: Icosphere 10 | 100004: ipr_camera 11 | 100006: Ring 12 | 100008: Disc 13 | 100010: Ring1 14 | 100012: Ring2 15 | 400000: //RootNode 16 | 400002: Icosphere 17 | 400004: ipr_camera 18 | 400006: Ring 19 | 400008: Disc 20 | 400010: Ring1 21 | 400012: Ring2 22 | 2300000: Icosphere 23 | 2300002: Ring 24 | 2300004: Disc 25 | 2300006: Ring1 26 | 2300008: Ring2 27 | 3300000: Icosphere 28 | 3300002: Ring 29 | 3300004: Disc 30 | 3300006: Ring1 31 | 3300008: Ring2 32 | 4300000: Icosphere 33 | 4300002: Ring 34 | 4300004: Ring1 35 | 4300006: Ring2 36 | 4300008: Disc 37 | materials: 38 | importMaterials: 0 39 | materialName: 0 40 | materialSearch: 1 41 | animations: 42 | legacyGenerateAnimations: 4 43 | bakeSimulation: 0 44 | optimizeGameObjects: 0 45 | motionNodeName: 46 | animationImportErrors: 47 | animationImportWarnings: 48 | animationRetargetingWarnings: 49 | animationDoRetargetingWarnings: 0 50 | animationCompression: 1 51 | animationRotationError: .5 52 | animationPositionError: .5 53 | animationScaleError: .5 54 | animationWrapMode: 0 55 | extraExposedTransformPaths: [] 56 | clipAnimations: [] 57 | isReadable: 1 58 | meshes: 59 | lODScreenPercentages: [] 60 | globalScale: 100 61 | meshCompression: 0 62 | addColliders: 0 63 | importBlendShapes: 0 64 | swapUVChannels: 0 65 | generateSecondaryUV: 0 66 | useFileUnits: 1 67 | optimizeMeshForGPU: 1 68 | keepQuads: 0 69 | weldVertices: 1 70 | secondaryUVAngleDistortion: 8 71 | secondaryUVAreaDistortion: 15.000001 72 | secondaryUVHardAngle: 88 73 | secondaryUVPackMargin: 4 74 | useFileScale: 1 75 | tangentSpace: 76 | normalSmoothAngle: 60 77 | splitTangentsAcrossUV: 1 78 | normalImportMode: 0 79 | tangentImportMode: 1 80 | importAnimation: 0 81 | copyAvatar: 0 82 | humanDescription: 83 | human: [] 84 | skeleton: [] 85 | armTwist: .5 86 | foreArmTwist: .5 87 | upperLegTwist: .5 88 | legTwist: .5 89 | armStretch: .0500000007 90 | legStretch: .0500000007 91 | feetSpacing: 0 92 | rootMotionBoneName: 93 | hasTranslationDoF: 0 94 | lastHumanDescriptionAvatarSource: {instanceID: 0} 95 | animationType: 0 96 | humanoidOversampling: 1 97 | additionalBone: 0 98 | userData: 99 | assetBundleName: 100 | assetBundleVariant: 101 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Shards.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Kvant/Spray/Models/Shards.fbx -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Models/Shards.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d156dcf56f86f404393203fbed35c031 3 | timeCreated: 1434630888 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: Shard 1 9 | 100002: Shard 2 10 | 100004: Shard 3 11 | 100006: Shard 4 12 | 100008: //RootNode 13 | 400000: Shard 1 14 | 400002: Shard 2 15 | 400004: Shard 3 16 | 400006: Shard 4 17 | 400008: //RootNode 18 | 2300000: Shard 1 19 | 2300002: Shard 2 20 | 2300004: Shard 3 21 | 2300006: Shard 4 22 | 3300000: Shard 1 23 | 3300002: Shard 2 24 | 3300004: Shard 3 25 | 3300006: Shard 4 26 | 4300000: Shard 4 27 | 4300002: Shard 3 28 | 4300004: Shard 2 29 | 4300006: Shard 1 30 | materials: 31 | importMaterials: 0 32 | materialName: 0 33 | materialSearch: 1 34 | animations: 35 | legacyGenerateAnimations: 4 36 | bakeSimulation: 0 37 | optimizeGameObjects: 0 38 | motionNodeName: 39 | animationImportErrors: 40 | animationImportWarnings: 41 | animationRetargetingWarnings: 42 | animationDoRetargetingWarnings: 0 43 | animationCompression: 1 44 | animationRotationError: .5 45 | animationPositionError: .5 46 | animationScaleError: .5 47 | animationWrapMode: 0 48 | extraExposedTransformPaths: [] 49 | clipAnimations: [] 50 | isReadable: 1 51 | meshes: 52 | lODScreenPercentages: [] 53 | globalScale: .100000001 54 | meshCompression: 0 55 | addColliders: 0 56 | importBlendShapes: 0 57 | swapUVChannels: 0 58 | generateSecondaryUV: 0 59 | useFileUnits: 1 60 | optimizeMeshForGPU: 1 61 | keepQuads: 0 62 | weldVertices: 1 63 | secondaryUVAngleDistortion: 8 64 | secondaryUVAreaDistortion: 15.000001 65 | secondaryUVHardAngle: 88 66 | secondaryUVPackMargin: 4 67 | useFileScale: 1 68 | tangentSpace: 69 | normalSmoothAngle: 60 70 | splitTangentsAcrossUV: 1 71 | normalImportMode: 0 72 | tangentImportMode: 1 73 | importAnimation: 1 74 | copyAvatar: 0 75 | humanDescription: 76 | human: [] 77 | skeleton: [] 78 | armTwist: .5 79 | foreArmTwist: .5 80 | upperLegTwist: .5 81 | legTwist: .5 82 | armStretch: .0500000007 83 | legStretch: .0500000007 84 | feetSpacing: 0 85 | rootMotionBoneName: 86 | lastHumanDescriptionAvatarSource: {instanceID: 0} 87 | animationType: 0 88 | additionalBone: 0 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94dbb5320e13b4e1388501773f60f1a3 3 | folderAsset: yes 4 | timeCreated: 1432209201 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Scripts/BulkMesh.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Bulk mesh handler 3 | // 4 | // Duplicate and combine given meshes into a single mesh. It duplicates the 5 | // meshes until the number of vertices reaches to 64k or the number of copies 6 | // reaches to 4k. 7 | // 8 | using UnityEngine; 9 | 10 | namespace Kvant 11 | { 12 | public partial class Spray 13 | { 14 | [System.Serializable] 15 | class BulkMesh 16 | { 17 | #region Properties 18 | 19 | // Single combined mesh. 20 | Mesh _mesh; 21 | public Mesh mesh { get { return _mesh; } } 22 | 23 | // Copy count. 24 | int _copyCount; 25 | public int copyCount { get { return _copyCount; } } 26 | 27 | #endregion 28 | 29 | #region Public Methods 30 | 31 | public BulkMesh(Mesh[] shapes) 32 | { 33 | CombineMeshes(shapes); 34 | } 35 | 36 | public void Rebuild(Mesh[] shapes) 37 | { 38 | Release(); 39 | CombineMeshes(shapes); 40 | } 41 | 42 | public void Release() 43 | { 44 | if (_mesh) 45 | { 46 | DestroyImmediate(_mesh); 47 | _copyCount = 0; 48 | } 49 | } 50 | 51 | #endregion 52 | 53 | #region Private Methods 54 | 55 | // Cache structure which stores shape information 56 | struct ShapeCacheData 57 | { 58 | Vector3[] vertices; 59 | Vector3[] normals; 60 | Vector4[] tangents; 61 | Vector2[] uv; 62 | int[] indices; 63 | 64 | public ShapeCacheData(Mesh mesh) 65 | { 66 | if (mesh) 67 | { 68 | vertices = mesh.vertices; 69 | normals = mesh.normals; 70 | tangents = mesh.tangents; 71 | uv = mesh.uv; 72 | indices = mesh.GetIndices(0); 73 | } 74 | else 75 | { 76 | // An empty mesh was given; replaces with a two-sided quad. 77 | vertices = new Vector3[] { 78 | new Vector3 (-1, +1, 0), new Vector3 (+1, +1, 0), 79 | new Vector3 (-1, -1, 0), new Vector3 (+1, -1, 0), 80 | new Vector3 (+1, +1, 0), new Vector3 (-1, +1, 0), 81 | new Vector3 (+1, -1, 0), new Vector3 (-1, -1, 0) 82 | }; 83 | normals = new Vector3[] { 84 | Vector3.forward, Vector3.forward, 85 | Vector3.forward, Vector3.forward, 86 | -Vector3.forward, -Vector3.forward, 87 | -Vector3.forward, -Vector3.forward, 88 | }; 89 | tangents = new Vector4[] { 90 | new Vector4( 1, 0, 0, 1), new Vector4( 1, 0, 0, 1), 91 | new Vector4( 1, 0, 0, 1), new Vector4( 1, 0, 0, 1), 92 | new Vector4(-1, 0, 0, 1), new Vector4(-1, 0, 0, 1), 93 | new Vector4(-1, 0, 0, 1), new Vector4(-1, 0, 0, 1) 94 | }; 95 | uv = new Vector2[] { 96 | new Vector2(0, 1), new Vector2(1, 1), 97 | new Vector2(0, 0), new Vector2(1, 0), 98 | new Vector2(1, 1), new Vector2(0, 1), 99 | new Vector2(1, 0), new Vector2(0, 0) 100 | }; 101 | indices = new int[] {0, 1, 2, 3, 2, 1, 4, 5, 6, 7, 6, 5}; 102 | } 103 | } 104 | 105 | public int VertexCount { get { return vertices.Length; } } 106 | public int IndexCount { get { return indices.Length; } } 107 | 108 | public void CopyVerticesTo(Vector3[] destination, int position) 109 | { 110 | System.Array.Copy(vertices, 0, destination, position, vertices.Length); 111 | } 112 | 113 | public void CopyNormalsTo(Vector3[] destination, int position) 114 | { 115 | System.Array.Copy(normals, 0, destination, position, normals.Length); 116 | } 117 | 118 | public void CopyTangentsTo(Vector4[] destination, int position) 119 | { 120 | System.Array.Copy(tangents, 0, destination, position, tangents.Length); 121 | } 122 | 123 | public void CopyUVTo(Vector2[] destination, int position) 124 | { 125 | System.Array.Copy(uv, 0, destination, position, uv.Length); 126 | } 127 | 128 | public void CopyIndicesTo(int[] destination, int position, int offset) 129 | { 130 | for (var i = 0; i < indices.Length; i++) 131 | destination[position + i] = offset + indices[i]; 132 | } 133 | } 134 | 135 | // Mesh combiner functoin 136 | void CombineMeshes(Mesh[] shapes) 137 | { 138 | ShapeCacheData[] cache; 139 | 140 | if (shapes == null || shapes.Length == 0) 141 | { 142 | // The shape array is empty; use the default shape. 143 | cache = new ShapeCacheData[1]; 144 | cache[0] = new ShapeCacheData(null); 145 | } 146 | else 147 | { 148 | // Store the meshes into the shape cache. 149 | cache = new ShapeCacheData[shapes.Length]; 150 | for (var i = 0; i < shapes.Length; i++) 151 | cache[i] = new ShapeCacheData(shapes[i]); 152 | } 153 | 154 | // Count the number of vertices and indices in the shape cache. 155 | var vc_shapes = 0; 156 | var ic_shapes = 0; 157 | foreach (var s in cache) { 158 | vc_shapes += s.VertexCount; 159 | ic_shapes += s.IndexCount; 160 | } 161 | 162 | // If there is nothing, break. 163 | if (vc_shapes == 0) return; 164 | 165 | // Determine the number of copies. 166 | // - The number of vertices must be less than 64k. 167 | // - The number of copies must be less than 4096. 168 | var vc = 0; 169 | var ic = 0; 170 | for (_copyCount = 0; _copyCount < 4096; _copyCount++) 171 | { 172 | var s = cache[_copyCount % cache.Length]; 173 | if (vc + s.VertexCount > 65535) break; 174 | vc += s.VertexCount; 175 | ic += s.IndexCount; 176 | } 177 | 178 | // Create vertex arrays. 179 | var vertices = new Vector3[vc]; 180 | var normals = new Vector3[vc]; 181 | var tangents = new Vector4[vc]; 182 | var uv = new Vector2[vc]; 183 | var uv2 = new Vector2[vc]; 184 | var indicies = new int[ic]; 185 | 186 | for (int v_i = 0, i_i = 0, e_i = 0; v_i < vc; e_i++) 187 | { 188 | var s = cache[e_i % cache.Length]; 189 | 190 | s.CopyVerticesTo(vertices, v_i); 191 | s.CopyNormalsTo (normals, v_i); 192 | s.CopyTangentsTo(tangents, v_i); 193 | s.CopyUVTo (uv, v_i); 194 | s.CopyIndicesTo (indicies, i_i, v_i); 195 | 196 | var coord = new Vector2((float)e_i / _copyCount, 0); 197 | for (var i = 0; i < s.VertexCount; i++) uv2[v_i + i] = coord; 198 | 199 | v_i += s.VertexCount; 200 | i_i += s.IndexCount; 201 | } 202 | 203 | // Create a mesh object. 204 | _mesh = new Mesh(); 205 | 206 | _mesh.vertices = vertices; 207 | _mesh.normals = normals; 208 | _mesh.tangents = tangents; 209 | _mesh.uv = uv; 210 | _mesh.uv2 = uv2; 211 | 212 | _mesh.SetIndices(indicies, MeshTopology.Triangles, 0); 213 | _mesh.Optimize(); 214 | 215 | // This only for temporary use. Don't save. 216 | _mesh.hideFlags = HideFlags.DontSave; 217 | 218 | // Avoid being culled. 219 | _mesh.bounds = new Bounds(Vector3.zero, Vector3.one * 1000); 220 | } 221 | 222 | #endregion 223 | } 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Scripts/BulkMesh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fef15445223b54f3eb3564a48fa0c520 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28ade760e1ad54cdcb979daffc750735 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Common.cginc: -------------------------------------------------------------------------------- 1 | // 2 | // Common parts of Spray shaders 3 | // 4 | 5 | sampler2D _PositionBuffer; 6 | sampler2D _RotationBuffer; 7 | 8 | half _ColorMode; 9 | half4 _Color; 10 | half4 _Color2; 11 | float _ScaleMin; 12 | float _ScaleMax; 13 | float _RandomSeed; 14 | float2 _BufferOffset; 15 | 16 | // PRNG function 17 | float nrand(float2 uv, float salt) 18 | { 19 | uv += float2(salt, _RandomSeed); 20 | return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453); 21 | } 22 | 23 | // Quaternion multiplication 24 | // http://mathworld.wolfram.com/Quaternion.html 25 | float4 qmul(float4 q1, float4 q2) 26 | { 27 | return float4( 28 | q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), 29 | q1.w * q2.w - dot(q1.xyz, q2.xyz) 30 | ); 31 | } 32 | 33 | // Vector rotation with a quaternion 34 | // http://mathworld.wolfram.com/Quaternion.html 35 | float3 rotate_vector(float3 v, float4 r) 36 | { 37 | float4 r_c = r * float4(-1, -1, -1, 1); 38 | return qmul(r, qmul(float4(v, 0), r_c)).xyz; 39 | } 40 | 41 | // Scale factor function 42 | float calc_scale(float2 uv, float time01) 43 | { 44 | float s = lerp(_ScaleMin, _ScaleMax, nrand(uv, 14)); 45 | // Linear scaling animation with life. 46 | // (0, 0) -> (0.1, 1) -> (0.9, 1) -> (1, 0) 47 | return s * min(1.0, 5.0 - abs(5.0 - time01 * 10)); 48 | } 49 | 50 | // Color function 51 | float4 calc_color(float2 uv, float time01) 52 | { 53 | #if _COLORMODE_RANDOM 54 | return lerp(_Color, _Color2, nrand(uv, 15)); 55 | #else 56 | return lerp(_Color, _Color2, (1.0 - time01) * _ColorMode); 57 | #endif 58 | } 59 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Common.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ea90d63bb949b48798b9a066f27394a7 3 | timeCreated: 1432472086 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Debug.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/Kvant/Spray/Debug" 2 | { 3 | Properties 4 | { 5 | _MainTex("-", 2D) = ""{} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | sampler2D _MainTex; 11 | 12 | #include "UnityCG.cginc" 13 | 14 | float4 frag(v2f_img i) : SV_Target 15 | { 16 | float3 c = tex2D(_MainTex, i.uv).xyz; 17 | return float4(c * 0.5 + 0.5, 1); 18 | } 19 | 20 | ENDCG 21 | 22 | SubShader 23 | { 24 | Pass 25 | { 26 | CGPROGRAM 27 | #pragma vertex vert_img 28 | #pragma fragment frag 29 | ENDCG 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Debug.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad2397ccf551046ecb4df814f027d430 3 | timeCreated: 1432208235 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Default Spray.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: Default Spray 10 | m_Shader: {fileID: 4800000, guid: 8e1247c2208bf4bef82f45b4c36f0600, type: 3} 11 | m_ShaderKeywords: _BLENDMODE_ALPHABLEND _COLORMODE_SINGLE 12 | m_LightmapFlags: 5 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | data: 19 | first: 20 | name: _PositionBuffer 21 | second: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | data: 26 | first: 27 | name: _RotationBuffer 28 | second: 29 | m_Texture: {fileID: 0} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | m_Floats: 33 | data: 34 | first: 35 | name: _Smoothness 36 | second: .5 37 | data: 38 | first: 39 | name: _Metallic 40 | second: .5 41 | data: 42 | first: 43 | name: _ScaleMin 44 | second: 1 45 | data: 46 | first: 47 | name: _ScaleMax 48 | second: 1 49 | data: 50 | first: 51 | name: _ColorMode 52 | second: 0 53 | data: 54 | first: 55 | name: _RandomSeed 56 | second: 0 57 | m_Colors: 58 | data: 59 | first: 60 | name: _Color 61 | second: {r: 1, g: 1, b: 1, a: 1} 62 | data: 63 | first: 64 | name: _Color2 65 | second: {r: .5, g: .5, b: .5, a: 1} 66 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Default Spray.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1aad33bf16194534a7c99e7c01a8249 3 | timeCreated: 1434290977 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Kernel.shader: -------------------------------------------------------------------------------- 1 | // 2 | // GPGPU kernels for Spray 3 | // 4 | // Position buffer format: 5 | // .xyz = particle position 6 | // .w = life (+0.5 -> -0.5) 7 | // 8 | // Velocity buffer format: 9 | // .xyz = particle velocity 10 | // 11 | // Rotation buffer format: 12 | // .xyzw = particle rotation 13 | // 14 | Shader "Hidden/Kvant/Spray/Kernel" 15 | { 16 | Properties 17 | { 18 | _PositionBuffer ("-", 2D) = ""{} 19 | _VelocityBuffer ("-", 2D) = ""{} 20 | _RotationBuffer ("-", 2D) = ""{} 21 | } 22 | 23 | CGINCLUDE 24 | 25 | #include "UnityCG.cginc" 26 | #include "SimplexNoiseGrad3D.cginc" 27 | 28 | sampler2D _PositionBuffer; 29 | sampler2D _VelocityBuffer; 30 | sampler2D _RotationBuffer; 31 | 32 | float3 _EmitterPos; 33 | float3 _EmitterSize; 34 | float2 _LifeParams; // 1/min, 1/max 35 | float4 _Direction; // x, y, z, spread 36 | float2 _SpeedParams; // speed, randomness 37 | float4 _Acceleration; // x, y, z, drag 38 | float3 _SpinParams; // spin*2, speed-to-spin*2, randomness 39 | float2 _NoiseParams; // freq, amp 40 | float3 _NoiseOffset; 41 | float4 _Config; // throttle, random seed, dT, time 42 | 43 | // PRNG function 44 | float nrand(float2 uv, float salt) 45 | { 46 | uv += float2(salt, _Config.y); 47 | return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453); 48 | } 49 | 50 | // Quaternion multiplication 51 | // http://mathworld.wolfram.com/Quaternion.html 52 | float4 qmul(float4 q1, float4 q2) 53 | { 54 | return float4( 55 | q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), 56 | q1.w * q2.w - dot(q1.xyz, q2.xyz) 57 | ); 58 | } 59 | 60 | // Particle generator functions 61 | float4 new_particle_position(float2 uv) 62 | { 63 | float t = _Config.w; 64 | 65 | // Random position 66 | float3 p = float3(nrand(uv, t), nrand(uv, t + 1), nrand(uv, t + 2)); 67 | p = (p - (float3)0.5) * _EmitterSize + _EmitterPos; 68 | 69 | // Throttling: discards particle emission by adding offset. 70 | float4 offs = float4(1e8, 1e8, 1e8, -1) * (uv.x > _Config.x); 71 | 72 | return float4(p, 0.5) + offs; 73 | } 74 | 75 | float4 new_particle_velocity(float2 uv) 76 | { 77 | // Random vector 78 | float3 v = float3(nrand(uv, 6), nrand(uv, 7), nrand(uv, 8)); 79 | v = (v - (float3)0.5) * 2; 80 | 81 | // Spreading 82 | v = lerp(_Direction.xyz, v, _Direction.w); 83 | 84 | // Speed 85 | v = normalize(v) * _SpeedParams.x; 86 | v *= 1.0 - nrand(uv, 9) * _SpeedParams.y; 87 | 88 | return float4(v, 0); 89 | } 90 | 91 | float4 new_particle_rotation(float2 uv) 92 | { 93 | // Uniform random unit quaternion 94 | // http://www.realtimerendering.com/resources/GraphicsGems/gemsiii/urot.c 95 | float r = nrand(uv, 3); 96 | float r1 = sqrt(1.0 - r); 97 | float r2 = sqrt(r); 98 | float t1 = UNITY_PI * 2 * nrand(uv, 4); 99 | float t2 = UNITY_PI * 2 * nrand(uv, 5); 100 | return float4(sin(t1) * r1, cos(t1) * r1, sin(t2) * r2, cos(t2) * r2); 101 | } 102 | 103 | // Deterministic random rotation axis 104 | float3 get_rotation_axis(float2 uv) 105 | { 106 | // Uniformaly distributed points 107 | // http://mathworld.wolfram.com/SpherePointPicking.html 108 | float u = nrand(uv, 10) * 2 - 1; 109 | float theta = nrand(uv, 11) * UNITY_PI * 2; 110 | float u2 = sqrt(1 - u * u); 111 | return float3(u2 * cos(theta), u2 * sin(theta), u); 112 | } 113 | 114 | // Pass 0: initial position 115 | float4 frag_init_position(v2f_img i) : SV_Target 116 | { 117 | // Crate a new particle and randomize its initial life. 118 | return new_particle_position(i.uv) - float4(0, 0, 0, nrand(i.uv, 14)); 119 | } 120 | 121 | // Pass 1: initial velocity 122 | float4 frag_init_velocity(v2f_img i) : SV_Target 123 | { 124 | return new_particle_velocity(i.uv); 125 | } 126 | 127 | // Pass 2: initial rotation 128 | float4 frag_init_rotation(v2f_img i) : SV_Target 129 | { 130 | return new_particle_rotation(i.uv); 131 | } 132 | 133 | // Pass 3: position update 134 | float4 frag_update_position(v2f_img i) : SV_Target 135 | { 136 | float4 p = tex2D(_PositionBuffer, i.uv); 137 | float3 v = tex2D(_VelocityBuffer, i.uv).xyz; 138 | 139 | // Decaying 140 | float dt = _Config.z; 141 | p.w -= lerp(_LifeParams.x, _LifeParams.y, nrand(i.uv, 12)) * dt; 142 | 143 | if (p.w > -0.5) 144 | { 145 | // Applying the velocity 146 | p.xyz += v * dt; 147 | return p; 148 | } 149 | else 150 | { 151 | // Respawn 152 | return new_particle_position(i.uv); 153 | } 154 | } 155 | 156 | // Pass 4: velocity update 157 | float4 frag_update_velocity(v2f_img i) : SV_Target 158 | { 159 | float4 p = tex2D(_PositionBuffer, i.uv); 160 | float3 v = tex2D(_VelocityBuffer, i.uv).xyz; 161 | 162 | if (p.w < 0.5) 163 | { 164 | // Drag 165 | v *= _Acceleration.w; // dt is pre-applied in script 166 | 167 | // Constant acceleration 168 | float dt = _Config.z; 169 | v += _Acceleration.xyz * dt; 170 | 171 | // Acceleration by turbulent noise 172 | float3 np = (p.xyz + _NoiseOffset) * _NoiseParams.x; 173 | float3 n1 = snoise_grad(np); 174 | float3 n2 = snoise_grad(np + float3(0, 13.28, 0)); 175 | v += cross(n1, n2) * _NoiseParams.y * dt; 176 | 177 | return float4(v, 0); 178 | } 179 | else 180 | { 181 | // Respawn 182 | return new_particle_velocity(i.uv); 183 | } 184 | } 185 | 186 | // Pass 5: rotation update 187 | float4 frag_update_rotation(v2f_img i) : SV_Target 188 | { 189 | float4 r = tex2D(_RotationBuffer, i.uv); 190 | float3 v = tex2D(_VelocityBuffer, i.uv).xyz; 191 | 192 | // Delta angle 193 | float dt = _Config.z; 194 | float theta = (_SpinParams.x + length(v) * _SpinParams.y) * dt; 195 | 196 | // Randomness 197 | theta *= 1.0 - nrand(i.uv, 13) * _SpinParams.z; 198 | 199 | // Spin quaternion 200 | float4 dq = float4(get_rotation_axis(i.uv) * sin(theta), cos(theta)); 201 | 202 | // Applying the quaternion and normalize the result. 203 | return normalize(qmul(dq, r)); 204 | } 205 | 206 | ENDCG 207 | 208 | SubShader 209 | { 210 | Pass 211 | { 212 | CGPROGRAM 213 | #pragma target 3.0 214 | #pragma vertex vert_img 215 | #pragma fragment frag_init_position 216 | ENDCG 217 | } 218 | Pass 219 | { 220 | CGPROGRAM 221 | #pragma target 3.0 222 | #pragma vertex vert_img 223 | #pragma fragment frag_init_velocity 224 | ENDCG 225 | } 226 | Pass 227 | { 228 | CGPROGRAM 229 | #pragma target 3.0 230 | #pragma vertex vert_img 231 | #pragma fragment frag_init_rotation 232 | ENDCG 233 | } 234 | Pass 235 | { 236 | CGPROGRAM 237 | #pragma target 3.0 238 | #pragma vertex vert_img 239 | #pragma fragment frag_update_position 240 | ENDCG 241 | } 242 | Pass 243 | { 244 | CGPROGRAM 245 | #pragma target 3.0 246 | #pragma vertex vert_img 247 | #pragma fragment frag_update_velocity 248 | ENDCG 249 | } 250 | Pass 251 | { 252 | CGPROGRAM 253 | #pragma target 3.0 254 | #pragma vertex vert_img 255 | #pragma fragment frag_update_rotation 256 | ENDCG 257 | } 258 | } 259 | } 260 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Kernel.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e5e161a3708e40119404232637809fc 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Opaque.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Opaque surface shader for Spray 3 | // 4 | // Vertex format: 5 | // position.xyz = vertex position 6 | // texcoord0.xy = uv for texturing 7 | // texcoord1.xy = uv for position/rotation buffer 8 | // 9 | // Position buffer format: 10 | // .xyz = particle position 11 | // .w = life (+0.5 -> -0.5) 12 | // 13 | // Rotation buffer format: 14 | // .xyzw = particle rotation 15 | // 16 | Shader "Kvant/Spray/Opaque PBR" 17 | { 18 | Properties 19 | { 20 | _PositionBuffer ("-", 2D) = "black"{} 21 | _RotationBuffer ("-", 2D) = "red"{} 22 | 23 | [KeywordEnum(Single, Animate, Random)] 24 | _ColorMode ("-", Float) = 0 25 | _Color ("-", Color) = (1, 1, 1, 1) 26 | _Color2 ("-", Color) = (0.5, 0.5, 0.5, 1) 27 | 28 | _Metallic ("-", Range(0,1)) = 0.5 29 | _Smoothness ("-", Range(0,1)) = 0.5 30 | 31 | _MainTex ("-", 2D) = "white"{} 32 | _NormalMap ("-", 2D) = "bump"{} 33 | _NormalScale ("-", Range(0,2)) = 1 34 | _OcclusionMap ("-", 2D) = "white"{} 35 | _OcclusionStr ("-", Range(0,1)) = 1 36 | 37 | [HDR] _Emission ("-", Color) = (0, 0, 0) 38 | 39 | _ScaleMin ("-", Float) = 1 40 | _ScaleMax ("-", Float) = 1 41 | 42 | _RandomSeed ("-", Float) = 0 43 | } 44 | SubShader 45 | { 46 | Tags { "RenderType"="Opaque" } 47 | 48 | CGPROGRAM 49 | 50 | #pragma surface surf Standard vertex:vert nolightmap addshadow 51 | #pragma shader_feature _COLORMODE_RANDOM 52 | #pragma shader_feature _ALBEDOMAP 53 | #pragma shader_feature _NORMALMAP 54 | #pragma shader_feature _OCCLUSIONMAP 55 | #pragma shader_feature _EMISSION 56 | #pragma target 3.0 57 | 58 | #include "Common.cginc" 59 | 60 | half _Metallic; 61 | half _Smoothness; 62 | 63 | sampler2D _MainTex; 64 | sampler2D _NormalMap; 65 | half _NormalScale; 66 | sampler2D _OcclusionMap; 67 | half _OcclusionStr; 68 | half3 _Emission; 69 | 70 | struct Input 71 | { 72 | float2 uv_MainTex; 73 | half4 color : COLOR; 74 | }; 75 | 76 | void vert(inout appdata_full v) 77 | { 78 | float4 uv = float4(v.texcoord1.xy + _BufferOffset, 0, 0); 79 | 80 | float4 p = tex2Dlod(_PositionBuffer, uv); 81 | float4 r = tex2Dlod(_RotationBuffer, uv); 82 | 83 | float l = p.w + 0.5; 84 | float s = calc_scale(uv, l); 85 | 86 | v.vertex.xyz = rotate_vector(v.vertex.xyz, r) * s + p.xyz; 87 | v.normal = rotate_vector(v.normal, r); 88 | #if _NORMALMAP 89 | v.tangent.xyz = rotate_vector(v.tangent.xyz, r); 90 | #endif 91 | v.color = calc_color(uv, l); 92 | } 93 | 94 | void surf(Input IN, inout SurfaceOutputStandard o) 95 | { 96 | #if _ALBEDOMAP 97 | half4 c = tex2D(_MainTex, IN.uv_MainTex); 98 | o.Albedo = IN.color.rgb * c.rgb; 99 | #else 100 | o.Albedo = IN.color.rgb; 101 | #endif 102 | 103 | #if _NORMALMAP 104 | half4 n = tex2D(_NormalMap, IN.uv_MainTex); 105 | o.Normal = UnpackScaleNormal(n, _NormalScale); 106 | #endif 107 | 108 | #if _OCCLUSIONMAP 109 | half4 occ = tex2D(_OcclusionMap, IN.uv_MainTex); 110 | o.Occlusion = lerp((half4)1, occ, _OcclusionStr); 111 | #endif 112 | 113 | #if _EMISSION 114 | o.Emission = _Emission; 115 | #endif 116 | 117 | o.Metallic = _Metallic; 118 | o.Smoothness = _Smoothness; 119 | } 120 | 121 | ENDCG 122 | } 123 | CustomEditor "Kvant.SpraySurfaceMaterialEditor" 124 | } 125 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Opaque.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e1247c2208bf4bef82f45b4c36f0600 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/SimplexNoiseGrad3D.cginc: -------------------------------------------------------------------------------- 1 | // 2 | // Noise Shader Library for Unity - https://github.com/keijiro/NoiseShader 3 | // 4 | // Original work (webgl-noise) Copyright (C) 2011 Ashima Arts. 5 | // Translation and modification was made by Keijiro Takahashi. 6 | // 7 | // This shader is based on the webgl-noise GLSL shader. For further details 8 | // of the original shader, please see the following description from the 9 | // original source code. 10 | // 11 | 12 | // 13 | // Description : Array and textureless GLSL 2D/3D/4D simplex 14 | // noise functions. 15 | // Author : Ian McEwan, Ashima Arts. 16 | // Maintainer : ijm 17 | // Lastmod : 20110822 (ijm) 18 | // License : Copyright (C) 2011 Ashima Arts. All rights reserved. 19 | // Distributed under the MIT License. See LICENSE file. 20 | // https://github.com/ashima/webgl-noise 21 | // 22 | 23 | float3 mod289(float3 x) 24 | { 25 | return x - floor(x / 289.0) * 289.0; 26 | } 27 | 28 | float4 mod289(float4 x) 29 | { 30 | return x - floor(x / 289.0) * 289.0; 31 | } 32 | 33 | float4 permute(float4 x) 34 | { 35 | return mod289((x * 34.0 + 1.0) * x); 36 | } 37 | 38 | float4 taylorInvSqrt(float4 r) 39 | { 40 | return 1.79284291400159 - r * 0.85373472095314; 41 | } 42 | 43 | float3 snoise_grad(float3 v) 44 | { 45 | const float2 C = float2(1.0 / 6.0, 1.0 / 3.0); 46 | 47 | // First corner 48 | float3 i = floor(v + dot(v, C.yyy)); 49 | float3 x0 = v - i + dot(i, C.xxx); 50 | 51 | // Other corners 52 | float3 g = step(x0.yzx, x0.xyz); 53 | float3 l = 1.0 - g; 54 | float3 i1 = min(g.xyz, l.zxy); 55 | float3 i2 = max(g.xyz, l.zxy); 56 | 57 | // x1 = x0 - i1 + 1.0 * C.xxx; 58 | // x2 = x0 - i2 + 2.0 * C.xxx; 59 | // x3 = x0 - 1.0 + 3.0 * C.xxx; 60 | float3 x1 = x0 - i1 + C.xxx; 61 | float3 x2 = x0 - i2 + C.yyy; 62 | float3 x3 = x0 - 0.5; 63 | 64 | // Permutations 65 | i = mod289(i); // Avoid truncation effects in permutation 66 | float4 p = 67 | permute(permute(permute(i.z + float4(0.0, i1.z, i2.z, 1.0)) 68 | + i.y + float4(0.0, i1.y, i2.y, 1.0)) 69 | + i.x + float4(0.0, i1.x, i2.x, 1.0)); 70 | 71 | // Gradients: 7x7 points over a square, mapped onto an octahedron. 72 | // The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) 73 | float4 j = p - 49.0 * floor(p / 49.0); // mod(p,7*7) 74 | 75 | float4 x_ = floor(j / 7.0); 76 | float4 y_ = floor(j - 7.0 * x_); // mod(j,N) 77 | 78 | float4 x = (x_ * 2.0 + 0.5) / 7.0 - 1.0; 79 | float4 y = (y_ * 2.0 + 0.5) / 7.0 - 1.0; 80 | 81 | float4 h = 1.0 - abs(x) - abs(y); 82 | 83 | float4 b0 = float4(x.xy, y.xy); 84 | float4 b1 = float4(x.zw, y.zw); 85 | 86 | //float4 s0 = float4(lessThan(b0, 0.0)) * 2.0 - 1.0; 87 | //float4 s1 = float4(lessThan(b1, 0.0)) * 2.0 - 1.0; 88 | float4 s0 = floor(b0) * 2.0 + 1.0; 89 | float4 s1 = floor(b1) * 2.0 + 1.0; 90 | float4 sh = -step(h, 0.0); 91 | 92 | float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; 93 | float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; 94 | 95 | float3 g0 = float3(a0.xy, h.x); 96 | float3 g1 = float3(a0.zw, h.y); 97 | float3 g2 = float3(a1.xy, h.z); 98 | float3 g3 = float3(a1.zw, h.w); 99 | 100 | // Normalise gradients 101 | float4 norm = taylorInvSqrt(float4(dot(g0, g0), dot(g1, g1), dot(g2, g2), dot(g3, g3))); 102 | g0 *= norm.x; 103 | g1 *= norm.y; 104 | g2 *= norm.z; 105 | g3 *= norm.w; 106 | 107 | // Compute gradient of noise function at P 108 | float4 m = max(0.6 - float4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0); 109 | float4 m2 = m * m; 110 | float4 m3 = m2 * m; 111 | float4 m4 = m2 * m2; 112 | float3 grad = 113 | -6.0 * m3.x * x0 * dot(x0, g0) + m4.x * g0 + 114 | -6.0 * m3.y * x1 * dot(x1, g1) + m4.y * g1 + 115 | -6.0 * m3.z * x2 * dot(x2, g2) + m4.z * g2 + 116 | -6.0 * m3.w * x3 * dot(x3, g3) + m4.w * g3; 117 | return 42.0 * grad; 118 | } 119 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/SimplexNoiseGrad3D.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4de643dee5d08964db4804edd17896ce 3 | timeCreated: 1449302846 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Unlit.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Transparent unlit shader for Spray 3 | // 4 | // Vertex format: 5 | // position.xyz = vertex position 6 | // texcoord.xy = uv for GPGPU buffers 7 | // 8 | // Position buffer format: 9 | // .xyz = particle position 10 | // .w = life (+0.5 -> -0.5) 11 | // 12 | // Rotation buffer format: 13 | // .xyzw = particle rotation 14 | // 15 | Shader "Kvant/Spray/Transparent Unlit" 16 | { 17 | Properties 18 | { 19 | _PositionBuffer ("-", 2D) = "black"{} 20 | _RotationBuffer ("-", 2D) = "red"{} 21 | 22 | [Enum(Add, 0, AlphaBlend, 1)] 23 | _BlendMode ("-", Float) = 0 24 | 25 | [KeywordEnum(Single, Animate, Random)] 26 | _ColorMode ("-", Float) = 0 27 | 28 | [HDR] _Color ("-", Color) = (1, 1, 1, 1) 29 | [HDR] _Color2 ("-", Color) = (0.5, 0.5, 0.5, 1) 30 | 31 | _MainTex ("-", 2D) = "white"{} 32 | 33 | _ScaleMin ("-", Float) = 1 34 | _ScaleMax ("-", Float) = 1 35 | 36 | _RandomSeed ("-", Float) = 0 37 | } 38 | 39 | CGINCLUDE 40 | 41 | #pragma shader_feature _COLORMODE_RANDOM 42 | #pragma shader_feature _MAINTEX 43 | #pragma multi_compile_fog 44 | 45 | #include "UnityCG.cginc" 46 | #include "Common.cginc" 47 | 48 | sampler2D _MainTex; 49 | float4 _MainTex_ST; 50 | half _BlendMode; 51 | 52 | struct appdata 53 | { 54 | float4 vertex : POSITION; 55 | float2 texcoord0 : TEXCOORD0; 56 | float2 texcoord1 : TEXCOORD1; 57 | }; 58 | 59 | struct v2f 60 | { 61 | float4 position : SV_POSITION; 62 | float2 texcoord : TEXCOORD; 63 | half4 color : COLOR; 64 | UNITY_FOG_COORDS(1) 65 | }; 66 | 67 | v2f vert(appdata v) 68 | { 69 | float4 uv = float4(v.texcoord1.xy + _BufferOffset, 0, 0); 70 | 71 | float4 p = tex2Dlod(_PositionBuffer, uv); 72 | float4 r = tex2Dlod(_RotationBuffer, uv); 73 | 74 | float l = p.w + 0.5; 75 | float s = calc_scale(uv, l); 76 | 77 | v.vertex.xyz = rotate_vector(v.vertex.xyz, r) * s + p.xyz; 78 | 79 | v2f o; 80 | 81 | o.position = mul(UNITY_MATRIX_MVP, v.vertex); 82 | o.texcoord = TRANSFORM_TEX(v.texcoord0, _MainTex); 83 | o.color = calc_color(uv, l); 84 | 85 | UNITY_TRANSFER_FOG(o, o.position); 86 | 87 | return o; 88 | } 89 | 90 | half4 frag(v2f i) : SV_Target 91 | { 92 | half4 c = i.color; 93 | #if _MAINTEX 94 | c *= tex2D(_MainTex, i.texcoord); 95 | #endif 96 | UNITY_APPLY_FOG_COLOR(i.fogCoord, c, (half4)0); 97 | c *= float4(c.aaa, _BlendMode); 98 | return c; 99 | } 100 | 101 | ENDCG 102 | 103 | SubShader 104 | { 105 | Tags { "RenderType"="Transparent" "Queue"="Transparent" } 106 | Pass 107 | { 108 | Blend One OneMinusSrcAlpha 109 | CGPROGRAM 110 | #pragma target 3.0 111 | #pragma vertex vert 112 | #pragma fragment frag 113 | ENDCG 114 | } 115 | } 116 | CustomEditor "Kvant.SprayUnlitMaterialEditor" 117 | } 118 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Shaders/Unlit.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc11471c70ec2478f80b9434bf45d6c1 3 | timeCreated: 1432364505 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Spray/Spray.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 051131338091a4b3d861d193e64fb704 3 | timeCreated: 1434379995 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _material: {instanceID: 0} 9 | - _defaultMaterial: {fileID: 2100000, guid: e1aad33bf16194534a7c99e7c01a8249, type: 2} 10 | - _kernelShader: {fileID: 4800000, guid: 5e5e161a3708e40119404232637809fc, type: 3} 11 | - _debugShader: {fileID: 4800000, guid: ad2397ccf551046ecb4df814f027d430, type: 3} 12 | executionOrder: 0 13 | icon: {instanceID: 0} 14 | userData: 15 | assetBundleName: 16 | assetBundleVariant: 17 | -------------------------------------------------------------------------------- /Assets/Main.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 848d4afbce9e040529bc294be177c29e 3 | timeCreated: 1459221762 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Material.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6930d66d98f104237a4609760d28d171 3 | folderAsset: yes 4 | timeCreated: 1459232130 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/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: 12 | m_LightmapFlags: 5 13 | m_CustomRenderQueue: 1000 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | data: 19 | first: 20 | name: _MainTex 21 | second: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | data: 26 | first: 27 | name: _BumpMap 28 | second: 29 | m_Texture: {fileID: 0} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | data: 33 | first: 34 | name: _DetailNormalMap 35 | second: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | data: 40 | first: 41 | name: _Tex 42 | second: 43 | m_Texture: {fileID: 8900000, guid: a09fc921d4a0f81449d9cf205595eb62, type: 3} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | data: 47 | first: 48 | name: _OcclusionMap 49 | second: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | data: 54 | first: 55 | name: _ParallaxMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | data: 61 | first: 62 | name: _EmissionMap 63 | second: 64 | m_Texture: {fileID: 0} 65 | m_Scale: {x: 1, y: 1} 66 | m_Offset: {x: 0, y: 0} 67 | data: 68 | first: 69 | name: _DetailMask 70 | second: 71 | m_Texture: {fileID: 0} 72 | m_Scale: {x: 1, y: 1} 73 | m_Offset: {x: 0, y: 0} 74 | data: 75 | first: 76 | name: _DetailAlbedoMap 77 | second: 78 | m_Texture: {fileID: 0} 79 | m_Scale: {x: 1, y: 1} 80 | m_Offset: {x: 0, y: 0} 81 | data: 82 | first: 83 | name: _MetallicGlossMap 84 | second: 85 | m_Texture: {fileID: 0} 86 | m_Scale: {x: 1, y: 1} 87 | m_Offset: {x: 0, y: 0} 88 | m_Floats: 89 | data: 90 | first: 91 | name: _SrcBlend 92 | second: 1 93 | data: 94 | first: 95 | name: _DstBlend 96 | second: 0 97 | data: 98 | first: 99 | name: _Cutoff 100 | second: 0.5 101 | data: 102 | first: 103 | name: _Exposure 104 | second: 3.4 105 | data: 106 | first: 107 | name: _Metallic 108 | second: 0 109 | data: 110 | first: 111 | name: _BumpScale 112 | second: 1 113 | data: 114 | first: 115 | name: _Glossiness 116 | second: 0.5 117 | data: 118 | first: 119 | name: _OcclusionStrength 120 | second: 1 121 | data: 122 | first: 123 | name: _Parallax 124 | second: 0.02 125 | data: 126 | first: 127 | name: _ZWrite 128 | second: 1 129 | data: 130 | first: 131 | name: _DetailNormalMapScale 132 | second: 1 133 | data: 134 | first: 135 | name: _UVSec 136 | second: 0 137 | data: 138 | first: 139 | name: _Mode 140 | second: 0 141 | data: 142 | first: 143 | name: _Rotation 144 | second: 0 145 | m_Colors: 146 | data: 147 | first: 148 | name: _EmissionColor 149 | second: {r: 0, g: 0, b: 0, a: 1} 150 | data: 151 | first: 152 | name: _Color 153 | second: {r: 1, g: 1, b: 1, a: 1} 154 | data: 155 | first: 156 | name: _Tint 157 | second: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} 158 | -------------------------------------------------------------------------------- /Assets/Material/Skybox.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 399297760b04342998949651c1a1333b 3 | timeCreated: 1459229820 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Material/Wall.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: Wall 10 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 5 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | data: 19 | first: 20 | name: _MainTex 21 | second: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1.5, y: 1.5} 24 | m_Offset: {x: 0.36, y: 0} 25 | data: 26 | first: 27 | name: _BumpMap 28 | second: 29 | m_Texture: {fileID: 0} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | data: 33 | first: 34 | name: _DetailNormalMap 35 | second: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | data: 40 | first: 41 | name: _OcclusionMap 42 | second: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | data: 47 | first: 48 | name: _ParallaxMap 49 | second: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | data: 54 | first: 55 | name: _EmissionMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1.5, y: 1.5} 59 | m_Offset: {x: 0.36, y: 0} 60 | data: 61 | first: 62 | name: _DetailMask 63 | second: 64 | m_Texture: {fileID: 0} 65 | m_Scale: {x: 1, y: 1} 66 | m_Offset: {x: 0, y: 0} 67 | data: 68 | first: 69 | name: _DetailAlbedoMap 70 | second: 71 | m_Texture: {fileID: 0} 72 | m_Scale: {x: 1, y: 1} 73 | m_Offset: {x: 0, y: 0} 74 | data: 75 | first: 76 | name: _MetallicGlossMap 77 | second: 78 | m_Texture: {fileID: 0} 79 | m_Scale: {x: 1, y: 1} 80 | m_Offset: {x: 0, y: 0} 81 | m_Floats: 82 | data: 83 | first: 84 | name: _SrcBlend 85 | second: 1 86 | data: 87 | first: 88 | name: _DstBlend 89 | second: 0 90 | data: 91 | first: 92 | name: _Cutoff 93 | second: 0.5 94 | data: 95 | first: 96 | name: _Glossiness 97 | second: 0.2 98 | data: 99 | first: 100 | name: _Metallic 101 | second: 0.4 102 | data: 103 | first: 104 | name: _BumpScale 105 | second: 1 106 | data: 107 | first: 108 | name: _OcclusionStrength 109 | second: 1 110 | data: 111 | first: 112 | name: _Parallax 113 | second: 0.02 114 | data: 115 | first: 116 | name: _ZWrite 117 | second: 1 118 | data: 119 | first: 120 | name: _DetailNormalMapScale 121 | second: 1 122 | data: 123 | first: 124 | name: _UVSec 125 | second: 0 126 | data: 127 | first: 128 | name: _Mode 129 | second: 0 130 | m_Colors: 131 | data: 132 | first: 133 | name: _EmissionColor 134 | second: {r: 0, g: 0, b: 0, a: 1} 135 | data: 136 | first: 137 | name: _Color 138 | second: {r: 0.34099266, g: 0.36753297, b: 0.3897059, a: 1} 139 | -------------------------------------------------------------------------------- /Assets/Material/Wall.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0f0d8a79a97349c78fb2f3dbc7e0f15 3 | timeCreated: 1459230097 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73257b0242b9c4f48adb7554613c7e5e 3 | folderAsset: yes 4 | timeCreated: 1459237270 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Model/Shapes.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Model/Shapes.fbx -------------------------------------------------------------------------------- /Assets/Model/Shapes.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 84d6d6175e8d24ce884cc230f40207d5 3 | timeCreated: 1459237280 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 19 7 | fileIDToRecycleName: 8 | 100000: Box 9 | 100002: ipr_camera 10 | 100004: Shaft 11 | 100006: //RootNode 12 | 100008: Spike 13 | 400000: Box 14 | 400002: ipr_camera 15 | 400004: Shaft 16 | 400006: //RootNode 17 | 400008: Spike 18 | 2300000: Box 19 | 2300002: Shaft 20 | 2300004: Spike 21 | 3300000: Box 22 | 3300002: Shaft 23 | 3300004: Spike 24 | 4300000: Box 25 | 4300002: Spike 26 | 4300004: Shaft 27 | materials: 28 | importMaterials: 0 29 | materialName: 0 30 | materialSearch: 1 31 | animations: 32 | legacyGenerateAnimations: 4 33 | bakeSimulation: 0 34 | resampleRotations: 1 35 | optimizeGameObjects: 0 36 | motionNodeName: 37 | animationImportErrors: 38 | animationImportWarnings: 39 | animationRetargetingWarnings: 40 | animationDoRetargetingWarnings: 0 41 | animationCompression: 1 42 | animationRotationError: 0.5 43 | animationPositionError: 0.5 44 | animationScaleError: 0.5 45 | animationWrapMode: 0 46 | extraExposedTransformPaths: [] 47 | clipAnimations: [] 48 | isReadable: 1 49 | meshes: 50 | lODScreenPercentages: [] 51 | globalScale: 100 52 | meshCompression: 0 53 | addColliders: 0 54 | importBlendShapes: 0 55 | swapUVChannels: 0 56 | generateSecondaryUV: 0 57 | useFileUnits: 1 58 | optimizeMeshForGPU: 1 59 | keepQuads: 0 60 | weldVertices: 1 61 | secondaryUVAngleDistortion: 8 62 | secondaryUVAreaDistortion: 15.000001 63 | secondaryUVHardAngle: 88 64 | secondaryUVPackMargin: 4 65 | useFileScale: 1 66 | tangentSpace: 67 | normalSmoothAngle: 60 68 | normalImportMode: 0 69 | tangentImportMode: 3 70 | importAnimation: 0 71 | copyAvatar: 0 72 | humanDescription: 73 | human: [] 74 | skeleton: [] 75 | armTwist: 0.5 76 | foreArmTwist: 0.5 77 | upperLegTwist: 0.5 78 | legTwist: 0.5 79 | armStretch: 0.05 80 | legStretch: 0.05 81 | feetSpacing: 0 82 | rootMotionBoneName: 83 | hasTranslationDoF: 0 84 | lastHumanDescriptionAvatarSource: {instanceID: 0} 85 | animationType: 0 86 | humanoidOversampling: 1 87 | additionalBone: 0 88 | userData: 89 | assetBundleName: 90 | assetBundleVariant: 91 | -------------------------------------------------------------------------------- /Assets/Particle System.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a58b1d9fcc3e54c0392c73a52f1d08a1 3 | folderAsset: yes 4 | timeCreated: 1459307432 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Particle System/Cube Cluster.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: Cube Cluster 9 | serializedVersion: 5 10 | m_AnimatorParameters: [] 11 | m_AnimatorLayers: 12 | - serializedVersion: 5 13 | m_Name: Base Layer 14 | m_StateMachine: {fileID: 110714712} 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 &110298672 25 | AnimatorState: 26 | serializedVersion: 5 27 | m_ObjectHideFlags: 1 28 | m_PrefabParentObject: {fileID: 0} 29 | m_PrefabInternal: {fileID: 0} 30 | m_Name: CubeCluster 31 | m_Speed: 1 32 | m_CycleOffset: 0 33 | m_Transitions: [] 34 | m_StateMachineBehaviours: [] 35 | m_Position: {x: 50, y: 50, z: 0} 36 | m_IKOnFeet: 0 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: 4e2c22b4fde634b3aa50d4f5bda7a76d, type: 2} 43 | m_Tag: 44 | m_SpeedParameter: 45 | m_MirrorParameter: 46 | m_CycleOffsetParameter: 47 | --- !u!1107 &110714712 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: 110298672} 57 | m_Position: {x: 200, y: 0, 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: 110298672} 68 | -------------------------------------------------------------------------------- /Assets/Particle System/Cube Cluster.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86e8d568b60da4618aa1decf03cc3a12 3 | timeCreated: 1459322272 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Particle System/CubeCluster.anim: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!74 &7400000 4 | AnimationClip: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: CubeCluster 9 | serializedVersion: 6 10 | m_Legacy: 0 11 | m_Compressed: 0 12 | m_UseHighQualityCurve: 1 13 | m_RotationCurves: [] 14 | m_CompressedRotationCurves: [] 15 | m_EulerCurves: [] 16 | m_PositionCurves: [] 17 | m_ScaleCurves: [] 18 | m_FloatCurves: 19 | - curve: 20 | serializedVersion: 2 21 | m_Curve: 22 | - time: 0 23 | value: 0 24 | inSlope: 0.055555556 25 | outSlope: 0.055555556 26 | tangentMode: 10 27 | - time: 18 28 | value: 1 29 | inSlope: 0.055555556 30 | outSlope: 0.055555556 31 | tangentMode: 10 32 | m_PreInfinity: 2 33 | m_PostInfinity: 2 34 | m_RotationOrder: 4 35 | attribute: _phase 36 | path: 37 | classID: 114 38 | script: {fileID: 11500000, guid: fc25ac8d039114093aab62baa8e91acb, type: 3} 39 | - curve: 40 | serializedVersion: 2 41 | m_Curve: 42 | - time: 0 43 | value: 1 44 | inSlope: -0.2 45 | outSlope: -0.25 46 | tangentMode: 21 47 | - time: 4 48 | value: 0 49 | inSlope: -0.25 50 | outSlope: -0 51 | tangentMode: 21 52 | - time: 14 53 | value: 0 54 | inSlope: 0 55 | outSlope: 0.25 56 | tangentMode: 21 57 | - time: 18 58 | value: 1 59 | inSlope: 0.25 60 | outSlope: 0.33333334 61 | tangentMode: 21 62 | m_PreInfinity: 2 63 | m_PostInfinity: 2 64 | m_RotationOrder: 4 65 | attribute: _throttle 66 | path: Shards 67 | classID: 114 68 | script: {fileID: 11500000, guid: 051131338091a4b3d861d193e64fb704, type: 3} 69 | m_PPtrCurves: [] 70 | m_SampleRate: 60 71 | m_WrapMode: 0 72 | m_Bounds: 73 | m_Center: {x: 0, y: 0, z: 0} 74 | m_Extent: {x: 0, y: 0, z: 0} 75 | m_ClipBindingConstant: 76 | genericBindings: 77 | - path: 0 78 | attribute: 998586967 79 | script: {fileID: 11500000, guid: fc25ac8d039114093aab62baa8e91acb, type: 3} 80 | classID: 114 81 | customType: 0 82 | isPPtrCurve: 0 83 | - path: 2397586699 84 | attribute: 3306950028 85 | script: {fileID: 11500000, guid: 051131338091a4b3d861d193e64fb704, type: 3} 86 | classID: 114 87 | customType: 0 88 | isPPtrCurve: 0 89 | pptrCurveMapping: [] 90 | m_AnimationClipSettings: 91 | serializedVersion: 2 92 | m_AdditiveReferencePoseClip: {fileID: 0} 93 | m_AdditiveReferencePoseTime: 0 94 | m_StartTime: 0 95 | m_StopTime: 18 96 | m_OrientationOffsetY: 0 97 | m_Level: 0 98 | m_CycleOffset: 0 99 | m_HasAdditiveReferencePose: 0 100 | m_LoopTime: 1 101 | m_LoopBlend: 0 102 | m_LoopBlendOrientation: 0 103 | m_LoopBlendPositionY: 0 104 | m_LoopBlendPositionXZ: 0 105 | m_KeepOriginalOrientation: 0 106 | m_KeepOriginalPositionY: 1 107 | m_KeepOriginalPositionXZ: 0 108 | m_HeightFromFeet: 0 109 | m_Mirror: 0 110 | m_EditorCurves: 111 | - curve: 112 | serializedVersion: 2 113 | m_Curve: 114 | - time: 0 115 | value: 0 116 | inSlope: 0.055555556 117 | outSlope: 0.055555556 118 | tangentMode: 10 119 | - time: 18 120 | value: 1 121 | inSlope: 0.055555556 122 | outSlope: 0.055555556 123 | tangentMode: 10 124 | m_PreInfinity: 2 125 | m_PostInfinity: 2 126 | m_RotationOrder: 4 127 | attribute: _phase 128 | path: 129 | classID: 114 130 | script: {fileID: 11500000, guid: fc25ac8d039114093aab62baa8e91acb, type: 3} 131 | - curve: 132 | serializedVersion: 2 133 | m_Curve: 134 | - time: 0 135 | value: 1 136 | inSlope: -0.2 137 | outSlope: -0.25 138 | tangentMode: 21 139 | - time: 4 140 | value: 0 141 | inSlope: -0.25 142 | outSlope: -0 143 | tangentMode: 21 144 | - time: 14 145 | value: 0 146 | inSlope: 0 147 | outSlope: 0.25 148 | tangentMode: 21 149 | - time: 18 150 | value: 1 151 | inSlope: 0.25 152 | outSlope: 0.33333334 153 | tangentMode: 21 154 | m_PreInfinity: 2 155 | m_PostInfinity: 2 156 | m_RotationOrder: 4 157 | attribute: _throttle 158 | path: Shards 159 | classID: 114 160 | script: {fileID: 11500000, guid: 051131338091a4b3d861d193e64fb704, type: 3} 161 | m_EulerEditorCurves: [] 162 | m_HasGenericRootTransform: 0 163 | m_HasMotionFloatCurves: 0 164 | m_GenerateMotionCurves: 0 165 | m_Events: 166 | - time: 17.983334 167 | functionName: ResetParams 168 | data: 169 | objectReferenceParameter: {fileID: 0} 170 | floatParameter: 0 171 | intParameter: 0 172 | messageOptions: 0 173 | -------------------------------------------------------------------------------- /Assets/Particle System/CubeCluster.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e2c22b4fde634b3aa50d4f5bda7a76d 3 | timeCreated: 1459322272 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Particle System/Shard.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: Shard 10 | m_Shader: {fileID: 4800000, guid: 8e1247c2208bf4bef82f45b4c36f0600, type: 3} 11 | m_ShaderKeywords: _COLORMODE_SINGLE _EMISSION 12 | m_LightmapFlags: 5 13 | m_CustomRenderQueue: 2000 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | data: 19 | first: 20 | name: _MainTex 21 | second: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | data: 26 | first: 27 | name: _BumpMap 28 | second: 29 | m_Texture: {fileID: 0} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | data: 33 | first: 34 | name: _NormalMap 35 | second: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | data: 40 | first: 41 | name: _DetailNormalMap 42 | second: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | data: 47 | first: 48 | name: _OcclusionMap 49 | second: 50 | m_Texture: {fileID: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | data: 54 | first: 55 | name: _ParallaxMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | data: 61 | first: 62 | name: _EmissionMap 63 | second: 64 | m_Texture: {fileID: 0} 65 | m_Scale: {x: 1, y: 1} 66 | m_Offset: {x: 0, y: 0} 67 | data: 68 | first: 69 | name: _DetailMask 70 | second: 71 | m_Texture: {fileID: 0} 72 | m_Scale: {x: 1, y: 1} 73 | m_Offset: {x: 0, y: 0} 74 | data: 75 | first: 76 | name: _DetailAlbedoMap 77 | second: 78 | m_Texture: {fileID: 0} 79 | m_Scale: {x: 1, y: 1} 80 | m_Offset: {x: 0, y: 0} 81 | data: 82 | first: 83 | name: _MetallicGlossMap 84 | second: 85 | m_Texture: {fileID: 0} 86 | m_Scale: {x: 1, y: 1} 87 | m_Offset: {x: 0, y: 0} 88 | data: 89 | first: 90 | name: _PositionBuffer 91 | second: 92 | m_Texture: {fileID: 0} 93 | m_Scale: {x: 1, y: 1} 94 | m_Offset: {x: 0, y: 0} 95 | data: 96 | first: 97 | name: _RotationBuffer 98 | second: 99 | m_Texture: {fileID: 0} 100 | m_Scale: {x: 1, y: 1} 101 | m_Offset: {x: 0, y: 0} 102 | m_Floats: 103 | data: 104 | first: 105 | name: _SrcBlend 106 | second: 1 107 | data: 108 | first: 109 | name: _DstBlend 110 | second: 0 111 | data: 112 | first: 113 | name: _Cutoff 114 | second: 0.5 115 | data: 116 | first: 117 | name: _Smoothness 118 | second: 0 119 | data: 120 | first: 121 | name: _BumpScale 122 | second: 1 123 | data: 124 | first: 125 | name: _Glossiness 126 | second: 0.5 127 | data: 128 | first: 129 | name: _Metallic 130 | second: 0 131 | data: 132 | first: 133 | name: _OcclusionStrength 134 | second: 1 135 | data: 136 | first: 137 | name: _Parallax 138 | second: 0.02 139 | data: 140 | first: 141 | name: _ZWrite 142 | second: 1 143 | data: 144 | first: 145 | name: _DetailNormalMapScale 146 | second: 1 147 | data: 148 | first: 149 | name: _UVSec 150 | second: 0 151 | data: 152 | first: 153 | name: _Mode 154 | second: 0 155 | data: 156 | first: 157 | name: _ColorMode 158 | second: 0 159 | data: 160 | first: 161 | name: _NormalScale 162 | second: 1 163 | data: 164 | first: 165 | name: _OcclusionStr 166 | second: 1 167 | data: 168 | first: 169 | name: _ScaleMin 170 | second: 1 171 | data: 172 | first: 173 | name: _ScaleMax 174 | second: 1 175 | data: 176 | first: 177 | name: _RandomSeed 178 | second: 0 179 | m_Colors: 180 | data: 181 | first: 182 | name: _EmissionColor 183 | second: {r: 0, g: 0, b: 0, a: 1} 184 | data: 185 | first: 186 | name: _Color 187 | second: {r: 1, g: 1, b: 1, a: 1} 188 | data: 189 | first: 190 | name: _Emission 191 | second: {r: 1.4, g: 0.9862474, b: 0.9161765, a: 1} 192 | data: 193 | first: 194 | name: _Color2 195 | second: {r: 0.5, g: 0.5, b: 0.5, a: 1} 196 | -------------------------------------------------------------------------------- /Assets/Particle System/Shard.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01e85f6dc59e048079cc31b425fc4697 3 | timeCreated: 1459306769 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ScreenOverlay.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5284cd2b743624d1cac56d9187d816d8 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/ScreenOverlay/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/ScreenOverlay/Logo.png -------------------------------------------------------------------------------- /Assets/ScreenOverlay/Logo.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f02dbdd9fe2a4e688fb225a7dcb476b 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 1 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 1 13 | mipMapFadeDistanceEnd: 3 14 | bumpmap: 15 | convertToNormalMap: 0 16 | externalNormalMap: 0 17 | heightScale: .25 18 | normalMapFilter: 0 19 | isReadable: 0 20 | grayScaleToAlpha: 0 21 | generateCubemap: 0 22 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: 1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | spriteMode: 0 34 | spriteExtrude: 1 35 | spriteMeshType: 1 36 | alignment: 0 37 | spritePivot: {x: .5, y: .5} 38 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 39 | spritePixelsToUnits: 100 40 | alphaIsTransparency: 0 41 | textureType: -1 42 | buildTargetSettings: [] 43 | spriteSheet: 44 | sprites: [] 45 | spritePackingTag: 46 | userData: 47 | -------------------------------------------------------------------------------- /Assets/ScreenOverlay/Mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/ScreenOverlay/Mask.png -------------------------------------------------------------------------------- /Assets/ScreenOverlay/Mask.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26cf17947eb304d3a902552cde339ff6 3 | TextureImporter: 4 | serializedVersion: 2 5 | mipmaps: 6 | mipMapMode: 0 7 | enableMipMap: 1 8 | linearTexture: 0 9 | correctGamma: 0 10 | fadeOut: 0 11 | borderMipMap: 0 12 | mipMapFadeDistanceStart: 1 13 | mipMapFadeDistanceEnd: 3 14 | bumpmap: 15 | convertToNormalMap: 0 16 | externalNormalMap: 0 17 | heightScale: .25 18 | normalMapFilter: 0 19 | isReadable: 0 20 | grayScaleToAlpha: 0 21 | generateCubemap: 0 22 | seamlessCubemap: 0 23 | textureFormat: -1 24 | maxTextureSize: 1024 25 | textureSettings: 26 | filterMode: -1 27 | aniso: -1 28 | mipBias: -1 29 | wrapMode: 1 30 | nPOTScale: 1 31 | lightmap: 0 32 | compressionQuality: 50 33 | spriteMode: 0 34 | spriteExtrude: 1 35 | spriteMeshType: 1 36 | alignment: 0 37 | spritePivot: {x: .5, y: .5} 38 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 39 | spritePixelsToUnits: 100 40 | alphaIsTransparency: 0 41 | textureType: -1 42 | buildTargetSettings: [] 43 | spriteSheet: 44 | sprites: [] 45 | spritePackingTag: 46 | userData: 47 | -------------------------------------------------------------------------------- /Assets/ScreenOverlay/ScreenOverlay.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | 4 | [ExecuteInEditMode] 5 | public class ScreenOverlay : MonoBehaviour 6 | { 7 | [SerializeField] 8 | Texture _mask; 9 | 10 | [SerializeField] 11 | Shader _shader; 12 | 13 | Material _material; 14 | 15 | void OnEnable() 16 | { 17 | _material = new Material(Shader.Find("Hidden/UnityLogo/ScreenOverlay")); 18 | _material.hideFlags = HideFlags.DontSave; 19 | } 20 | 21 | void OnDisable() 22 | { 23 | DestroyImmediate(_material); 24 | _material = null; 25 | } 26 | 27 | void OnRenderImage(RenderTexture source, RenderTexture destination) 28 | { 29 | _material.SetTexture("_MaskTex", _mask); 30 | Graphics.Blit(source, destination, _material, 0); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/ScreenOverlay/ScreenOverlay.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2b63e579940fa4161885cd7ce901bea3 3 | timeCreated: 1459234232 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: cd0c20cefa09448a895f44e6ebe79210, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/ScreenOverlay/ScreenOverlay.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/UnityLogo/ScreenOverlay" 2 | { 3 | Properties 4 | { 5 | _MainTex("", 2D) = "white"{} 6 | _MaskTex("", 2D) = "white"{} 7 | } 8 | 9 | CGINCLUDE 10 | 11 | #include "UnityCG.cginc" 12 | 13 | sampler2D _MainTex; 14 | sampler2D _MaskTex; 15 | 16 | fixed4 frag (v2f_img i) : SV_Target 17 | { 18 | fixed4 c = tex2D(_MainTex, i.uv); 19 | fixed m = tex2D(_MaskTex, i.uv).r; 20 | return c * m; 21 | } 22 | 23 | ENDCG 24 | 25 | SubShader 26 | { 27 | Cull Off ZWrite Off ZTest Always 28 | Pass 29 | { 30 | CGPROGRAM 31 | #pragma vertex vert_img 32 | #pragma fragment frag 33 | ENDCG 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/ScreenOverlay/ScreenOverlay.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd0c20cefa09448a895f44e6ebe79210 3 | timeCreated: 1459233829 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Texture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 268117c1faea440f5bb4750e356f194e 3 | folderAsset: yes 4 | timeCreated: 1459232121 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Texture/BrushedMetalNormal.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Texture/BrushedMetalNormal.tif -------------------------------------------------------------------------------- /Assets/Texture/BrushedMetalNormal.tif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22908ad6783998142a0597f6ea5fc501 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 1 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 1 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 2 31 | aniso: 3 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | textureType: 1 48 | buildTargetSettings: [] 49 | spriteSheet: 50 | sprites: [] 51 | outline: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Texture/BrushedMetalSpecular.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Texture/BrushedMetalSpecular.tif -------------------------------------------------------------------------------- /Assets/Texture/BrushedMetalSpecular.tif.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1085d6f82e40b31428079b25ebee7d74 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | serializedVersion: 2 6 | mipmaps: 7 | mipMapMode: 0 8 | enableMipMap: 1 9 | linearTexture: 0 10 | correctGamma: 0 11 | fadeOut: 0 12 | borderMipMap: 0 13 | mipMapFadeDistanceStart: 1 14 | mipMapFadeDistanceEnd: 3 15 | bumpmap: 16 | convertToNormalMap: 0 17 | externalNormalMap: 0 18 | heightScale: 0.25 19 | normalMapFilter: 0 20 | isReadable: 0 21 | grayScaleToAlpha: 0 22 | generateCubemap: 0 23 | cubemapConvolution: 0 24 | cubemapConvolutionSteps: 8 25 | cubemapConvolutionExponent: 1.5 26 | seamlessCubemap: 0 27 | textureFormat: -1 28 | maxTextureSize: 2048 29 | textureSettings: 30 | filterMode: 2 31 | aniso: 3 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | allowsAlphaSplitting: 0 39 | spriteMode: 0 40 | spriteExtrude: 1 41 | spriteMeshType: 1 42 | alignment: 0 43 | spritePivot: {x: 0.5, y: 0.5} 44 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 45 | spritePixelsToUnits: 100 46 | alphaIsTransparency: 0 47 | textureType: -1 48 | buildTargetSettings: [] 49 | spriteSheet: 50 | sprites: [] 51 | outline: [] 52 | spritePackingTag: 53 | userData: 54 | assetBundleName: 55 | assetBundleVariant: 56 | -------------------------------------------------------------------------------- /Assets/Texture/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Assets/Texture/Icon.png -------------------------------------------------------------------------------- /Assets/Texture/Icon.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f951c75f198b14b85b2b3def01474af5 3 | timeCreated: 1459306191 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 0 11 | linearTexture: 1 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: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 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: 0 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: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 1 49 | textureType: 2 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Extras/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Extras/Logo.png -------------------------------------------------------------------------------- /Extras/UnityCubes.mad: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/UnityCubes/e09d28c90dc8031f9b2c84e1863eae6626fc5d86/Extras/UnityCubes.mad -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_SolverIterationCount: 6 13 | m_QueriesHitTriggers: 1 14 | m_EnableAdaptiveForce: 0 15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 16 | -------------------------------------------------------------------------------- /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 | - enabled: 1 9 | path: Assets/Main.unity 10 | -------------------------------------------------------------------------------- /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/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: 5 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_LegacyDeferred: 14 | m_Mode: 1 15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 16 | m_AlwaysIncludedShaders: 17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 23 | m_PreloadedShaders: [] 24 | m_ShaderSettings: 25 | useScreenSpaceShadows: 1 26 | m_BuildTargetShaderSettings: [] 27 | m_LightmapStripping: 0 28 | m_FogStripping: 0 29 | m_LightmapKeepPlain: 1 30 | m_LightmapKeepDirCombined: 1 31 | m_LightmapKeepDirSeparate: 1 32 | m_LightmapKeepDynamicPlain: 1 33 | m_LightmapKeepDynamicDirCombined: 1 34 | m_LightmapKeepDynamicDirSeparate: 1 35 | m_FogKeepLinear: 1 36 | m_FogKeepExp: 1 37 | m_FogKeepExp2: 1 38 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 26 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.4p1 2 | m_StandardAssetsVersion: 0 3 | -------------------------------------------------------------------------------- /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: 2 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 3 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 | BlackBerry: 0 38 | GLES Emulation: 0 39 | Nintendo 3DS: 0 40 | PS3: 0 41 | PS4: 0 42 | PSM: 0 43 | PSP2: 0 44 | Samsung TV: 0 45 | Standalone: 0 46 | Tizen: 0 47 | WP8: 0 48 | Web: 0 49 | WebGL: 0 50 | WiiU: 0 51 | Windows Store Apps: 0 52 | XBOX360: 0 53 | XboxOne: 0 54 | iPhone: 0 55 | tvOS: 0 56 | -------------------------------------------------------------------------------- /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/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.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | UnityPurchasingSettings: 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | UnityAnalyticsSettings: 10 | m_Enabled: 0 11 | m_InitializeOnStartup: 1 12 | m_TestMode: 0 13 | m_TestEventUrl: 14 | m_TestConfigUrl: 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | UnityCubes 2 | ========== 3 | 4 | *UnityCubes* is a small projection mapping project with the Unity logo. 5 | 6 | ![Gif][Gif] 7 | 8 | ![Photo][Photo] 9 | 10 | System Requirements 11 | ------------------- 12 | 13 | - Unity 5.3.4 or later 14 | - Mac OS X system 15 | - [MadMapper][MadMapper] 16 | 17 | How To Set Up 18 | ------------- 19 | 20 | - Download the latest build from [the releases page][releases]. 21 | - Open UnityCubes.mad in the package with MadMapper. 22 | - Adjust mapping with using the static image of the Unity logo (which is included in the package). 23 | - Run UnityCubes.app and switch the media input to "UnityCubes - Main Camera". 24 | 25 | [Gif]: https://49.media.tumblr.com/9e2bd2465b6cbf0fa2c86b81cca8fd75/tumblr_o4ujh8zLUN1qio469o2_400.gif 26 | [Photo]: https://41.media.tumblr.com/d705a51b3f050307edcd07181edeb3c2/tumblr_o4uji3zrfK1qio469o1_400.jpg 27 | [MadMapper]: http://www.madmapper.com 28 | [Releases]: https://github.com/keijiro/UnityCubes/releases 29 | --------------------------------------------------------------------------------