├── .gitignore ├── Assets ├── ColorSuite.meta ├── ColorSuite │ ├── ColorSuite.cs │ ├── ColorSuite.cs.meta │ ├── Editor.meta │ ├── Editor │ │ ├── ColorSuiteEditor.cs │ │ └── ColorSuiteEditor.cs.meta │ ├── Shader.meta │ └── Shader │ │ ├── ColorSuite.shader │ │ └── ColorSuite.shader.meta ├── DeferredAO.meta ├── DeferredAO │ ├── DeferredAO.cs │ ├── DeferredAO.cs.meta │ ├── Editor.meta │ ├── Editor │ │ ├── DeferredAOEditor.cs │ │ └── DeferredAOEditor.cs.meta │ ├── Shader.meta │ └── Shader │ │ ├── DeferredAO.shader │ │ └── DeferredAO.shader.meta ├── Editor.meta ├── Editor │ ├── PackageTool.cs │ └── PackageTool.cs.meta ├── Kino.meta ├── Kino │ ├── Bokeh.meta │ ├── Bokeh │ │ ├── Bokeh.cs │ │ ├── Bokeh.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── BokehEditor.cs │ │ │ └── BokehEditor.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Bokeh.shader │ │ │ └── Bokeh.shader.meta │ ├── Fog.meta │ ├── Fog │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── FogEditor.cs │ │ │ └── FogEditor.cs.meta │ │ ├── Fog.cs │ │ ├── Fog.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Fog.shader │ │ │ └── Fog.shader.meta │ ├── Fringe.meta │ ├── Fringe │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── FringeEditor.cs │ │ │ └── FringeEditor.cs.meta │ │ ├── Fringe.cs │ │ ├── Fringe.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Fringe.shader │ │ │ └── Fringe.shader.meta │ ├── Vignette.meta │ └── Vignette │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── VignetteEditor.cs │ │ └── VignetteEditor.cs.meta │ │ ├── Shader.meta │ │ ├── Shader │ │ ├── Vignette.shader │ │ └── Vignette.shader.meta │ │ ├── Vignette.cs │ │ └── Vignette.cs.meta ├── Kvant.meta ├── Kvant │ ├── Grass.meta │ └── Grass │ │ ├── Editor.meta │ │ ├── Editor │ │ ├── GrassEditor.cs │ │ ├── GrassEditor.cs.meta │ │ ├── GrassMaterialEditor.cs │ │ ├── GrassMaterialEditor.cs.meta │ │ ├── GrassScrollerEditor.cs │ │ └── GrassScrollerEditor.cs.meta │ │ ├── Grass.cs │ │ ├── Grass.cs.meta │ │ ├── GrassScroller.cs │ │ ├── GrassScroller.cs.meta │ │ ├── Model.meta │ │ ├── Model │ │ ├── Grass.fbx │ │ └── Grass.fbx.meta │ │ ├── Scripts.meta │ │ ├── Scripts │ │ ├── BulkMesh.cs │ │ └── BulkMesh.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ ├── ClassicNoise3D.cginc │ │ ├── ClassicNoise3D.cginc.meta │ │ ├── Default Grass.mat │ │ ├── Default Grass.mat.meta │ │ ├── Kernel.shader │ │ ├── Kernel.shader.meta │ │ ├── Lines.png │ │ ├── Lines.png.meta │ │ ├── Surface.shader │ │ └── Surface.shader.meta ├── Reaktion.meta ├── Reaktion │ ├── Editor.meta │ ├── Editor │ │ ├── Utility.meta │ │ └── Utility │ │ │ ├── JitterMotionEditor.cs │ │ │ └── JitterMotionEditor.cs.meta │ ├── Internal.meta │ ├── Internal │ │ ├── Perlin.cs │ │ └── Perlin.cs.meta │ ├── Utility.meta │ └── Utility │ │ ├── JitterMotion.cs │ │ └── JitterMotion.cs.meta ├── Standard Assets.meta ├── Standard Assets │ ├── Characters.meta │ └── Characters │ │ ├── ThirdPersonCharacter.meta │ │ └── ThirdPersonCharacter │ │ ├── Animation.meta │ │ ├── Animation │ │ ├── HumanoidIdle.fbx │ │ ├── HumanoidIdle.fbx.meta │ │ ├── HumanoidRun.fbx │ │ └── HumanoidRun.fbx.meta │ │ ├── Materials.meta │ │ ├── Materials │ │ ├── EthanGrey.mat │ │ ├── EthanGrey.mat.meta │ │ ├── EthanWhite.mat │ │ └── EthanWhite.mat.meta │ │ ├── Models.meta │ │ ├── Models │ │ ├── Ethan.fbx │ │ └── Ethan.fbx.meta │ │ ├── Textures.meta │ │ └── Textures │ │ ├── EthanNormals.png │ │ ├── EthanNormals.png.meta │ │ ├── EthanOcclusion.png │ │ └── EthanOcclusion.png.meta ├── Test.meta ├── Test │ ├── Black.png │ ├── Black.png.meta │ ├── Idle.controller │ ├── Idle.controller.meta │ ├── Moving.unity │ ├── Moving.unity.meta │ ├── Plane.mat │ ├── Plane.mat.meta │ ├── Run.controller │ ├── Run.controller.meta │ ├── Skybox.mat │ ├── Skybox.mat.meta │ ├── Stay.unity │ ├── Stay.unity.meta │ ├── Test.mat │ └── Test.mat.meta ├── sIBL Archive.meta └── sIBL Archive │ ├── Acknowledgement.txt │ ├── Acknowledgement.txt.meta │ ├── Etnies_Park_Center_Env.hdr │ └── Etnies_Park_Center_Env.hdr.meta ├── Extra └── Grass.c4d ├── KvantGrass.unitypackage ├── ProjectSettings ├── AudioManager.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 └── UnityAnalyticsManager.asset └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | 5 | # Autogenerated VS/MD solution and project files 6 | *.csproj 7 | *.unityproj 8 | *.sln 9 | *.pidb 10 | *.userprefs 11 | 12 | .DS_Store 13 | *.swp 14 | -------------------------------------------------------------------------------- /Assets/ColorSuite.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92b634cb636824bfb98b32d3fc16d5c4 3 | folderAsset: yes 4 | timeCreated: 1440327030 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ColorSuite/ColorSuite.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 10593b7d510b64560a297a8af1356dcb 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - shader: {fileID: 4800000, guid: dc9775b65c52747e69fc4c854c00d696, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd386d94948a6489a9baa003c1f5b171 3 | folderAsset: yes 4 | timeCreated: 1440327030 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Editor/ColorSuiteEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014, 2015 Keijiro Takahashi 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | // this software and associated documentation files (the "Software"), to deal in 6 | // the Software without restriction, including without limitation the rights to 7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | // the Software, and to permit persons to whom the Software is furnished to do so, 9 | // subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in all 12 | // copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | // 21 | using UnityEngine; 22 | using UnityEditor; 23 | using System.Collections; 24 | 25 | [CustomEditor(typeof(ColorSuite)), CanEditMultipleObjects] 26 | public class ColorSuiteEditor : Editor 27 | { 28 | SerializedProperty propColorTemp; 29 | SerializedProperty propColorTint; 30 | 31 | SerializedProperty propToneMapping; 32 | SerializedProperty propExposure; 33 | 34 | SerializedProperty propSaturation; 35 | 36 | SerializedProperty propRCurve; 37 | SerializedProperty propGCurve; 38 | SerializedProperty propBCurve; 39 | SerializedProperty propCCurve; 40 | 41 | SerializedProperty propDitherMode; 42 | 43 | GUIContent labelColorTemp; 44 | GUIContent labelColorTint; 45 | 46 | void OnEnable() 47 | { 48 | propColorTemp = serializedObject.FindProperty("_colorTemp"); 49 | propColorTint = serializedObject.FindProperty("_colorTint"); 50 | 51 | propToneMapping = serializedObject.FindProperty("_toneMapping"); 52 | propExposure = serializedObject.FindProperty("_exposure"); 53 | 54 | propSaturation = serializedObject.FindProperty("_saturation"); 55 | 56 | propRCurve = serializedObject.FindProperty("_rCurve"); 57 | propGCurve = serializedObject.FindProperty("_gCurve"); 58 | propBCurve = serializedObject.FindProperty("_bCurve"); 59 | propCCurve = serializedObject.FindProperty("_cCurve"); 60 | 61 | propDitherMode = serializedObject.FindProperty("_ditherMode"); 62 | 63 | labelColorTemp = new GUIContent("Color Temperature"); 64 | labelColorTint = new GUIContent("Tint (green-purple)"); 65 | } 66 | 67 | public override void OnInspectorGUI() 68 | { 69 | serializedObject.Update(); 70 | 71 | EditorGUILayout.PropertyField(propToneMapping); 72 | if (propToneMapping.hasMultipleDifferentValues || propToneMapping.boolValue) 73 | { 74 | EditorGUILayout.Slider(propExposure, 0, 5); 75 | if (QualitySettings.activeColorSpace != ColorSpace.Linear) 76 | EditorGUILayout.HelpBox("Linear space lighting should be enabled for tone mapping.", MessageType.Warning); 77 | } 78 | 79 | EditorGUILayout.Space(); 80 | 81 | EditorGUILayout.Slider(propColorTemp, -1.0f, 1.0f, labelColorTemp); 82 | EditorGUILayout.Slider(propColorTint, -1.0f, 1.0f, labelColorTint); 83 | 84 | EditorGUILayout.Space(); 85 | 86 | EditorGUILayout.Slider(propSaturation, 0, 2); 87 | 88 | EditorGUILayout.LabelField("Curves (R, G, B, Combined)"); 89 | EditorGUILayout.BeginHorizontal(); 90 | var doubleHeight = GUILayout.Height(EditorGUIUtility.singleLineHeight * 2); 91 | EditorGUILayout.PropertyField(propRCurve, GUIContent.none, doubleHeight); 92 | EditorGUILayout.PropertyField(propGCurve, GUIContent.none, doubleHeight); 93 | EditorGUILayout.PropertyField(propBCurve, GUIContent.none, doubleHeight); 94 | EditorGUILayout.PropertyField(propCCurve, GUIContent.none, doubleHeight); 95 | EditorGUILayout.EndHorizontal(); 96 | 97 | EditorGUILayout.Space(); 98 | 99 | EditorGUILayout.PropertyField(propDitherMode); 100 | 101 | serializedObject.ApplyModifiedProperties(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Editor/ColorSuiteEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f328b8677255d426a999185016ef88f2 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4911ca47559e444a8aa3e74b16a42ce1 3 | folderAsset: yes 4 | timeCreated: 1440327030 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Shader/ColorSuite.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014, 2015 Keijiro Takahashi 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | // this software and associated documentation files (the "Software"), to deal in 6 | // the Software without restriction, including without limitation the rights to 7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | // the Software, and to permit persons to whom the Software is furnished to do so, 9 | // subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in all 12 | // copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | // 21 | 22 | Shader "Hidden/ColorSuite" 23 | { 24 | Properties 25 | { 26 | _MainTex ("-", 2D) = ""{} 27 | _Curves ("-", 2D) = ""{} 28 | _Exposure ("-", Float) = 1.0 29 | _Saturation ("-", Float) = 1.0 30 | _Balance ("-", Vector) = (1, 1, 1, 0) 31 | } 32 | 33 | CGINCLUDE 34 | 35 | // Multi-compilation options. 36 | #pragma multi_compile COLORSPACE_SRGB COLORSPACE_LINEAR 37 | #pragma multi_compile BALANCING_OFF BALANCING_ON 38 | #pragma multi_compile TONEMAPPING_OFF TONEMAPPING_ON 39 | #pragma multi_compile DITHER_OFF DITHER_ORDERED DITHER_TRIANGULAR 40 | 41 | #include "UnityCG.cginc" 42 | 43 | sampler2D _MainTex; 44 | float2 _MainTex_TexelSize; 45 | sampler2D _Curves; 46 | float _Exposure; 47 | float _Saturation; 48 | float4 _Balance; 49 | 50 | #if COLORSPACE_LINEAR 51 | 52 | // Color space conversion between sRGB and linear space. 53 | // http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html 54 | 55 | float3 srgb_to_linear(float3 c) 56 | { 57 | return c * (c * (c * 0.305306011 + 0.682171111) + 0.012522878); 58 | } 59 | 60 | float3 linear_to_srgb(float3 c) 61 | { 62 | return max(1.055 * pow(c, 0.416666667) - 0.055, 0.0); 63 | } 64 | 65 | #endif 66 | 67 | #if BALANCING_ON 68 | 69 | // Color space conversion between linear RGB and LMS 70 | // based on the CIECAM02 model (CAT02). 71 | // http://en.wikipedia.org/wiki/LMS_color_space#CAT02 72 | 73 | float3 lrgb_to_lms(float3 c) 74 | { 75 | float3x3 m = { 76 | 3.90405e-1f, 5.49941e-1f, 8.92632e-3f, 77 | 7.08416e-2f, 9.63172e-1f, 1.35775e-3f, 78 | 2.31082e-2f, 1.28021e-1f, 9.36245e-1f 79 | }; 80 | return mul(m, c); 81 | } 82 | 83 | float3 lms_to_lrgb(float3 c) 84 | { 85 | float3x3 m = { 86 | 2.85847e+0f, -1.62879e+0f, -2.48910e-2f, 87 | -2.10182e-1f, 1.15820e+0f, 3.24281e-4f, 88 | -4.18120e-2f, -1.18169e-1f, 1.06867e+0f 89 | }; 90 | return mul(m, c); 91 | } 92 | 93 | // Color balance function. 94 | // - The gamma compression/expansion equation used in this function 95 | // differs from the standard sRGB-Linear conversion. 96 | 97 | float3 apply_balance(float3 c) 98 | { 99 | #if !COLORSPACE_LINEAR 100 | // Do the gamma expansion before applying the color balance. 101 | c = pow(c, 2.2); 102 | #endif 103 | 104 | // Apply the color balance in the LMS color space. 105 | c = lms_to_lrgb(lrgb_to_lms(c) * _Balance); 106 | 107 | // It may return a minus value, which should be cropped out. 108 | c = max(c, 0.0); 109 | 110 | #if !COLORSPACE_LINEAR 111 | // Gamma compression. 112 | c = pow(c, 1.0 / 2.2); 113 | #endif 114 | 115 | return c; 116 | } 117 | 118 | #endif 119 | 120 | #if TONEMAPPING_ON 121 | 122 | // John Hable's filmic tone mapping operator. 123 | // http://filmicgames.com/archives/6 124 | 125 | float3 hable_op(float3 c) 126 | { 127 | float A = 0.15; 128 | float B = 0.50; 129 | float C = 0.10; 130 | float D = 0.20; 131 | float E = 0.02; 132 | float F = 0.30; 133 | return ((c * (c * A + B * C) + D * E) / (c * (c * A + B) + D * F)) - E / F; 134 | } 135 | 136 | float3 tone_mapping(float3 c) 137 | { 138 | c *= _Exposure * 4; 139 | c = hable_op(c) / hable_op(11.2); 140 | return pow(c, 1 / 2.2); 141 | } 142 | 143 | #endif 144 | 145 | // Color saturation. 146 | 147 | float luma(float3 c) 148 | { 149 | return 0.212 * c.r + 0.701 * c.g + 0.087 * c.b; 150 | } 151 | 152 | float3 apply_saturation(float3 c) 153 | { 154 | return lerp((float3)luma(c), c, _Saturation); 155 | } 156 | 157 | // RGB curves. 158 | 159 | float3 apply_curves(float3 c) 160 | { 161 | float4 r = tex2D(_Curves, float2(c.r, 0)); 162 | float4 g = tex2D(_Curves, float2(c.g, 0)); 163 | float4 b = tex2D(_Curves, float2(c.b, 0)); 164 | return float3(r.r * r.a, g.g * g.a, b.b * b.a); 165 | } 166 | 167 | #if DITHER_ORDERED 168 | 169 | // Interleaved gradient function from CoD AW. 170 | // http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare 171 | 172 | float interleaved_gradient(float2 uv) 173 | { 174 | float3 magic = float3(0.06711056, 0.00583715, 52.9829189); 175 | return frac(magic.z * frac(dot(uv, magic.xy))); 176 | } 177 | 178 | float3 dither(float2 uv) 179 | { 180 | return (float3)(interleaved_gradient(uv / _MainTex_TexelSize) / 255); 181 | } 182 | 183 | #endif 184 | 185 | #if DITHER_TRIANGULAR 186 | 187 | // Triangular PDF. 188 | 189 | float nrand(float2 uv) 190 | { 191 | return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453); 192 | } 193 | 194 | float3 dither(float2 uv) 195 | { 196 | float r = nrand(uv) + nrand(uv + (float2)1.1) - 0.5; 197 | return (float3)(r / 255); 198 | } 199 | 200 | #endif 201 | 202 | float4 frag(v2f_img i) : SV_Target 203 | { 204 | float4 source = tex2D(_MainTex, i.uv); 205 | float3 rgb = source.rgb; 206 | 207 | #if BALANCING_ON 208 | rgb = apply_balance(rgb); 209 | #endif 210 | 211 | #if COLORSPACE_LINEAR 212 | #if TONEMAPPING_ON 213 | // Apply the tone mapping. 214 | rgb = tone_mapping(rgb); 215 | #else 216 | // Convert the color into the sRGB color space. 217 | rgb = linear_to_srgb(rgb); 218 | #endif 219 | #endif 220 | 221 | // Color saturation. 222 | rgb = apply_saturation(rgb); 223 | 224 | // RGB curves. 225 | rgb = apply_curves(rgb); 226 | 227 | #if !DITHER_OFF 228 | rgb += dither(i.uv); 229 | #endif 230 | 231 | #if COLORSPACE_LINEAR 232 | // Take the color back into the linear color space. 233 | rgb = srgb_to_linear(rgb); 234 | #endif 235 | 236 | return float4(rgb, source.a); 237 | } 238 | 239 | ENDCG 240 | 241 | Subshader 242 | { 243 | Pass 244 | { 245 | ZTest Always Cull Off ZWrite Off 246 | Fog { Mode off } 247 | CGPROGRAM 248 | #pragma target 3.0 249 | #pragma glsl 250 | #pragma vertex vert_img 251 | #pragma fragment frag 252 | ENDCG 253 | } 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /Assets/ColorSuite/Shader/ColorSuite.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc9775b65c52747e69fc4c854c00d696 3 | ShaderImporter: 4 | defaultTextures: [] 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/DeferredAO.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9228dd6c5f1bc426abef4bf88e9ce584 3 | folderAsset: yes 4 | timeCreated: 1435398751 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/DeferredAO/DeferredAO.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Deferred AO - SSAO image effect for deferred shading 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | 25 | [ImageEffectOpaque] 26 | [ExecuteInEditMode] 27 | [RequireComponent(typeof(Camera))] 28 | [AddComponentMenu("Image Effects/Rendering/Deferred AO")] 29 | public class DeferredAO : MonoBehaviour 30 | { 31 | #region Public Properties 32 | 33 | // Effect intensity 34 | 35 | [SerializeField] 36 | float _intensity = 1; 37 | 38 | public float intensity { 39 | get { return _intensity; } 40 | set { _intensity = value; } 41 | } 42 | 43 | // Sample radius 44 | 45 | [SerializeField] 46 | float _sampleRadius = 1; 47 | 48 | public float sampleRadius { 49 | get { return _sampleRadius; } 50 | set { _sampleRadius = value; } 51 | } 52 | 53 | // Range check (rejects distant samples) 54 | 55 | [SerializeField] 56 | bool _rangeCheck = true; 57 | 58 | public bool rangeCheck { 59 | get { return _rangeCheck; } 60 | set { _rangeCheck = value; } 61 | } 62 | 63 | // Fall-off distance 64 | 65 | [SerializeField] 66 | float _fallOffDistance = 100; 67 | 68 | public float fallOffDistance { 69 | get { return _fallOffDistance; } 70 | set { _fallOffDistance = value; } 71 | } 72 | 73 | // Sample count 74 | 75 | public enum SampleCount { Low, Medium, High, Overkill } 76 | 77 | [SerializeField] 78 | SampleCount _sampleCount = SampleCount.Medium; 79 | 80 | public SampleCount sampleCount { 81 | get { return _sampleCount; } 82 | set { _sampleCount = value; } 83 | } 84 | 85 | #endregion 86 | 87 | #region Private Resources 88 | 89 | [SerializeField] 90 | Shader _shader; 91 | 92 | Material _material; 93 | 94 | bool CheckDeferredShading() 95 | { 96 | var path = GetComponent().actualRenderingPath; 97 | return path == RenderingPath.DeferredShading; 98 | } 99 | 100 | #endregion 101 | 102 | #region MonoBehaviour Functions 103 | 104 | void OnRenderImage(RenderTexture source, RenderTexture destination) 105 | { 106 | if (!CheckDeferredShading()) { 107 | Graphics.Blit(source, destination); 108 | return; 109 | } 110 | 111 | if (_material == null) { 112 | _material = new Material(_shader); 113 | _material.hideFlags = HideFlags.DontSave; 114 | } 115 | 116 | _material.SetFloat("_Radius", _sampleRadius); 117 | _material.SetFloat("_Intensity", _intensity); 118 | _material.SetFloat("_FallOff", _fallOffDistance); 119 | 120 | _material.shaderKeywords = null; 121 | 122 | if (_rangeCheck) 123 | _material.EnableKeyword("_RANGE_CHECK"); 124 | 125 | if (_sampleCount == SampleCount.Medium) 126 | _material.EnableKeyword("_SAMPLE_MEDIUM"); 127 | else if (_sampleCount == SampleCount.High) 128 | _material.EnableKeyword("_SAMPLE_HIGH"); 129 | else if (_sampleCount == SampleCount.Overkill) 130 | _material.EnableKeyword("_SAMPLE_OVERKILL"); 131 | 132 | Graphics.Blit(source, destination, _material, 0); 133 | } 134 | 135 | #endregion 136 | } 137 | -------------------------------------------------------------------------------- /Assets/DeferredAO/DeferredAO.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f6a516d891854931acf7fb785c812ec 3 | timeCreated: 1435398836 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: c928e16c12e994a70928a9181450d18c, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/DeferredAO/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86aa7a07c1e4f4d8d93c38a39c302fd2 3 | folderAsset: yes 4 | timeCreated: 1435499990 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/DeferredAO/Editor/DeferredAOEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Deferred AO - SSAO image effect for deferred shading 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | using UnityEditor; 25 | 26 | [CanEditMultipleObjects] 27 | [CustomEditor(typeof(DeferredAO))] 28 | public class DeferredAOEditor : Editor 29 | { 30 | SerializedProperty _intensity; 31 | SerializedProperty _sampleRadius; 32 | SerializedProperty _rangeCheck; 33 | SerializedProperty _fallOffDistance; 34 | SerializedProperty _sampleCount; 35 | 36 | void OnEnable() 37 | { 38 | _intensity = serializedObject.FindProperty("_intensity"); 39 | _sampleRadius = serializedObject.FindProperty("_sampleRadius"); 40 | _rangeCheck = serializedObject.FindProperty("_rangeCheck"); 41 | _fallOffDistance = serializedObject.FindProperty("_fallOffDistance"); 42 | _sampleCount = serializedObject.FindProperty("_sampleCount"); 43 | } 44 | 45 | bool CheckDisabled() 46 | { 47 | var cam = ((DeferredAO)target).GetComponent(); 48 | return cam.actualRenderingPath != RenderingPath.DeferredShading; 49 | } 50 | 51 | public override void OnInspectorGUI() 52 | { 53 | serializedObject.Update(); 54 | 55 | if (CheckDisabled()) 56 | { 57 | var text = "To enable the effect, change Rendering Path to Deferred."; 58 | EditorGUILayout.HelpBox(text, MessageType.Warning); 59 | } 60 | else 61 | { 62 | EditorGUILayout.PropertyField(_intensity); 63 | EditorGUILayout.PropertyField(_sampleRadius); 64 | EditorGUILayout.PropertyField(_rangeCheck); 65 | EditorGUILayout.PropertyField(_fallOffDistance); 66 | EditorGUILayout.PropertyField(_sampleCount); 67 | } 68 | 69 | serializedObject.ApplyModifiedProperties(); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/DeferredAO/Editor/DeferredAOEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc11bf4e6f30c46d98811ebcbab0bf98 3 | timeCreated: 1435500000 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/DeferredAO/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f49a98fd01d54b5893810f5bd1bcdd3 3 | folderAsset: yes 4 | timeCreated: 1435499972 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/DeferredAO/Shader/DeferredAO.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Deferred AO - SSAO image effect for deferred shading 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | Shader "Hidden/DeferredAO" 24 | { 25 | Properties 26 | { 27 | _MainTex("-", 2D) = "" {} 28 | } 29 | CGINCLUDE 30 | 31 | #include "UnityCG.cginc" 32 | 33 | #pragma multi_compile _ _RANGE_CHECK 34 | #pragma multi_compile _SAMPLE_LOW _SAMPLE_MEDIUM _SAMPLE_HIGH _SAMPLE_OVERKILL 35 | 36 | sampler2D _MainTex; 37 | float2 _MainTex_TexelSize; 38 | 39 | sampler2D_float _CameraDepthTexture; 40 | sampler2D _CameraGBufferTexture2; 41 | float4x4 _WorldToCamera; 42 | 43 | float _Intensity; 44 | float _Radius; 45 | float _FallOff; 46 | 47 | #if _SAMPLE_LOW 48 | static const int SAMPLE_COUNT = 8; 49 | #elif _SAMPLE_MEDIUM 50 | static const int SAMPLE_COUNT = 16; 51 | #elif _SAMPLE_HIGH 52 | static const int SAMPLE_COUNT = 24; 53 | #else 54 | static const int SAMPLE_COUNT = 80; 55 | #endif 56 | 57 | float nrand(float2 uv, float dx, float dy) 58 | { 59 | uv += float2(dx, dy + _Time.x); 60 | return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453); 61 | } 62 | 63 | float3 spherical_kernel(float2 uv, float index) 64 | { 65 | // Uniformaly distributed points 66 | // http://mathworld.wolfram.com/SpherePointPicking.html 67 | float u = nrand(uv, 0, index) * 2 - 1; 68 | float theta = nrand(uv, 1, index) * UNITY_PI * 2; 69 | float u2 = sqrt(1 - u * u); 70 | float3 v = float3(u2 * cos(theta), u2 * sin(theta), u); 71 | // Adjustment for distance distribution. 72 | float l = index / SAMPLE_COUNT; 73 | return v * lerp(0.1, 1.0, l * l); 74 | } 75 | 76 | half4 frag_ao(v2f_img i) : SV_Target 77 | { 78 | half4 src = tex2D(_MainTex, i.uv); 79 | 80 | // Sample a linear depth on the depth buffer. 81 | float depth_o = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv); 82 | depth_o = LinearEyeDepth(depth_o); 83 | 84 | // This early-out flow control is not allowed in HLSL. 85 | // if (depth_o > _FallOff) return src; 86 | 87 | // Sample a view-space normal vector on the g-buffer. 88 | float3 norm_o = tex2D(_CameraGBufferTexture2, i.uv).xyz * 2 - 1; 89 | norm_o = mul((float3x3)_WorldToCamera, norm_o); 90 | 91 | // Reconstruct the view-space position. 92 | float2 p11_22 = float2(unity_CameraProjection._11, unity_CameraProjection._22); 93 | float3 pos_o = float3((i.uv * 2 - 1) / p11_22, 1) * depth_o; 94 | 95 | float3x3 proj = (float3x3)unity_CameraProjection; 96 | 97 | float occ = 0.0; 98 | for (int s = 0; s < SAMPLE_COUNT; s++) 99 | { 100 | float3 delta = spherical_kernel(i.uv, s); 101 | 102 | // Wants a sample in normal oriented hemisphere. 103 | delta *= (dot(norm_o, delta) >= 0) * 2 - 1; 104 | 105 | // Sampling point. 106 | float3 pos_s = pos_o + delta * _Radius; 107 | 108 | // Re-project the sampling point. 109 | float3 pos_sc = mul(proj, pos_s); 110 | float2 uv_s = (pos_sc.xy / pos_s.z + 1) * 0.5; 111 | 112 | // Sample a linear depth at the sampling point. 113 | float depth_s = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv_s)); 114 | 115 | // Occlusion test. 116 | float dist = pos_s.z - depth_s; 117 | #if _RANGE_CHECK 118 | occ += (dist > 0.01 * _Radius) * (dist < _Radius); 119 | #else 120 | occ += (dist > 0.01 * _Radius); 121 | #endif 122 | } 123 | 124 | float falloff = 1.0 - depth_o / _FallOff; 125 | occ = saturate(occ * _Intensity * falloff / SAMPLE_COUNT); 126 | 127 | return half4(lerp(src.rgb, (half3)0.0, occ), src.a); 128 | } 129 | 130 | ENDCG 131 | SubShader 132 | { 133 | Pass 134 | { 135 | ZTest Always Cull Off ZWrite Off 136 | CGPROGRAM 137 | #pragma vertex vert_img 138 | #pragma fragment frag_ao 139 | #pragma target 3.0 140 | ENDCG 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /Assets/DeferredAO/Shader/DeferredAO.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c928e16c12e994a70928a9181450d18c 3 | timeCreated: 1435398831 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a4556897a2d04d0c92f96c1369b6c84 3 | folderAsset: yes 4 | timeCreated: 1440421406 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor/PackageTool.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | public class PackageTool 5 | { 6 | [MenuItem("Package/Update Package")] 7 | static void UpdatePackage() 8 | { 9 | AssetDatabase.ExportPackage("Assets/Kvant", "KvantGrass.unitypackage", ExportPackageOptions.Recurse); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assets/Editor/PackageTool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4e9e404c77be419993c5159136a2ddf 3 | timeCreated: 1440421415 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.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/Bokeh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af525943e840a66479f05084b0addbf7 3 | folderAsset: yes 4 | timeCreated: 1438698772 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bokeh/Bokeh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c8d76155f53cfc45b4f02922de468b3 3 | timeCreated: 1438936192 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _focalTarget: {instanceID: 0} 9 | - _shader: {fileID: 4800000, guid: b99c58356816f7b46818fe7e788b2fa1, type: 3} 10 | executionOrder: 0 11 | icon: {instanceID: 0} 12 | userData: 13 | assetBundleName: 14 | assetBundleVariant: 15 | -------------------------------------------------------------------------------- /Assets/Kino/Bokeh/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58e768b4cfb91704c830e227cba42413 3 | folderAsset: yes 4 | timeCreated: 1439212552 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bokeh/Editor/BokehEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoBokeh - Fast DOF filter with hexagonal aperture 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | using UnityEditor; 25 | 26 | namespace Kino 27 | { 28 | [CanEditMultipleObjects, CustomEditor(typeof(Bokeh))] 29 | public class BokehEditor : Editor 30 | { 31 | SerializedProperty _subject; 32 | SerializedProperty _distance; 33 | SerializedProperty _fNumber; 34 | SerializedProperty _useCameraFov; 35 | SerializedProperty _focalLength; 36 | SerializedProperty _maxBlur; 37 | SerializedProperty _irisAngle; 38 | SerializedProperty _sampleCount; 39 | SerializedProperty _foregroundBlur; 40 | SerializedProperty _visualize; 41 | 42 | static GUIContent _textFNumber = new GUIContent("f/"); 43 | static GUIContent _textFocalLengthMM = new GUIContent("Focal Length (mm)"); 44 | static GUIContent _textMaxBlurPercent = new GUIContent("Max Blur (%)"); 45 | 46 | void OnEnable() 47 | { 48 | _subject = serializedObject.FindProperty("_subject"); 49 | _distance = serializedObject.FindProperty("_distance"); 50 | _fNumber = serializedObject.FindProperty("_fNumber"); 51 | _useCameraFov = serializedObject.FindProperty("_useCameraFov"); 52 | _focalLength = serializedObject.FindProperty("_focalLength"); 53 | _maxBlur = serializedObject.FindProperty("_maxBlur"); 54 | _irisAngle = serializedObject.FindProperty("_irisAngle"); 55 | _sampleCount = serializedObject.FindProperty("_sampleCount"); 56 | _foregroundBlur = serializedObject.FindProperty("_foregroundBlur"); 57 | _visualize = serializedObject.FindProperty("_visualize"); 58 | } 59 | 60 | public override void OnInspectorGUI() 61 | { 62 | serializedObject.Update(); 63 | 64 | // Subject/Distance 65 | EditorGUILayout.PropertyField(_subject); 66 | if (_subject.hasMultipleDifferentValues || _subject.objectReferenceValue == null) 67 | EditorGUILayout.PropertyField(_distance); 68 | 69 | // f/ 70 | EditorGUILayout.PropertyField(_fNumber, _textFNumber); 71 | 72 | // Use Camera FOV 73 | EditorGUILayout.PropertyField(_useCameraFov); 74 | 75 | // Focal Length 76 | if (_useCameraFov.hasMultipleDifferentValues || !_useCameraFov.boolValue) 77 | { 78 | if (_focalLength.hasMultipleDifferentValues) 79 | EditorGUILayout.PropertyField(_focalLength); 80 | else 81 | { 82 | EditorGUI.BeginChangeCheck(); 83 | var f = _focalLength.floatValue * 1000; 84 | f = EditorGUILayout.Slider(_textFocalLengthMM, f, 10.0f, 300.0f); 85 | if (EditorGUI.EndChangeCheck()) 86 | _focalLength.floatValue = f / 1000; 87 | } 88 | } 89 | 90 | // Max Blur 91 | if (_maxBlur.hasMultipleDifferentValues) 92 | EditorGUILayout.PropertyField(_maxBlur); 93 | else 94 | { 95 | EditorGUI.BeginChangeCheck(); 96 | var blur = _maxBlur.floatValue * 100; 97 | blur = EditorGUILayout.Slider(_textMaxBlurPercent, blur, 1, 10); 98 | if (EditorGUI.EndChangeCheck()) 99 | _maxBlur.floatValue = blur / 100; 100 | } 101 | 102 | // Iris Angle 103 | EditorGUILayout.Slider(_irisAngle, 0, 90); 104 | 105 | // Sample Count 106 | EditorGUILayout.PropertyField(_sampleCount); 107 | 108 | // Foreground Blur 109 | EditorGUILayout.PropertyField(_foregroundBlur); 110 | 111 | // Visualize 112 | EditorGUILayout.PropertyField(_visualize); 113 | 114 | serializedObject.ApplyModifiedProperties(); 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /Assets/Kino/Bokeh/Editor/BokehEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64e6ea258478bd04b9a994c797baf05b 3 | timeCreated: 1439212562 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/Bokeh/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1cb662381c5313e428cec9f7493cce4f 3 | folderAsset: yes 4 | timeCreated: 1439216597 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bokeh/Shader/Bokeh.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoBokeh - Fast DOF filter with hexagonal aperture 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | // The idea of the separable hex bokeh filter came from the paper by 25 | // L. McIntosh (2012). See the following paper for further details. 26 | // http://ivizlab.sfu.ca/media/DiPaolaMcIntoshRiecke2012.pdf 27 | 28 | Shader "Hidden/Kino/Bokeh" 29 | { 30 | Properties 31 | { 32 | _MainTex("-", 2D) = "black"{} 33 | _BlurTex1("-", 2D) = "black"{} 34 | _BlurTex2("-", 2D) = "black"{} 35 | } 36 | 37 | CGINCLUDE 38 | 39 | #include "UnityCG.cginc" 40 | 41 | #pragma multi_compile BLUR_STEP5 BLUR_STEP10 BLUR_STEP15 BLUR_STEP20 42 | #pragma multi_compile _ FOREGROUND_BLUR 43 | 44 | #if BLUR_STEP5 45 | static const int BLUR_STEP = 5; 46 | #elif BLUR_STEP10 47 | static const int BLUR_STEP = 10; 48 | #elif BLUR_STEP15 49 | static const int BLUR_STEP = 15; 50 | #else 51 | static const int BLUR_STEP = 20; 52 | #endif 53 | 54 | // Source textures 55 | sampler2D _MainTex; 56 | sampler2D_float _CameraDepthTexture; 57 | 58 | // Only used in the combiner pass. 59 | sampler2D _BlurTex1; 60 | sampler2D _BlurTex2; 61 | 62 | // Camera parameters 63 | float _SubjectDistance; 64 | float _LensCoeff; // f^2 / (N * (S1 - f) * film_width) 65 | 66 | // Blur parameters 67 | float2 _Aspect; 68 | float2 _BlurDisp; 69 | 70 | // 1st pass - make CoC map in alpha plane 71 | half4 frag_make_coc(v2f_img i) : SV_Target 72 | { 73 | // Calculate the radius of CoC. 74 | // https://en.wikipedia.org/wiki/Circle_of_confusion 75 | half3 c = tex2D(_MainTex, i.uv).rgb; 76 | float d = LinearEyeDepth(SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv)); 77 | float r = 0.5 * (d - _SubjectDistance) * _LensCoeff / d; 78 | return half4(c, r); 79 | } 80 | 81 | // 2nd pass - CoC visualization 82 | half4 frag_alpha_to_grayscale(v2f_img i) : SV_Target 83 | { 84 | half a = tex2D(_MainTex, i.uv).a * 2; 85 | return saturate(half4(abs(a), a, a, 1)); 86 | } 87 | 88 | // 3rd pass - separable blur filter 89 | half4 frag_blur(v2f_img i) : SV_Target 90 | { 91 | half4 c0 = tex2D(_MainTex, i.uv); 92 | half r0 = abs(c0.a); // CoC radius 93 | 94 | half3 acc = c0.rgb; // accumulation 95 | half total = 1; // total weight 96 | 97 | for (int di = 1; di < BLUR_STEP; di++) 98 | { 99 | float2 disp = _BlurDisp * di; 100 | float disp_len = length(disp); 101 | 102 | float2 duv = disp * _Aspect; 103 | float2 uv1 = i.uv - duv; 104 | float2 uv2 = i.uv + duv; 105 | 106 | half4 c1 = tex2D(_MainTex, uv1); 107 | half4 c2 = tex2D(_MainTex, uv2); 108 | 109 | #if FOREGROUND_BLUR 110 | // Complex version of sample weight calculation, 111 | // which supports both background and foreground blurring. 112 | 113 | // if depth > depth0 114 | // weight = min(CoC, CoC0) > |disp| 115 | // else 116 | // weight = CoC > |disp| 117 | 118 | half r1 = abs(c1.a); 119 | half r2 = abs(c2.a); 120 | 121 | float w1 = min(r1, (c1.a <= r0) * r1 + r0) > disp_len; 122 | float w2 = min(r2, (c2.a <= r0) * r2 + r0) > disp_len; 123 | #else 124 | // Simpler version only supports background blurring. 125 | float w1 = min(c1.a, c0.a) > disp_len; 126 | float w2 = min(c2.a, c0.a) > disp_len; 127 | #endif 128 | acc += c1.rgb * w1 + c2.rgb * w2; 129 | total += w1 + w2; 130 | } 131 | 132 | return half4(acc / total, c0.a); 133 | } 134 | 135 | // 4th pass - combiner 136 | half4 frag_combiner(v2f_img i) : SV_Target 137 | { 138 | half4 c1 = tex2D(_BlurTex1, i.uv); 139 | half4 c2 = tex2D(_BlurTex2, i.uv); 140 | return min(c1, c2); 141 | } 142 | 143 | ENDCG 144 | 145 | Subshader 146 | { 147 | Pass 148 | { 149 | ZTest Always Cull Off ZWrite Off 150 | CGPROGRAM 151 | #pragma vertex vert_img 152 | #pragma fragment frag_make_coc 153 | ENDCG 154 | } 155 | Pass 156 | { 157 | ZTest Always Cull Off ZWrite Off 158 | CGPROGRAM 159 | #pragma vertex vert_img 160 | #pragma fragment frag_alpha_to_grayscale 161 | ENDCG 162 | } 163 | Pass 164 | { 165 | ZTest Always Cull Off ZWrite Off 166 | CGPROGRAM 167 | #pragma target 3.0 168 | #pragma vertex vert_img 169 | #pragma fragment frag_blur 170 | ENDCG 171 | } 172 | Pass 173 | { 174 | ZTest Always Cull Off ZWrite Off 175 | CGPROGRAM 176 | #pragma vertex vert_img 177 | #pragma fragment frag_combiner 178 | ENDCG 179 | } 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /Assets/Kino/Bokeh/Shader/Bokeh.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b99c58356816f7b46818fe7e788b2fa1 3 | timeCreated: 1438698790 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fog.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fba6b0e4a46c4e07a0153904e753df8 3 | folderAsset: yes 4 | timeCreated: 1435838661 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fog/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 58aa7694ca3de4e8e9cf8cf893804671 3 | folderAsset: yes 4 | timeCreated: 1435838677 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fog/Editor/FogEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoFog - Deferred fog effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | using UnityEditor; 25 | 26 | namespace Kino 27 | { 28 | [CanEditMultipleObjects] 29 | [CustomEditor(typeof(Fog))] 30 | public class FogEditor : Editor 31 | { 32 | SerializedProperty _startDistance; 33 | SerializedProperty _useRadialDistance; 34 | SerializedProperty _fadeToSkybox; 35 | 36 | void OnEnable() 37 | { 38 | _startDistance = serializedObject.FindProperty("_startDistance"); 39 | _useRadialDistance = serializedObject.FindProperty("_useRadialDistance"); 40 | _fadeToSkybox = serializedObject.FindProperty("_fadeToSkybox"); 41 | } 42 | 43 | public override void OnInspectorGUI() 44 | { 45 | serializedObject.Update(); 46 | 47 | EditorGUILayout.PropertyField(_startDistance); 48 | EditorGUILayout.PropertyField(_useRadialDistance); 49 | EditorGUILayout.PropertyField(_fadeToSkybox); 50 | 51 | serializedObject.ApplyModifiedProperties(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Assets/Kino/Fog/Editor/FogEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60a60d9e0b29447ed832e2d9aad638b0 3 | timeCreated: 1435838686 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/Fog/Fog.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoFog - Deferred fog effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | 25 | namespace Kino 26 | { 27 | [ExecuteInEditMode] 28 | [RequireComponent(typeof(Camera))] 29 | [AddComponentMenu("Kino Image Effects/Fog")] 30 | public class Fog : MonoBehaviour 31 | { 32 | #region Public Properties 33 | 34 | // Start distance 35 | [SerializeField] 36 | float _startDistance = 1; 37 | 38 | public float startDistance { 39 | get { return _startDistance; } 40 | set { _startDistance = value; } 41 | } 42 | 43 | // Use radial distance 44 | [SerializeField] 45 | bool _useRadialDistance; 46 | 47 | public bool useRadialDistance { 48 | get { return _useRadialDistance; } 49 | set { _useRadialDistance = value; } 50 | } 51 | 52 | // Fade-to-skybox flag 53 | [SerializeField] 54 | bool _fadeToSkybox; 55 | 56 | public bool fadeToSkybox { 57 | get { return _fadeToSkybox; } 58 | set { _fadeToSkybox = value; } 59 | } 60 | 61 | #endregion 62 | 63 | #region Private Properties 64 | 65 | [SerializeField] Shader _shader; 66 | 67 | Material _material; 68 | 69 | #endregion 70 | 71 | #region MonoBehaviour Functions 72 | 73 | void OnEnable() 74 | { 75 | GetComponent().depthTextureMode |= DepthTextureMode.Depth; 76 | } 77 | 78 | [ImageEffectOpaque] 79 | void OnRenderImage(RenderTexture source, RenderTexture destination) 80 | { 81 | if (_material == null) 82 | { 83 | _material = new Material(_shader); 84 | _material.hideFlags = HideFlags.DontSave; 85 | } 86 | 87 | _startDistance = Mathf.Max(_startDistance, 0.0f); 88 | _material.SetFloat("_DistanceOffset", _startDistance); 89 | 90 | var mode = RenderSettings.fogMode; 91 | if (mode == FogMode.Linear) 92 | { 93 | var start = RenderSettings.fogStartDistance; 94 | var end = RenderSettings.fogEndDistance; 95 | var invDiff = 1.0f / Mathf.Max(end - start, 1.0e-6f); 96 | _material.SetFloat("_LinearGrad", -invDiff); 97 | _material.SetFloat("_LinearOffs", end * invDiff); 98 | _material.DisableKeyword("FOG_EXP"); 99 | _material.DisableKeyword("FOG_EXP2"); 100 | } 101 | else if (mode == FogMode.Exponential) 102 | { 103 | const float coeff = 1.4426950408f; // 1/ln(2) 104 | var density = RenderSettings.fogDensity; 105 | _material.SetFloat("_Density", coeff * density); 106 | _material.EnableKeyword("FOG_EXP"); 107 | _material.DisableKeyword("FOG_EXP2"); 108 | } 109 | else // FogMode.ExponentialSquared 110 | { 111 | const float coeff = 1.2011224087f; // 1/sqrt(ln(2)) 112 | var density = RenderSettings.fogDensity; 113 | _material.SetFloat("_Density", coeff * density); 114 | _material.DisableKeyword("FOG_EXP"); 115 | _material.EnableKeyword("FOG_EXP2"); 116 | } 117 | 118 | if (_useRadialDistance) 119 | _material.EnableKeyword("RADIAL_DIST"); 120 | else 121 | _material.DisableKeyword("RADIAL_DIST"); 122 | 123 | if (_fadeToSkybox) 124 | { 125 | _material.EnableKeyword("USE_SKYBOX"); 126 | // Transfer the skybox parameters. 127 | var skybox = RenderSettings.skybox; 128 | _material.SetTexture("_SkyCubemap", skybox.GetTexture("_Tex")); 129 | _material.SetColor("_SkyTint", skybox.GetColor("_Tint")); 130 | _material.SetFloat("_SkyExposure", skybox.GetFloat("_Exposure")); 131 | _material.SetFloat("_SkyRotation", skybox.GetFloat("_Rotation")); 132 | } 133 | else 134 | { 135 | _material.DisableKeyword("USE_SKYBOX"); 136 | _material.SetColor("_FogColor", RenderSettings.fogColor); 137 | } 138 | 139 | // Calculate vectors towards frustum corners. 140 | var cam = GetComponent(); 141 | var camtr = cam.transform; 142 | var camNear = cam.nearClipPlane; 143 | var camFar = cam.farClipPlane; 144 | 145 | var tanHalfFov = Mathf.Tan(cam.fieldOfView * Mathf.Deg2Rad / 2); 146 | var toRight = camtr.right * camNear * tanHalfFov * cam.aspect; 147 | var toTop = camtr.up * camNear * tanHalfFov; 148 | 149 | var v_tl = camtr.forward * camNear - toRight + toTop; 150 | var v_tr = camtr.forward * camNear + toRight + toTop; 151 | var v_br = camtr.forward * camNear + toRight - toTop; 152 | var v_bl = camtr.forward * camNear - toRight - toTop; 153 | 154 | var v_s = v_tl.magnitude * camFar / camNear; 155 | 156 | // Draw screen quad. 157 | RenderTexture.active = destination; 158 | 159 | _material.SetTexture("_MainTex", source); 160 | _material.SetPass(0); 161 | 162 | GL.PushMatrix(); 163 | GL.LoadOrtho(); 164 | GL.Begin(GL.QUADS); 165 | 166 | GL.MultiTexCoord2(0, 0, 0); 167 | GL.MultiTexCoord(1, v_bl.normalized * v_s); 168 | GL.Vertex3(0, 0, 0.1f); 169 | 170 | GL.MultiTexCoord2(0, 1, 0); 171 | GL.MultiTexCoord(1, v_br.normalized * v_s); 172 | GL.Vertex3(1, 0, 0.1f); 173 | 174 | GL.MultiTexCoord2(0, 1, 1); 175 | GL.MultiTexCoord(1, v_tr.normalized * v_s); 176 | GL.Vertex3(1, 1, 0.1f); 177 | 178 | GL.MultiTexCoord2(0, 0, 1); 179 | GL.MultiTexCoord(1, v_tl.normalized * v_s); 180 | GL.Vertex3(0, 1, 0.1f); 181 | 182 | GL.End(); 183 | GL.PopMatrix(); 184 | } 185 | 186 | #endregion 187 | } 188 | } 189 | -------------------------------------------------------------------------------- /Assets/Kino/Fog/Fog.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee4ab9821096c489f84e50f35b7b9644 3 | timeCreated: 1435839407 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 3514cc2676a6c4db294c28459f22c359, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Kino/Fog/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d17a16d39c5864bf89575ff76ad6667e 3 | folderAsset: yes 4 | timeCreated: 1435838681 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fog/Shader/Fog.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoFog - Deferred fog effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | Shader "Hidden/Kino/Fog" 24 | { 25 | Properties 26 | { 27 | _MainTex ("-", 2D) = "" {} 28 | _FogColor ("-", Color) = (0, 0, 0, 0) 29 | _SkyTint ("-", Color) = (.5, .5, .5, .5) 30 | [Gamma] _SkyExposure ("-", Range(0, 8)) = 1.0 31 | [NoScaleOffset] _SkyCubemap ("-", Cube) = "" {} 32 | } 33 | CGINCLUDE 34 | 35 | #include "UnityCG.cginc" 36 | 37 | #pragma multi_compile FOG_LINEAR FOG_EXP FOG_EXP2 38 | #pragma multi_compile _ RADIAL_DIST 39 | #pragma multi_compile _ USE_SKYBOX 40 | 41 | sampler2D _MainTex; 42 | float4 _MainTex_TexelSize; 43 | 44 | sampler2D_float _CameraDepthTexture; 45 | 46 | float _DistanceOffset; 47 | float _Density; 48 | float _LinearGrad; 49 | float _LinearOffs; 50 | 51 | // Fog/skybox information 52 | half4 _FogColor; 53 | samplerCUBE _SkyCubemap; 54 | half4 _SkyCubemap_HDR; 55 | half4 _SkyTint; 56 | half _SkyExposure; 57 | float _SkyRotation; 58 | 59 | struct v2f 60 | { 61 | float4 pos : SV_POSITION; 62 | float2 uv : TEXCOORD0; 63 | float2 uv_depth : TEXCOORD1; 64 | float3 ray : TEXCOORD2; 65 | }; 66 | 67 | float3 RotateAroundYAxis(float3 v, float deg) 68 | { 69 | float alpha = deg * UNITY_PI / 180.0; 70 | float sina, cosa; 71 | sincos(alpha, sina, cosa); 72 | float2x2 m = float2x2(cosa, -sina, sina, cosa); 73 | return float3(mul(m, v.xz), v.y).xzy; 74 | } 75 | 76 | v2f vert(appdata_full v) 77 | { 78 | v2f o; 79 | 80 | o.pos = mul(UNITY_MATRIX_MVP, v.vertex); 81 | o.uv = v.texcoord.xy; 82 | o.uv_depth = v.texcoord.xy; 83 | o.ray = RotateAroundYAxis(v.texcoord1.xyz, -_SkyRotation); 84 | 85 | #if UNITY_UV_STARTS_AT_TOP 86 | if (_MainTex_TexelSize.y < 0.0) o.uv.y = 1.0 - o.uv.y; 87 | #endif 88 | 89 | return o; 90 | } 91 | 92 | // Applies one of standard fog formulas, given fog coordinate (i.e. distance) 93 | half ComputeFogFactor(float coord) 94 | { 95 | float fog = 0.0; 96 | #if FOG_LINEAR 97 | // factor = (end-z)/(end-start) = z * (-1/(end-start)) + (end/(end-start)) 98 | fog = coord * _LinearGrad + _LinearOffs; 99 | #elif FOG_EXP 100 | // factor = exp(-density*z) 101 | fog = _Density * coord; 102 | fog = exp2(-fog); 103 | #else // FOG_EXP2 104 | // factor = exp(-(density*z)^2) 105 | fog = _Density * coord; 106 | fog = exp2(-fog * fog); 107 | #endif 108 | return saturate(fog); 109 | } 110 | 111 | // Distance-based fog 112 | float ComputeDistance(float3 ray, float depth) 113 | { 114 | float dist; 115 | #if RADIAL_DIST 116 | dist = length(ray * depth); 117 | #else 118 | dist = depth * _ProjectionParams.z; 119 | #endif 120 | // Built-in fog starts at near plane, so match that by 121 | // subtracting the near value. Not a perfect approximation 122 | // if near plane is very large, but good enough. 123 | dist -= _ProjectionParams.y; 124 | return dist; 125 | } 126 | 127 | half4 frag(v2f i) : SV_Target 128 | { 129 | half4 sceneColor = tex2D(_MainTex, i.uv); 130 | 131 | // Reconstruct world space position & direction towards this screen pixel. 132 | float zsample = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, i.uv_depth); 133 | float depth = Linear01Depth(zsample * (zsample < 1.0)); 134 | 135 | // Compute fog amount. 136 | float g = ComputeDistance(i.ray, depth) - _DistanceOffset; 137 | half fog = ComputeFogFactor(max(0.0, g)); 138 | 139 | #if USE_SKYBOX 140 | // Look up the skybox color. 141 | half3 skyColor = DecodeHDR(texCUBE(_SkyCubemap, i.ray), _SkyCubemap_HDR); 142 | skyColor *= _SkyTint.rgb * _SkyExposure * unity_ColorSpaceDouble; 143 | // Lerp between source color to skybox color with fog amount. 144 | return lerp(half4(skyColor, 1), sceneColor, fog); 145 | #else 146 | // Lerp between source color to fog color with the fog amount. 147 | return lerp(_FogColor, sceneColor, fog); 148 | #endif 149 | } 150 | 151 | ENDCG 152 | SubShader 153 | { 154 | ZTest Always Cull Off ZWrite Off 155 | Pass 156 | { 157 | CGPROGRAM 158 | #pragma vertex vert 159 | #pragma fragment frag 160 | ENDCG 161 | } 162 | } 163 | Fallback off 164 | } 165 | -------------------------------------------------------------------------------- /Assets/Kino/Fog/Shader/Fog.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3514cc2676a6c4db294c28459f22c359 3 | timeCreated: 1435838691 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 473406a9bb49846d4a86baa6b3bc6e45 3 | folderAsset: yes 4 | timeCreated: 1438092929 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75aca1c5048c4f84fb8f74f680dba321 3 | folderAsset: yes 4 | timeCreated: 1438528237 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe/Editor/FringeEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoFringe - Chromatic aberration effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | using UnityEditor; 25 | 26 | namespace Kino 27 | { 28 | [CanEditMultipleObjects, CustomEditor(typeof(Fringe))] 29 | public class FringeEditor : Editor 30 | { 31 | SerializedProperty _lateralShift; 32 | SerializedProperty _axialStrength; 33 | SerializedProperty _axialShift; 34 | SerializedProperty _axialQuality; 35 | 36 | static GUIContent _textShift = new GUIContent("Shift"); 37 | static GUIContent _textStrength = new GUIContent("Strength"); 38 | static GUIContent _textQuality = new GUIContent("Quality"); 39 | 40 | void OnEnable() 41 | { 42 | _lateralShift = serializedObject.FindProperty("_lateralShift"); 43 | _axialStrength = serializedObject.FindProperty("_axialStrength"); 44 | _axialShift = serializedObject.FindProperty("_axialShift"); 45 | _axialQuality = serializedObject.FindProperty("_axialQuality"); 46 | } 47 | 48 | public override void OnInspectorGUI() 49 | { 50 | serializedObject.Update(); 51 | 52 | EditorGUILayout.LabelField("Lateral CA", EditorStyles.boldLabel); 53 | EditorGUILayout.PropertyField(_lateralShift, _textShift); 54 | 55 | EditorGUILayout.LabelField("Axial CA (purple fringing)", EditorStyles.boldLabel); 56 | EditorGUILayout.PropertyField(_axialStrength, _textStrength); 57 | EditorGUILayout.PropertyField(_axialShift, _textShift); 58 | EditorGUILayout.PropertyField(_axialQuality, _textQuality); 59 | 60 | serializedObject.ApplyModifiedProperties(); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe/Editor/FringeEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 671e39ebb83d76d4c947046211765e36 3 | timeCreated: 1438528250 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/Fringe/Fringe.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoFringe - Chromatic aberration effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | 25 | namespace Kino 26 | { 27 | [ExecuteInEditMode] 28 | [RequireComponent(typeof(Camera))] 29 | [AddComponentMenu("Kino Image Effects/Fringe")] 30 | public class Fringe : MonoBehaviour 31 | { 32 | #region Public Properties 33 | 34 | // Shift amount for lateral CA 35 | [SerializeField, Range(0, 1)] 36 | float _lateralShift = 0.3f; 37 | 38 | public float lateralShift { 39 | get { return _lateralShift; } 40 | set { _lateralShift = value; } 41 | } 42 | 43 | // Axial CA strength 44 | [SerializeField, Range(0, 1)] 45 | float _axialStrength = 0.8f; 46 | 47 | public float axialStrength { 48 | get { return _axialStrength; } 49 | set { _axialStrength = value; } 50 | } 51 | 52 | // Shift amount for axial CA 53 | [SerializeField, Range(0, 1)] 54 | float _axialShift = 0.3f; 55 | 56 | public float axialShift { 57 | get { return _axialShift; } 58 | set { _axialShift = value; } 59 | } 60 | 61 | // Quality level for axial CA 62 | public enum QualityLevel { Low, High } 63 | 64 | [SerializeField] 65 | QualityLevel _axialQuality = QualityLevel.Low; 66 | 67 | public QualityLevel axialQuality { 68 | get { return _axialQuality; } 69 | set { _axialQuality = value; } 70 | } 71 | 72 | #endregion 73 | 74 | #region Private Properties 75 | 76 | [SerializeField] Shader _shader; 77 | 78 | Material _material; 79 | 80 | #endregion 81 | 82 | #region MonoBehaviour Functions 83 | 84 | void OnRenderImage(RenderTexture source, RenderTexture destination) 85 | { 86 | if (_material == null) 87 | { 88 | _material = new Material(_shader); 89 | _material.hideFlags = HideFlags.DontSave; 90 | } 91 | 92 | var cam = GetComponent(); 93 | var aspect = new Vector4(cam.aspect, 1.0f / cam.aspect, 1, 0); 94 | 95 | _material.SetVector("_CameraAspect", aspect); 96 | _material.SetFloat("_LateralShift", _lateralShift); 97 | _material.SetFloat("_AxialStrength", _axialStrength); 98 | _material.SetFloat("_AxialShift", _axialShift); 99 | 100 | if (_axialStrength == 0) 101 | { 102 | _material.DisableKeyword("AXIAL_SAMPLE_LOW"); 103 | _material.DisableKeyword("AXIAL_SAMPLE_HIGH"); 104 | } 105 | else if (_axialQuality == QualityLevel.Low) 106 | { 107 | _material.EnableKeyword("AXIAL_SAMPLE_LOW"); 108 | _material.DisableKeyword("AXIAL_SAMPLE_HIGH"); 109 | } 110 | else 111 | { 112 | _material.DisableKeyword("AXIAL_SAMPLE_LOW"); 113 | _material.EnableKeyword("AXIAL_SAMPLE_HIGH"); 114 | } 115 | 116 | Graphics.Blit(source, destination, _material, 0); 117 | } 118 | 119 | #endregion 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe/Fringe.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e11ef96a8174459fa3d231009ff28f8 3 | timeCreated: 1438093366 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 4e3f6504698a346cb971f9ab5286fca9, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e6a57babb8fa4b998eda0cab28b28b3 3 | folderAsset: yes 4 | timeCreated: 1438611720 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe/Shader/Fringe.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoFringe - Chromatic aberration effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | Shader "Hidden/Kino/Fringe" 24 | { 25 | Properties 26 | { 27 | _MainTex ("-", 2D) = "" {} 28 | } 29 | 30 | CGINCLUDE 31 | 32 | #pragma multi_compile _ AXIAL_SAMPLE_LOW AXIAL_SAMPLE_HIGH 33 | 34 | #include "UnityCG.cginc" 35 | 36 | sampler2D _MainTex; 37 | float4 _MainTex_TexelSize; 38 | 39 | float4 _CameraAspect; // (h/w, w/h, 1, 0) 40 | float _LateralShift; 41 | float _AxialStrength; 42 | float _AxialShift; 43 | 44 | // Poisson disk sample points 45 | #if AXIAL_SAMPLE_LOW 46 | static const uint SAMPLE_NUM = 8; 47 | static const float2 POISSON_SAMPLES[SAMPLE_NUM] = 48 | { 49 | float2( 0.373838022357f, 0.662882019975f ), 50 | float2( -0.335774814282f, -0.940070127794f ), 51 | float2( -0.9115721822f, 0.324130702404f ), 52 | float2( 0.837294074715f, -0.504677167232f ), 53 | float2( -0.0500874221246f, -0.0917990757772f ), 54 | float2( -0.358644570242f, 0.906381100284f ), 55 | float2( 0.961200130218f, 0.219135111748f ), 56 | float2( -0.896666615007f, -0.440304757692f ) 57 | }; 58 | #else 59 | static const uint SAMPLE_NUM = 16; 60 | static const float2 POISSON_SAMPLES[SAMPLE_NUM] = 61 | { 62 | float2( 0.0984258332809f, 0.918808284462f ), 63 | float2( 0.00259138629413f, -0.999838959623f ), 64 | float2( -0.987959729023f, -0.00429660140761f ), 65 | float2( 0.981234239267f, -0.140666219895f ), 66 | float2( -0.0212157973013f, -0.0443286928994f ), 67 | float2( -0.652058534734f, 0.695078086985f ), 68 | float2( -0.68090417832f, -0.681862769398f ), 69 | float2( 0.779643686501f, 0.603399060386f ), 70 | float2( 0.67941165083f, -0.731372789969f ), 71 | float2( 0.468821477499f, -0.251621416756f ), 72 | float2( 0.278991228738f, 0.39302189329f ), 73 | float2( -0.191188273806f, -0.527976638433f ), 74 | float2( -0.464789669525f, 0.216311272754f ), 75 | float2( -0.559833960421f, -0.256176089172f ), 76 | float2( 0.65988403582f, 0.170056284903f ), 77 | float2( -0.170289189543f, 0.551561042407f ) 78 | }; 79 | #endif 80 | 81 | // Poisson filter 82 | half3 poisson_filter(float2 uv) 83 | { 84 | half3 acc = 0; 85 | for (uint i = 0; i < SAMPLE_NUM; i++) 86 | { 87 | float2 disp = POISSON_SAMPLES[i]; 88 | disp *= _CameraAspect.yz * _AxialShift * 0.02; 89 | acc += tex2D(_MainTex, uv + disp).rgb; 90 | } 91 | return acc / SAMPLE_NUM; 92 | } 93 | 94 | // Rec.709 Luminance 95 | half luminance(half3 rgb) 96 | { 97 | return dot(rgb, half3(0.2126, 0.7152, 0.0722)); 98 | } 99 | 100 | // CA filter 101 | half4 frag(v2f_img i) : SV_Target 102 | { 103 | float2 spc = (i.uv - 0.5) * _CameraAspect.xz; 104 | float r2 = dot(spc, spc); 105 | 106 | float f_r = 1.0 + r2 * _LateralShift * -0.02; 107 | float f_b = 1.0 + r2 * _LateralShift * +0.02; 108 | 109 | half4 src = tex2D(_MainTex, i.uv); 110 | src.r = tex2D(_MainTex, (i.uv - 0.5) * f_r + 0.5).r; 111 | src.b = tex2D(_MainTex, (i.uv - 0.5) * f_b + 0.5).b; 112 | 113 | #if AXIAL_SAMPLE_LOW || AXIAL_SAMPLE_HIGH 114 | half3 blur = poisson_filter(i.uv); 115 | half ldiff = luminance(blur) - luminance(src.rgb); 116 | src.rb = max(src.rb, blur.rb * ldiff * _AxialStrength); 117 | #endif 118 | 119 | return src; 120 | } 121 | 122 | ENDCG 123 | 124 | SubShader 125 | { 126 | Pass 127 | { 128 | ZTest Always Cull Off ZWrite Off 129 | CGPROGRAM 130 | #pragma vertex vert_img 131 | #pragma fragment frag 132 | ENDCG 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /Assets/Kino/Fringe/Shader/Fringe.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e3f6504698a346cb971f9ab5286fca9 3 | timeCreated: 1438093351 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d43a8ab8eb36c346bdf5c760580b019 3 | folderAsset: yes 4 | timeCreated: 1439534051 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ad044d970086bc48b37420227aaa504 3 | folderAsset: yes 4 | timeCreated: 1439538202 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Editor/VignetteEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoVignette - Natural vignetting effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | using UnityEditor; 25 | 26 | namespace Kino 27 | { 28 | [CanEditMultipleObjects] 29 | [CustomEditor(typeof(Vignette))] 30 | public class VignetteEditor : Editor 31 | { 32 | SerializedProperty _falloff; 33 | 34 | void OnEnable() 35 | { 36 | _falloff = serializedObject.FindProperty("_falloff"); 37 | } 38 | 39 | public override void OnInspectorGUI() 40 | { 41 | serializedObject.Update(); 42 | 43 | EditorGUILayout.PropertyField(_falloff); 44 | 45 | serializedObject.ApplyModifiedProperties(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Editor/VignetteEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01095d10408c28d429dcdb7841e375a5 3 | timeCreated: 1439538208 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8e0d748f5d5fd8479f21c06cddbc912 3 | folderAsset: yes 4 | timeCreated: 1439534088 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Shader/Vignette.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoVignette - Natural vignetting effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | Shader "Hidden/Kino/Vignette" 24 | { 25 | Properties 26 | { 27 | _MainTex ("-", 2D) = "" {} 28 | } 29 | 30 | CGINCLUDE 31 | 32 | #include "UnityCG.cginc" 33 | 34 | sampler2D _MainTex; 35 | float2 _Aspect; 36 | float _Falloff; 37 | 38 | half4 frag(v2f_img i) : SV_Target 39 | { 40 | float2 coord = (i.uv - 0.5) * _Aspect * 2; 41 | float rf = sqrt(dot(coord, coord)) * _Falloff; 42 | float rf2_1 = rf * rf + 1.0; 43 | float e = 1.0 / (rf2_1 * rf2_1); 44 | 45 | half4 src = tex2D(_MainTex, i.uv); 46 | return half4(src.rgb * e, src.a); 47 | } 48 | 49 | ENDCG 50 | 51 | SubShader 52 | { 53 | Pass 54 | { 55 | ZTest Always Cull Off ZWrite Off 56 | CGPROGRAM 57 | #pragma vertex vert_img 58 | #pragma fragment frag 59 | ENDCG 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Shader/Vignette.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89a223cbeee1935419811f8736c0a9b3 3 | timeCreated: 1439534076 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Vignette.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoVignette - Natural vignetting effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | 25 | namespace Kino 26 | { 27 | [ExecuteInEditMode] 28 | [RequireComponent(typeof(Camera))] 29 | [AddComponentMenu("Kino Image Effects/Vignette")] 30 | public class Vignette : MonoBehaviour 31 | { 32 | #region Public Properties 33 | 34 | // Natural vignetting falloff 35 | [SerializeField, Range(0.0f, 1.0f)] 36 | float _falloff = 0.5f; 37 | 38 | public float intensity { 39 | get { return _falloff; } 40 | set { _falloff = value; } 41 | } 42 | 43 | #endregion 44 | 45 | #region Private Properties 46 | 47 | [SerializeField] Shader _shader; 48 | Material _material; 49 | 50 | #endregion 51 | 52 | #region MonoBehaviour Functions 53 | 54 | void OnRenderImage(RenderTexture source, RenderTexture destination) 55 | { 56 | if (_material == null) 57 | { 58 | _material = new Material(_shader); 59 | _material.hideFlags = HideFlags.DontSave; 60 | } 61 | 62 | var cam = GetComponent(); 63 | _material.SetVector("_Aspect", new Vector2(cam.aspect, 1)); 64 | _material.SetFloat("_Falloff", _falloff); 65 | 66 | Graphics.Blit(source, destination, _material, 0); 67 | } 68 | 69 | #endregion 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/Kino/Vignette/Vignette.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fc18a55c333d51489e5ee49b3cbff50 3 | timeCreated: 1439534795 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 89a223cbeee1935419811f8736c0a9b3, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Kvant.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8be732b80b8b445e5bd196d2b01ed59c 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a2771dd06412493aabb6b7e0369f524 3 | folderAsset: yes 4 | timeCreated: 1440305426 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9f0c322d275a2475ab3a73b332cd5dce 3 | folderAsset: yes 4 | timeCreated: 1440312646 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Editor/GrassEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Custom editor for Grass 3 | // 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | namespace Kvant 8 | { 9 | [CanEditMultipleObjects] 10 | [CustomEditor(typeof(Grass))] 11 | public class GrassEditor : Editor 12 | { 13 | SerializedProperty _density; 14 | SerializedProperty _extent; 15 | SerializedProperty _offset; 16 | 17 | SerializedProperty _randomPitchAngle; 18 | SerializedProperty _noisePitchAngle; 19 | SerializedProperty _rotationNoiseFrequency; 20 | SerializedProperty _rotationNoiseSpeed; 21 | SerializedProperty _rotationNoiseAxis; 22 | 23 | SerializedProperty _baseScale; 24 | SerializedProperty _minRandomScale; 25 | SerializedProperty _maxRandomScale; 26 | SerializedProperty _scaleNoiseAmplitude; 27 | SerializedProperty _scaleNoiseFrequency; 28 | 29 | SerializedProperty _shapes; 30 | SerializedProperty _material; 31 | SerializedProperty _castShadows; 32 | SerializedProperty _receiveShadows; 33 | 34 | static GUIContent _textRandomPitch = new GUIContent("Random Pitch"); 35 | static GUIContent _textNoiseToPitch = new GUIContent("Noise To Pitch"); 36 | static GUIContent _textNoiseFrequency = new GUIContent("Noise Frequency"); 37 | static GUIContent _textNoiseSpeed = new GUIContent("Noise Speed"); 38 | static GUIContent _textNoiseAxis = new GUIContent("Noise Axis"); 39 | static GUIContent _textNoiseToScale = new GUIContent("Noise To Scale"); 40 | 41 | static GUIContent _textRandomScale = new GUIContent("Random Scale"); 42 | 43 | void OnEnable() 44 | { 45 | _density = serializedObject.FindProperty("_density"); 46 | _extent = serializedObject.FindProperty("_extent"); 47 | _offset = serializedObject.FindProperty("_offset"); 48 | 49 | _randomPitchAngle = serializedObject.FindProperty("_randomPitchAngle"); 50 | _noisePitchAngle = serializedObject.FindProperty("_noisePitchAngle"); 51 | _rotationNoiseFrequency = serializedObject.FindProperty("_rotationNoiseFrequency"); 52 | _rotationNoiseSpeed = serializedObject.FindProperty("_rotationNoiseSpeed"); 53 | _rotationNoiseAxis = serializedObject.FindProperty("_rotationNoiseAxis"); 54 | 55 | _baseScale = serializedObject.FindProperty("_baseScale"); 56 | _minRandomScale = serializedObject.FindProperty("_minRandomScale"); 57 | _maxRandomScale = serializedObject.FindProperty("_maxRandomScale"); 58 | _scaleNoiseAmplitude = serializedObject.FindProperty("_scaleNoiseAmplitude"); 59 | _scaleNoiseFrequency = serializedObject.FindProperty("_scaleNoiseFrequency"); 60 | 61 | _shapes = serializedObject.FindProperty("_shapes"); 62 | _material = serializedObject.FindProperty("_material"); 63 | _castShadows = serializedObject.FindProperty("_castShadows"); 64 | _receiveShadows = serializedObject.FindProperty("_receiveShadows"); 65 | } 66 | 67 | public override void OnInspectorGUI() 68 | { 69 | var instance = target as Grass; 70 | 71 | serializedObject.Update(); 72 | 73 | EditorGUI.BeginChangeCheck(); 74 | EditorGUILayout.PropertyField(_density); 75 | if (EditorGUI.EndChangeCheck()) instance.NotifyConfigChange(); 76 | 77 | EditorGUILayout.PropertyField(_extent); 78 | EditorGUILayout.PropertyField(_offset); 79 | 80 | EditorGUILayout.Space(); 81 | 82 | EditorGUILayout.LabelField("Rotation", EditorStyles.boldLabel); 83 | EditorGUILayout.PropertyField(_randomPitchAngle, _textRandomPitch); 84 | EditorGUILayout.PropertyField(_noisePitchAngle, _textNoiseToPitch); 85 | EditorGUILayout.PropertyField(_rotationNoiseFrequency, _textNoiseFrequency); 86 | EditorGUILayout.PropertyField(_rotationNoiseSpeed, _textNoiseSpeed); 87 | EditorGUILayout.PropertyField(_rotationNoiseAxis, _textNoiseAxis); 88 | 89 | EditorGUILayout.Space(); 90 | 91 | EditorGUILayout.LabelField("Scale", EditorStyles.boldLabel); 92 | EditorGUILayout.PropertyField(_baseScale); 93 | MinMaxSlider(_textRandomScale, _minRandomScale, _maxRandomScale, 0.01f, 5.0f); 94 | EditorGUILayout.PropertyField(_scaleNoiseAmplitude, _textNoiseToScale); 95 | EditorGUILayout.PropertyField(_scaleNoiseFrequency, _textNoiseFrequency); 96 | 97 | EditorGUILayout.Space(); 98 | 99 | EditorGUILayout.LabelField("Rendering", EditorStyles.boldLabel); 100 | 101 | EditorGUI.BeginChangeCheck(); 102 | EditorGUILayout.PropertyField(_shapes, true); 103 | if (EditorGUI.EndChangeCheck()) instance.NotifyConfigChange(); 104 | 105 | EditorGUILayout.PropertyField(_material); 106 | EditorGUILayout.PropertyField(_castShadows); 107 | EditorGUILayout.PropertyField(_receiveShadows); 108 | 109 | serializedObject.ApplyModifiedProperties(); 110 | } 111 | 112 | void MinMaxSlider(GUIContent label, SerializedProperty propMin, SerializedProperty propMax, float minLimit, float maxLimit) 113 | { 114 | var min = propMin.floatValue; 115 | var max = propMax.floatValue; 116 | 117 | EditorGUI.BeginChangeCheck(); 118 | 119 | // Min-max slider. 120 | EditorGUILayout.MinMaxSlider(label, ref min, ref max, minLimit, maxLimit); 121 | 122 | var prevIndent = EditorGUI.indentLevel; 123 | EditorGUI.indentLevel = 0; 124 | 125 | // Float value boxes. 126 | var rect = EditorGUILayout.GetControlRect(); 127 | rect.x += EditorGUIUtility.labelWidth; 128 | rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2; 129 | 130 | if (EditorGUIUtility.wideMode) 131 | { 132 | EditorGUIUtility.labelWidth = 28; 133 | min = Mathf.Clamp(EditorGUI.FloatField(rect, "min", min), minLimit, max); 134 | rect.x += rect.width + 4; 135 | max = Mathf.Clamp(EditorGUI.FloatField(rect, "max", max), min, maxLimit); 136 | EditorGUIUtility.labelWidth = 0; 137 | } 138 | else 139 | { 140 | min = Mathf.Clamp(EditorGUI.FloatField(rect, min), minLimit, max); 141 | rect.x += rect.width + 4; 142 | max = Mathf.Clamp(EditorGUI.FloatField(rect, max), min, maxLimit); 143 | } 144 | 145 | EditorGUI.indentLevel = prevIndent; 146 | 147 | if (EditorGUI.EndChangeCheck()) { 148 | propMin.floatValue = min; 149 | propMax.floatValue = max; 150 | } 151 | } 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Editor/GrassEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 264e232cde9364f5b9e1d96250184c8d 3 | timeCreated: 1440417830 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/Grass/Editor/GrassMaterialEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Custom material editor for Grass surface shader 3 | // 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | namespace Kvant 8 | { 9 | public class GrassMaterialEditor : 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 _occHeight; 20 | MaterialProperty _occExp; 21 | MaterialProperty _occToColor; 22 | 23 | static GUIContent _albedoText = new GUIContent("Albedo"); 24 | static GUIContent _normalMapText = new GUIContent("Normal Map"); 25 | 26 | bool _initial = true; 27 | 28 | void FindProperties(MaterialProperty[] props) 29 | { 30 | _colorMode = FindProperty("_ColorMode", props); 31 | _color = FindProperty("_Color", props); 32 | _color2 = FindProperty("_Color2", props); 33 | _metallic = FindProperty("_Metallic", props); 34 | _smoothness = FindProperty("_Smoothness", props); 35 | _albedoMap = FindProperty("_MainTex", props); 36 | _normalMap = FindProperty("_NormalMap", props); 37 | _normalScale = FindProperty("_NormalScale", props); 38 | _occHeight = FindProperty("_OccHeight", props); 39 | _occExp = FindProperty("_OccExp", props); 40 | _occToColor = FindProperty("_OccToColor", props); 41 | } 42 | 43 | public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) 44 | { 45 | FindProperties(properties); 46 | 47 | if (ShaderPropertiesGUI(materialEditor) || _initial) 48 | foreach (Material m in materialEditor.targets) 49 | CompleteMaterialChanges(m); 50 | 51 | _initial = false; 52 | } 53 | 54 | bool ShaderPropertiesGUI(MaterialEditor materialEditor) 55 | { 56 | EditorGUI.BeginChangeCheck(); 57 | 58 | materialEditor.ShaderProperty(_colorMode, "Color Mode"); 59 | 60 | if (_colorMode.floatValue > 0) 61 | { 62 | var rect = EditorGUILayout.GetControlRect(); 63 | rect.x += EditorGUIUtility.labelWidth; 64 | rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2; 65 | materialEditor.ShaderProperty(rect, _color, ""); 66 | rect.x += rect.width + 4; 67 | materialEditor.ShaderProperty(rect, _color2, ""); 68 | } 69 | else 70 | { 71 | materialEditor.ShaderProperty(_color, " "); 72 | } 73 | 74 | EditorGUILayout.Space(); 75 | 76 | materialEditor.ShaderProperty(_metallic, "Metallic"); 77 | materialEditor.ShaderProperty(_smoothness, "Smoothness"); 78 | 79 | EditorGUILayout.Space(); 80 | 81 | materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null); 82 | materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, _normalMap.textureValue ? _normalScale : null); 83 | materialEditor.TextureScaleOffsetProperty(_albedoMap); 84 | 85 | EditorGUILayout.Space(); 86 | 87 | materialEditor.ShaderProperty(_occHeight, "Occlusion Height"); 88 | materialEditor.ShaderProperty(_occExp, "Occlusion Exponent"); 89 | materialEditor.ShaderProperty(_occToColor, "Occlusion To Color"); 90 | 91 | return EditorGUI.EndChangeCheck(); 92 | } 93 | 94 | static void CompleteMaterialChanges(Material material) 95 | { 96 | var occh = Mathf.Max(material.GetFloat("_OccHeight"), 0.01f); 97 | material.SetFloat("_HeightToOcc", 1.0f / occh); 98 | 99 | SetKeyword(material, "_ALBEDOMAP", material.GetTexture("_MainTex")); 100 | SetKeyword(material, "_NORMALMAP", material.GetTexture("_NormalMap")); 101 | } 102 | 103 | static void SetKeyword(Material m, string keyword, bool state) 104 | { 105 | if (state) 106 | m.EnableKeyword(keyword); 107 | else 108 | m.DisableKeyword(keyword); 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Editor/GrassMaterialEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3155a7687583248e89b226dc848c15ea 3 | timeCreated: 1440312637 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/Grass/Editor/GrassScrollerEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Custom editor for GrassScroller 3 | // 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | namespace Kvant 8 | { 9 | [CanEditMultipleObjects] 10 | [CustomEditor(typeof(GrassScroller))] 11 | public class GrassScrollerEditor : Editor 12 | { 13 | SerializedProperty _yawAngle; 14 | SerializedProperty _speed; 15 | 16 | void OnEnable() 17 | { 18 | _yawAngle = serializedObject.FindProperty("_yawAngle"); 19 | _speed = serializedObject.FindProperty("_speed"); 20 | } 21 | 22 | public override void OnInspectorGUI() 23 | { 24 | serializedObject.Update(); 25 | EditorGUILayout.PropertyField(_yawAngle); 26 | EditorGUILayout.PropertyField(_speed); 27 | serializedObject.ApplyModifiedProperties(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Editor/GrassScrollerEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 28bce0d489d8f410292d3753c0b973c4 3 | timeCreated: 1443321752 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/Grass/Grass.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5b91f4970bd6b4ce490e72b8f4797b81 3 | timeCreated: 1440312726 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _material: {instanceID: 0} 9 | - _defaultMaterial: {fileID: 2100000, guid: 3f215119d17f3496a9a46251be8bb9bc, type: 2} 10 | - _kernelShader: {fileID: 4800000, guid: 1404e2fdeb8d34504b143c592d0817b3, type: 3} 11 | executionOrder: 0 12 | icon: {instanceID: 0} 13 | userData: 14 | assetBundleName: 15 | assetBundleVariant: 16 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/GrassScroller.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Scroller script for Grass 3 | // 4 | using UnityEngine; 5 | using UnityEngine.Serialization; 6 | 7 | namespace Kvant 8 | { 9 | [RequireComponent(typeof(Grass))] 10 | [AddComponentMenu("Kvant/Grass Scroller")] 11 | public class GrassScroller : MonoBehaviour 12 | { 13 | [SerializeField, FormerlySerializedAs("yawAngle")] 14 | float _yawAngle; 15 | 16 | public float yawAngle { 17 | get { return _yawAngle; } 18 | set { _yawAngle = value; } 19 | } 20 | 21 | [SerializeField, FormerlySerializedAs("speed")] 22 | float _speed; 23 | 24 | public float speed { 25 | get { return _speed; } 26 | set { _speed = value; } 27 | } 28 | 29 | void Update() 30 | { 31 | var r = _yawAngle * Mathf.Deg2Rad; 32 | var dir = new Vector2(Mathf.Cos(r), Mathf.Sin(r)); 33 | GetComponent().offset += dir * _speed * Time.deltaTime; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/GrassScroller.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe4d9cfcdfc2440f4ad305a6296d9d87 3 | timeCreated: 1440419877 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/Grass/Model.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 56fd90d5460424c659d9227ca50432fd 3 | folderAsset: yes 4 | timeCreated: 1440305440 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Model/Grass.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Kvant/Grass/Model/Grass.fbx -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Model/Grass.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fc6a34e7a0cb449f5b40f31834051a3b 3 | timeCreated: 1440251761 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 100002: Grass_1 10 | 100004: Grass_2 11 | 400000: //RootNode 12 | 400002: Grass_1 13 | 400004: Grass_2 14 | 2300000: //RootNode 15 | 2300002: Grass_1 16 | 2300004: Grass_2 17 | 3300000: //RootNode 18 | 3300002: Grass_1 19 | 3300004: Grass_2 20 | 4300000: Grass 21 | 4300002: Grass_1 22 | 4300004: Grass_2 23 | materials: 24 | importMaterials: 0 25 | materialName: 0 26 | materialSearch: 1 27 | animations: 28 | legacyGenerateAnimations: 4 29 | bakeSimulation: 0 30 | optimizeGameObjects: 0 31 | motionNodeName: 32 | animationImportErrors: 33 | animationImportWarnings: 34 | animationRetargetingWarnings: 35 | animationDoRetargetingWarnings: 0 36 | animationCompression: 1 37 | animationRotationError: .5 38 | animationPositionError: .5 39 | animationScaleError: .5 40 | animationWrapMode: 0 41 | extraExposedTransformPaths: [] 42 | clipAnimations: [] 43 | isReadable: 1 44 | meshes: 45 | lODScreenPercentages: [] 46 | globalScale: 1 47 | meshCompression: 0 48 | addColliders: 0 49 | importBlendShapes: 0 50 | swapUVChannels: 0 51 | generateSecondaryUV: 0 52 | useFileUnits: 1 53 | optimizeMeshForGPU: 1 54 | keepQuads: 0 55 | weldVertices: 1 56 | secondaryUVAngleDistortion: 8 57 | secondaryUVAreaDistortion: 15.000001 58 | secondaryUVHardAngle: 88 59 | secondaryUVPackMargin: 4 60 | useFileScale: 1 61 | tangentSpace: 62 | normalSmoothAngle: 60 63 | splitTangentsAcrossUV: 1 64 | normalImportMode: 0 65 | tangentImportMode: 1 66 | importAnimation: 0 67 | copyAvatar: 0 68 | humanDescription: 69 | human: [] 70 | skeleton: [] 71 | armTwist: .5 72 | foreArmTwist: .5 73 | upperLegTwist: .5 74 | legTwist: .5 75 | armStretch: .0500000007 76 | legStretch: .0500000007 77 | feetSpacing: 0 78 | rootMotionBoneName: 79 | hasTranslationDoF: 0 80 | lastHumanDescriptionAvatarSource: {instanceID: 0} 81 | animationType: 0 82 | humanoidOversampling: 1 83 | additionalBone: 0 84 | userData: 85 | assetBundleName: 86 | assetBundleVariant: 87 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 880b81ac6d8d84a40a61136c9a643c72 3 | folderAsset: yes 4 | timeCreated: 1440307454 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Scripts/BulkMesh.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Bulk mesh container 3 | // 4 | using UnityEngine; 5 | 6 | namespace Kvant 7 | { 8 | public partial class Grass 9 | { 10 | [System.Serializable] 11 | class BulkMesh 12 | { 13 | #region Public Properties 14 | 15 | Mesh _mesh; 16 | public Mesh mesh { get { return _mesh; } } 17 | 18 | #endregion 19 | 20 | #region Public Methods 21 | 22 | public BulkMesh(Mesh[] shapes, int copyCount) 23 | { 24 | CombineMeshes(shapes, copyCount); 25 | } 26 | 27 | public void Rebuild(Mesh[] shapes, int copyCount) 28 | { 29 | Release(); 30 | CombineMeshes(shapes, copyCount); 31 | } 32 | 33 | public void Release() 34 | { 35 | if (_mesh) DestroyImmediate(_mesh); 36 | } 37 | 38 | #endregion 39 | 40 | #region Private Methods 41 | 42 | // Cache structure which stores shape information 43 | struct ShapeCacheData 44 | { 45 | Vector3[] vertices; 46 | Vector3[] normals; 47 | Vector4[] tangents; 48 | Vector2[] uv; 49 | int[] indices; 50 | 51 | public ShapeCacheData(Mesh mesh) 52 | { 53 | if (mesh) 54 | { 55 | vertices = mesh.vertices; 56 | normals = mesh.normals; 57 | tangents = mesh.tangents; 58 | uv = mesh.uv; 59 | indices = mesh.GetIndices(0); 60 | } 61 | else 62 | { 63 | // An empty mesh was given; replaces with a two-sided quad. 64 | vertices = new Vector3[] { 65 | new Vector3(-1, +1, 0), new Vector3(+1, +1, 0), 66 | new Vector3(-1, -1, 0), new Vector3(+1, -1, 0), 67 | new Vector3(+1, +1, 0), new Vector3(-1, +1, 0), 68 | new Vector3(+1, -1, 0), new Vector3(-1, -1, 0) 69 | }; 70 | normals = new Vector3[] { 71 | Vector3.forward, Vector3.forward, 72 | Vector3.forward, Vector3.forward, 73 | -Vector3.forward, -Vector3.forward, 74 | -Vector3.forward, -Vector3.forward, 75 | }; 76 | tangents = new Vector4[] { 77 | new Vector4( 1, 0, 0, 1), new Vector4( 1, 0, 0, 1), 78 | new Vector4( 1, 0, 0, 1), new Vector4( 1, 0, 0, 1), 79 | new Vector4(-1, 0, 0, 1), new Vector4(-1, 0, 0, 1), 80 | new Vector4(-1, 0, 0, 1), new Vector4(-1, 0, 0, 1) 81 | }; 82 | uv = new Vector2[] { 83 | new Vector2(0, 1), new Vector2(1, 1), 84 | new Vector2(0, 0), new Vector2(1, 0), 85 | new Vector2(1, 1), new Vector2(0, 1), 86 | new Vector2(1, 0), new Vector2(0, 0) 87 | }; 88 | indices = new int[] {0, 1, 2, 3, 2, 1, 4, 5, 6, 7, 6, 5}; 89 | } 90 | } 91 | 92 | public int VertexCount { get { return vertices.Length; } } 93 | public int IndexCount { get { return indices.Length; } } 94 | 95 | public void CopyVerticesTo(Vector3[] destination, int position) 96 | { 97 | System.Array.Copy(vertices, 0, destination, position, vertices.Length); 98 | } 99 | 100 | public void CopyNormalsTo(Vector3[] destination, int position) 101 | { 102 | System.Array.Copy(normals, 0, destination, position, normals.Length); 103 | } 104 | 105 | public void CopyTangentsTo(Vector4[] destination, int position) 106 | { 107 | System.Array.Copy(tangents, 0, destination, position, tangents.Length); 108 | } 109 | 110 | public void CopyUVTo(Vector2[] destination, int position) 111 | { 112 | System.Array.Copy(uv, 0, destination, position, uv.Length); 113 | } 114 | 115 | public void CopyIndicesTo(int[] destination, int position, int offset) 116 | { 117 | for (var i = 0; i < indices.Length; i++) 118 | destination[position + i] = offset + indices[i]; 119 | } 120 | } 121 | 122 | // Mesh combiner function 123 | void CombineMeshes(Mesh[] shapes, int copyCount) 124 | { 125 | ShapeCacheData[] cache; 126 | 127 | if (shapes == null || shapes.Length == 0) 128 | { 129 | // An empty shape was given; use the default shape. 130 | cache = new ShapeCacheData[1]; 131 | cache[0] = new ShapeCacheData(null); 132 | } 133 | else 134 | { 135 | // Copy given meshes into a shape cache. 136 | cache = new ShapeCacheData[shapes.Length]; 137 | for (var i = 0; i < shapes.Length; i++) 138 | cache[i] = new ShapeCacheData(shapes[i]); 139 | } 140 | 141 | // Count the number of vertices and indices in the shape cache. 142 | var vc_shapes = 0; 143 | var ic_shapes = 0; 144 | foreach (var s in cache) { 145 | vc_shapes += s.VertexCount; 146 | ic_shapes += s.IndexCount; 147 | } 148 | 149 | // If there is nothing, break. 150 | if (vc_shapes == 0) return; 151 | 152 | // Determine the number of vertices/indicies. 153 | var vc = 0; 154 | var ic = 0; 155 | for (var i = 0; i < copyCount; i++) 156 | { 157 | var s = cache[i % cache.Length]; 158 | if (vc + s.VertexCount > 65535) break; 159 | vc += s.VertexCount; 160 | ic += s.IndexCount; 161 | } 162 | 163 | // Create vertex arrays. 164 | var vertices = new Vector3[vc]; 165 | var normals = new Vector3[vc]; 166 | var tangents = new Vector4[vc]; 167 | var uv = new Vector2[vc]; 168 | var uv2 = new Vector2[vc]; 169 | var indicies = new int[ic]; 170 | 171 | for (int v_i = 0, i_i = 0, e_i = 0; v_i < vc; e_i++) 172 | { 173 | var s = cache[e_i % cache.Length]; 174 | 175 | s.CopyVerticesTo(vertices, v_i); 176 | s.CopyNormalsTo (normals, v_i); 177 | s.CopyTangentsTo(tangents, v_i); 178 | s.CopyUVTo (uv, v_i); 179 | 180 | s.CopyIndicesTo(indicies, i_i, v_i); 181 | 182 | var coord = new Vector2((float)e_i / copyCount, 0); 183 | for (var i = 0; i < s.VertexCount; i++) uv2[v_i + i] = coord; 184 | 185 | v_i += s.VertexCount; 186 | i_i += s.IndexCount; 187 | } 188 | 189 | // Create a mesh object. 190 | _mesh = new Mesh(); 191 | 192 | _mesh.vertices = vertices; 193 | _mesh.normals = normals; 194 | _mesh.tangents = tangents; 195 | _mesh.uv = uv; 196 | _mesh.uv2 = uv2; 197 | 198 | _mesh.SetIndices(indicies, MeshTopology.Triangles, 0); 199 | _mesh.Optimize(); 200 | 201 | // This only for temporary use. Don't save. 202 | _mesh.hideFlags = HideFlags.DontSave; 203 | 204 | // Avoid being culled. 205 | _mesh.bounds = new Bounds(Vector3.zero, Vector3.one * 1000); 206 | } 207 | 208 | #endregion 209 | } 210 | } 211 | } 212 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Scripts/BulkMesh.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0ebaac0184db64079a87aff35d7cc7c2 3 | timeCreated: 1440307446 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/Grass/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c81e9a2b250a4423ba242d311788024 3 | folderAsset: yes 4 | timeCreated: 1440307464 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/ClassicNoise3D.cginc: -------------------------------------------------------------------------------- 1 | // An HLSL variant of the Gustavson's webgl-noise shader. 2 | // Translated by Keijiro Takahashi 3 | // For further information, see the original notice below. 4 | 5 | // 6 | // GLSL textureless classic 3D noise "cnoise", 7 | // with an RSL-style periodic variant "pnoise". 8 | // Author: Stefan Gustavson (stefan.gustavson@liu.se) 9 | // Version: 2011-10-11 10 | // 11 | // Many thanks to Ian McEwan of Ashima Arts for the 12 | // ideas for permutation and gradient selection. 13 | // 14 | // Copyright (c) 2011 Stefan Gustavson. All rights reserved. 15 | // Distributed under the MIT license. See LICENSE file. 16 | // https://github.com/ashima/webgl-noise 17 | // 18 | 19 | float3 mod(float3 x, float3 y) 20 | { 21 | return x - y * floor(x / y); 22 | } 23 | 24 | float3 mod289(float3 x) 25 | { 26 | return x - floor(x / 289.0) * 289.0; 27 | } 28 | 29 | float4 mod289(float4 x) 30 | { 31 | return x - floor(x / 289.0) * 289.0; 32 | } 33 | 34 | float4 permute(float4 x) 35 | { 36 | return mod289(((x*34.0)+1.0)*x); 37 | } 38 | 39 | float4 taylorInvSqrt(float4 r) 40 | { 41 | return (float4)1.79284291400159 - r * 0.85373472095314; 42 | } 43 | 44 | float3 fade(float3 t) { 45 | return t*t*t*(t*(t*6.0-15.0)+10.0); 46 | } 47 | 48 | // Classic Perlin noise 49 | float cnoise(float3 P) 50 | { 51 | float3 Pi0 = floor(P); // Integer part for indexing 52 | float3 Pi1 = Pi0 + (float3)1.0; // Integer part + 1 53 | Pi0 = mod289(Pi0); 54 | Pi1 = mod289(Pi1); 55 | float3 Pf0 = frac(P); // Fractional part for interpolation 56 | float3 Pf1 = Pf0 - (float3)1.0; // Fractional part - 1.0 57 | float4 ix = float4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); 58 | float4 iy = float4(Pi0.y, Pi0.y, Pi1.y, Pi1.y); 59 | float4 iz0 = (float4)Pi0.z; 60 | float4 iz1 = (float4)Pi1.z; 61 | 62 | float4 ixy = permute(permute(ix) + iy); 63 | float4 ixy0 = permute(ixy + iz0); 64 | float4 ixy1 = permute(ixy + iz1); 65 | 66 | float4 gx0 = ixy0 / 7.0; 67 | float4 gy0 = frac(floor(gx0) / 7.0) - 0.5; 68 | gx0 = frac(gx0); 69 | float4 gz0 = (float4)0.5 - abs(gx0) - abs(gy0); 70 | float4 sz0 = step(gz0, (float4)0.0); 71 | gx0 -= sz0 * (step((float4)0.0, gx0) - 0.5); 72 | gy0 -= sz0 * (step((float4)0.0, gy0) - 0.5); 73 | 74 | float4 gx1 = ixy1 / 7.0; 75 | float4 gy1 = frac(floor(gx1) / 7.0) - 0.5; 76 | gx1 = frac(gx1); 77 | float4 gz1 = (float4)0.5 - abs(gx1) - abs(gy1); 78 | float4 sz1 = step(gz1, (float4)0.0); 79 | gx1 -= sz1 * (step((float4)0.0, gx1) - 0.5); 80 | gy1 -= sz1 * (step((float4)0.0, gy1) - 0.5); 81 | 82 | float3 g000 = float3(gx0.x,gy0.x,gz0.x); 83 | float3 g100 = float3(gx0.y,gy0.y,gz0.y); 84 | float3 g010 = float3(gx0.z,gy0.z,gz0.z); 85 | float3 g110 = float3(gx0.w,gy0.w,gz0.w); 86 | float3 g001 = float3(gx1.x,gy1.x,gz1.x); 87 | float3 g101 = float3(gx1.y,gy1.y,gz1.y); 88 | float3 g011 = float3(gx1.z,gy1.z,gz1.z); 89 | float3 g111 = float3(gx1.w,gy1.w,gz1.w); 90 | 91 | float4 norm0 = taylorInvSqrt(float4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); 92 | g000 *= norm0.x; 93 | g010 *= norm0.y; 94 | g100 *= norm0.z; 95 | g110 *= norm0.w; 96 | 97 | float4 norm1 = taylorInvSqrt(float4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); 98 | g001 *= norm1.x; 99 | g011 *= norm1.y; 100 | g101 *= norm1.z; 101 | g111 *= norm1.w; 102 | 103 | float n000 = dot(g000, Pf0); 104 | float n100 = dot(g100, float3(Pf1.x, Pf0.y, Pf0.z)); 105 | float n010 = dot(g010, float3(Pf0.x, Pf1.y, Pf0.z)); 106 | float n110 = dot(g110, float3(Pf1.x, Pf1.y, Pf0.z)); 107 | float n001 = dot(g001, float3(Pf0.x, Pf0.y, Pf1.z)); 108 | float n101 = dot(g101, float3(Pf1.x, Pf0.y, Pf1.z)); 109 | float n011 = dot(g011, float3(Pf0.x, Pf1.y, Pf1.z)); 110 | float n111 = dot(g111, Pf1); 111 | 112 | float3 fade_xyz = fade(Pf0); 113 | float4 n_z = lerp(float4(n000, n100, n010, n110), float4(n001, n101, n011, n111), fade_xyz.z); 114 | float2 n_yz = lerp(n_z.xy, n_z.zw, fade_xyz.y); 115 | float n_xyz = lerp(n_yz.x, n_yz.y, fade_xyz.x); 116 | return 2.2 * n_xyz; 117 | } 118 | 119 | // Classic Perlin noise, periodic variant 120 | float pnoise(float3 P, float3 rep) 121 | { 122 | float3 Pi0 = mod(floor(P), rep); // Integer part, modulo period 123 | float3 Pi1 = mod(Pi0 + (float3)1.0, rep); // Integer part + 1, mod period 124 | Pi0 = mod289(Pi0); 125 | Pi1 = mod289(Pi1); 126 | float3 Pf0 = frac(P); // Fractional part for interpolation 127 | float3 Pf1 = Pf0 - (float3)1.0; // Fractional part - 1.0 128 | float4 ix = float4(Pi0.x, Pi1.x, Pi0.x, Pi1.x); 129 | float4 iy = float4(Pi0.y, Pi0.y, Pi1.y, Pi1.y); 130 | float4 iz0 = (float4)Pi0.z; 131 | float4 iz1 = (float4)Pi1.z; 132 | 133 | float4 ixy = permute(permute(ix) + iy); 134 | float4 ixy0 = permute(ixy + iz0); 135 | float4 ixy1 = permute(ixy + iz1); 136 | 137 | float4 gx0 = ixy0 / 7.0; 138 | float4 gy0 = frac(floor(gx0) / 7.0) - 0.5; 139 | gx0 = frac(gx0); 140 | float4 gz0 = (float4)0.5 - abs(gx0) - abs(gy0); 141 | float4 sz0 = step(gz0, (float4)0.0); 142 | gx0 -= sz0 * (step((float4)0.0, gx0) - 0.5); 143 | gy0 -= sz0 * (step((float4)0.0, gy0) - 0.5); 144 | 145 | float4 gx1 = ixy1 / 7.0; 146 | float4 gy1 = frac(floor(gx1) / 7.0) - 0.5; 147 | gx1 = frac(gx1); 148 | float4 gz1 = (float4)0.5 - abs(gx1) - abs(gy1); 149 | float4 sz1 = step(gz1, (float4)0.0); 150 | gx1 -= sz1 * (step((float4)0.0, gx1) - 0.5); 151 | gy1 -= sz1 * (step((float4)0.0, gy1) - 0.5); 152 | 153 | float3 g000 = float3(gx0.x,gy0.x,gz0.x); 154 | float3 g100 = float3(gx0.y,gy0.y,gz0.y); 155 | float3 g010 = float3(gx0.z,gy0.z,gz0.z); 156 | float3 g110 = float3(gx0.w,gy0.w,gz0.w); 157 | float3 g001 = float3(gx1.x,gy1.x,gz1.x); 158 | float3 g101 = float3(gx1.y,gy1.y,gz1.y); 159 | float3 g011 = float3(gx1.z,gy1.z,gz1.z); 160 | float3 g111 = float3(gx1.w,gy1.w,gz1.w); 161 | 162 | float4 norm0 = taylorInvSqrt(float4(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110))); 163 | g000 *= norm0.x; 164 | g010 *= norm0.y; 165 | g100 *= norm0.z; 166 | g110 *= norm0.w; 167 | float4 norm1 = taylorInvSqrt(float4(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111))); 168 | g001 *= norm1.x; 169 | g011 *= norm1.y; 170 | g101 *= norm1.z; 171 | g111 *= norm1.w; 172 | 173 | float n000 = dot(g000, Pf0); 174 | float n100 = dot(g100, float3(Pf1.x, Pf0.y, Pf0.z)); 175 | float n010 = dot(g010, float3(Pf0.x, Pf1.y, Pf0.z)); 176 | float n110 = dot(g110, float3(Pf1.x, Pf1.y, Pf0.z)); 177 | float n001 = dot(g001, float3(Pf0.x, Pf0.y, Pf1.z)); 178 | float n101 = dot(g101, float3(Pf1.x, Pf0.y, Pf1.z)); 179 | float n011 = dot(g011, float3(Pf0.x, Pf1.y, Pf1.z)); 180 | float n111 = dot(g111, Pf1); 181 | 182 | float3 fade_xyz = fade(Pf0); 183 | float4 n_z = lerp(float4(n000, n100, n010, n110), float4(n001, n101, n011, n111), fade_xyz.z); 184 | float2 n_yz = lerp(n_z.xy, n_z.zw, fade_xyz.y); 185 | float n_xyz = lerp(n_yz.x, n_yz.y, fade_xyz.x); 186 | return 2.2 * n_xyz; 187 | } 188 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/ClassicNoise3D.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26d56fa79857a41999e3cf2e7a4f3c11 3 | timeCreated: 1440307479 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Default Grass.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 Grass 10 | m_Shader: {fileID: 4800000, guid: da73fcaab82534881adec3f5f772b88a, type: 3} 11 | m_ShaderKeywords: _NORMALMAP 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: 2, y: 2} 24 | m_Offset: {x: 0, y: 0} 25 | data: 26 | first: 27 | name: _NormalMap 28 | second: 29 | m_Texture: {fileID: 2800000, guid: 9e3930dc2759048d59ceab73bfa51f28, type: 3} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | data: 33 | first: 34 | name: _OcclusionMap 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: _PositionTex 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: _RotationTex 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: _ScaleTex 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | m_Floats: 61 | data: 62 | first: 63 | name: _Smoothness 64 | second: .400000006 65 | data: 66 | first: 67 | name: _Metallic 68 | second: 0 69 | data: 70 | first: 71 | name: _ColorMode 72 | second: 1 73 | data: 74 | first: 75 | name: _NormalScale 76 | second: .5 77 | data: 78 | first: 79 | name: _HeightToOcc 80 | second: 2 81 | data: 82 | first: 83 | name: _OccExp 84 | second: 2 85 | data: 86 | first: 87 | name: _OccToColor 88 | second: .5 89 | data: 90 | first: 91 | name: _OccHeight 92 | second: .5 93 | data: 94 | first: 95 | name: _OcclusionStr 96 | second: 1 97 | m_Colors: 98 | data: 99 | first: 100 | name: _Color 101 | second: {r: .16446799, g: .860294104, b: .313232273, a: 1} 102 | data: 103 | first: 104 | name: _Color2 105 | second: {r: .527511239, g: .75, b: .104779422, a: 1} 106 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Default Grass.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3f215119d17f3496a9a46251be8bb9bc 3 | timeCreated: 1440312694 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Kernel.shader: -------------------------------------------------------------------------------- 1 | // 2 | // GPGPU kernels for Grass 3 | // 4 | // Position kernel outputs: 5 | // .xyz = position 6 | // .w = 0 7 | // 8 | // Rotation kernel outputs: 9 | // .xyzw = rotation (quaternion) 10 | // 11 | // Scale kernel outputs: 12 | // .xyz = scale factor 13 | // .w = random value (0-1) 14 | // 15 | Shader "Hidden/Kvant/Grass/Kernel" 16 | { 17 | CGINCLUDE 18 | 19 | #include "UnityCG.cginc" 20 | #include "ClassicNoise3D.cginc" 21 | 22 | float2 _Extent; 23 | float2 _Scroll; 24 | 25 | float _RandomPitch; 26 | float3 _RotationNoise; // freq, amp, time 27 | float3 _RotationAxis; 28 | 29 | float3 _BaseScale; 30 | float2 _RandomScale; // min, max 31 | float2 _ScaleNoise; // freq, amp 32 | 33 | // PRNG function 34 | float nrand(float2 uv, float salt) 35 | { 36 | uv += float2(salt, 0); 37 | return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453); 38 | } 39 | 40 | // Quaternion multiplication 41 | // http://mathworld.wolfram.com/Quaternion.html 42 | float4 qmul(float4 q1, float4 q2) 43 | { 44 | return float4( 45 | q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), 46 | q1.w * q2.w - dot(q1.xyz, q2.xyz) 47 | ); 48 | } 49 | 50 | // Get the point bound to the UV 51 | float2 get_point(float2 uv) 52 | { 53 | float2 p = float2(nrand(uv, 0), nrand(uv, 1)); 54 | return (p - 0.5) * _Extent; 55 | } 56 | 57 | float2 get_point_offs(float2 uv, float2 offs) 58 | { 59 | float2 p = float2(nrand(uv, 0), nrand(uv, 1)); 60 | return (frac(p + offs) - 0.5) * _Extent; 61 | } 62 | 63 | // Random rotation around the Y axis 64 | float4 random_yaw(float2 uv) 65 | { 66 | float a = (nrand(uv, 2) - 0.5) * UNITY_PI * 2; 67 | float sn, cs; 68 | sincos(a * 0.5, sn, cs); 69 | return float4(0, sn, 0, cs); 70 | } 71 | 72 | // Random pitch rotation 73 | float4 random_pitch(float2 uv) 74 | { 75 | float a1 = (nrand(uv, 3) - 0.5) * UNITY_PI * 2; 76 | float a2 = (nrand(uv, 4) - 0.5) * _RandomPitch * 2; 77 | float sn1, cs1, sn2, cs2; 78 | sincos(a1 * 0.5, sn1, cs1); 79 | sincos(a2 * 0.5, sn2, cs2); 80 | return float4(float3(cs1, 0, sn1) * sn2, cs2); 81 | } 82 | 83 | // Pass 0: Position kernel 84 | float4 frag_position(v2f_img i) : SV_Target 85 | { 86 | float2 p = get_point_offs(i.uv, _Scroll); 87 | return float4(p.x, 0, p.y, 0); 88 | } 89 | 90 | // Pass 1: Rotation kernel 91 | float4 frag_rotation(v2f_img i) : SV_Target 92 | { 93 | float4 r1 = random_yaw(i.uv); 94 | float4 r2 = random_pitch(i.uv); 95 | 96 | // Noise to rotation 97 | float2 np = get_point(i.uv) * _RotationNoise.x; 98 | float3 nc = float3(np.xy, _RotationNoise.z); 99 | float na = cnoise(nc) * _RotationNoise.y; 100 | 101 | // Getting a quaternion of it 102 | float sn, cs; 103 | sincos(na * 0.5, sn, cs); 104 | float4 r3 = float4(_RotationAxis * sn, cs); 105 | 106 | return qmul(r3, qmul(r2, r1)); 107 | } 108 | 109 | // Pass 2: Scale kernel 110 | float4 frag_scale(v2f_img i) : SV_Target 111 | { 112 | // Random scale factor 113 | float s1 = lerp(_RandomScale.x, _RandomScale.y, nrand(i.uv, 5)); 114 | 115 | // Noise to scale factor 116 | float2 np = get_point(i.uv) * _ScaleNoise.x; 117 | float3 nc = float3(np.xy, 0.92 /* magic num */); 118 | float s2 = cnoise(nc) * _ScaleNoise.y; 119 | 120 | return float4(_BaseScale * (s1 + s2), nrand(i.uv, 6)); 121 | } 122 | 123 | ENDCG 124 | 125 | SubShader 126 | { 127 | Pass 128 | { 129 | CGPROGRAM 130 | #pragma target 3.0 131 | #pragma vertex vert_img 132 | #pragma fragment frag_position 133 | ENDCG 134 | } 135 | Pass 136 | { 137 | CGPROGRAM 138 | #pragma target 3.0 139 | #pragma vertex vert_img 140 | #pragma fragment frag_rotation 141 | ENDCG 142 | } 143 | Pass 144 | { 145 | CGPROGRAM 146 | #pragma target 3.0 147 | #pragma vertex vert_img 148 | #pragma fragment frag_scale 149 | ENDCG 150 | } 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Kernel.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1404e2fdeb8d34504b143c592d0817b3 3 | timeCreated: 1440307479 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Lines.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Kvant/Grass/Shader/Lines.png -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Lines.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e3930dc2759048d59ceab73bfa51f28 3 | timeCreated: 1440322125 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 1 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 1 19 | externalNormalMap: 1 20 | heightScale: .25 21 | normalMapFilter: 1 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 512 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 2 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: .5, y: .5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 0 49 | textureType: 1 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Surface.shader: -------------------------------------------------------------------------------- 1 | // 2 | // Opaque surface shader for Grass 3 | // 4 | // Vertex format: 5 | // position.xyz = vertex position 6 | // texcoord0.xy = uv for texturing 7 | // texcoord1.xy = uv for position/rotation/scale texture 8 | // 9 | // Position kernel outputs: 10 | // .xyz = position 11 | // .w = 0 12 | // 13 | // Rotation kernel outputs: 14 | // .xyzw = rotation (quaternion) 15 | // 16 | // Scale kernel outputs: 17 | // .xyz = scale factor 18 | // .w = random value (0-1) 19 | // 20 | Shader "Kvant/Grass/Surface" 21 | { 22 | Properties 23 | { 24 | _PositionTex ("-", 2D) = "black"{} 25 | _RotationTex ("-", 2D) = "red"{} 26 | _ScaleTex ("-", 2D) = "white"{} 27 | 28 | [Enum(Single, 0, Random, 1)] 29 | _ColorMode ("-", Float) = 0 30 | _Color ("-", Color) = (1, 1, 1, 1) 31 | _Color2 ("-", Color) = (0.5, 0.5, 0.5, 1) 32 | 33 | _Metallic ("-", Range(0,1)) = 0.5 34 | _Smoothness ("-", Range(0,1)) = 0.5 35 | 36 | _MainTex ("-", 2D) = "white"{} 37 | _NormalMap ("-", 2D) = "bump"{} 38 | _NormalScale ("-", Range(0,2)) = 1 39 | 40 | _OccHeight ("-", Float) = 0.25 41 | _HeightToOcc ("-", Float) = 4.0 42 | _OccExp ("-", Range(1,10)) = 2 43 | _OccToColor ("-", Range(0,1)) = 0.2 44 | } 45 | SubShader 46 | { 47 | Tags { "RenderType"="Opaque" } 48 | 49 | CGPROGRAM 50 | 51 | #pragma surface surf Standard vertex:vert nolightmap addshadow 52 | #pragma shader_feature _ALBEDOMAP 53 | #pragma shader_feature _NORMALMAP 54 | #pragma target 3.0 55 | 56 | sampler2D _PositionTex; 57 | sampler2D _RotationTex; 58 | sampler2D _ScaleTex; 59 | float2 _BufferOffset; 60 | 61 | half _ColorMode; 62 | half4 _Color; 63 | half4 _Color2; 64 | 65 | half _Metallic; 66 | half _Smoothness; 67 | 68 | sampler2D _MainTex; 69 | sampler2D _NormalMap; 70 | half _NormalScale; 71 | 72 | half _HeightToOcc; 73 | half _OccExp; 74 | half _OccToColor; 75 | 76 | // Quaternion multiplication. 77 | // http://mathworld.wolfram.com/Quaternion.html 78 | float4 qmul(float4 q1, float4 q2) 79 | { 80 | return float4( 81 | q2.xyz * q1.w + q1.xyz * q2.w + cross(q1.xyz, q2.xyz), 82 | q1.w * q2.w - dot(q1.xyz, q2.xyz) 83 | ); 84 | } 85 | 86 | // Rotate a vector with a rotation quaternion. 87 | // http://mathworld.wolfram.com/Quaternion.html 88 | float3 rotate_vector(float3 v, float4 r) 89 | { 90 | float4 r_c = r * float4(-1, -1, -1, 1); 91 | return qmul(r, qmul(float4(v, 0), r_c)).xyz; 92 | } 93 | 94 | struct Input 95 | { 96 | float2 uv_MainTex; 97 | half4 color : COLOR; 98 | half occlusion; 99 | }; 100 | 101 | void vert(inout appdata_full v, out Input data) 102 | { 103 | UNITY_INITIALIZE_OUTPUT(Input, data); 104 | 105 | float4 uv = float4(v.texcoord1.xy + _BufferOffset, 0, 0); 106 | 107 | float4 p = tex2Dlod(_PositionTex, uv); 108 | float4 r = tex2Dlod(_RotationTex, uv); 109 | float4 s = tex2Dlod(_ScaleTex, uv); 110 | 111 | v.vertex.xyz = rotate_vector(v.vertex.xyz * s.xyz, r); 112 | 113 | float occ = saturate(v.vertex.y * _HeightToOcc); 114 | data.occlusion = pow(occ, _OccExp); 115 | 116 | v.vertex.xyz += p.xyz; 117 | v.normal = rotate_vector(v.normal, r); 118 | #if _NORMALMAP 119 | v.tangent.xyz = rotate_vector(v.tangent.xyz, r); 120 | #endif 121 | v.color = lerp(_Color, _Color2, s.w * _ColorMode); 122 | } 123 | 124 | void surf(Input IN, inout SurfaceOutputStandard o) 125 | { 126 | #if _ALBEDOMAP 127 | half4 c = tex2D(_MainTex, IN.uv_MainTex); 128 | o.Albedo = IN.color.rgb * c.rgb; 129 | o.Alpha = IN.color.a * c.a; 130 | #else 131 | o.Albedo = IN.color.rgb; 132 | o.Alpha = IN.color.a; 133 | #endif 134 | o.Albedo = lerp(o.Albedo, 0, (1.0 - IN.occlusion) * _OccToColor); 135 | 136 | #if _NORMALMAP 137 | half4 n = tex2D(_NormalMap, IN.uv_MainTex); 138 | o.Normal = UnpackScaleNormal(n, _NormalScale); 139 | #endif 140 | 141 | o.Metallic = _Metallic; 142 | o.Smoothness = _Smoothness; 143 | o.Occlusion = IN.occlusion; 144 | } 145 | 146 | ENDCG 147 | } 148 | CustomEditor "Kvant.GrassMaterialEditor" 149 | } 150 | -------------------------------------------------------------------------------- /Assets/Kvant/Grass/Shader/Surface.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: da73fcaab82534881adec3f5f772b88a 3 | timeCreated: 1440307480 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Reaktion.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 487429d9beca24ae78ab8ac96eb73dde 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Reaktion/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 263f8cf5a4c1141e6a79dc1c86d69dc2 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Reaktion/Editor/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c8c8f5affaaa4616a15e69dda142154 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Reaktion/Editor/Utility/JitterMotionEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Reaktion - An audio reactive animation toolkit for Unity. 3 | // 4 | // Copyright (C) 2013, 2014 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | using UnityEditor; 25 | using System.Collections; 26 | 27 | namespace Reaktion { 28 | 29 | [CustomEditor(typeof(JitterMotion)), CanEditMultipleObjects] 30 | public class JitterMotionEditor : Editor 31 | { 32 | SerializedProperty propPositionFrequency; 33 | SerializedProperty propRotationFrequency; 34 | 35 | SerializedProperty propPositionAmount; 36 | SerializedProperty propRotationAmount; 37 | 38 | SerializedProperty propPositionComponents; 39 | SerializedProperty propRotationComponents; 40 | 41 | SerializedProperty propPositionOctave; 42 | SerializedProperty propRotationOctave; 43 | 44 | GUIContent labelFrequency; 45 | GUIContent labelAmount; 46 | GUIContent labelOctave; 47 | 48 | void OnEnable() 49 | { 50 | propPositionFrequency = serializedObject.FindProperty("positionFrequency"); 51 | propRotationFrequency = serializedObject.FindProperty("rotationFrequency"); 52 | 53 | propPositionAmount = serializedObject.FindProperty("positionAmount"); 54 | propRotationAmount = serializedObject.FindProperty("rotationAmount"); 55 | 56 | propPositionComponents = serializedObject.FindProperty("positionComponents"); 57 | propRotationComponents = serializedObject.FindProperty("rotationComponents"); 58 | 59 | propPositionOctave = serializedObject.FindProperty("positionOctave"); 60 | propRotationOctave = serializedObject.FindProperty("rotationOctave"); 61 | 62 | labelFrequency = new GUIContent("Frequency"); 63 | labelAmount = new GUIContent("Noise Strength"); 64 | labelOctave = new GUIContent("Fractal Level"); 65 | } 66 | 67 | public override void OnInspectorGUI() 68 | { 69 | serializedObject.Update(); 70 | 71 | EditorGUILayout.LabelField("Position"); 72 | EditorGUI.indentLevel++; 73 | EditorGUILayout.PropertyField(propPositionAmount, labelAmount); 74 | EditorGUILayout.PropertyField(propPositionComponents, GUIContent.none); 75 | EditorGUILayout.PropertyField(propPositionFrequency, labelFrequency); 76 | EditorGUILayout.IntSlider(propPositionOctave, 1, 8, labelOctave); 77 | EditorGUI.indentLevel--; 78 | 79 | EditorGUILayout.LabelField("Rotation"); 80 | EditorGUI.indentLevel++; 81 | EditorGUILayout.PropertyField(propRotationAmount, labelAmount); 82 | EditorGUILayout.PropertyField(propRotationComponents, GUIContent.none); 83 | EditorGUILayout.PropertyField(propRotationFrequency, labelFrequency); 84 | EditorGUILayout.IntSlider(propRotationOctave, 1, 8, labelOctave); 85 | EditorGUI.indentLevel--; 86 | 87 | serializedObject.ApplyModifiedProperties(); 88 | } 89 | } 90 | 91 | } // namespace Reaktion 92 | -------------------------------------------------------------------------------- /Assets/Reaktion/Editor/Utility/JitterMotionEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 268ea7a40f25a4aca9338ec15fae8021 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Reaktion/Internal.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 326e33d18c9d64154b21ab0147da9239 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Reaktion/Internal/Perlin.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Reaktion - An audio reactive animation toolkit for Unity. 3 | // 4 | // Copyright (C) 2013, 2014 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | 24 | using UnityEngine; 25 | using System.Runtime.InteropServices; 26 | 27 | namespace Reaktion { 28 | 29 | public static class Perlin 30 | { 31 | // 32 | // Based on the original implementation by Ken Perlin 33 | // http://mrl.nyu.edu/~perlin/noise/ 34 | // 35 | 36 | #region Noise functions 37 | 38 | public static float Noise (float x) 39 | { 40 | var X = Mathf.FloorToInt (x) & 0xff; 41 | x -= Mathf.Floor (x); 42 | return Lerp (Fade (x), Grad(X, x), Grad (X + 1, x - 1)); 43 | } 44 | 45 | public static float Noise (float x, float y) 46 | { 47 | var X = Mathf.FloorToInt (x) & 0xff; 48 | var Y = Mathf.FloorToInt (y) & 0xff; 49 | x -= Mathf.Floor (x); 50 | y -= Mathf.Floor (y); 51 | var u = Fade (x); 52 | var v = Fade (y); 53 | var A = (perm [X ] + Y) & 0xff; 54 | var B = (perm [X + 1] + Y) & 0xff; 55 | return Lerp (v, Lerp (u, Grad (A , x, y ), Grad (B, x - 1, y )), 56 | Lerp (u, Grad (A + 1, x, y - 1), Grad (B + 1, x - 1, y - 1))); 57 | } 58 | 59 | public static float Noise (Vector2 coord) 60 | { 61 | return Noise (coord.x, coord.y); 62 | } 63 | 64 | public static float Noise (float x, float y, float z) 65 | { 66 | var X = Mathf.FloorToInt (x) & 0xff; 67 | var Y = Mathf.FloorToInt (y) & 0xff; 68 | var Z = Mathf.FloorToInt (z) & 0xff; 69 | x -= Mathf.Floor (x); 70 | y -= Mathf.Floor (y); 71 | z -= Mathf.Floor (z); 72 | var u = Fade (x); 73 | var v = Fade (y); 74 | var w = Fade (z); 75 | var A = (perm [X ] + Y) & 0xff; 76 | var B = (perm [X + 1] + Y) & 0xff; 77 | var AA = (perm [A ] + Z) & 0xff; 78 | var BA = (perm [B ] + Z) & 0xff; 79 | var AB = (perm [A + 1] + Z) & 0xff; 80 | var BB = (perm [B + 1] + Z) & 0xff; 81 | return Lerp (w, Lerp (v, Lerp (u, Grad (AA , x , y , z ), Grad (BA , x - 1, y , z )), 82 | Lerp (u, Grad (AB , x , y - 1, z ), Grad (BB , x - 1, y - 1, z ))), 83 | Lerp (v, Lerp (u, Grad (AA + 1, x , y , z - 1), Grad (BA + 1, x - 1, y , z - 1)), 84 | Lerp (u, Grad (AB + 1, x , y - 1, z - 1), Grad (BB + 1, x - 1, y - 1, z - 1)))); 85 | } 86 | 87 | public static float Noise (Vector3 coord) 88 | { 89 | return Noise (coord.x, coord.y, coord.z); 90 | } 91 | 92 | #endregion 93 | 94 | #region fBm functions 95 | 96 | public static float Fbm (float x, int octave) 97 | { 98 | var f = 0.0f; 99 | var w = 0.5f; 100 | for (var i = 0; i < octave; i++) { 101 | f += w * Noise (x); 102 | x *= 2.0f; 103 | w *= 0.5f; 104 | } 105 | return f; 106 | } 107 | 108 | public static float Fbm (Vector2 coord, int octave) 109 | { 110 | var f = 0.0f; 111 | var w = 0.5f; 112 | for (var i = 0; i < octave; i++) { 113 | f += w * Noise (coord); 114 | coord *= 2.0f; 115 | w *= 0.5f; 116 | } 117 | return f; 118 | } 119 | 120 | public static float Fbm (Vector3 coord, int octave) 121 | { 122 | var f = 0.0f; 123 | var w = 0.5f; 124 | for (var i = 0; i < octave; i++) { 125 | f += w * Noise (coord); 126 | coord *= 2.0f; 127 | w *= 0.5f; 128 | } 129 | return f; 130 | } 131 | 132 | #endregion 133 | 134 | #region Private functions 135 | 136 | static float Fade (float t) 137 | { 138 | return t * t * t * (t * (t * 6 - 15) + 10); 139 | } 140 | 141 | static float Lerp (float t, float a, float b) 142 | { 143 | return a + t * (b - a); 144 | } 145 | 146 | static float Grad (int i, float x) 147 | { 148 | return (perm [i] & 1) != 0 ? x : -x; 149 | } 150 | 151 | static float Grad (int i, float x, float y) 152 | { 153 | var h = perm [i]; 154 | return ((h & 1) != 0 ? x : -x) + ((h & 2) != 0 ? y : -y); 155 | } 156 | 157 | static float Grad (int i, float x, float y, float z) 158 | { 159 | var h = perm [i] & 15; 160 | var u = h < 8 ? x : y; 161 | var v = h < 4 ? y : (h == 12 || h == 14 ? x : z); 162 | return ((h & 1) != 0 ? u : -u) + ((h & 2) != 0 ? v : -v); 163 | } 164 | 165 | static int[] perm = { 166 | 151,160,137,91,90,15, 167 | 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 168 | 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 169 | 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, 170 | 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, 171 | 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, 172 | 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, 173 | 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, 174 | 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, 175 | 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, 176 | 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, 177 | 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, 178 | 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180, 179 | 151 180 | }; 181 | 182 | #endregion 183 | } 184 | 185 | } // namespace Reaktion 186 | -------------------------------------------------------------------------------- /Assets/Reaktion/Internal/Perlin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f982ffe3e8ec84582a4b361630ea004a 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Reaktion/Utility.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4d874762c14cf4223bd1bcfc86500326 3 | folderAsset: yes 4 | DefaultImporter: 5 | userData: 6 | -------------------------------------------------------------------------------- /Assets/Reaktion/Utility/JitterMotion.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Reaktion - An audio reactive animation toolkit for Unity. 3 | // 4 | // Copyright (C) 2013, 2014 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 7 | // this software and associated documentation files (the "Software"), to deal in 8 | // the Software without restriction, including without limitation the rights to 9 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 10 | // the Software, and to permit persons to whom the Software is furnished to do so, 11 | // subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in all 14 | // copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 18 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 19 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 20 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | // 23 | using UnityEngine; 24 | 25 | namespace Reaktion { 26 | 27 | public class JitterMotion : MonoBehaviour 28 | { 29 | public float positionFrequency = 0.2f; 30 | public float rotationFrequency = 0.2f; 31 | 32 | public float positionAmount = 1.0f; 33 | public float rotationAmount = 30.0f; 34 | 35 | public Vector3 positionComponents = Vector3.one; 36 | public Vector3 rotationComponents = new Vector3(1, 1, 0); 37 | 38 | public int positionOctave = 3; 39 | public int rotationOctave = 3; 40 | 41 | float timePosition; 42 | float timeRotation; 43 | 44 | Vector2[] noiseVectors; 45 | 46 | Vector3 initialPosition; 47 | Quaternion initialRotation; 48 | 49 | void Awake() 50 | { 51 | timePosition = Random.value * 10; 52 | timeRotation = Random.value * 10; 53 | 54 | noiseVectors = new Vector2[6]; 55 | 56 | for (var i = 0; i < 6; i++) 57 | { 58 | var theta = Random.value * Mathf.PI * 2; 59 | noiseVectors[i].Set(Mathf.Cos(theta), Mathf.Sin(theta)); 60 | } 61 | 62 | initialPosition = transform.localPosition; 63 | initialRotation = transform.localRotation; 64 | } 65 | 66 | void Update() 67 | { 68 | timePosition += Time.deltaTime * positionFrequency; 69 | timeRotation += Time.deltaTime * rotationFrequency; 70 | 71 | if (positionAmount != 0.0f) 72 | { 73 | var p = new Vector3( 74 | Fbm(noiseVectors[0] * timePosition, positionOctave), 75 | Fbm(noiseVectors[1] * timePosition, positionOctave), 76 | Fbm(noiseVectors[2] * timePosition, positionOctave) 77 | ); 78 | p = Vector3.Scale(p, positionComponents) * positionAmount * 2; 79 | transform.localPosition = initialPosition + p; 80 | } 81 | 82 | if (rotationAmount != 0.0f) 83 | { 84 | var r = new Vector3( 85 | Fbm(noiseVectors[3] * timeRotation, rotationOctave), 86 | Fbm(noiseVectors[4] * timeRotation, rotationOctave), 87 | Fbm(noiseVectors[5] * timeRotation, rotationOctave) 88 | ); 89 | r = Vector3.Scale(r, rotationComponents) * rotationAmount * 2; 90 | transform.localRotation = Quaternion.Euler(r) * initialRotation; 91 | } 92 | } 93 | 94 | static float Fbm(Vector2 coord, int octave) 95 | { 96 | var f = 0.0f; 97 | var w = 1.0f; 98 | for (var i = 0; i < octave; i++) 99 | { 100 | f += w * Perlin.Noise(coord.x, coord.y) * 0.5f; 101 | coord *= 2; 102 | w *= 0.5f; 103 | } 104 | return f; 105 | } 106 | } 107 | 108 | } // namespace Reaktion 109 | -------------------------------------------------------------------------------- /Assets/Reaktion/Utility/JitterMotion.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d637268abbbb5428e991dd9ec93136f2 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | -------------------------------------------------------------------------------- /Assets/Standard Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 238dd03b79f3e954192b0124bd2eca00 3 | folderAsset: yes 4 | timeCreated: 1440327177 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c32f58513a41ef4dab9cb7704c5fb92 3 | folderAsset: yes 4 | timeCreated: 1440327177 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8912f13e18e67bc478684ec30d73bc64 3 | folderAsset: yes 4 | timeCreated: 1440327177 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Animation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb0e763ded53048dd80e7b78c35ded56 3 | folderAsset: yes 4 | timeCreated: 1440327177 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Animation/HumanoidIdle.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Standard Assets/Characters/ThirdPersonCharacter/Animation/HumanoidIdle.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Animation/HumanoidRun.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Standard Assets/Characters/ThirdPersonCharacter/Animation/HumanoidRun.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f93df448921b46c45999c77f43856ba2 3 | folderAsset: yes 4 | timeCreated: 1440327177 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Materials/EthanGrey.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 4 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: EthanGrey 10 | m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _LIGHTMAPPING_STATIC_LIGHTMAPS _NORMALMAP _UVPRIM_UV1 _UVSEC_UV1 12 | m_CustomRenderQueue: -1 13 | m_SavedProperties: 14 | serializedVersion: 2 15 | m_TexEnvs: 16 | data: 17 | first: 18 | name: _MainTex 19 | second: 20 | m_Texture: {fileID: 2800000, guid: 0ca09a4614a0daa44ba043de90181896, type: 3} 21 | m_Scale: {x: 1, y: 1} 22 | m_Offset: {x: 0, y: 0} 23 | data: 24 | first: 25 | name: _BumpMap 26 | second: 27 | m_Texture: {fileID: 2800000, guid: 3b5b7be0f2332c24f89a2af018daa62d, type: 3} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | data: 31 | first: 32 | name: _DetailNormalMap 33 | second: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | data: 38 | first: 39 | name: _EmissionMap 40 | second: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | data: 45 | first: 46 | name: _ParallaxMap 47 | second: 48 | m_Texture: {fileID: 0} 49 | m_Scale: {x: 1, y: 1} 50 | m_Offset: {x: 0, y: 0} 51 | data: 52 | first: 53 | name: _Occlusion 54 | second: 55 | m_Texture: {fileID: 2800000, guid: 4e2f32e9a1fefc24092337ae061f3dbc, type: 3} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | data: 59 | first: 60 | name: _SpecGlossMap 61 | second: 62 | m_Texture: {fileID: 2800000, guid: c6093d6055cd6a44ebf0637f17fca0e8, type: 3} 63 | m_Scale: {x: 1, y: 1} 64 | m_Offset: {x: 0, y: 0} 65 | data: 66 | first: 67 | name: _DetailMask 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | data: 73 | first: 74 | name: _DetailAlbedoMap 75 | second: 76 | m_Texture: {fileID: 0} 77 | m_Scale: {x: 1, y: 1} 78 | m_Offset: {x: 0, y: 0} 79 | data: 80 | first: 81 | name: _Cube 82 | second: 83 | m_Texture: {fileID: 8900000, guid: 6c5668bb9f9669342bfdd3eaddebb56b, type: 2} 84 | m_Scale: {x: 1, y: 1} 85 | m_Offset: {x: 0, y: 0} 86 | data: 87 | first: 88 | name: _OcclusionMap 89 | second: 90 | m_Texture: {fileID: 2800000, guid: 4e2f32e9a1fefc24092337ae061f3dbc, type: 3} 91 | m_Scale: {x: 1, y: 1} 92 | m_Offset: {x: 0, y: 0} 93 | m_Floats: 94 | data: 95 | first: 96 | name: _Shininess 97 | second: .413138449 98 | data: 99 | first: 100 | name: _AlphaTestRef 101 | second: .5 102 | data: 103 | first: 104 | name: _Lightmapping 105 | second: 0 106 | data: 107 | first: 108 | name: _SrcBlend 109 | second: 1 110 | data: 111 | first: 112 | name: _DstBlend 113 | second: 0 114 | data: 115 | first: 116 | name: _Parallax 117 | second: .0199999996 118 | data: 119 | first: 120 | name: _ZWrite 121 | second: 1 122 | data: 123 | first: 124 | name: _Glossiness 125 | second: .150000006 126 | data: 127 | first: 128 | name: _BumpScale 129 | second: 1 130 | data: 131 | first: 132 | name: _OcclusionStrength 133 | second: 1 134 | data: 135 | first: 136 | name: _DetailNormalMapScale 137 | second: 1 138 | data: 139 | first: 140 | name: _UVSec 141 | second: 0 142 | data: 143 | first: 144 | name: _Mode 145 | second: 0 146 | data: 147 | first: 148 | name: _EmissionScaleUI 149 | second: 1 150 | data: 151 | first: 152 | name: _EmissionScale 153 | second: 1 154 | data: 155 | first: 156 | name: _DetailAlbedoMultiplier 157 | second: 2 158 | data: 159 | first: 160 | name: _UVPrim 161 | second: 0 162 | data: 163 | first: 164 | name: _DetailMode 165 | second: 0 166 | m_Colors: 167 | data: 168 | first: 169 | name: _EmissionColor 170 | second: {r: 0, g: 0, b: 0, a: .99999994} 171 | data: 172 | first: 173 | name: _Color 174 | second: {r: .498039216, g: .498039216, b: .498039216, a: 1} 175 | data: 176 | first: 177 | name: _SpecularColor 178 | second: {r: .242647052, g: .242647052, b: .242647052, a: 1} 179 | data: 180 | first: 181 | name: _EmissionColorUI 182 | second: {r: 0, g: 0, b: 0, a: 1} 183 | data: 184 | first: 185 | name: _EmissionColorWithMapUI 186 | second: {r: 1, g: 1, b: 1, a: 1} 187 | data: 188 | first: 189 | name: _SpecColor 190 | second: {r: .0980392173, g: .0980392173, b: .0980392173, a: 1} 191 | data: 192 | first: 193 | name: _ReflectColor 194 | second: {r: 1, g: 1, b: 1, a: .5} 195 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Materials/EthanGrey.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 621e901dcf5ebaf46bce29d18f67194c 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Materials/EthanWhite.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 4 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: EthanWhite 10 | m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _LIGHTMAPPING_STATIC_LIGHTMAPS _NORMALMAP _UVPRIM_UV1 _UVSEC_UV1 12 | m_CustomRenderQueue: -1 13 | m_SavedProperties: 14 | serializedVersion: 2 15 | m_TexEnvs: 16 | data: 17 | first: 18 | name: _MainTex 19 | second: 20 | m_Texture: {fileID: 2800000, guid: 0ca09a4614a0daa44ba043de90181896, type: 3} 21 | m_Scale: {x: 1, y: 1} 22 | m_Offset: {x: 0, y: 0} 23 | data: 24 | first: 25 | name: _BumpMap 26 | second: 27 | m_Texture: {fileID: 2800000, guid: 3b5b7be0f2332c24f89a2af018daa62d, type: 3} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | data: 31 | first: 32 | name: _DetailNormalMap 33 | second: 34 | m_Texture: {fileID: 0} 35 | m_Scale: {x: 1, y: 1} 36 | m_Offset: {x: 0, y: 0} 37 | data: 38 | first: 39 | name: _EmissionMap 40 | second: 41 | m_Texture: {fileID: 0} 42 | m_Scale: {x: 1, y: 1} 43 | m_Offset: {x: 0, y: 0} 44 | data: 45 | first: 46 | name: _ParallaxMap 47 | second: 48 | m_Texture: {fileID: 0} 49 | m_Scale: {x: 1, y: 1} 50 | m_Offset: {x: 0, y: 0} 51 | data: 52 | first: 53 | name: _Occlusion 54 | second: 55 | m_Texture: {fileID: 2800000, guid: 4e2f32e9a1fefc24092337ae061f3dbc, type: 3} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | data: 59 | first: 60 | name: _SpecGlossMap 61 | second: 62 | m_Texture: {fileID: 2800000, guid: c6093d6055cd6a44ebf0637f17fca0e8, type: 3} 63 | m_Scale: {x: 1, y: 1} 64 | m_Offset: {x: 0, y: 0} 65 | data: 66 | first: 67 | name: _DetailMask 68 | second: 69 | m_Texture: {fileID: 0} 70 | m_Scale: {x: 1, y: 1} 71 | m_Offset: {x: 0, y: 0} 72 | data: 73 | first: 74 | name: _DetailAlbedoMap 75 | second: 76 | m_Texture: {fileID: 0} 77 | m_Scale: {x: 1, y: 1} 78 | m_Offset: {x: 0, y: 0} 79 | data: 80 | first: 81 | name: _Cube 82 | second: 83 | m_Texture: {fileID: 8900000, guid: 6c5668bb9f9669342bfdd3eaddebb56b, type: 2} 84 | m_Scale: {x: 1, y: 1} 85 | m_Offset: {x: 0, y: 0} 86 | data: 87 | first: 88 | name: _OcclusionMap 89 | second: 90 | m_Texture: {fileID: 2800000, guid: 4e2f32e9a1fefc24092337ae061f3dbc, type: 3} 91 | m_Scale: {x: 1, y: 1} 92 | m_Offset: {x: 0, y: 0} 93 | m_Floats: 94 | data: 95 | first: 96 | name: _Shininess 97 | second: .413138449 98 | data: 99 | first: 100 | name: _AlphaTestRef 101 | second: .5 102 | data: 103 | first: 104 | name: _Lightmapping 105 | second: 0 106 | data: 107 | first: 108 | name: _SrcBlend 109 | second: 1 110 | data: 111 | first: 112 | name: _DstBlend 113 | second: 0 114 | data: 115 | first: 116 | name: _Parallax 117 | second: .0199999996 118 | data: 119 | first: 120 | name: _ZWrite 121 | second: 1 122 | data: 123 | first: 124 | name: _Glossiness 125 | second: .150000006 126 | data: 127 | first: 128 | name: _BumpScale 129 | second: 1 130 | data: 131 | first: 132 | name: _OcclusionStrength 133 | second: 1 134 | data: 135 | first: 136 | name: _DetailNormalMapScale 137 | second: 1 138 | data: 139 | first: 140 | name: _UVSec 141 | second: 0 142 | data: 143 | first: 144 | name: _Mode 145 | second: 0 146 | data: 147 | first: 148 | name: _EmissionScaleUI 149 | second: 1 150 | data: 151 | first: 152 | name: _EmissionScale 153 | second: 1 154 | data: 155 | first: 156 | name: _DetailAlbedoMultiplier 157 | second: 2 158 | data: 159 | first: 160 | name: _UVPrim 161 | second: 0 162 | data: 163 | first: 164 | name: _DetailMode 165 | second: 0 166 | m_Colors: 167 | data: 168 | first: 169 | name: _EmissionColor 170 | second: {r: 0, g: 0, b: 0, a: .99999994} 171 | data: 172 | first: 173 | name: _Color 174 | second: {r: 1, g: 1, b: 1, a: 1} 175 | data: 176 | first: 177 | name: _SpecularColor 178 | second: {r: .242647052, g: .242647052, b: .242647052, a: 1} 179 | data: 180 | first: 181 | name: _EmissionColorUI 182 | second: {r: 0, g: 0, b: 0, a: 1} 183 | data: 184 | first: 185 | name: _EmissionColorWithMapUI 186 | second: {r: 1, g: 1, b: 1, a: 1} 187 | data: 188 | first: 189 | name: _SpecColor 190 | second: {r: .0980392173, g: .0980392173, b: .0980392173, a: 1} 191 | data: 192 | first: 193 | name: _ReflectColor 194 | second: {r: 1, g: 1, b: 1, a: .5} 195 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Materials/EthanWhite.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f62b52b2d4b721742a0bc5c6b4db468d 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aef224e1951a8274684081643c7fa672 3 | folderAsset: yes 4 | timeCreated: 1440327177 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Models/Ethan.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Standard Assets/Characters/ThirdPersonCharacter/Models/Ethan.fbx -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0de3730b71e479c47995d4a98395073e 3 | folderAsset: yes 4 | timeCreated: 1440327177 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Textures/EthanNormals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Standard Assets/Characters/ThirdPersonCharacter/Textures/EthanNormals.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Textures/EthanNormals.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b5b7be0f2332c24f89a2af018daa62d 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: .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: 4096 29 | textureSettings: 30 | filterMode: -1 31 | aniso: -1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: .5, y: .5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaIsTransparency: 0 46 | textureType: 1 47 | buildTargetSettings: [] 48 | spriteSheet: 49 | sprites: [] 50 | spritePackingTag: 51 | userData: 52 | assetBundleName: 53 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Textures/EthanOcclusion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Standard Assets/Characters/ThirdPersonCharacter/Textures/EthanOcclusion.png -------------------------------------------------------------------------------- /Assets/Standard Assets/Characters/ThirdPersonCharacter/Textures/EthanOcclusion.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e2f32e9a1fefc24092337ae061f3dbc 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: .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: 4096 29 | textureSettings: 30 | filterMode: 2 31 | aniso: 1 32 | mipBias: -1 33 | wrapMode: -1 34 | nPOTScale: 1 35 | lightmap: 0 36 | rGBM: 0 37 | compressionQuality: 50 38 | spriteMode: 0 39 | spriteExtrude: 1 40 | spriteMeshType: 1 41 | alignment: 0 42 | spritePivot: {x: .5, y: .5} 43 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 44 | spritePixelsToUnits: 100 45 | alphaIsTransparency: 0 46 | textureType: 0 47 | buildTargetSettings: [] 48 | spriteSheet: 49 | sprites: [] 50 | spritePackingTag: 51 | userData: 52 | assetBundleName: 53 | -------------------------------------------------------------------------------- /Assets/Test.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fcc47811528b4b21a1f2b9162ee7004 3 | folderAsset: yes 4 | timeCreated: 1440305458 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Test/Black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/Test/Black.png -------------------------------------------------------------------------------- /Assets/Test/Black.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 967037d02f0b44d5ebad8b9fab4df43a 3 | timeCreated: 1440342296 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: .25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 8 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: -1 34 | mipBias: -1 35 | wrapMode: -1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: .5, y: .5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 0 49 | textureType: -1 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | spritePackingTag: 54 | userData: 55 | assetBundleName: 56 | assetBundleVariant: 57 | -------------------------------------------------------------------------------- /Assets/Test/Idle.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: Idle 9 | serializedVersion: 5 10 | m_AnimatorParameters: [] 11 | m_AnimatorLayers: 12 | - serializedVersion: 5 13 | m_Name: Base Layer 14 | m_StateMachine: {fileID: 110717676} 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 &110254378 25 | AnimatorState: 26 | serializedVersion: 5 27 | m_ObjectHideFlags: 1 28 | m_PrefabParentObject: {fileID: 0} 29 | m_PrefabInternal: {fileID: 0} 30 | m_Name: HumanoidIdle 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: 1 37 | m_WriteDefaultValues: 1 38 | m_Mirror: 0 39 | m_SpeedParameterActive: 0 40 | m_MirrorParameterActive: 0 41 | m_CycleOffsetParameterActive: 0 42 | m_Motion: {fileID: 7400000, guid: dffa50cfe77e0434bbfa71245b3dd529, type: 3} 43 | m_Tag: 44 | m_SpeedParameter: 45 | m_MirrorParameter: 46 | m_CycleOffsetParameter: 47 | --- !u!1107 &110717676 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: 110254378} 57 | m_Position: {x: 326, y: 112, 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: 110254378} 68 | -------------------------------------------------------------------------------- /Assets/Test/Idle.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f25944b8cff6488baed3e2abc484d82 3 | timeCreated: 1440403041 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Moving.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0082b0b88354945fcb7117d37585d9dc 3 | timeCreated: 1440403007 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Plane.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: Plane 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, 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: _ParallaxMap 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: 2800000, guid: 967037d02f0b44d5ebad8b9fab4df43a, type: 3} 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, y: 1} 59 | m_Offset: {x: 0, 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: .5 94 | data: 95 | first: 96 | name: _Parallax 97 | second: .0199999996 98 | data: 99 | first: 100 | name: _ZWrite 101 | second: 1 102 | data: 103 | first: 104 | name: _Glossiness 105 | second: 0 106 | data: 107 | first: 108 | name: _BumpScale 109 | second: 1 110 | data: 111 | first: 112 | name: _OcclusionStrength 113 | second: 1 114 | data: 115 | first: 116 | name: _DetailNormalMapScale 117 | second: 1 118 | data: 119 | first: 120 | name: _UVSec 121 | second: 0 122 | data: 123 | first: 124 | name: _Mode 125 | second: 0 126 | data: 127 | first: 128 | name: _Metallic 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: .0922413915, g: .125, b: 0, a: 1} 139 | -------------------------------------------------------------------------------- /Assets/Test/Plane.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7f4acd096511a45839c89b562092f266 3 | timeCreated: 1440313812 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Run.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: Run 9 | serializedVersion: 5 10 | m_AnimatorParameters: [] 11 | m_AnimatorLayers: 12 | - serializedVersion: 5 13 | m_Name: Base Layer 14 | m_StateMachine: {fileID: 110717676} 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 &110256926 25 | AnimatorState: 26 | serializedVersion: 5 27 | m_ObjectHideFlags: 1 28 | m_PrefabParentObject: {fileID: 0} 29 | m_PrefabInternal: {fileID: 0} 30 | m_Name: HumanoidRun 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: 1cb8ed3cbba15f0479fbae54e0a963df, type: 3} 43 | m_Tag: 44 | m_SpeedParameter: 45 | m_MirrorParameter: 46 | m_CycleOffsetParameter: 47 | --- !u!1107 &110717676 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: 110256926} 57 | m_Position: {x: 347, y: 45, 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: 110256926} 68 | -------------------------------------------------------------------------------- /Assets/Test/Run.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 267e484c0e36d443895ed1ada3169bac 3 | timeCreated: 1440335057 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/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: 69b5681f4a80a4d728dc32f53e6456ce, 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: .5 101 | data: 102 | first: 103 | name: _Exposure 104 | second: 1 105 | data: 106 | first: 107 | name: _Metallic 108 | second: 0 109 | data: 110 | first: 111 | name: _Parallax 112 | second: .0199999996 113 | data: 114 | first: 115 | name: _ZWrite 116 | second: 1 117 | data: 118 | first: 119 | name: _Glossiness 120 | second: .5 121 | data: 122 | first: 123 | name: _BumpScale 124 | second: 1 125 | data: 126 | first: 127 | name: _OcclusionStrength 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: 90 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: .5, g: .5, b: .5, a: .5} 158 | -------------------------------------------------------------------------------- /Assets/Test/Skybox.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98217df331fc543c8ac1fbdfcf3ebbb1 3 | timeCreated: 1440322812 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Stay.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 36634d8aaff2d43db80b751ca4511313 3 | timeCreated: 1440251837 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Test/Test.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_PrefabParentObject: {fileID: 0} 8 | m_PrefabInternal: {fileID: 0} 9 | m_Name: Test 10 | m_Shader: {fileID: 4800000, guid: da73fcaab82534881adec3f5f772b88a, type: 3} 11 | m_ShaderKeywords: _NORMALMAP 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: 2, y: 2} 24 | m_Offset: {x: 0, y: 0} 25 | data: 26 | first: 27 | name: _NormalMap 28 | second: 29 | m_Texture: {fileID: 2800000, guid: 9e3930dc2759048d59ceab73bfa51f28, type: 3} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | data: 33 | first: 34 | name: _OcclusionMap 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: _PositionTex 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: _RotationTex 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: _ScaleTex 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, y: 1} 59 | m_Offset: {x: 0, y: 0} 60 | m_Floats: 61 | data: 62 | first: 63 | name: _Smoothness 64 | second: .425000012 65 | data: 66 | first: 67 | name: _Metallic 68 | second: 0 69 | data: 70 | first: 71 | name: _ColorMode 72 | second: 1 73 | data: 74 | first: 75 | name: _NormalScale 76 | second: .649999976 77 | data: 78 | first: 79 | name: _HeightToOcc 80 | second: 1.78571427 81 | data: 82 | first: 83 | name: _OccExp 84 | second: 3.33999991 85 | data: 86 | first: 87 | name: _OccToColor 88 | second: .477999985 89 | data: 90 | first: 91 | name: _OccHeight 92 | second: .560000002 93 | data: 94 | first: 95 | name: _OcclusionStr 96 | second: 1 97 | m_Colors: 98 | data: 99 | first: 100 | name: _Color 101 | second: {r: .128676489, g: .875, b: .288238466, a: 1} 102 | data: 103 | first: 104 | name: _Color2 105 | second: {r: .527511239, g: .75, b: .104779422, a: 1} 106 | -------------------------------------------------------------------------------- /Assets/Test/Test.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7711acfb2b5e944dca6694790187339c 3 | timeCreated: 1440420353 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/sIBL Archive.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 75705a8d3d62f46d8aeeb67367ab0326 3 | folderAsset: yes 4 | timeCreated: 1440421293 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/sIBL Archive/Acknowledgement.txt: -------------------------------------------------------------------------------- 1 | All image files in this directory are provided from sIBL Archive. 2 | See the following page for further details. 3 | 4 | http://www.smartibl.com/sibl/archive.html 5 | -------------------------------------------------------------------------------- /Assets/sIBL Archive/Acknowledgement.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b9edea4154c2420d8caba8c697497d2 3 | timeCreated: 1440421328 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/sIBL Archive/Etnies_Park_Center_Env.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Assets/sIBL Archive/Etnies_Park_Center_Env.hdr -------------------------------------------------------------------------------- /Assets/sIBL Archive/Etnies_Park_Center_Env.hdr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 69b5681f4a80a4d728dc32f53e6456ce 3 | timeCreated: 1440327918 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: -3 31 | maxTextureSize: 2048 32 | textureSettings: 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapMode: 1 37 | nPOTScale: 1 38 | lightmap: 0 39 | rGBM: 0 40 | compressionQuality: 50 41 | allowsAlphaSplitting: 0 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: .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 | -------------------------------------------------------------------------------- /Extra/Grass.c4d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/Extra/Grass.c4d -------------------------------------------------------------------------------- /KvantGrass.unitypackage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/KvantGrass/ea7abd1102b57e8b28895ff95b19871873bcbcfb/KvantGrass.unitypackage -------------------------------------------------------------------------------- /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/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.81000042, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: .00499999989 11 | m_DefaultContactOffset: .00999999978 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 | -------------------------------------------------------------------------------- /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: 4 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_LightmapStripping: 0 25 | m_LightmapKeepPlain: 1 26 | m_LightmapKeepDirCombined: 1 27 | m_LightmapKeepDirSeparate: 1 28 | m_LightmapKeepDynamicPlain: 1 29 | m_LightmapKeepDynamicDirCombined: 1 30 | m_LightmapKeepDynamicDirSeparate: 1 31 | m_FogStripping: 0 32 | m_FogKeepLinear: 1 33 | m_FogKeepExp: 1 34 | m_FogKeepExp2: 1 35 | -------------------------------------------------------------------------------- /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: .00100000005 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: .00100000005 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: .00100000005 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: .00100000005 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: .00100000005 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: .00100000005 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: .100000001 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: .100000001 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: .100000001 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: .189999998 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: .189999998 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: .00100000005 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: .00100000005 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: .00100000005 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: .00100000005 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: .00100000005 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: .00100000005 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: .00100000005 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.81000042} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: .200000003 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: .00999999978 17 | m_BaumgarteScale: .200000003 18 | m_BaumgarteTimeOfImpactScale: .75 19 | m_TimeToSleep: .5 20 | m_LinearSleepTolerance: .00999999978 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.2.1f1 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: 1 14 | shadowProjection: 1 15 | shadowCascades: 2 16 | shadowDistance: 40 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: .333333343 19 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669} 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 | excludedTargetPlatforms: [] 33 | m_PerPlatformDefaultQuality: 34 | Android: 0 35 | BlackBerry: 0 36 | GLES Emulation: 0 37 | Nintendo 3DS: 0 38 | PS3: 0 39 | PS4: 0 40 | PSM: 0 41 | PSP2: 0 42 | Samsung TV: 0 43 | Standalone: 0 44 | Tizen: 0 45 | WP8: 0 46 | Web: 0 47 | WebGL: 0 48 | Wii U: 0 49 | Windows Store Apps: 0 50 | XBOX360: 0 51 | XboxOne: 0 52 | iPhone: 0 53 | -------------------------------------------------------------------------------- /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: .0199999996 7 | Maximum Allowed Timestep: .333333343 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/UnityAnalyticsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!303 &1 4 | UnityAnalyticsManager: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_InitializeOnStartup: 1 8 | m_TestMode: 0 9 | m_TestEventUrl: 10 | m_TestConfigUrl: 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | KvantGrass 2 | ========== 3 | 4 | KvantGrass is an animating grass shader for Unity. 5 | 6 | ![screen](https://41.media.tumblr.com/407f2c0b0280bb2cb95bdb907573a2a4/tumblr_ntl9sjs4301qio469o1_400.png) 7 | 8 | ![animation](https://33.media.tumblr.com/9fafc9748b1f1709b9a2c810586af0d7/tumblr_ntjejw1zHe1qio469o1_400.gif) 9 | 10 | Don't expect too much! This shader might be useless for your production 11 | because of its lack of versatility. Using this just for an experiment 12 | or prototyping is better idea. 13 | 14 | System Requirements 15 | ------------------- 16 | 17 | Unity 5.1 or later versions. 18 | 19 | Compatibility 20 | ------------- 21 | 22 | KvantSwarm needs a 4-component floating-point texture format. Basically, it 23 | means it runs only on desktop/laptop-class GPUs. 24 | 25 | License 26 | ------- 27 | 28 | Copyright (C) 2015 Keijiro Takahashi 29 | 30 | Permission is hereby granted, free of charge, to any person obtaining a copy of 31 | this software and associated documentation files (the "Software"), to deal in 32 | the Software without restriction, including without limitation the rights to 33 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 34 | the Software, and to permit persons to whom the Software is furnished to do so, 35 | subject to the following conditions: 36 | 37 | The above copyright notice and this permission notice shall be included in all 38 | copies or substantial portions of the Software. 39 | 40 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 41 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 42 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 43 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 44 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 45 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 46 | --------------------------------------------------------------------------------