├── .gitattributes ├── .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 ├── Kino.meta ├── Kino │ ├── Bloom.meta │ ├── Bloom │ │ ├── Bloom.cs │ │ ├── Bloom.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── BloomEditor.cs │ │ │ └── BloomEditor.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Bloom.shader │ │ │ └── Bloom.shader.meta │ ├── Bokeh.meta │ ├── Bokeh │ │ ├── Bokeh.cs │ │ ├── Bokeh.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── BokehEditor.cs │ │ │ └── BokehEditor.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Bokeh.shader │ │ │ └── Bokeh.shader.meta │ ├── Contour.meta │ ├── Contour │ │ ├── Contour.cs │ │ ├── Contour.cs.meta │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── ContourEditor.cs │ │ │ └── ContourEditor.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Contour.shader │ │ │ └── Contour.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 │ ├── Ramp.meta │ ├── Ramp │ │ ├── Editor.meta │ │ ├── Editor │ │ │ ├── RampEditor.cs │ │ │ └── RampEditor.cs.meta │ │ ├── Ramp.cs │ │ ├── Ramp.cs.meta │ │ ├── Shader.meta │ │ └── Shader │ │ │ ├── Ramp.shader │ │ │ └── Ramp.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 ├── SkyboxPlus.meta ├── SkyboxPlus │ ├── Cubemap.shader │ ├── Cubemap.shader.meta │ ├── Editor.meta │ └── Editor │ │ ├── CubemapMaterialEditor.cs │ │ └── CubemapMaterialEditor.cs.meta ├── TextAnimation.meta ├── TextAnimation │ ├── ClassicNoise3D.cginc │ ├── ClassicNoise3D.cginc.meta │ ├── Editor.meta │ ├── Editor │ │ ├── TextModelPostprocessor.cs │ │ └── TextModelPostprocessor.cs.meta │ ├── Skybox.mat │ ├── Skybox.mat.meta │ ├── Test Text.fbx │ ├── Test Text.fbx.meta │ ├── Test.unity │ ├── Test.unity.meta │ ├── Text.anim │ ├── Text.anim.meta │ ├── Text.controller │ ├── Text.controller.meta │ ├── Text.mat │ ├── Text.mat.meta │ ├── TextAnimation.shader │ └── TextAnimation.shader.meta ├── sIBL Archive.meta └── sIBL Archive │ ├── Acknowledgement.txt │ ├── Acknowledgement.txt.meta │ ├── waterfall_Ref.exr │ └── waterfall_Ref.exr.meta ├── Extras └── Text.hiplc ├── 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 /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Library/ 2 | Temp/ 3 | 4 | *.csproj 5 | *.unityproj 6 | *.sln 7 | *.pidb 8 | *.userprefs 9 | 10 | .DS_Store 11 | *.swp 12 | -------------------------------------------------------------------------------- /Assets/ColorSuite.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 92b634cb636824bfb98b32d3fc16d5c4 3 | folderAsset: yes 4 | timeCreated: 1446884141 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/ColorSuite/ColorSuite.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) 2014, 2015 Keijiro Takahashi 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | // this software and associated documentation files (the "Software"), to deal in 6 | // the Software without restriction, including without limitation the rights to 7 | // use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | // the Software, and to permit persons to whom the Software is furnished to do so, 9 | // subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in all 12 | // copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | // FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | // COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | // 21 | using UnityEngine; 22 | using System.Collections; 23 | 24 | [ExecuteInEditMode] 25 | [ImageEffectTransformsToLDR] 26 | [RequireComponent(typeof(Camera))] 27 | [AddComponentMenu("Image Effects/Color Adjustments/Color Suite")] 28 | public class ColorSuite : MonoBehaviour 29 | { 30 | #region Public Properties 31 | 32 | // White balance. 33 | [SerializeField] float _colorTemp = 0.0f; 34 | [SerializeField] float _colorTint = 0.0f; 35 | 36 | public float colorTemp { 37 | get { return _colorTemp; } 38 | set { _colorTemp = value; } 39 | } 40 | public float colorTint { 41 | get { return _colorTint; } 42 | set { _colorTint = value; } 43 | } 44 | 45 | // Tone mapping. 46 | [SerializeField] bool _toneMapping = false; 47 | [SerializeField] float _exposure = 1.0f; 48 | 49 | public bool toneMapping { 50 | get { return _toneMapping; } 51 | set { _toneMapping = value; } 52 | } 53 | public float exposure { 54 | get { return _exposure; } 55 | set { _exposure = value; } 56 | } 57 | 58 | // Color saturation. 59 | [SerializeField] float _saturation = 1.0f; 60 | 61 | public float saturation { 62 | get { return _saturation; } 63 | set { _saturation = value; } 64 | } 65 | 66 | // Curves. 67 | [SerializeField] AnimationCurve _rCurve = AnimationCurve.Linear(0, 0, 1, 1); 68 | [SerializeField] AnimationCurve _gCurve = AnimationCurve.Linear(0, 0, 1, 1); 69 | [SerializeField] AnimationCurve _bCurve = AnimationCurve.Linear(0, 0, 1, 1); 70 | [SerializeField] AnimationCurve _cCurve = AnimationCurve.Linear(0, 0, 1, 1); 71 | 72 | public AnimationCurve redCurve { 73 | get { return _rCurve; } 74 | set { _rCurve = value; UpdateLUT(); } 75 | } 76 | public AnimationCurve greenCurve { 77 | get { return _gCurve; } 78 | set { _gCurve = value; UpdateLUT(); } 79 | } 80 | public AnimationCurve blueCurve { 81 | get { return _bCurve; } 82 | set { _bCurve = value; UpdateLUT(); } 83 | } 84 | public AnimationCurve rgbCurve { 85 | get { return _cCurve; } 86 | set { _cCurve = value; UpdateLUT(); } 87 | } 88 | 89 | // Dithering. 90 | public enum DitherMode { Off, Ordered, Triangular } 91 | [SerializeField] DitherMode _ditherMode = DitherMode.Off; 92 | 93 | public DitherMode ditherMode { 94 | get { return _ditherMode; } 95 | set { _ditherMode = value; } 96 | } 97 | 98 | #endregion 99 | 100 | #region Internal Properties 101 | 102 | // Reference to the shader. 103 | [SerializeField] Shader shader; 104 | 105 | // Temporary objects. 106 | Material _material; 107 | Texture2D _lutTexture; 108 | 109 | #endregion 110 | 111 | #region Local Functions 112 | 113 | // RGBM encoding. 114 | static Color EncodeRGBM(float r, float g, float b) 115 | { 116 | var a = Mathf.Max(Mathf.Max(r, g), Mathf.Max(b, 1e-6f)); 117 | a = Mathf.Ceil(a * 255) / 255; 118 | return new Color(r / a, g / a, b / a, a); 119 | } 120 | 121 | // An analytical model of chromaticity of the standard illuminant, by Judd et al. 122 | // http://en.wikipedia.org/wiki/Standard_illuminant#Illuminant_series_D 123 | // Slightly modifed to adjust it with the D65 white point (x=0.31271, y=0.32902). 124 | static float StandardIlluminantY(float x) 125 | { 126 | return 2.87f * x - 3.0f * x * x - 0.27509507f; 127 | } 128 | 129 | // CIE xy chromaticity to CAT02 LMS. 130 | // http://en.wikipedia.org/wiki/LMS_color_space#CAT02 131 | static Vector3 CIExyToLMS(float x, float y) 132 | { 133 | var Y = 1.0f; 134 | var X = Y * x / y; 135 | var Z = Y * (1.0f - x - y) / y; 136 | 137 | var L = 0.7328f * X + 0.4296f * Y - 0.1624f * Z; 138 | var M = -0.7036f * X + 1.6975f * Y + 0.0061f * Z; 139 | var S = 0.0030f * X + 0.0136f * Y + 0.9834f * Z; 140 | 141 | return new Vector3(L, M, S); 142 | } 143 | 144 | #endregion 145 | 146 | #region Private Methods 147 | 148 | // Set up the temporary assets. 149 | void Setup() 150 | { 151 | if (_material == null) 152 | { 153 | _material = new Material(shader); 154 | _material.hideFlags = HideFlags.DontSave; 155 | } 156 | 157 | if (_lutTexture == null) 158 | { 159 | _lutTexture = new Texture2D(512, 1, TextureFormat.ARGB32, false, true); 160 | _lutTexture.hideFlags = HideFlags.DontSave; 161 | _lutTexture.wrapMode = TextureWrapMode.Clamp; 162 | UpdateLUT(); 163 | } 164 | } 165 | 166 | // Update the LUT texture. 167 | void UpdateLUT() 168 | { 169 | for (var x = 0; x < _lutTexture.width; x++) 170 | { 171 | var u = 1.0f / (_lutTexture.width - 1) * x; 172 | var r = _cCurve.Evaluate(_rCurve.Evaluate(u)); 173 | var g = _cCurve.Evaluate(_gCurve.Evaluate(u)); 174 | var b = _cCurve.Evaluate(_bCurve.Evaluate(u)); 175 | _lutTexture.SetPixel(x, 0, EncodeRGBM(r, g, b)); 176 | } 177 | _lutTexture.Apply(); 178 | } 179 | 180 | // Calculate the color balance coefficients. 181 | Vector3 CalculateColorBalance() 182 | { 183 | // Get the CIE xy chromaticity of the reference white point. 184 | // Note: 0.31271 = x value on the D65 white point 185 | var x = 0.31271f - _colorTemp * (_colorTemp < 0.0f ? 0.1f : 0.05f); 186 | var y = StandardIlluminantY(x) + _colorTint * 0.05f; 187 | 188 | // Calculate the coefficients in the LMS space. 189 | var w1 = new Vector3(0.949237f, 1.03542f, 1.08728f); // D65 white point 190 | var w2 = CIExyToLMS(x, y); 191 | return new Vector3(w1.x / w2.x, w1.y / w2.y, w1.z / w2.z); 192 | } 193 | 194 | #endregion 195 | 196 | #region Monobehaviour Functions 197 | 198 | void Start() 199 | { 200 | Setup(); 201 | } 202 | 203 | void OnValidate() 204 | { 205 | Setup(); 206 | UpdateLUT(); 207 | } 208 | 209 | void Reset() 210 | { 211 | Setup(); 212 | UpdateLUT(); 213 | } 214 | 215 | void OnRenderImage(RenderTexture source, RenderTexture destination) 216 | { 217 | var linear = QualitySettings.activeColorSpace == ColorSpace.Linear; 218 | 219 | Setup(); 220 | 221 | if (linear) 222 | _material.EnableKeyword("COLORSPACE_LINEAR"); 223 | else 224 | _material.DisableKeyword("COLORSPACE_LINEAR"); 225 | 226 | if (_colorTemp != 0.0f || _colorTint != 0.0f) 227 | { 228 | _material.EnableKeyword("BALANCING_ON"); 229 | _material.SetVector("_Balance", CalculateColorBalance()); 230 | } 231 | else 232 | _material.DisableKeyword("BALANCING_ON"); 233 | 234 | if (_toneMapping && linear) 235 | { 236 | _material.EnableKeyword("TONEMAPPING_ON"); 237 | _material.SetFloat("_Exposure", _exposure); 238 | } 239 | else 240 | _material.DisableKeyword("TONEMAPPING_ON"); 241 | 242 | _material.SetTexture("_Curves", _lutTexture); 243 | _material.SetFloat("_Saturation", _saturation); 244 | 245 | if (_ditherMode == DitherMode.Ordered) 246 | { 247 | _material.EnableKeyword("DITHER_ORDERED"); 248 | _material.DisableKeyword("DITHER_TRIANGULAR"); 249 | } 250 | else if (_ditherMode == DitherMode.Triangular) 251 | { 252 | _material.DisableKeyword("DITHER_ORDERED"); 253 | _material.EnableKeyword("DITHER_TRIANGULAR"); 254 | } 255 | else 256 | { 257 | _material.DisableKeyword("DITHER_ORDERED"); 258 | _material.DisableKeyword("DITHER_TRIANGULAR"); 259 | } 260 | 261 | Graphics.Blit(source, destination, _material); 262 | } 263 | 264 | #endregion 265 | } 266 | -------------------------------------------------------------------------------- /Assets/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: 1446884141 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: 1446884141 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 | [ExecuteInEditMode] 26 | [RequireComponent(typeof(Camera))] 27 | [AddComponentMenu("Image Effects/Rendering/Deferred AO")] 28 | public class DeferredAO : MonoBehaviour 29 | { 30 | #region Public Properties 31 | 32 | // Effect intensity 33 | 34 | [SerializeField] 35 | float _intensity = 1; 36 | 37 | public float intensity { 38 | get { return _intensity; } 39 | set { _intensity = value; } 40 | } 41 | 42 | // Sample radius 43 | 44 | [SerializeField] 45 | float _sampleRadius = 1; 46 | 47 | public float sampleRadius { 48 | get { return _sampleRadius; } 49 | set { _sampleRadius = value; } 50 | } 51 | 52 | // Range check (rejects distant samples) 53 | 54 | [SerializeField] 55 | bool _rangeCheck = true; 56 | 57 | public bool rangeCheck { 58 | get { return _rangeCheck; } 59 | set { _rangeCheck = value; } 60 | } 61 | 62 | // Fall-off distance 63 | 64 | [SerializeField] 65 | float _fallOffDistance = 100; 66 | 67 | public float fallOffDistance { 68 | get { return _fallOffDistance; } 69 | set { _fallOffDistance = value; } 70 | } 71 | 72 | // Sample count 73 | 74 | public enum SampleCount { Low, Medium, High, Overkill } 75 | 76 | [SerializeField] 77 | SampleCount _sampleCount = SampleCount.Medium; 78 | 79 | public SampleCount sampleCount { 80 | get { return _sampleCount; } 81 | set { _sampleCount = value; } 82 | } 83 | 84 | #endregion 85 | 86 | #region Private Resources 87 | 88 | [SerializeField] 89 | Shader _shader; 90 | 91 | Material _material; 92 | 93 | bool CheckDeferredShading() 94 | { 95 | var path = GetComponent().actualRenderingPath; 96 | return path == RenderingPath.DeferredShading; 97 | } 98 | 99 | #endregion 100 | 101 | #region MonoBehaviour Functions 102 | 103 | //[ImageEffectOpaque] 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/Kino.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96d6f0c23b5b349a39907f19574573ef 3 | folderAsset: yes 4 | timeCreated: 1435811145 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ecdb90abc15fe42bca3b67047f7fd9df 3 | folderAsset: yes 4 | timeCreated: 1445666754 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Bloom.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoBloom - Bloom effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | 26 | namespace Kino 27 | { 28 | [ExecuteInEditMode] 29 | [RequireComponent(typeof(Camera))] 30 | [AddComponentMenu("Kino Image Effects/Bloom")] 31 | public class Bloom : MonoBehaviour 32 | { 33 | #region Public Properties 34 | 35 | // Bloom radius 36 | [SerializeField, Range(1, 10)] 37 | float _radius1 = 1.0f; 38 | 39 | public float radius1 { 40 | get { return _radius1; } 41 | set { _radius1 = value; } 42 | } 43 | 44 | [SerializeField, Range(1, 10)] 45 | float _radius2 = 4.0f; 46 | 47 | public float radius2 { 48 | get { return _radius2; } 49 | set { _radius2 = value; } 50 | } 51 | 52 | // Bloom intensity 53 | [SerializeField, Range(0, 1.0f)] 54 | float _intensity1 = 0.2f; 55 | 56 | public float intensity1 { 57 | get { return _intensity1; } 58 | set { _intensity1 = value; } 59 | } 60 | 61 | [SerializeField, Range(0, 1.0f)] 62 | float _intensity2 = 0.2f; 63 | 64 | public float intensity2 { 65 | get { return _intensity2; } 66 | set { _intensity2 = value; } 67 | } 68 | 69 | // Threshold 70 | [SerializeField, Range(0, 2)] 71 | float _threshold = 0.5f; 72 | 73 | public float threshold { 74 | get { return _threshold; } 75 | set { _threshold = value; } 76 | } 77 | 78 | // Temporal filtering 79 | [SerializeField, Range(0, 1.0f)] 80 | float _temporalFiltering = 0.0f; 81 | 82 | public float temporalFiltering { 83 | get { return _temporalFiltering; } 84 | set { _temporalFiltering = value; } 85 | } 86 | 87 | #endregion 88 | 89 | #region Private Properties 90 | 91 | [SerializeField] Shader _shader; 92 | Material _material; 93 | RenderTexture _accBuffer; 94 | 95 | #endregion 96 | 97 | #region MonoBehaviour Functions 98 | 99 | RenderTexture GetTempBuffer(int width, int height) 100 | { 101 | return RenderTexture.GetTemporary(width, height, 0, RenderTextureFormat.DefaultHDR); 102 | } 103 | 104 | void ReleaseTempBuffer(RenderTexture rt) 105 | { 106 | RenderTexture.ReleaseTemporary(rt); 107 | } 108 | 109 | void OnRenderImage(RenderTexture source, RenderTexture destination) 110 | { 111 | // Set up the material object. 112 | if (_material == null) 113 | { 114 | _material = new Material(_shader); 115 | _material.hideFlags = HideFlags.DontSave; 116 | } 117 | 118 | // Common options 119 | _material.SetFloat("_Intensity1", _intensity1); 120 | _material.SetFloat("_Intensity2", _intensity2); 121 | _material.SetFloat("_Threshold", _threshold); 122 | _material.SetFloat("_TempFilter", 1.0f - Mathf.Exp(_temporalFiltering * -4)); 123 | 124 | // Calculate the size of the blur buffers. 125 | var blur1Height = (int)(720 / _radius1); 126 | var blur2Height = (int)(256 / _radius2); 127 | var blur1Width = blur1Height * source.width / source.height; 128 | var blur2Width = blur2Height * source.width / source.height; 129 | 130 | // Blur image buffers 131 | RenderTexture rt1 = null, rt2 = null; 132 | 133 | // Small bloom 134 | if (_intensity1 > 0.0f) 135 | { 136 | var rt = source; 137 | 138 | // Shrink the source image with the quater downsampler 139 | while (rt.height > blur1Height * 4) 140 | { 141 | var rt_next = GetTempBuffer(rt.width / 4, rt.height / 4); 142 | Graphics.Blit(rt, rt_next, _material, 0); 143 | if (rt != source) ReleaseTempBuffer(rt); 144 | rt = rt_next; 145 | } 146 | 147 | // Allocate the blur buffer. 148 | rt1 = GetTempBuffer(blur1Width, blur1Height); 149 | 150 | // Shrink the source image and apply the threshold. 151 | Graphics.Blit(rt, rt1, _material, 1); 152 | if (rt != source) ReleaseTempBuffer(rt); 153 | 154 | // Apply the separable Gaussian filter. 155 | var rtb = GetTempBuffer(blur1Width, blur1Height); 156 | for (var i = 0; i < 2; i++) 157 | { 158 | Graphics.Blit(rt1, rtb, _material, 3); 159 | Graphics.Blit(rtb, rt1, _material, 4); 160 | } 161 | ReleaseTempBuffer(rtb); 162 | } 163 | 164 | // Large bloom 165 | if (_intensity2 > 0.0f) 166 | { 167 | var rt = source; 168 | 169 | // Shrink the source image with the quater downsampler 170 | while (rt.height > blur2Height * 4) 171 | { 172 | var rt_next = GetTempBuffer(rt.width / 4, rt.height / 4); 173 | Graphics.Blit(rt, rt_next, _material, 0); 174 | if (rt != source) ReleaseTempBuffer(rt); 175 | rt = rt_next; 176 | } 177 | 178 | // Allocate the blur buffer. 179 | rt2 = GetTempBuffer(blur2Width, blur2Height); 180 | 181 | // Shrink + thresholding + temporal filtering 182 | if (_accBuffer && _temporalFiltering > 0.0f) 183 | { 184 | _material.SetTexture("_AccTex", _accBuffer); 185 | Graphics.Blit(rt, rt2, _material, 2); 186 | } 187 | else 188 | { 189 | Graphics.Blit(rt, rt2, _material, 1); 190 | } 191 | if (rt != source) ReleaseTempBuffer(rt); 192 | 193 | // Update the accmulation buffer. 194 | if (_accBuffer) 195 | { 196 | ReleaseTempBuffer(_accBuffer); 197 | _accBuffer = null; 198 | } 199 | if (_temporalFiltering > 0.0f) 200 | { 201 | _accBuffer = GetTempBuffer(blur2Width, blur2Height); 202 | Graphics.Blit(rt2, _accBuffer); 203 | } 204 | 205 | // Apply the separable box filter repeatedly. 206 | var rtb = GetTempBuffer(blur2Width, blur2Height); 207 | for (var i = 0; i < 4; i++) 208 | { 209 | Graphics.Blit(rt2, rtb, _material, 5); 210 | Graphics.Blit(rtb, rt2, _material, 6); 211 | } 212 | ReleaseTempBuffer(rtb); 213 | } 214 | 215 | // Compositing 216 | _material.SetTexture("_Blur1Tex", rt1 ? rt1 : source); 217 | _material.SetTexture("_Blur2Tex", rt2 ? rt2 : source); 218 | Graphics.Blit(source, destination, _material, 7); 219 | 220 | // Release the blur buffers. 221 | ReleaseTempBuffer(rt1); 222 | ReleaseTempBuffer(rt2); 223 | } 224 | 225 | #endregion 226 | } 227 | } 228 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Bloom.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6363bba448bf64e60a763433f9ddf81b 3 | timeCreated: 1445671165 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 5a711a01011934ebcb58ef5ad52159d6, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e7e3e77db40c4cba83bb3a6ab440084 3 | folderAsset: yes 4 | timeCreated: 1445666764 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Editor/BloomEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoBloom - Bloom effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | using UnityEngine; 25 | using UnityEditor; 26 | 27 | namespace Kino 28 | { 29 | [CanEditMultipleObjects] 30 | [CustomEditor(typeof(Bloom))] 31 | public class Bloomditor : Editor 32 | { 33 | SerializedProperty _radius1; 34 | SerializedProperty _radius2; 35 | SerializedProperty _intensity1; 36 | SerializedProperty _intensity2; 37 | SerializedProperty _threshold; 38 | SerializedProperty _temporalFiltering; 39 | 40 | static string _configWarning = 41 | "This effect only works properly with HDR and linear rendering. " + 42 | "It's strongly recommended to enable these options."; 43 | 44 | static GUIContent _textRadius = new GUIContent("Radius"); 45 | static GUIContent _textIntensity = new GUIContent("Intensity"); 46 | 47 | bool CheckConfig() 48 | { 49 | // Check if HDR rendering is enabled. 50 | var cam = ((Bloom)target).GetComponent(); 51 | if (!cam.hdr) return false; 52 | 53 | // check if linear rendering is enabled. 54 | return QualitySettings.activeColorSpace == ColorSpace.Linear; 55 | } 56 | 57 | void OnEnable() 58 | { 59 | _radius1 = serializedObject.FindProperty("_radius1"); 60 | _radius2 = serializedObject.FindProperty("_radius2"); 61 | _intensity1 = serializedObject.FindProperty("_intensity1"); 62 | _intensity2 = serializedObject.FindProperty("_intensity2"); 63 | _threshold = serializedObject.FindProperty("_threshold"); 64 | _temporalFiltering = serializedObject.FindProperty("_temporalFiltering"); 65 | } 66 | 67 | public override void OnInspectorGUI() 68 | { 69 | serializedObject.Update(); 70 | 71 | if (!CheckConfig()) 72 | EditorGUILayout.HelpBox(_configWarning, MessageType.Warning); 73 | 74 | EditorGUILayout.LabelField("Fringe (small bloom)", EditorStyles.boldLabel); 75 | EditorGUILayout.PropertyField(_radius1, _textRadius); 76 | EditorGUILayout.PropertyField(_intensity1, _textIntensity); 77 | 78 | EditorGUILayout.Space(); 79 | 80 | EditorGUILayout.LabelField("Diffusion (large bloom)", EditorStyles.boldLabel); 81 | EditorGUILayout.PropertyField(_radius2, _textRadius); 82 | EditorGUILayout.PropertyField(_intensity2, _textIntensity); 83 | 84 | EditorGUILayout.Space(); 85 | 86 | EditorGUILayout.PropertyField(_threshold); 87 | EditorGUILayout.PropertyField(_temporalFiltering); 88 | 89 | serializedObject.ApplyModifiedProperties(); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Editor/BloomEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 036bc30d96c3349ce86bfc8d95667da7 3 | timeCreated: 1435816745 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f44dd1607e93a4131a4003b39c363e93 3 | folderAsset: yes 4 | timeCreated: 1445666764 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Shader/Bloom.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoBloom - Bloom effect 3 | // 4 | // Copyright (C) 2015 Keijiro Takahashi 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | Shader "Hidden/Kino/Bloom" 25 | { 26 | Properties 27 | { 28 | _MainTex("-", 2D) = "" {} 29 | _AccTex("-", 2D) = "" {} 30 | _Blur1Tex("-", 2D) = "" {} 31 | _Blur2Tex("-", 2D) = "" {} 32 | } 33 | 34 | CGINCLUDE 35 | 36 | #include "UnityCG.cginc" 37 | 38 | sampler2D _MainTex; 39 | float2 _MainTex_TexelSize; 40 | 41 | sampler2D _AccTex; 42 | sampler2D _Blur1Tex; 43 | sampler2D _Blur2Tex; 44 | 45 | float _Threshold; 46 | float _TempFilter; 47 | float _Intensity1; 48 | float _Intensity2; 49 | 50 | // Quarter downsampler 51 | half4 frag_downsample(v2f_img i) : SV_Target 52 | { 53 | float4 d = _MainTex_TexelSize.xyxy * float4(1, 1, -1, -1); 54 | half4 s; 55 | s = tex2D(_MainTex, i.uv + d.xy); 56 | s += tex2D(_MainTex, i.uv + d.xw); 57 | s += tex2D(_MainTex, i.uv + d.zy); 58 | s += tex2D(_MainTex, i.uv + d.zw); 59 | return s * 0.25; 60 | } 61 | 62 | // Thresholding filter 63 | half4 frag_threshold(v2f_img i) : SV_Target 64 | { 65 | half4 cs = tex2D(_MainTex, i.uv); 66 | half lm = Luminance(cs.rgb); 67 | return cs * smoothstep(_Threshold, _Threshold * 1.5, lm); 68 | } 69 | 70 | // Thresholding filter with temporal filtering 71 | half4 frag_threshold_temp(v2f_img i) : SV_Target 72 | { 73 | half4 co = frag_threshold(i); 74 | half4 cp = tex2D(_AccTex, i.uv); 75 | return lerp(co, cp, _TempFilter); 76 | } 77 | 78 | // 9-tap Gaussian filter with linear sampling 79 | // http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/ 80 | half4 gaussian_filter(float2 uv, float2 stride) 81 | { 82 | half4 s = tex2D(_MainTex, uv) * 0.227027027; 83 | 84 | float2 d1 = stride * 1.3846153846; 85 | s += tex2D(_MainTex, uv + d1) * 0.3162162162; 86 | s += tex2D(_MainTex, uv - d1) * 0.3162162162; 87 | 88 | float2 d2 = stride * 3.2307692308; 89 | s += tex2D(_MainTex, uv + d2) * 0.0702702703; 90 | s += tex2D(_MainTex, uv - d2) * 0.0702702703; 91 | 92 | return s; 93 | } 94 | 95 | half4 frag_gaussian_blur_h(v2f_img i) : SV_Target 96 | { 97 | return gaussian_filter(i.uv, float2(_MainTex_TexelSize.x, 0)); 98 | } 99 | 100 | half4 frag_gaussian_blur_v(v2f_img i) : SV_Target 101 | { 102 | return gaussian_filter(i.uv, float2(0, _MainTex_TexelSize.y)); 103 | } 104 | 105 | // 13-tap box filter with linear sampling 106 | half4 box_filter(float2 uv, float2 stride) 107 | { 108 | half4 s = tex2D(_MainTex, uv) / 2; 109 | 110 | float2 d1 = stride * 1.5; 111 | s += tex2D(_MainTex, uv + d1); 112 | s += tex2D(_MainTex, uv - d1); 113 | 114 | float2 d2 = stride * 3.5; 115 | s += tex2D(_MainTex, uv + d2); 116 | s += tex2D(_MainTex, uv - d2); 117 | 118 | float2 d3 = stride * 5.5; 119 | s += tex2D(_MainTex, uv + d3); 120 | s += tex2D(_MainTex, uv - d3); 121 | 122 | return s * 2 / 13; 123 | } 124 | 125 | half4 frag_box_blur_h(v2f_img i) : SV_Target 126 | { 127 | return box_filter(i.uv, float2(_MainTex_TexelSize.x, 0)); 128 | } 129 | 130 | half4 frag_box_blur_v(v2f_img i) : SV_Target 131 | { 132 | return box_filter(i.uv, float2(0, _MainTex_TexelSize.y)); 133 | } 134 | 135 | // Composite function 136 | half4 frag_composite(v2f_img i) : SV_Target 137 | { 138 | half4 cs = tex2D(_MainTex, i.uv); 139 | half3 c1 = LinearToGammaSpace(cs.rgb); 140 | half3 c2 = LinearToGammaSpace(tex2D(_Blur1Tex, i.uv).rgb); 141 | half3 c3 = LinearToGammaSpace(tex2D(_Blur2Tex, i.uv).rgb); 142 | half3 co = c1 + c2 * _Intensity1 + c3 * _Intensity2; 143 | return half4(GammaToLinearSpace(co), cs.a); 144 | } 145 | 146 | ENDCG 147 | SubShader 148 | { 149 | Pass 150 | { 151 | ZTest Always Cull Off ZWrite Off 152 | CGPROGRAM 153 | #pragma vertex vert_img 154 | #pragma fragment frag_downsample 155 | #pragma target 3.0 156 | ENDCG 157 | } 158 | Pass 159 | { 160 | ZTest Always Cull Off ZWrite Off 161 | CGPROGRAM 162 | #pragma vertex vert_img 163 | #pragma fragment frag_threshold 164 | #pragma target 3.0 165 | ENDCG 166 | } 167 | Pass 168 | { 169 | ZTest Always Cull Off ZWrite Off 170 | CGPROGRAM 171 | #pragma vertex vert_img 172 | #pragma fragment frag_threshold_temp 173 | #pragma target 3.0 174 | ENDCG 175 | } 176 | Pass 177 | { 178 | ZTest Always Cull Off ZWrite Off 179 | CGPROGRAM 180 | #pragma vertex vert_img 181 | #pragma fragment frag_gaussian_blur_h 182 | #pragma target 3.0 183 | ENDCG 184 | } 185 | Pass 186 | { 187 | ZTest Always Cull Off ZWrite Off 188 | CGPROGRAM 189 | #pragma vertex vert_img 190 | #pragma fragment frag_gaussian_blur_v 191 | #pragma target 3.0 192 | ENDCG 193 | } 194 | Pass 195 | { 196 | ZTest Always Cull Off ZWrite Off 197 | CGPROGRAM 198 | #pragma vertex vert_img 199 | #pragma fragment frag_box_blur_h 200 | #pragma target 3.0 201 | ENDCG 202 | } 203 | Pass 204 | { 205 | ZTest Always Cull Off ZWrite Off 206 | CGPROGRAM 207 | #pragma vertex vert_img 208 | #pragma fragment frag_box_blur_v 209 | #pragma target 3.0 210 | ENDCG 211 | } 212 | Pass 213 | { 214 | ZTest Always Cull Off ZWrite Off 215 | CGPROGRAM 216 | #pragma vertex vert_img 217 | #pragma fragment frag_composite 218 | #pragma target 3.0 219 | ENDCG 220 | } 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /Assets/Kino/Bloom/Shader/Bloom.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a711a01011934ebcb58ef5ad52159d6 3 | timeCreated: 1435809878 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/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: -------------------------------------------------------------------------------- 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 | 25 | namespace Kino 26 | { 27 | [ExecuteInEditMode, RequireComponent(typeof(Camera))] 28 | public class Bokeh : MonoBehaviour 29 | { 30 | #region Public Properties 31 | 32 | [SerializeField] 33 | Transform _subject; 34 | 35 | Transform subject { 36 | get { return _subject; } 37 | set { _subject = value; } 38 | } 39 | 40 | [SerializeField] 41 | float _distance = 10.0f; 42 | 43 | float distance { 44 | get { return _distance; } 45 | set { _distance = value; } 46 | } 47 | 48 | [SerializeField] 49 | float _fNumber = 1.4f; 50 | 51 | float fNumber { 52 | get { return _fNumber; } 53 | set { _fNumber = value; } 54 | } 55 | 56 | [SerializeField] 57 | bool _useCameraFov = true; 58 | 59 | bool useCameraFov { 60 | get { return _useCameraFov; } 61 | set { _useCameraFov = value; } 62 | } 63 | 64 | [SerializeField] 65 | float _focalLength = 0.05f; 66 | 67 | float focalLength { 68 | get { return _focalLength; } 69 | set { _focalLength = value; } 70 | } 71 | 72 | [SerializeField] 73 | float _maxBlur = 0.03f; 74 | 75 | float maxBlur { 76 | get { return _maxBlur; } 77 | set { _maxBlur = value; } 78 | } 79 | 80 | [SerializeField] 81 | float _irisAngle = 0; 82 | 83 | float irisAngle { 84 | get { return _irisAngle; } 85 | set { _irisAngle = value; } 86 | } 87 | 88 | public enum SampleCount { Low, Medium, High, UltraHigh } 89 | 90 | [SerializeField] 91 | public SampleCount _sampleCount = SampleCount.Medium; 92 | 93 | SampleCount sampleCount { 94 | get { return _sampleCount; } 95 | set { _sampleCount = value; } 96 | } 97 | 98 | [SerializeField] 99 | bool _foregroundBlur = true; 100 | 101 | bool foregroundBlur { 102 | get { return _foregroundBlur; } 103 | set { _foregroundBlur = value; } 104 | } 105 | 106 | [SerializeField] 107 | bool _visualize; 108 | 109 | #endregion 110 | 111 | #region Private Properties and Functions 112 | 113 | // Standard film width = 24mm 114 | const float filmWidth = 0.024f; 115 | 116 | [SerializeField] Shader _shader; 117 | Material _material; 118 | 119 | int SeparableBlurSteps { 120 | get { 121 | if (_sampleCount == SampleCount.Low) return 5; 122 | if (_sampleCount == SampleCount.Medium) return 10; 123 | if (_sampleCount == SampleCount.High) return 15; 124 | return 20; 125 | } 126 | } 127 | 128 | float CalculateSubjectDistance() 129 | { 130 | if (_subject == null) return _distance; 131 | var cam = GetComponent().transform; 132 | return Vector3.Dot(_subject.position - cam.position, cam.forward); 133 | } 134 | 135 | float CalculateFocalLength() 136 | { 137 | if (!_useCameraFov) return _focalLength; 138 | var fov = GetComponent().fieldOfView * Mathf.Deg2Rad; 139 | return 0.5f * filmWidth / Mathf.Tan(0.5f * fov); 140 | } 141 | 142 | void SetUpShaderKeywords() 143 | { 144 | if (_sampleCount == SampleCount.Low) 145 | { 146 | _material.DisableKeyword("BLUR_STEP10"); 147 | _material.DisableKeyword("BLUR_STEP15"); 148 | _material.DisableKeyword("BLUR_STEP20"); 149 | } 150 | else if (_sampleCount == SampleCount.Medium) 151 | { 152 | _material.EnableKeyword("BLUR_STEP10"); 153 | _material.DisableKeyword("BLUR_STEP15"); 154 | _material.DisableKeyword("BLUR_STEP20"); 155 | } 156 | else if (_sampleCount == SampleCount.High) 157 | { 158 | _material.DisableKeyword("BLUR_STEP10"); 159 | _material.EnableKeyword("BLUR_STEP15"); 160 | _material.DisableKeyword("BLUR_STEP20"); 161 | } 162 | else // SampleCount.UltraHigh 163 | { 164 | _material.DisableKeyword("BLUR_STEP10"); 165 | _material.DisableKeyword("BLUR_STEP15"); 166 | _material.EnableKeyword("BLUR_STEP20"); 167 | } 168 | 169 | if (_foregroundBlur) 170 | _material.EnableKeyword("FOREGROUND_BLUR"); 171 | else 172 | _material.DisableKeyword("FOREGROUND_BLUR"); 173 | } 174 | 175 | void SetUpShaderParameters(RenderTexture source) 176 | { 177 | var s1 = CalculateSubjectDistance(); 178 | _material.SetFloat("_SubjectDistance", s1); 179 | 180 | var f = CalculateFocalLength(); 181 | var coeff = f * f / (_fNumber * (s1 - f) * filmWidth); 182 | _material.SetFloat("_LensCoeff", coeff); 183 | 184 | var aspect = new Vector2((float)source.height / source.width, 1); 185 | _material.SetVector("_Aspect", aspect); 186 | } 187 | 188 | void SetSeparableBlurParameter(float dx, float dy) 189 | { 190 | float sin = Mathf.Sin(_irisAngle * Mathf.Deg2Rad); 191 | float cos = Mathf.Cos(_irisAngle * Mathf.Deg2Rad); 192 | var v = new Vector2(dx * cos - dy * sin, dx * sin + dy * cos); 193 | v *= _maxBlur * 0.5f / SeparableBlurSteps; 194 | _material.SetVector("_BlurDisp", v); 195 | } 196 | 197 | #endregion 198 | 199 | #region MonoBehaviour Functions 200 | 201 | void OnEnable() 202 | { 203 | var cam = GetComponent(); 204 | cam.depthTextureMode |= DepthTextureMode.Depth; 205 | } 206 | 207 | void OnRenderImage(RenderTexture source, RenderTexture destination) 208 | { 209 | if (_material == null) 210 | { 211 | _material = new Material(_shader); 212 | _material.hideFlags = HideFlags.DontSave; 213 | } 214 | 215 | // Set up the shader parameters. 216 | SetUpShaderKeywords(); 217 | SetUpShaderParameters(source); 218 | 219 | // Create temporary buffers. 220 | var rt1 = RenderTexture.GetTemporary(source.width, source.height, 0, source.format); 221 | var rt2 = RenderTexture.GetTemporary(source.width, source.height, 0, source.format); 222 | var rt3 = RenderTexture.GetTemporary(source.width, source.height, 0, source.format); 223 | 224 | // Make CoC map in alpha channel. 225 | Graphics.Blit(source, rt1, _material, 0); 226 | 227 | if (_visualize) 228 | { 229 | // CoC visualization. 230 | Graphics.Blit(rt1, destination, _material, 1); 231 | } 232 | else 233 | { 234 | // 1st separable filter: horizontal blur. 235 | SetSeparableBlurParameter(1, 0); 236 | Graphics.Blit(rt1, rt2, _material, 2); 237 | 238 | // 2nd separable filter: skewed vertical blur (left). 239 | SetSeparableBlurParameter(-0.5f, -1); 240 | Graphics.Blit(rt2, rt3, _material, 2); 241 | 242 | // 3rd separable filter: skewed vertical blur (right). 243 | SetSeparableBlurParameter(0.5f, -1); 244 | Graphics.Blit(rt2, rt1, _material, 2); 245 | 246 | // Combine the result. 247 | _material.SetTexture("_BlurTex1", rt1); 248 | _material.SetTexture("_BlurTex2", rt3); 249 | Graphics.Blit(source, destination, _material, 3); 250 | } 251 | 252 | // Release the temporary buffers. 253 | RenderTexture.ReleaseTemporary(rt1); 254 | RenderTexture.ReleaseTemporary(rt2); 255 | RenderTexture.ReleaseTemporary(rt3); 256 | } 257 | 258 | #endregion 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /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/Contour.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad134022fa3ba48619edac6738ae8229 3 | folderAsset: yes 4 | timeCreated: 1435809839 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Contour.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoContour - Contour line 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/Contour")] 30 | public class Contour : MonoBehaviour 31 | { 32 | #region Public Properties 33 | 34 | // Line color 35 | [SerializeField] 36 | Color _lineColor = Color.black; 37 | 38 | public Color lineColor { 39 | get { return _lineColor; } 40 | set { _lineColor = value; } 41 | } 42 | 43 | // Background color 44 | [SerializeField] 45 | Color _backgroundColor = new Color(1, 1, 1, 0); 46 | 47 | public Color backgroundColor { 48 | get { return _backgroundColor; } 49 | set { _backgroundColor = value; } 50 | } 51 | 52 | // Low threshold 53 | [SerializeField, Range(0, 1)] 54 | float _lowThreshold = 0.05f; 55 | 56 | public float lowThreshold { 57 | get { return _lowThreshold; } 58 | set { _lowThreshold = value; } 59 | } 60 | 61 | // High threshold 62 | [SerializeField, Range(0, 1)] 63 | float _highThreshold = 0.5f; 64 | 65 | public float highThreshold { 66 | get { return _highThreshold; } 67 | set { _highThreshold = value; } 68 | } 69 | 70 | // Depth sensitivity 71 | [SerializeField, Range(0, 2)] 72 | float _depthSensitivity = 1; 73 | 74 | public float depthSensitivity { 75 | get { return _depthSensitivity; } 76 | set { _depthSensitivity = value; } 77 | } 78 | 79 | // Normal sensitivity 80 | [SerializeField, Range(0, 1)] 81 | float _normalSensitivity = 0; 82 | 83 | public float normalSensitivity { 84 | get { return _normalSensitivity; } 85 | set { _normalSensitivity = value; } 86 | } 87 | 88 | // Depth fall-off 89 | [SerializeField] 90 | float _fallOffDepth = 40; 91 | 92 | public float fallOffDepth { 93 | get { return _fallOffDepth; } 94 | set { _fallOffDepth = value; } 95 | } 96 | 97 | #endregion 98 | 99 | #region Private Properties 100 | 101 | [SerializeField] Shader _shader; 102 | 103 | Material _material; 104 | 105 | #endregion 106 | 107 | #region MonoBehaviour Functions 108 | 109 | void OnEnable() 110 | { 111 | GetComponent().depthTextureMode |= DepthTextureMode.Depth; 112 | } 113 | 114 | void OnRenderImage(RenderTexture source, RenderTexture destination) 115 | { 116 | if (_material == null) 117 | { 118 | _material = new Material(_shader); 119 | _material.hideFlags = HideFlags.DontSave; 120 | } 121 | 122 | _material.SetColor("_Color", _lineColor); 123 | _material.SetColor("_BgColor", _backgroundColor); 124 | 125 | var hi = Mathf.Max(_lowThreshold, _highThreshold); 126 | _material.SetFloat("_LowThreshold", _lowThreshold); 127 | _material.SetFloat("_HighThreshold", hi); 128 | 129 | _material.SetFloat("_DepthSensitivity", _depthSensitivity); 130 | _material.SetFloat("_NormalSensitivity", _normalSensitivity); 131 | 132 | _material.SetFloat("_FallOffDepth", _fallOffDepth); 133 | 134 | if (_depthSensitivity > 0) 135 | _material.EnableKeyword("USE_DEPTH"); 136 | else 137 | _material.DisableKeyword("USE_DEPTH"); 138 | 139 | if (_normalSensitivity > 0) 140 | _material.EnableKeyword("USE_NORMAL"); 141 | else 142 | _material.DisableKeyword("USE_NORMAL"); 143 | 144 | Graphics.Blit(source, destination, _material); 145 | } 146 | 147 | #endregion 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Contour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6ffff0e474954f3a926daf865cc2eaa 3 | timeCreated: 1435811125 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: b8cb1cfbd02c146ccbe95b4baf27a54e, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4f4ed898044a464ba873e8e5ed44036 3 | folderAsset: yes 4 | timeCreated: 1435816558 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Editor/ContourEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoContour - Contour line 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(Contour))] 30 | public class ContourEditor : Editor 31 | { 32 | SerializedProperty _lineColor; 33 | SerializedProperty _backgroundColor; 34 | SerializedProperty _lowThreshold; 35 | SerializedProperty _highThreshold; 36 | SerializedProperty _depthSensitivity; 37 | SerializedProperty _normalSensitivity; 38 | SerializedProperty _fallOffDepth; 39 | 40 | static string useDeferredWarning = 41 | "G-buffer is required for normal edge detection. " + 42 | "Use the deferred rendering path."; 43 | 44 | bool CheckDeferred() 45 | { 46 | var cam = ((Contour)target).GetComponent(); 47 | return cam.actualRenderingPath == RenderingPath.DeferredShading; 48 | } 49 | 50 | void OnEnable() 51 | { 52 | _lineColor = serializedObject.FindProperty("_lineColor"); 53 | _backgroundColor = serializedObject.FindProperty("_backgroundColor"); 54 | _lowThreshold = serializedObject.FindProperty("_lowThreshold"); 55 | _highThreshold = serializedObject.FindProperty("_highThreshold"); 56 | _depthSensitivity = serializedObject.FindProperty("_depthSensitivity"); 57 | _normalSensitivity = serializedObject.FindProperty("_normalSensitivity"); 58 | _fallOffDepth = serializedObject.FindProperty("_fallOffDepth"); 59 | } 60 | 61 | public override void OnInspectorGUI() 62 | { 63 | serializedObject.Update(); 64 | 65 | EditorGUILayout.PropertyField(_lineColor); 66 | EditorGUILayout.PropertyField(_backgroundColor); 67 | 68 | EditorGUILayout.Space(); 69 | 70 | EditorGUILayout.PropertyField(_lowThreshold); 71 | EditorGUILayout.PropertyField(_highThreshold); 72 | 73 | EditorGUILayout.Space(); 74 | 75 | EditorGUILayout.PropertyField(_depthSensitivity); 76 | EditorGUILayout.PropertyField(_normalSensitivity); 77 | 78 | if (_normalSensitivity.floatValue > 0 && !CheckDeferred()) 79 | EditorGUILayout.HelpBox(useDeferredWarning, MessageType.Warning); 80 | 81 | EditorGUILayout.Space(); 82 | 83 | if (_depthSensitivity.hasMultipleDifferentValues || 84 | _depthSensitivity.floatValue > 0) 85 | EditorGUILayout.PropertyField(_fallOffDepth); 86 | 87 | serializedObject.ApplyModifiedProperties(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Editor/ContourEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ba0aa8258713a4b1ba10a0a1e70fc883 3 | timeCreated: 1435816745 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 82051acc29f1b481a8351d15c41bfad8 3 | folderAsset: yes 4 | timeCreated: 1435816552 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Shader/Contour.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoContour - Contour line 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/Contour" 24 | { 25 | Properties 26 | { 27 | _MainTex ("-", 2D) = "" {} 28 | _Color ("-", Color) = (0, 0, 0, 1) 29 | _BgColor ("-", Color) = (1, 1, 1, 0) 30 | } 31 | 32 | CGINCLUDE 33 | 34 | #pragma multi_compile _ USE_DEPTH 35 | #pragma multi_compile _ USE_NORMAL 36 | 37 | #include "UnityCG.cginc" 38 | 39 | sampler2D _MainTex; 40 | float2 _MainTex_TexelSize; 41 | 42 | sampler2D_float _CameraDepthTexture; 43 | sampler2D _CameraGBufferTexture2; 44 | 45 | half4 _Color; 46 | half4 _BgColor; 47 | 48 | float _LowThreshold; 49 | float _HighThreshold; 50 | 51 | float _DepthSensitivity; 52 | float _NormalSensitivity; 53 | 54 | float _FallOffDepth; 55 | 56 | half4 frag(v2f_img i) : SV_Target 57 | { 58 | float4 disp = float4(_MainTex_TexelSize.xy, -_MainTex_TexelSize.x, 0); 59 | 60 | // four sample points for the roberts cross operator 61 | float2 uv0 = i.uv; // TL 62 | float2 uv1 = i.uv + disp.xy; // BR 63 | float2 uv2 = i.uv + disp.xw; // TR 64 | float2 uv3 = i.uv + disp.wy; // BL 65 | 66 | float edge = 0; 67 | 68 | #ifdef USE_DEPTH 69 | 70 | // sample depth values 71 | float zs0 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv0); 72 | float zs1 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv1); 73 | float zs2 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv2); 74 | float zs3 = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv3); 75 | 76 | // calculate fall-off parameter from the depth of the nearest point 77 | float zm = min(min(min(zs0, zs1), zs2), zs3); 78 | float falloff = 1.0 - saturate(LinearEyeDepth(zm) / _FallOffDepth); 79 | 80 | // convert to linear depth value 81 | float z0 = Linear01Depth(zs0); 82 | float z1 = Linear01Depth(zs1); 83 | float z2 = Linear01Depth(zs2); 84 | float z3 = Linear01Depth(zs3); 85 | 86 | // roberts cross operator 87 | float zg1 = z1 - z0; 88 | float zg2 = z3 - z2; 89 | float zg = sqrt(zg1 * zg1 + zg2 * zg2); 90 | 91 | edge = zg * falloff * _DepthSensitivity / Linear01Depth(zm); 92 | 93 | #endif 94 | 95 | #ifdef USE_NORMAL 96 | 97 | // sample normal vector values from the g-buffer 98 | float3 n0 = tex2D(_CameraGBufferTexture2, uv0); 99 | float3 n1 = tex2D(_CameraGBufferTexture2, uv1); 100 | float3 n2 = tex2D(_CameraGBufferTexture2, uv2); 101 | float3 n3 = tex2D(_CameraGBufferTexture2, uv3); 102 | 103 | // roberts cross operator 104 | float3 ng1 = n1 - n0; 105 | float3 ng2 = n3 - n2; 106 | float ng = sqrt(dot(ng1, ng1) + dot(ng2, ng2)); 107 | 108 | edge = max(edge, ng * _NormalSensitivity); 109 | 110 | #endif 111 | 112 | // thresholding 113 | edge = saturate((edge - _LowThreshold) / (_HighThreshold - _LowThreshold)); 114 | 115 | half4 cs = tex2D(_MainTex, i.uv); 116 | half3 c0 = lerp(cs.rgb, _BgColor.rgb, _BgColor.a); 117 | half3 co = lerp(c0, _Color.rgb, edge * _Color.a); 118 | return half4(co, cs.a); 119 | } 120 | 121 | ENDCG 122 | SubShader 123 | { 124 | Pass 125 | { 126 | ZTest Always Cull Off ZWrite Off 127 | CGPROGRAM 128 | #pragma vertex vert_img 129 | #pragma fragment frag 130 | #pragma target 3.0 131 | ENDCG 132 | } 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /Assets/Kino/Contour/Shader/Contour.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8cb1cfbd02c146ccbe95b4baf27a54e 3 | timeCreated: 1435809878 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/Ramp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e13f3a7c552544401bd896791e7714f2 3 | folderAsset: yes 4 | timeCreated: 1441444637 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Ramp/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e4dcee7122e943f8a9643df289e9b3f 3 | folderAsset: yes 4 | timeCreated: 1441458798 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Ramp/Editor/RampEditor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoRamp - Color ramp overlay 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(Ramp))] 30 | public class RampEditor : Editor 31 | { 32 | SerializedProperty _color1; 33 | SerializedProperty _color2; 34 | SerializedProperty _angle; 35 | SerializedProperty _opacity; 36 | SerializedProperty _blendMode; 37 | SerializedProperty _debug; 38 | 39 | static GUIContent _textDebug = new GUIContent("Debug (view ramp)"); 40 | 41 | void OnEnable() 42 | { 43 | _color1 = serializedObject.FindProperty("_color1"); 44 | _color2 = serializedObject.FindProperty("_color2"); 45 | _angle = serializedObject.FindProperty("_angle"); 46 | _opacity = serializedObject.FindProperty("_opacity"); 47 | _blendMode = serializedObject.FindProperty("_blendMode"); 48 | _debug = serializedObject.FindProperty("_debug"); 49 | } 50 | 51 | public override void OnInspectorGUI() 52 | { 53 | serializedObject.Update(); 54 | 55 | EditorGUILayout.PropertyField(_color1); 56 | EditorGUILayout.PropertyField(_color2); 57 | EditorGUILayout.PropertyField(_angle); 58 | EditorGUILayout.PropertyField(_opacity); 59 | EditorGUILayout.PropertyField(_blendMode); 60 | EditorGUILayout.PropertyField(_debug, _textDebug); 61 | 62 | serializedObject.ApplyModifiedProperties(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Assets/Kino/Ramp/Editor/RampEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86e2a7ecd31f84261abe02737de9ee93 3 | timeCreated: 1441458798 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/Ramp/Ramp.cs: -------------------------------------------------------------------------------- 1 | // 2 | // KinoRamp - Color ramp overlay 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/Ramp")] 30 | public class Ramp : MonoBehaviour 31 | { 32 | #region Public Properties 33 | 34 | // first color 35 | 36 | [SerializeField] 37 | Color _color1 = Color.blue; 38 | 39 | public Color color1 { 40 | get { return _color1; } 41 | set { _color1 = value; } 42 | } 43 | 44 | // second color 45 | 46 | [SerializeField] 47 | Color _color2 = Color.red; 48 | 49 | public Color color2 { 50 | get { return _color2; } 51 | set { _color2 = value; } 52 | } 53 | 54 | // ramp angle 55 | 56 | [SerializeField, Range(-180, 180)] 57 | float _angle = 90; 58 | 59 | public float angle { 60 | get { return _angle; } 61 | set { _angle = value; } 62 | } 63 | 64 | // blend opacity 65 | 66 | [SerializeField, Range(0, 1)] 67 | float _opacity = 1; 68 | 69 | public float opacity { 70 | get { return _opacity; } 71 | set { _opacity = value; } 72 | } 73 | 74 | // blend mode 75 | 76 | public enum BlendMode { 77 | Multiply, Screen, Overlay, HardLight, SoftLight 78 | } 79 | 80 | [SerializeField] 81 | BlendMode _blendMode = BlendMode.Overlay; 82 | 83 | public BlendMode blendMode { 84 | get { return _blendMode; } 85 | set { _blendMode = value; } 86 | } 87 | 88 | // debug (show ramp) 89 | 90 | [SerializeField] 91 | bool _debug; 92 | 93 | #endregion 94 | 95 | #region Private Properties 96 | 97 | [SerializeField] Shader _shader; 98 | Material _material; 99 | 100 | static string[] _blendModeKeywords = { 101 | "_MULTIPLY", "_SCREEN", "_OVERLAY", "_HARDLIGHT", "_SOFTLIGHT" 102 | }; 103 | 104 | #endregion 105 | 106 | #region MonoBehaviour Functions 107 | 108 | void OnRenderImage(RenderTexture source, RenderTexture destination) 109 | { 110 | if (_material == null) 111 | { 112 | _material = new Material(_shader); 113 | _material.hideFlags = HideFlags.DontSave; 114 | } 115 | 116 | // color parameters 117 | Color c0; 118 | if (_blendMode == BlendMode.Multiply) 119 | c0 = Color.white; 120 | else if (_blendMode == BlendMode.Screen) 121 | c0 = Color.black; 122 | else 123 | c0 = Color.gray; 124 | 125 | var blend = _debug ? 1.0f : _opacity; 126 | _material.SetColor("_Color1", Color.Lerp(c0, _color1, blend)); 127 | _material.SetColor("_Color2", Color.Lerp(c0, _color2, blend)); 128 | 129 | // ramp direction vector 130 | var phi = Mathf.Deg2Rad * _angle; 131 | var dir = new Vector2(Mathf.Cos(phi), Mathf.Sin(phi)); 132 | _material.SetVector("_Direction", dir); 133 | 134 | // setting shader keywords 135 | _material.shaderKeywords = null; 136 | _material.EnableKeyword(_blendModeKeywords[(int)_blendMode]); 137 | 138 | if (QualitySettings.activeColorSpace == ColorSpace.Linear) 139 | _material.EnableKeyword("_LINEAR"); 140 | else 141 | _material.DisableKeyword("_LINEAR"); 142 | 143 | if (_debug) 144 | _material.EnableKeyword("_DEBUG"); 145 | else 146 | _material.DisableKeyword("_DEBUG"); 147 | 148 | Graphics.Blit(source, destination, _material, 0); 149 | } 150 | 151 | #endregion 152 | } 153 | } 154 | -------------------------------------------------------------------------------- /Assets/Kino/Ramp/Ramp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9b8e0d4b232a1475283137c73daf58a6 3 | timeCreated: 1441444662 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: 8 | - _shader: {fileID: 4800000, guid: 0eccb83e08c1a4981813863cbdebc044, type: 3} 9 | executionOrder: 0 10 | icon: {instanceID: 0} 11 | userData: 12 | assetBundleName: 13 | assetBundleVariant: 14 | -------------------------------------------------------------------------------- /Assets/Kino/Ramp/Shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a2bc701f6c56e4cc2bc699a0d5a22455 3 | folderAsset: yes 4 | timeCreated: 1441444637 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Kino/Ramp/Shader/Ramp.shader: -------------------------------------------------------------------------------- 1 | // 2 | // KinoRamp - Color ramp overlay 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/Ramp" 24 | { 25 | Properties 26 | { 27 | _MainTex ("-", 2D) = "black" {} 28 | _Color1 ("-", Color) = (0, 0, 1, 0) 29 | _Color2 ("-", Color) = (1, 0, 0, 0) 30 | _Direction ("-", Vector) = (0, 1, 0, 0) 31 | } 32 | 33 | CGINCLUDE 34 | 35 | #pragma multi_compile _MULTIPLY _SCREEN _OVERLAY _HARDLIGHT _SOFTLIGHT 36 | #pragma multi_compile _ _LINEAR 37 | #pragma multi_compile _ _DEBUG 38 | 39 | #include "UnityCG.cginc" 40 | 41 | sampler2D _MainTex; 42 | half4 _Color1; 43 | half4 _Color2; 44 | float2 _Direction; 45 | 46 | #if _LINEAR 47 | 48 | // Color space conversion between sRGB and linear space. 49 | // http://chilliant.blogspot.com/2012/08/srgb-approximations-for-hlsl.html 50 | 51 | half3 srgb_to_linear(half3 c) 52 | { 53 | return c * (c * (c * 0.305306011 + 0.682171111) + 0.012522878); 54 | } 55 | 56 | half3 linear_to_srgb(half3 c) 57 | { 58 | return max(1.055 * pow(c, 0.416666667) - 0.055, 0.0); 59 | } 60 | 61 | #endif 62 | 63 | half4 frag(v2f_img i) : SV_Target 64 | { 65 | half4 src = tex2D(_MainTex, i.uv); 66 | 67 | half3 c_a = src.rgb; 68 | half3 grad1 = _Color1.rgb; 69 | half3 grad2 = _Color2.rgb; 70 | 71 | #if _LINEAR 72 | c_a = linear_to_srgb(c_a); 73 | grad1 = linear_to_srgb(grad1); 74 | grad2 = linear_to_srgb(grad2); 75 | #endif 76 | 77 | float param = dot(i.uv - 0.5, _Direction); 78 | half3 c_b = lerp(grad1, grad2, param + 0.5); 79 | 80 | #if _DEBUG 81 | half3 c_f = c_b; 82 | 83 | #elif _MULTIPLY 84 | half3 c_f = c_a * c_b; 85 | 86 | #elif _SCREEN 87 | half3 c_f = 1.0 - (1.0 - c_a) * (1.0 - c_b); 88 | 89 | #elif _SOFTLIGHT 90 | half3 c_u = c_a * c_b * 2.0 + (1.0 - c_b * 2.0) * c_a * c_a; 91 | half3 c_d = (1.0 - c_b) * c_a * 2.0 + (c_b * 2.0 - 1.0) * sqrt(c_a); 92 | half3 c_f = lerp(c_u, c_d, c_b > 0.5); 93 | 94 | #else 95 | half3 c_u = c_a * c_b * 2.0; 96 | half3 c_d = 1.0 - (1.0 - c_a) * (1.0 - c_b) * 2.0; 97 | 98 | #if _OVERLAY 99 | half3 c_f = lerp(c_u, c_d, c_a > 0.5); 100 | 101 | #else // _HARDLIGHT 102 | half3 c_f = lerp(c_u, c_d, c_b > 0.5); 103 | 104 | #endif 105 | #endif 106 | 107 | #if _LINEAR 108 | c_f = srgb_to_linear(c_f); 109 | #endif 110 | 111 | return half4(c_f, src.a); 112 | } 113 | 114 | ENDCG 115 | 116 | SubShader 117 | { 118 | Pass 119 | { 120 | ZTest Always Cull Off ZWrite Off 121 | CGPROGRAM 122 | #pragma vertex vert_img 123 | #pragma fragment frag 124 | ENDCG 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /Assets/Kino/Ramp/Shader/Ramp.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0eccb83e08c1a4981813863cbdebc044 3 | timeCreated: 1441444640 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/SkyboxPlus.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee8b1f8a232534f5794208dc2331f425 3 | folderAsset: yes 4 | timeCreated: 1446300825 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SkyboxPlus/Cubemap.shader: -------------------------------------------------------------------------------- 1 | Shader "Skybox/Cubemap Plus" 2 | { 3 | Properties 4 | { 5 | [NoScaleOffset] _Cubemap("-", Cube) = "grey"{} 6 | _Tint("-", Color) = (.5, .5, .5) 7 | 8 | _Euler("-", Vector) = (0, 0, 0) 9 | [HideInInspector] _Rotation1("-", Vector) = (1, 0, 0) 10 | [HideInInspector] _Rotation2("-", Vector) = (0, 1, 0) 11 | [HideInInspector] _Rotation3("-", Vector) = (0, 0, 1) 12 | 13 | [Gamma] _Exposure("-", Range(0, 8)) = 1 14 | _Saturation("-", Range(0, 2)) = 1 15 | } 16 | CGINCLUDE 17 | 18 | #include "UnityCG.cginc" 19 | 20 | samplerCUBE _Cubemap; 21 | half4 _Cubemap_HDR; 22 | 23 | half4 _Tint; 24 | half _Exposure; 25 | half _Saturation; 26 | 27 | float4 _Rotation1; 28 | float4 _Rotation2; 29 | float4 _Rotation3; 30 | 31 | struct appdata_t { 32 | float4 vertex : POSITION; 33 | }; 34 | 35 | struct v2f { 36 | float4 vertex : SV_POSITION; 37 | float3 texcoord : TEXCOORD0; 38 | }; 39 | 40 | v2f vert(appdata_t v) 41 | { 42 | v2f o; 43 | float3x3 m = float3x3(_Rotation1.xyz, _Rotation2.xyz, _Rotation3.xyz); 44 | float4 vp = float4(mul(m, v.vertex.xyz), v.vertex.w); 45 | o.vertex = mul(UNITY_MATRIX_MVP, vp); 46 | o.texcoord = v.vertex.xyz; 47 | return o; 48 | } 49 | 50 | fixed4 frag(v2f i) : SV_Target 51 | { 52 | half4 tex = texCUBE(_Cubemap, i.texcoord); 53 | half3 c = DecodeHDR(tex, _Cubemap_HDR); 54 | c *= _Tint.rgb * unity_ColorSpaceDouble.rgb * _Exposure; 55 | c = lerp((half3)Luminance(c), c, _Saturation); 56 | return half4(c, 1); 57 | } 58 | 59 | ENDCG 60 | SubShader 61 | { 62 | Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" } 63 | Cull Off ZWrite Off 64 | Pass 65 | { 66 | CGPROGRAM 67 | #pragma vertex vert 68 | #pragma fragment frag 69 | ENDCG 70 | } 71 | } 72 | Fallback Off 73 | CustomEditor "SkyboxPlus.CubemapMaterialEditor" 74 | } 75 | -------------------------------------------------------------------------------- /Assets/SkyboxPlus/Cubemap.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f2a20f3ce17b84e938179dc858a385eb 3 | timeCreated: 1446300852 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SkyboxPlus/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 442c5816359b942c796d7d60c29c730a 3 | folderAsset: yes 4 | timeCreated: 1446300907 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/SkyboxPlus/Editor/CubemapMaterialEditor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | 4 | namespace SkyboxPlus 5 | { 6 | public class CubemapMaterialEditor : ShaderGUI 7 | { 8 | MaterialProperty _cubemap; 9 | MaterialProperty _tint; 10 | MaterialProperty _euler; 11 | MaterialProperty _exposure; 12 | MaterialProperty _saturation; 13 | 14 | static GUIContent _textCubemap = new GUIContent("Cubemap"); 15 | 16 | bool _initial = true; 17 | 18 | void FindProperties(MaterialProperty[] props) 19 | { 20 | _cubemap = FindProperty("_Cubemap", props); 21 | _tint = FindProperty("_Tint", props); 22 | _euler = FindProperty("_Euler", props); 23 | _exposure = FindProperty("_Exposure", props); 24 | _saturation = FindProperty("_Saturation", props); 25 | } 26 | 27 | public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties) 28 | { 29 | FindProperties(properties); 30 | if (ShaderPropertiesGUI(materialEditor) || _initial) 31 | foreach (Material m in materialEditor.targets) 32 | SetMatrix(m); 33 | _initial = false; 34 | } 35 | 36 | bool ShaderPropertiesGUI(MaterialEditor materialEditor) 37 | { 38 | EditorGUI.BeginChangeCheck(); 39 | materialEditor.TexturePropertySingleLine(_textCubemap, _cubemap, _tint); 40 | Vector3Property(materialEditor, _euler, "Rotation"); 41 | materialEditor.ShaderProperty(_exposure, "Exposure"); 42 | materialEditor.ShaderProperty(_saturation, "Saturation"); 43 | return EditorGUI.EndChangeCheck(); 44 | } 45 | 46 | static void SetMatrix(Material material) 47 | { 48 | var r = material.GetVector("_Euler"); 49 | var q = Quaternion.Euler(r.x, r.y, r.z); 50 | var m = Matrix4x4.TRS(Vector3.zero, q, Vector3.one); 51 | material.SetVector("_Rotation1", m.GetRow(0)); 52 | material.SetVector("_Rotation2", m.GetRow(1)); 53 | material.SetVector("_Rotation3", m.GetRow(2)); 54 | } 55 | 56 | void Vector3Property(MaterialEditor materialEditor, MaterialProperty prop, string label) 57 | { 58 | EditorGUI.BeginChangeCheck(); 59 | EditorGUI.showMixedValue = prop.hasMixedValue; 60 | var newValue = EditorGUILayout.Vector3Field(label, prop.vectorValue); 61 | EditorGUI.showMixedValue = false; 62 | if (EditorGUI.EndChangeCheck()) prop.vectorValue = newValue; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Assets/SkyboxPlus/Editor/CubemapMaterialEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5fc180a60c2d4b66b4de30169e4b9da 3 | timeCreated: 1446300856 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/TextAnimation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bde1acfe048444a618a9ff800d6b360b 3 | folderAsset: yes 4 | timeCreated: 1446987536 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextAnimation/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/TextAnimation/ClassicNoise3D.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7305da27570aa42a28c2cf8886dde299 3 | timeCreated: 1446824266 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19890c447c78e44d6b54b31fb2ffa5ff 3 | folderAsset: yes 4 | timeCreated: 1446820224 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Editor/TextModelPostprocessor.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEditor; 3 | using System.Collections.Generic; 4 | using System.IO; 5 | 6 | public class TextModelPostprocessor : AssetPostprocessor 7 | { 8 | void OnPostprocessModel(GameObject go) 9 | { 10 | var filename = Path.GetFileNameWithoutExtension(assetPath); 11 | if (filename.ToLower().EndsWith("text")) 12 | foreach (var meshFilter in go.GetComponentsInChildren()) 13 | ProcessMesh(meshFilter.sharedMesh); 14 | } 15 | 16 | static void ProcessMesh(Mesh mesh) 17 | { 18 | var ia_i = mesh.triangles; 19 | var vcount = ia_i.Length; 20 | 21 | // Split all the shared vertices. 22 | 23 | var va_o = new Vector3[vcount]; 24 | var na_o = new Vector3[vcount]; 25 | 26 | var va_i = mesh.vertices; 27 | var na_i = mesh.normals; 28 | 29 | for (var i = 0; i < vcount; i++) 30 | { 31 | var vi = ia_i[i]; 32 | va_o[i] = va_i[vi]; 33 | na_o[i] = na_i[vi]; 34 | } 35 | 36 | mesh.vertices = va_o; 37 | mesh.normals = na_o; 38 | 39 | // UV0 - the centroid of the triangle 40 | // UV1 - the next vertex in the triangle 41 | // UV2 - the previous vertex in the triangle 42 | 43 | var uv0 = new List(vcount); 44 | var uv1 = new List(vcount); 45 | var uv2 = new List(vcount); 46 | 47 | for (var i = 0; i < vcount; i += 3) 48 | { 49 | var v0 = va_i[ia_i[i ]]; 50 | var v1 = va_i[ia_i[i + 1]]; 51 | var v2 = va_i[ia_i[i + 2]]; 52 | 53 | var center = (v0 + v1 + v2) / 3; 54 | 55 | uv0.Add(center); 56 | uv0.Add(center); 57 | uv0.Add(center); 58 | 59 | uv1.Add(v1); 60 | uv1.Add(v2); 61 | uv1.Add(v0); 62 | 63 | uv2.Add(v2); 64 | uv2.Add(v0); 65 | uv2.Add(v1); 66 | } 67 | 68 | mesh.SetUVs(0, uv0); 69 | mesh.SetUVs(1, uv1); 70 | mesh.SetUVs(2, uv2); 71 | 72 | // Rebuild all the triangles with the split vertices. 73 | 74 | var vi2 = 0; 75 | for (var smi = 0; smi < mesh.subMeshCount; smi++) 76 | { 77 | var sia_i = mesh.GetTriangles(smi); 78 | var sia_o = new int[sia_i.Length]; 79 | for (var i = 0; i < sia_o.Length; i++) sia_o[i] = vi2++; 80 | mesh.SetTriangles(sia_o, smi); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Editor/TextModelPostprocessor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74c040e7e0fef46babd58cda4051bfbb 3 | timeCreated: 1446821852 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/TextAnimation/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: 4800000, guid: f2a20f3ce17b84e938179dc858a385eb, type: 3} 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: _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: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | data: 54 | first: 55 | name: _EmissionMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, 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 | data: 82 | first: 83 | name: _Cubemap 84 | second: 85 | m_Texture: {fileID: 8900000, guid: 6fbd3d382c17a4be492b8c9d2f054cde, type: 3} 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.20000005 105 | data: 106 | first: 107 | name: _Saturation 108 | second: .150000006 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: _Metallic 144 | second: 0 145 | m_Colors: 146 | data: 147 | first: 148 | name: _EmissionColor 149 | second: {r: 0, g: 0, b: 0, a: 1} 150 | data: 151 | first: 152 | name: _Color 153 | second: {r: 1, g: 1, b: 1, a: 1} 154 | data: 155 | first: 156 | name: _Tint 157 | second: {r: .5, g: .5, b: .5, a: 1} 158 | data: 159 | first: 160 | name: _Euler 161 | second: {r: 0, g: 0, b: 0, a: 1} 162 | data: 163 | first: 164 | name: _Rotation1 165 | second: {r: 1, g: 0, b: 0, a: 0} 166 | data: 167 | first: 168 | name: _Rotation2 169 | second: {r: 0, g: 1, b: 0, a: 0} 170 | data: 171 | first: 172 | name: _Rotation3 173 | second: {r: 0, g: 0, b: 1, a: 0} 174 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Skybox.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 73608dea8e5084b5c82f966075c5f497 3 | timeCreated: 1446879418 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Test Text.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/TextAnimation/9f402032ed0298072fc7f4b0e9672157fed4b7f1/Assets/TextAnimation/Test Text.fbx -------------------------------------------------------------------------------- /Assets/TextAnimation/Test Text.fbx.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bb4b92337b164a1fa7265125516719c 3 | timeCreated: 1446815731 4 | licenseType: Pro 5 | ModelImporter: 6 | serializedVersion: 18 7 | fileIDToRecycleName: 8 | 100000: //RootNode 9 | 400000: //RootNode 10 | 2300000: //RootNode 11 | 3300000: //RootNode 12 | 4300000: Text 13 | materials: 14 | importMaterials: 0 15 | materialName: 0 16 | materialSearch: 1 17 | animations: 18 | legacyGenerateAnimations: 4 19 | bakeSimulation: 0 20 | optimizeGameObjects: 0 21 | motionNodeName: 22 | animationImportErrors: 23 | animationImportWarnings: 24 | animationRetargetingWarnings: 25 | animationDoRetargetingWarnings: 0 26 | animationCompression: 1 27 | animationRotationError: .5 28 | animationPositionError: .5 29 | animationScaleError: .5 30 | animationWrapMode: 0 31 | extraExposedTransformPaths: [] 32 | clipAnimations: [] 33 | isReadable: 1 34 | meshes: 35 | lODScreenPercentages: [] 36 | globalScale: 100 37 | meshCompression: 0 38 | addColliders: 0 39 | importBlendShapes: 0 40 | swapUVChannels: 0 41 | generateSecondaryUV: 0 42 | useFileUnits: 1 43 | optimizeMeshForGPU: 1 44 | keepQuads: 0 45 | weldVertices: 1 46 | secondaryUVAngleDistortion: 8 47 | secondaryUVAreaDistortion: 15.000001 48 | secondaryUVHardAngle: 88 49 | secondaryUVPackMargin: 4 50 | useFileScale: 1 51 | tangentSpace: 52 | normalSmoothAngle: 0 53 | splitTangentsAcrossUV: 1 54 | normalImportMode: 1 55 | tangentImportMode: 1 56 | importAnimation: 1 57 | copyAvatar: 0 58 | humanDescription: 59 | human: [] 60 | skeleton: [] 61 | armTwist: .5 62 | foreArmTwist: .5 63 | upperLegTwist: .5 64 | legTwist: .5 65 | armStretch: .0500000007 66 | legStretch: .0500000007 67 | feetSpacing: 0 68 | rootMotionBoneName: 69 | hasTranslationDoF: 0 70 | lastHumanDescriptionAvatarSource: {instanceID: 0} 71 | animationType: 0 72 | humanoidOversampling: 1 73 | additionalBone: 0 74 | userData: 75 | assetBundleName: 76 | assetBundleVariant: 77 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Test.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | SceneSettings: 5 | m_ObjectHideFlags: 0 6 | m_PVSData: 7 | m_PVSObjectsArray: [] 8 | m_PVSPortalsArray: [] 9 | m_OcclusionBakeSettings: 10 | smallestOccluder: 5 11 | smallestHole: .25 12 | backfaceThreshold: 100 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 6 17 | m_Fog: 0 18 | m_FogColor: {r: .5, g: .5, b: .5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: .00999999978 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: .211999997, g: .226999998, b: .259000003, a: 1} 24 | m_AmbientEquatorColor: {r: .114, g: .125, b: .133000001, a: 1} 25 | m_AmbientGroundColor: {r: .0469999984, g: .0430000015, b: .0350000001, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SkyboxMaterial: {fileID: 2100000, guid: 73608dea8e5084b5c82f966075c5f497, type: 2} 29 | m_HaloStrength: .5 30 | m_FlareStrength: 1 31 | m_FlareFadeSpeed: 3 32 | m_HaloTexture: {fileID: 0} 33 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 34 | m_DefaultReflectionMode: 0 35 | m_DefaultReflectionResolution: 128 36 | m_ReflectionBounces: 1 37 | m_ReflectionIntensity: 1 38 | m_CustomReflection: {fileID: 0} 39 | m_Sun: {fileID: 0} 40 | --- !u!157 &3 41 | LightmapSettings: 42 | m_ObjectHideFlags: 0 43 | serializedVersion: 5 44 | m_GIWorkflowMode: 0 45 | m_LightmapsMode: 1 46 | m_GISettings: 47 | serializedVersion: 2 48 | m_BounceScale: 1 49 | m_IndirectOutputScale: 1 50 | m_AlbedoBoost: 1 51 | m_TemporalCoherenceThreshold: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 1 54 | m_EnableRealtimeLightmaps: 1 55 | m_LightmapEditorSettings: 56 | serializedVersion: 3 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_TextureWidth: 1024 60 | m_TextureHeight: 1024 61 | m_AOMaxDistance: 1 62 | m_Padding: 2 63 | m_CompAOExponent: 0 64 | m_LightmapParameters: {fileID: 0} 65 | m_TextureCompression: 1 66 | m_FinalGather: 0 67 | m_FinalGatherRayCount: 1024 68 | m_ReflectionCompression: 2 69 | m_LightmapSnapshot: {fileID: 0} 70 | m_RuntimeCPUUsage: 25 71 | --- !u!196 &4 72 | NavMeshSettings: 73 | serializedVersion: 2 74 | m_ObjectHideFlags: 0 75 | m_BuildSettings: 76 | serializedVersion: 2 77 | agentRadius: .5 78 | agentHeight: 2 79 | agentSlope: 45 80 | agentClimb: .400000006 81 | ledgeDropHeight: 0 82 | maxJumpAcrossDistance: 0 83 | accuratePlacement: 0 84 | minRegionArea: 2 85 | cellSize: .166666672 86 | manualCellSize: 0 87 | m_NavMeshData: {fileID: 0} 88 | --- !u!1 &623711548 89 | GameObject: 90 | m_ObjectHideFlags: 0 91 | m_PrefabParentObject: {fileID: 100000, guid: 7bb4b92337b164a1fa7265125516719c, type: 3} 92 | m_PrefabInternal: {fileID: 0} 93 | serializedVersion: 4 94 | m_Component: 95 | - 4: {fileID: 623711551} 96 | - 33: {fileID: 623711550} 97 | - 23: {fileID: 623711549} 98 | - 95: {fileID: 623711552} 99 | m_Layer: 0 100 | m_Name: Text 101 | m_TagString: Untagged 102 | m_Icon: {fileID: 0} 103 | m_NavMeshLayer: 0 104 | m_StaticEditorFlags: 0 105 | m_IsActive: 1 106 | --- !u!23 &623711549 107 | MeshRenderer: 108 | m_ObjectHideFlags: 0 109 | m_PrefabParentObject: {fileID: 2300000, guid: 7bb4b92337b164a1fa7265125516719c, 110 | type: 3} 111 | m_PrefabInternal: {fileID: 0} 112 | m_GameObject: {fileID: 623711548} 113 | m_Enabled: 1 114 | m_CastShadows: 1 115 | m_ReceiveShadows: 1 116 | m_Materials: 117 | - {fileID: 2100000, guid: 245b0d3660a96406f9734f7e595124b1, type: 2} 118 | m_SubsetIndices: 119 | m_StaticBatchRoot: {fileID: 0} 120 | m_UseLightProbes: 1 121 | m_ReflectionProbeUsage: 1 122 | m_ProbeAnchor: {fileID: 0} 123 | m_ScaleInLightmap: 1 124 | m_PreserveUVs: 0 125 | m_ImportantGI: 0 126 | m_AutoUVMaxDistance: .5 127 | m_AutoUVMaxAngle: 89 128 | m_LightmapParameters: {fileID: 0} 129 | m_SortingLayerID: 0 130 | m_SortingOrder: 0 131 | --- !u!33 &623711550 132 | MeshFilter: 133 | m_ObjectHideFlags: 0 134 | m_PrefabParentObject: {fileID: 3300000, guid: 7bb4b92337b164a1fa7265125516719c, 135 | type: 3} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 623711548} 138 | m_Mesh: {fileID: 4300000, guid: 7bb4b92337b164a1fa7265125516719c, type: 3} 139 | --- !u!4 &623711551 140 | Transform: 141 | m_ObjectHideFlags: 0 142 | m_PrefabParentObject: {fileID: 400000, guid: 7bb4b92337b164a1fa7265125516719c, type: 3} 143 | m_PrefabInternal: {fileID: 0} 144 | m_GameObject: {fileID: 623711548} 145 | m_LocalRotation: {x: 0, y: 1, z: 0, w: -1.62920685e-07} 146 | m_LocalPosition: {x: 0, y: 0, z: 0} 147 | m_LocalScale: {x: 1, y: 1, z: 1} 148 | m_Children: [] 149 | m_Father: {fileID: 0} 150 | m_RootOrder: 1 151 | --- !u!95 &623711552 152 | Animator: 153 | serializedVersion: 3 154 | m_ObjectHideFlags: 0 155 | m_PrefabParentObject: {fileID: 0} 156 | m_PrefabInternal: {fileID: 0} 157 | m_GameObject: {fileID: 623711548} 158 | m_Enabled: 1 159 | m_Avatar: {fileID: 0} 160 | m_Controller: {fileID: 9100000, guid: ad7b37986fe0c45d8a3d1a9828e46151, type: 2} 161 | m_CullingMode: 0 162 | m_UpdateMode: 0 163 | m_ApplyRootMotion: 0 164 | m_LinearVelocityBlending: 0 165 | m_WarningMessage: 166 | m_HasTransformHierarchy: 1 167 | m_AllowConstantClipSamplingOptimization: 1 168 | --- !u!1 &1523319508 169 | GameObject: 170 | m_ObjectHideFlags: 0 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 0} 173 | serializedVersion: 4 174 | m_Component: 175 | - 4: {fileID: 1523319513} 176 | - 20: {fileID: 1523319512} 177 | - 92: {fileID: 1523319511} 178 | - 124: {fileID: 1523319510} 179 | - 81: {fileID: 1523319509} 180 | - 114: {fileID: 1523319515} 181 | - 114: {fileID: 1523319520} 182 | - 114: {fileID: 1523319514} 183 | - 114: {fileID: 1523319516} 184 | - 114: {fileID: 1523319518} 185 | - 114: {fileID: 1523319517} 186 | - 114: {fileID: 1523319521} 187 | - 114: {fileID: 1523319519} 188 | m_Layer: 0 189 | m_Name: Main Camera 190 | m_TagString: MainCamera 191 | m_Icon: {fileID: 0} 192 | m_NavMeshLayer: 0 193 | m_StaticEditorFlags: 0 194 | m_IsActive: 1 195 | --- !u!81 &1523319509 196 | AudioListener: 197 | m_ObjectHideFlags: 0 198 | m_PrefabParentObject: {fileID: 0} 199 | m_PrefabInternal: {fileID: 0} 200 | m_GameObject: {fileID: 1523319508} 201 | m_Enabled: 1 202 | --- !u!124 &1523319510 203 | Behaviour: 204 | m_ObjectHideFlags: 0 205 | m_PrefabParentObject: {fileID: 0} 206 | m_PrefabInternal: {fileID: 0} 207 | m_GameObject: {fileID: 1523319508} 208 | m_Enabled: 1 209 | --- !u!92 &1523319511 210 | Behaviour: 211 | m_ObjectHideFlags: 0 212 | m_PrefabParentObject: {fileID: 0} 213 | m_PrefabInternal: {fileID: 0} 214 | m_GameObject: {fileID: 1523319508} 215 | m_Enabled: 1 216 | --- !u!20 &1523319512 217 | Camera: 218 | m_ObjectHideFlags: 0 219 | m_PrefabParentObject: {fileID: 0} 220 | m_PrefabInternal: {fileID: 0} 221 | m_GameObject: {fileID: 1523319508} 222 | m_Enabled: 1 223 | serializedVersion: 2 224 | m_ClearFlags: 2 225 | m_BackGroundColor: {r: .0767193064, g: .0783382729, b: .0808823705, a: .0196078438} 226 | m_NormalizedViewPortRect: 227 | serializedVersion: 2 228 | x: 0 229 | y: 0 230 | width: 1 231 | height: 1 232 | near clip plane: .300000012 233 | far clip plane: 300 234 | field of view: 14 235 | orthographic: 0 236 | orthographic size: 5 237 | m_Depth: -1 238 | m_CullingMask: 239 | serializedVersion: 2 240 | m_Bits: 4294967295 241 | m_RenderingPath: 3 242 | m_TargetTexture: {fileID: 0} 243 | m_TargetDisplay: 0 244 | m_TargetEye: 3 245 | m_HDR: 1 246 | m_OcclusionCulling: 0 247 | m_StereoConvergence: 10 248 | m_StereoSeparation: .0219999999 249 | m_StereoMirrorMode: 0 250 | --- !u!4 &1523319513 251 | Transform: 252 | m_ObjectHideFlags: 0 253 | m_PrefabParentObject: {fileID: 0} 254 | m_PrefabInternal: {fileID: 0} 255 | m_GameObject: {fileID: 1523319508} 256 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 257 | m_LocalPosition: {x: 0, y: 0, z: -15} 258 | m_LocalScale: {x: 1, y: 1, z: 1} 259 | m_Children: [] 260 | m_Father: {fileID: 1970356652} 261 | m_RootOrder: 0 262 | --- !u!114 &1523319514 263 | MonoBehaviour: 264 | m_ObjectHideFlags: 0 265 | m_PrefabParentObject: {fileID: 0} 266 | m_PrefabInternal: {fileID: 0} 267 | m_GameObject: {fileID: 1523319508} 268 | m_Enabled: 1 269 | m_EditorHideFlags: 0 270 | m_Script: {fileID: 11500000, guid: 2f6a516d891854931acf7fb785c812ec, type: 3} 271 | m_Name: 272 | m_EditorClassIdentifier: 273 | _intensity: 2 274 | _sampleRadius: .400000006 275 | _rangeCheck: 1 276 | _fallOffDistance: 100 277 | _sampleCount: 2 278 | _shader: {fileID: 4800000, guid: c928e16c12e994a70928a9181450d18c, type: 3} 279 | --- !u!114 &1523319515 280 | MonoBehaviour: 281 | m_ObjectHideFlags: 0 282 | m_PrefabParentObject: {fileID: 0} 283 | m_PrefabInternal: {fileID: 0} 284 | m_GameObject: {fileID: 1523319508} 285 | m_Enabled: 0 286 | m_EditorHideFlags: 0 287 | m_Script: {fileID: 11500000, guid: e6ffff0e474954f3a926daf865cc2eaa, type: 3} 288 | m_Name: 289 | m_EditorClassIdentifier: 290 | _lineColor: {r: 0, g: 0, b: 0, a: 1} 291 | _backgroundColor: {r: 1, g: 1, b: 1, a: 1} 292 | _lowThreshold: .0500000007 293 | _highThreshold: .5 294 | _depthSensitivity: 1 295 | _normalSensitivity: 1 296 | _fallOffDepth: 40 297 | _shader: {fileID: 4800000, guid: b8cb1cfbd02c146ccbe95b4baf27a54e, type: 3} 298 | --- !u!114 &1523319516 299 | MonoBehaviour: 300 | m_ObjectHideFlags: 0 301 | m_PrefabParentObject: {fileID: 0} 302 | m_PrefabInternal: {fileID: 0} 303 | m_GameObject: {fileID: 1523319508} 304 | m_Enabled: 1 305 | m_EditorHideFlags: 0 306 | m_Script: {fileID: 11500000, guid: 6363bba448bf64e60a763433f9ddf81b, type: 3} 307 | m_Name: 308 | m_EditorClassIdentifier: 309 | _radius1: 1 310 | _radius2: 4 311 | _intensity1: .100000001 312 | _intensity2: .100000001 313 | _threshold: 1 314 | _temporalFiltering: 0 315 | _shader: {fileID: 4800000, guid: 5a711a01011934ebcb58ef5ad52159d6, type: 3} 316 | --- !u!114 &1523319517 317 | MonoBehaviour: 318 | m_ObjectHideFlags: 0 319 | m_PrefabParentObject: {fileID: 0} 320 | m_PrefabInternal: {fileID: 0} 321 | m_GameObject: {fileID: 1523319508} 322 | m_Enabled: 1 323 | m_EditorHideFlags: 0 324 | m_Script: {fileID: 11500000, guid: 9e11ef96a8174459fa3d231009ff28f8, type: 3} 325 | m_Name: 326 | m_EditorClassIdentifier: 327 | _lateralShift: .300000012 328 | _axialStrength: .200000003 329 | _axialShift: .200000003 330 | _axialQuality: 0 331 | _shader: {fileID: 4800000, guid: 4e3f6504698a346cb971f9ab5286fca9, type: 3} 332 | --- !u!114 &1523319518 333 | MonoBehaviour: 334 | m_ObjectHideFlags: 0 335 | m_PrefabParentObject: {fileID: 0} 336 | m_PrefabInternal: {fileID: 0} 337 | m_GameObject: {fileID: 1523319508} 338 | m_Enabled: 1 339 | m_EditorHideFlags: 0 340 | m_Script: {fileID: 11500000, guid: 6fc18a55c333d51489e5ee49b3cbff50, type: 3} 341 | m_Name: 342 | m_EditorClassIdentifier: 343 | _falloff: .5 344 | _shader: {fileID: 4800000, guid: 89a223cbeee1935419811f8736c0a9b3, type: 3} 345 | --- !u!114 &1523319519 346 | MonoBehaviour: 347 | m_ObjectHideFlags: 0 348 | m_PrefabParentObject: {fileID: 0} 349 | m_PrefabInternal: {fileID: 0} 350 | m_GameObject: {fileID: 1523319508} 351 | m_Enabled: 1 352 | m_EditorHideFlags: 0 353 | m_Script: {fileID: 11500000, guid: 10593b7d510b64560a297a8af1356dcb, type: 3} 354 | m_Name: 355 | m_EditorClassIdentifier: 356 | _colorTemp: -.180000007 357 | _colorTint: 0 358 | _toneMapping: 1 359 | _exposure: 1.08000004 360 | _saturation: 1 361 | _rCurve: 362 | serializedVersion: 2 363 | m_Curve: 364 | - time: 0 365 | value: 0 366 | inSlope: 0 367 | outSlope: 1 368 | tangentMode: 0 369 | - time: 1 370 | value: 1 371 | inSlope: 1 372 | outSlope: 0 373 | tangentMode: 0 374 | m_PreInfinity: 2 375 | m_PostInfinity: 2 376 | _gCurve: 377 | serializedVersion: 2 378 | m_Curve: 379 | - time: 0 380 | value: 0 381 | inSlope: 0 382 | outSlope: 1 383 | tangentMode: 0 384 | - time: 1 385 | value: 1 386 | inSlope: 1 387 | outSlope: 0 388 | tangentMode: 0 389 | m_PreInfinity: 2 390 | m_PostInfinity: 2 391 | _bCurve: 392 | serializedVersion: 2 393 | m_Curve: 394 | - time: 0 395 | value: 0 396 | inSlope: 0 397 | outSlope: 1 398 | tangentMode: 0 399 | - time: 1 400 | value: 1 401 | inSlope: 1 402 | outSlope: 0 403 | tangentMode: 0 404 | m_PreInfinity: 2 405 | m_PostInfinity: 2 406 | _cCurve: 407 | serializedVersion: 2 408 | m_Curve: 409 | - time: 0 410 | value: 0 411 | inSlope: 0 412 | outSlope: 1 413 | tangentMode: 0 414 | - time: 1 415 | value: 1 416 | inSlope: 1 417 | outSlope: 0 418 | tangentMode: 0 419 | m_PreInfinity: 2 420 | m_PostInfinity: 2 421 | _ditherMode: 0 422 | shader: {fileID: 4800000, guid: dc9775b65c52747e69fc4c854c00d696, type: 3} 423 | --- !u!114 &1523319520 424 | MonoBehaviour: 425 | m_ObjectHideFlags: 0 426 | m_PrefabParentObject: {fileID: 0} 427 | m_PrefabInternal: {fileID: 0} 428 | m_GameObject: {fileID: 1523319508} 429 | m_Enabled: 1 430 | m_EditorHideFlags: 0 431 | m_Script: {fileID: 11500000, guid: 9b8e0d4b232a1475283137c73daf58a6, type: 3} 432 | m_Name: 433 | m_EditorClassIdentifier: 434 | _color1: {r: .394679964, g: .394679964, b: .536764741, a: 1} 435 | _color2: {r: 1, g: .665720105, b: .242647052, a: 1} 436 | _angle: 68 437 | _opacity: .423000008 438 | _blendMode: 2 439 | _debug: 0 440 | _shader: {fileID: 4800000, guid: 0eccb83e08c1a4981813863cbdebc044, type: 3} 441 | --- !u!114 &1523319521 442 | MonoBehaviour: 443 | m_ObjectHideFlags: 0 444 | m_PrefabParentObject: {fileID: 0} 445 | m_PrefabInternal: {fileID: 0} 446 | m_GameObject: {fileID: 1523319508} 447 | m_Enabled: 1 448 | m_EditorHideFlags: 0 449 | m_Script: {fileID: 11500000, guid: 7c8d76155f53cfc45b4f02922de468b3, type: 3} 450 | m_Name: 451 | m_EditorClassIdentifier: 452 | _subject: {fileID: 0} 453 | _distance: 15 454 | _fNumber: 1 455 | _useCameraFov: 1 456 | _focalLength: .0500000007 457 | _maxBlur: .0299999993 458 | _irisAngle: 0 459 | _sampleCount: 1 460 | _foregroundBlur: 1 461 | _visualize: 0 462 | _shader: {fileID: 4800000, guid: b99c58356816f7b46818fe7e788b2fa1, type: 3} 463 | --- !u!1 &1970356651 464 | GameObject: 465 | m_ObjectHideFlags: 0 466 | m_PrefabParentObject: {fileID: 0} 467 | m_PrefabInternal: {fileID: 0} 468 | serializedVersion: 4 469 | m_Component: 470 | - 4: {fileID: 1970356652} 471 | m_Layer: 0 472 | m_Name: Camera Pivot 473 | m_TagString: Untagged 474 | m_Icon: {fileID: 0} 475 | m_NavMeshLayer: 0 476 | m_StaticEditorFlags: 0 477 | m_IsActive: 1 478 | --- !u!4 &1970356652 479 | Transform: 480 | m_ObjectHideFlags: 0 481 | m_PrefabParentObject: {fileID: 0} 482 | m_PrefabInternal: {fileID: 0} 483 | m_GameObject: {fileID: 1970356651} 484 | m_LocalRotation: {x: .082131207, y: .333355993, z: -.0291648731, w: .938763976} 485 | m_LocalPosition: {x: 0, y: 0, z: 0} 486 | m_LocalScale: {x: 1, y: 1, z: 1} 487 | m_Children: 488 | - {fileID: 1523319513} 489 | m_Father: {fileID: 0} 490 | m_RootOrder: 0 491 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Test.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3877bebaff58c456c82a97141b33d3df 3 | timeCreated: 1446824721 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Text.anim: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!74 &7400000 4 | AnimationClip: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 0} 8 | m_Name: Text 9 | serializedVersion: 6 10 | m_Legacy: 0 11 | m_Compressed: 0 12 | m_UseHighQualityCurve: 1 13 | m_RotationCurves: [] 14 | m_CompressedRotationCurves: [] 15 | m_PositionCurves: [] 16 | m_ScaleCurves: [] 17 | m_FloatCurves: 18 | - curve: 19 | serializedVersion: 2 20 | m_Curve: 21 | - time: 0 22 | value: 0 23 | inSlope: 1.66666663 24 | outSlope: 1.66666663 25 | tangentMode: 21 26 | - time: 3 27 | value: 5 28 | inSlope: 1.66666663 29 | outSlope: -0 30 | tangentMode: 21 31 | - time: 4 32 | value: 5 33 | inSlope: 0 34 | outSlope: -1.66666663 35 | tangentMode: 21 36 | - time: 7 37 | value: 0 38 | inSlope: -1.66666663 39 | outSlope: -0 40 | tangentMode: 21 41 | - time: 7.5 42 | value: 0 43 | inSlope: 0 44 | outSlope: 0 45 | tangentMode: 5 46 | m_PreInfinity: 2 47 | m_PostInfinity: 2 48 | attribute: material._Transition 49 | path: 50 | classID: 23 51 | script: {fileID: 0} 52 | m_PPtrCurves: [] 53 | m_SampleRate: 60 54 | m_WrapMode: 0 55 | m_Bounds: 56 | m_Center: {x: 0, y: 0, z: 0} 57 | m_Extent: {x: 0, y: 0, z: 0} 58 | m_ClipBindingConstant: 59 | genericBindings: 60 | - path: 0 61 | attribute: 2332251378 62 | script: {fileID: 0} 63 | classID: 23 64 | customType: 22 65 | isPPtrCurve: 0 66 | pptrCurveMapping: [] 67 | m_AnimationClipSettings: 68 | serializedVersion: 2 69 | m_StartTime: 0 70 | m_StopTime: 7.5 71 | m_OrientationOffsetY: 0 72 | m_Level: 0 73 | m_CycleOffset: 0 74 | m_LoopTime: 1 75 | m_LoopBlend: 0 76 | m_LoopBlendOrientation: 0 77 | m_LoopBlendPositionY: 0 78 | m_LoopBlendPositionXZ: 0 79 | m_KeepOriginalOrientation: 0 80 | m_KeepOriginalPositionY: 1 81 | m_KeepOriginalPositionXZ: 0 82 | m_HeightFromFeet: 0 83 | m_Mirror: 0 84 | m_EditorCurves: 85 | - curve: 86 | serializedVersion: 2 87 | m_Curve: 88 | - time: 0 89 | value: 0 90 | inSlope: 1.66666663 91 | outSlope: 1.66666663 92 | tangentMode: 21 93 | - time: 3 94 | value: 5 95 | inSlope: 1.66666663 96 | outSlope: -0 97 | tangentMode: 21 98 | - time: 4 99 | value: 5 100 | inSlope: 0 101 | outSlope: -1.66666663 102 | tangentMode: 21 103 | - time: 7 104 | value: 0 105 | inSlope: -1.66666663 106 | outSlope: -0 107 | tangentMode: 21 108 | - time: 7.5 109 | value: 0 110 | inSlope: 0 111 | outSlope: 0 112 | tangentMode: 5 113 | m_PreInfinity: 2 114 | m_PostInfinity: 2 115 | attribute: material._Transition 116 | path: 117 | classID: 23 118 | script: {fileID: 0} 119 | m_EulerEditorCurves: [] 120 | m_HasGenericRootTransform: 0 121 | m_HasMotionFloatCurves: 0 122 | m_GenerateMotionCurves: 0 123 | m_Events: [] 124 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Text.anim.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 44cc59b2d9617426ba0a546f5ee4b133 3 | timeCreated: 1447081782 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Text.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: Text 9 | serializedVersion: 5 10 | m_AnimatorParameters: [] 11 | m_AnimatorLayers: 12 | - serializedVersion: 5 13 | m_Name: Base Layer 14 | m_StateMachine: {fileID: 110786270} 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 &110244220 25 | AnimatorState: 26 | serializedVersion: 5 27 | m_ObjectHideFlags: 1 28 | m_PrefabParentObject: {fileID: 0} 29 | m_PrefabInternal: {fileID: 0} 30 | m_Name: Text 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: 44cc59b2d9617426ba0a546f5ee4b133, type: 2} 43 | m_Tag: 44 | m_SpeedParameter: 45 | m_MirrorParameter: 46 | m_CycleOffsetParameter: 47 | --- !u!1107 &110786270 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: 110244220} 57 | m_Position: {x: 200, y: 0, z: 0} 58 | m_ChildStateMachines: [] 59 | m_AnyStateTransitions: [] 60 | m_EntryTransitions: [] 61 | m_StateMachineTransitions: {} 62 | m_StateMachineBehaviours: [] 63 | m_AnyStatePosition: {x: 50, y: 20, z: 0} 64 | m_EntryPosition: {x: 50, y: 120, z: 0} 65 | m_ExitPosition: {x: 800, y: 120, z: 0} 66 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} 67 | m_DefaultState: {fileID: 110244220} 68 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Text.controller.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad7b37986fe0c45d8a3d1a9828e46151 3 | timeCreated: 1447081782 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Text.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: Text 10 | m_Shader: {fileID: 4800000, guid: ee541a60e4c94447faab79005dd4c9d9, type: 3} 11 | m_ShaderKeywords: 12 | m_LightmapFlags: 5 13 | m_CustomRenderQueue: 2000 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | data: 19 | first: 20 | name: _MainTex 21 | second: 22 | m_Texture: {fileID: 0} 23 | m_Scale: {x: 1, y: 1} 24 | m_Offset: {x: 0, y: 0} 25 | data: 26 | first: 27 | name: _BumpMap 28 | second: 29 | m_Texture: {fileID: 0} 30 | m_Scale: {x: 1, y: 1} 31 | m_Offset: {x: 0, y: 0} 32 | data: 33 | first: 34 | name: _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: 0} 51 | m_Scale: {x: 1, y: 1} 52 | m_Offset: {x: 0, y: 0} 53 | data: 54 | first: 55 | name: _EmissionMap 56 | second: 57 | m_Texture: {fileID: 0} 58 | m_Scale: {x: 1, 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: .824999988 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: 1 130 | data: 131 | first: 132 | name: _Amplitude 133 | second: 2 134 | data: 135 | first: 136 | name: _Transition 137 | second: 2.5 138 | data: 139 | first: 140 | name: _Duration 141 | second: 2 142 | data: 143 | first: 144 | name: _Rotation 145 | second: 20.6700001 146 | data: 147 | first: 148 | name: _Twist 149 | second: 27.0499992 150 | data: 151 | first: 152 | name: _Speed 153 | second: 2.9000001 154 | data: 155 | first: 156 | name: _ScaleCurve 157 | second: 2 158 | data: 159 | first: 160 | name: _RotationNoise 161 | second: 1 162 | data: 163 | first: 164 | name: _TNoiseAmp 165 | second: 1 166 | data: 167 | first: 168 | name: _TNoiseFreq 169 | second: 2 170 | data: 171 | first: 172 | name: _WaveAmp 173 | second: .600000024 174 | data: 175 | first: 176 | name: _WaveFreq 177 | second: 1.25 178 | data: 179 | first: 180 | name: _WaveSpeed 181 | second: 1 182 | data: 183 | first: 184 | name: _TNoiseRatio 185 | second: 1 186 | data: 187 | first: 188 | name: _NoiseAmp 189 | second: 1.5 190 | data: 191 | first: 192 | name: _NoiseCurve 193 | second: 8 194 | data: 195 | first: 196 | name: _NoiseFreq 197 | second: .300000012 198 | m_Colors: 199 | data: 200 | first: 201 | name: _EmissionColor 202 | second: {r: 0, g: 0, b: 0, a: 1} 203 | data: 204 | first: 205 | name: _Color 206 | second: {r: 1, g: 1, b: 1, a: 1} 207 | data: 208 | first: 209 | name: _NoiseVel 210 | second: {r: .699999988, g: 1, b: 0, a: 0} 211 | -------------------------------------------------------------------------------- /Assets/TextAnimation/Text.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 245b0d3660a96406f9734f7e595124b1 3 | timeCreated: 1446824548 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/TextAnimation/TextAnimation.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/TextAnimation" 2 | { 3 | Properties 4 | { 5 | _Color("Color", Color) = (1, 1, 1, 1) 6 | _Glossiness("Smoothness", Range(0, 1)) = 0.5 7 | _Metallic("Metallic", Range(0, 1)) = 0.0 8 | 9 | [Header(Transition)] 10 | _Duration("Duration", Float) = 2 11 | _Speed("Speed", Float) = 1 12 | _Transition("Current Time", Float) = 0.5 13 | 14 | [Header(Twisting)] 15 | _Twist("Twisting Angle", Float) = 3.14 16 | _TNoiseRatio("Noise Ratio", Range(0, 1)) = 1 17 | _TNoiseFreq("Noise Frequency", Float) = 2 18 | 19 | [Header(Noise)] 20 | _NoiseAmp("Noise Amplitude", Float) = 0.75 21 | _NoiseCurve("Amplitude Curve", Float) = 15 22 | _NoiseFreq("Noise Frequency", Float) = 0.5 23 | _NoiseVel("Noise Velocity", Vector) = (0.7, 1, 0, 0) 24 | 25 | [Header(Waving)] 26 | _WaveAmp("Wave Height", Float) = 0.6 27 | _WaveFreq("Wave Frequency", Float) = 1.25 28 | _WaveSpeed("Wave Speed", Float) = 1 29 | 30 | [Space] 31 | _ScaleCurve("Scale Curve", Float) = 10 32 | } 33 | SubShader 34 | { 35 | Tags { "RenderType"="Opaque" } 36 | 37 | CGPROGRAM 38 | 39 | #pragma surface surf Standard vertex:vert nolightmap 40 | #pragma target 3.0 41 | 42 | #include "ClassicNoise3D.cginc" 43 | 44 | struct Input 45 | { 46 | float2 uv_MainTex; 47 | }; 48 | 49 | half _Glossiness; 50 | half _Metallic; 51 | half4 _Color; 52 | 53 | float _Duration; 54 | float _Speed; 55 | float _Transition; 56 | 57 | float _Twist; 58 | float _TNoiseRatio; 59 | float _TNoiseFreq; 60 | 61 | float _NoiseAmp; 62 | float _NoiseCurve; 63 | float _NoiseFreq; 64 | float3 _NoiseVel; 65 | 66 | float _WaveAmp; 67 | float _WaveFreq; 68 | float _WaveSpeed; 69 | 70 | float _ScaleCurve; 71 | 72 | float nrand(float2 uv) 73 | { 74 | return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453); 75 | } 76 | 77 | float3 displace(float3 p, float2x2 mtx) 78 | { 79 | // random vector 80 | float rx = nrand(p.xy + p.zx); 81 | float ry = nrand(p.yz + p.xy + float2(3.1, 4.2)); 82 | float rz = nrand(p.zx - p.yz + float2(5.3, 5.1)); 83 | float3 rv = float3(rx, ry, rz) * 2 - 1; 84 | 85 | // tweak distribution 86 | rv = normalize(rv) * pow(nrand(p.xx + p.yz) , _NoiseCurve); 87 | 88 | // noise field 89 | float3 np = p * _NoiseFreq + _NoiseVel * _Time.y; 90 | float ns = max(cnoise(np), 0) * _NoiseAmp; 91 | 92 | // waving 93 | float wv = sin(p.x * _WaveFreq + _Time.y * _WaveSpeed) * _WaveAmp; 94 | 95 | // applying the rotation matrix 96 | p.yz = mul(mtx, p.yz); 97 | 98 | // composite 99 | return p + rv * ns + float3(0, 0, wv); 100 | } 101 | 102 | void vert(inout appdata_full v, out Input data) 103 | { 104 | UNITY_INITIALIZE_OUTPUT(Input, data); 105 | 106 | float3 p0 = v.vertex.xyz; // this vertex 107 | float3 pc = v.texcoord.xyz; // centroid 108 | float3 p1 = v.texcoord1.xyz; // next vertex 109 | float3 p2 = v.texcoord2.xyz; // prev vertex 110 | 111 | // time parameter 112 | float t = min(_Transition / _Duration - abs(pc.x) / _Speed, 1.0); 113 | 114 | // twisting angle 115 | float tw = lerp(_Twist, 0, t); 116 | tw *= lerp(1, cnoise(pc * _TNoiseFreq), _TNoiseRatio); 117 | 118 | // scaling factor 119 | float sc = 1 - pow(1 - max(t, 0), _ScaleCurve); 120 | 121 | // rotation matrix 122 | float snr, csr; 123 | sincos(tw, snr, csr); 124 | float2x2 mtx = float2x2(csr, -snr, snr, csr); 125 | 126 | // displace the vertices 127 | p0 = displace(p0, mtx); 128 | pc = displace(pc, mtx); 129 | p1 = displace(p1, mtx); 130 | p2 = displace(p2, mtx); 131 | 132 | // write back to the vertex 133 | v.vertex.xyz = lerp(pc, p0, sc); 134 | v.normal = normalize(cross(p1 - p0, p2 - p0)); 135 | } 136 | 137 | void surf(Input IN, inout SurfaceOutputStandard o) 138 | { 139 | o.Albedo = _Color.rgb; 140 | o.Metallic = _Metallic; 141 | o.Smoothness = _Glossiness; 142 | } 143 | 144 | ENDCG 145 | } 146 | FallBack "Diffuse" 147 | } 148 | -------------------------------------------------------------------------------- /Assets/TextAnimation/TextAnimation.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ee541a60e4c94447faab79005dd4c9d9 3 | timeCreated: 1446823656 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/sIBL Archive.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b616f12653f8c4fdea36b60ea3592596 3 | folderAsset: yes 4 | timeCreated: 1446987507 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: 6e4dd1a4403164eb3b404d22a616c8e3 3 | timeCreated: 1446987515 4 | licenseType: Pro 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/sIBL Archive/waterfall_Ref.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keijiro/TextAnimation/9f402032ed0298072fc7f4b0e9672157fed4b7f1/Assets/sIBL Archive/waterfall_Ref.exr -------------------------------------------------------------------------------- /Assets/sIBL Archive/waterfall_Ref.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6fbd3d382c17a4be492b8c9d2f054cde 3 | timeCreated: 1446879384 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: 7 | 8900000: generatedCubemap 8 | serializedVersion: 2 9 | mipmaps: 10 | mipMapMode: 0 11 | enableMipMap: 1 12 | linearTexture: 0 13 | correctGamma: 0 14 | fadeOut: 0 15 | borderMipMap: 0 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: .25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | grayScaleToAlpha: 0 25 | generateCubemap: 6 26 | cubemapConvolution: 0 27 | cubemapConvolutionSteps: 8 28 | cubemapConvolutionExponent: 1.5 29 | seamlessCubemap: 0 30 | textureFormat: -1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | filterMode: -1 34 | aniso: -1 35 | mipBias: -1 36 | wrapMode: 1 37 | nPOTScale: 1 38 | lightmap: 0 39 | rGBM: 0 40 | compressionQuality: 50 41 | allowsAlphaSplitting: 0 42 | spriteMode: 0 43 | spriteExtrude: 1 44 | spriteMeshType: 1 45 | alignment: 0 46 | spritePivot: {x: .5, y: .5} 47 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 48 | spritePixelsToUnits: 100 49 | alphaIsTransparency: 0 50 | textureType: 3 51 | buildTargetSettings: [] 52 | spriteSheet: 53 | sprites: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /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.2f1 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 | # TextAnimation 2 | 3 | A prototype of text animation shader 4 | 5 | ![gif](http://33.media.tumblr.com/c162cc9841f09f58126edbc5129d1a3c/tumblr_nxhuscM7qJ1qio469o1_400.gif) 6 | ![gif](http://33.media.tumblr.com/11727db1165e885c0b288195c4059b4e/tumblr_nxhl02wvnQ1qio469o1_400.gif) 7 | ![gif](http://33.media.tumblr.com/f15e5c652234627fd1028552e6a25e09/tumblr_nxehycihNc1qio469o1_400.gif) 8 | --------------------------------------------------------------------------------