├── .gitignore ├── Assets ├── Editor.meta ├── Editor │ ├── ImageEffects.meta │ └── ImageEffects │ │ ├── TonemappingEditor.cs │ │ └── TonemappingEditor.cs.meta ├── Models.meta ├── Models │ ├── Terrain.meta │ └── Terrain │ │ ├── Cliffs.meta │ │ ├── Cliffs │ │ ├── TiledCliffs_01_Diff.png │ │ └── TiledCliffs_01_Diff.png.meta │ │ ├── MountainPeaks.meta │ │ └── MountainPeaks │ │ ├── Materials.meta │ │ ├── Materials │ │ ├── MountainPeak_01.mat │ │ └── MountainPeak_01.mat.meta │ │ ├── MountainPeak_01.FBX │ │ ├── MountainPeak_01.FBX.meta │ │ ├── MountainPeak_01_NM.png │ │ └── MountainPeak_01_NM.png.meta ├── Prefabs.meta ├── Prefabs │ ├── Mountains.prefab │ └── Mountains.prefab.meta ├── Resources.meta ├── Resources │ ├── NoiseVolume.bytes │ └── NoiseVolume.bytes.meta ├── Scripts.meta ├── Scripts │ ├── VolumetricLight.cs │ ├── VolumetricLight.cs.meta │ ├── VolumetricLightRenderer.cs │ └── VolumetricLightRenderer.cs.meta ├── Shaders.meta ├── Shaders │ ├── BilateralBlur.shader │ ├── BilateralBlur.shader.meta │ ├── BlitAdd.shader │ ├── BlitAdd.shader.meta │ ├── VolumetricLight.shader │ └── VolumetricLight.shader.meta ├── Standard Assets.meta ├── Standard Assets │ ├── Effects.meta │ └── Effects │ │ ├── ImageEffects.meta │ │ └── ImageEffects │ │ ├── Scripts.meta │ │ ├── Scripts │ │ ├── PostEffectsBase.cs │ │ ├── PostEffectsBase.cs.meta │ │ ├── Tonemapping.cs │ │ └── Tonemapping.cs.meta │ │ ├── Shaders.meta │ │ └── Shaders │ │ ├── Tonemapper.shader │ │ └── Tonemapper.shader.meta ├── Textures.meta ├── Textures │ ├── spot.png │ └── spot.png.meta ├── example.unity ├── example.unity.meta ├── spotlight.unity ├── spotlight.unity.meta ├── sun-fog.unity ├── sun-fog.unity.meta ├── sun-haze.unity ├── sun-haze.unity.meta ├── sun-height-fog.unity └── sun-height-fog.unity.meta ├── LICENSE ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityAdsSettings.asset └── UnityConnectSettings.asset └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.sln 2 | Library 3 | Temp 4 | *.suo 5 | *.csproj -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 798ec66dcec719b44a9a1660c6836796 3 | folderAsset: yes 4 | timeCreated: 1460465907 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor/ImageEffects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 09dc73a0f7e7c1d41992d8d3efac815d 3 | folderAsset: yes 4 | timeCreated: 1460409823 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Editor/ImageEffects/TonemappingEditor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | namespace UnityStandardAssets.ImageEffects 6 | { 7 | [CustomEditor (typeof(Tonemapping))] 8 | class TonemappingEditor : Editor 9 | { 10 | SerializedObject serObj; 11 | 12 | SerializedProperty type; 13 | 14 | // CURVE specific parameter 15 | SerializedProperty remapCurve; 16 | 17 | SerializedProperty exposureAdjustment; 18 | 19 | // REINHARD specific parameter 20 | SerializedProperty middleGrey; 21 | SerializedProperty white; 22 | SerializedProperty adaptionSpeed; 23 | SerializedProperty adaptiveTextureSize; 24 | 25 | void OnEnable () { 26 | serObj = new SerializedObject (target); 27 | 28 | type = serObj.FindProperty ("type"); 29 | remapCurve = serObj.FindProperty ("remapCurve"); 30 | exposureAdjustment = serObj.FindProperty ("exposureAdjustment"); 31 | middleGrey = serObj.FindProperty ("middleGrey"); 32 | white = serObj.FindProperty ("white"); 33 | adaptionSpeed = serObj.FindProperty ("adaptionSpeed"); 34 | adaptiveTextureSize = serObj.FindProperty("adaptiveTextureSize"); 35 | } 36 | 37 | 38 | public override void OnInspectorGUI () { 39 | serObj.Update (); 40 | 41 | GUILayout.Label("Mapping HDR to LDR ranges since 1982", EditorStyles.miniLabel); 42 | 43 | Camera cam = (target as Tonemapping).GetComponent(); 44 | if (cam != null) { 45 | if (!cam.hdr) { 46 | EditorGUILayout.HelpBox("The camera is not HDR enabled. This will likely break the Tonemapper.", MessageType.Warning); 47 | } 48 | else if (!(target as Tonemapping).validRenderTextureFormat) { 49 | EditorGUILayout.HelpBox("The input to Tonemapper is not in HDR. Make sure that all effects prior to this are executed in HDR.", MessageType.Warning); 50 | } 51 | } 52 | 53 | EditorGUILayout.PropertyField (type, new GUIContent ("Technique")); 54 | 55 | if (type.enumValueIndex == (int) Tonemapping.TonemapperType.UserCurve) { 56 | EditorGUILayout.PropertyField (remapCurve, new GUIContent ("Remap curve", "Specify the mapping of luminances yourself")); 57 | } else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.SimpleReinhard) { 58 | EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment")); 59 | } else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.Hable) { 60 | EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment")); 61 | } else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.Photographic) { 62 | EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment")); 63 | } else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.OptimizedHejiDawson) { 64 | EditorGUILayout.PropertyField (exposureAdjustment, new GUIContent ("Exposure", "Exposure adjustment")); 65 | } else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.AdaptiveReinhard) { 66 | EditorGUILayout.PropertyField (middleGrey, new GUIContent ("Middle grey", "Middle grey defines the average luminance thus brightening or darkening the entire image.")); 67 | EditorGUILayout.PropertyField (white, new GUIContent ("White", "Smallest luminance value that will be mapped to white")); 68 | EditorGUILayout.PropertyField (adaptionSpeed, new GUIContent ("Adaption Speed", "Speed modifier for the automatic adaption")); 69 | EditorGUILayout.PropertyField (adaptiveTextureSize, new GUIContent ("Texture size", "Defines the amount of downsamples needed.")); 70 | } else if (type.enumValueIndex == (int) Tonemapping.TonemapperType.AdaptiveReinhardAutoWhite) { 71 | EditorGUILayout.PropertyField (middleGrey, new GUIContent ("Middle grey", "Middle grey defines the average luminance thus brightening or darkening the entire image.")); 72 | EditorGUILayout.PropertyField (adaptionSpeed, new GUIContent ("Adaption Speed", "Speed modifier for the automatic adaption")); 73 | EditorGUILayout.PropertyField (adaptiveTextureSize, new GUIContent ("Texture size", "Defines the amount of downsamples needed.")); 74 | } 75 | 76 | GUILayout.Label("All following effects will use LDR color buffers", EditorStyles.miniBoldLabel); 77 | 78 | serObj.ApplyModifiedProperties(); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Assets/Editor/ImageEffects/TonemappingEditor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f7cab214f141f642b87a5bdbd14653e 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: [] 6 | executionOrder: 0 7 | icon: {instanceID: 0} 8 | userData: 9 | assetBundleName: 10 | -------------------------------------------------------------------------------- /Assets/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40ef0ce588163bf4cb3b32ea3d8a7d7b 3 | folderAsset: yes 4 | timeCreated: 1460465907 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Models/Terrain.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 05b4509d99e09e14e906d35e364cfe50 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/Cliffs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 090beefaaab429347832feffaf1cd805 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/Cliffs/TiledCliffs_01_Diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlightlyMad/VolumetricLights/d20b6f9a47ae857e1d313b147db2df3ef44b9196/Assets/Models/Terrain/Cliffs/TiledCliffs_01_Diff.png -------------------------------------------------------------------------------- /Assets/Models/Terrain/Cliffs/TiledCliffs_01_Diff.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 61bf2927e7ab71f4c99e4cd6e01bb473 3 | timeCreated: 1460469003 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 16 34 | mipBias: -1 35 | wrapMode: 0 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 0 49 | textureType: 0 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5487cd2865ae444dbd8f4a17c90df80 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 59d92319d2f13ef4aa5f77f3aaab9378 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks/Materials/MountainPeak_01.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: MountainPeak_01 10 | m_Shader: {fileID: 45, guid: 0000000000000000f000000000000000, type: 0} 11 | m_ShaderKeywords: _LIGHTMAPPING_REALTIME _NORMALMAP _UVSEC_UV1 12 | m_LightmapFlags: 5 13 | m_CustomRenderQueue: -1 14 | stringTagMap: {} 15 | m_SavedProperties: 16 | serializedVersion: 2 17 | m_TexEnvs: 18 | data: 19 | first: 20 | name: _MainTex 21 | second: 22 | m_Texture: {fileID: 2800000, guid: 61bf2927e7ab71f4c99e4cd6e01bb473, type: 3} 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: 2800000, guid: 74123bffa53134540bc02436db0cbe8b, type: 3} 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: 3, y: 6} 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: _SpecGlossMap 84 | second: 85 | m_Texture: {fileID: 0} 86 | m_Scale: {x: 1, y: 1} 87 | m_Offset: {x: 0, y: 0} 88 | data: 89 | first: 90 | name: _MaskyMixAlbedo 91 | second: 92 | m_Texture: {fileID: 2800000, guid: 9c05ab852b0a1034ba7fa0ebc859271c, type: 3} 93 | m_Scale: {x: 1, y: 1} 94 | m_Offset: {x: 0, y: 0} 95 | data: 96 | first: 97 | name: _MaskyMixBumpMap 98 | second: 99 | m_Texture: {fileID: 0} 100 | m_Scale: {x: 1, y: 1} 101 | m_Offset: {x: 0, y: 0} 102 | data: 103 | first: 104 | name: _MaskyMixMask 105 | second: 106 | m_Texture: {fileID: 0} 107 | m_Scale: {x: 1, y: 1} 108 | m_Offset: {x: 0, y: 0} 109 | data: 110 | first: 111 | name: _EmissionTempRamp 112 | second: 113 | m_Texture: {fileID: 0} 114 | m_Scale: {x: 1, y: 1} 115 | m_Offset: {x: 0, y: 0} 116 | m_Floats: 117 | data: 118 | first: 119 | name: _SrcBlend 120 | second: 1 121 | data: 122 | first: 123 | name: _DstBlend 124 | second: 0 125 | data: 126 | first: 127 | name: _Cutoff 128 | second: 0.5 129 | data: 130 | first: 131 | name: _AlphaTestRef 132 | second: 0.5 133 | data: 134 | first: 135 | name: _Parallax 136 | second: 0.02 137 | data: 138 | first: 139 | name: _ZWrite 140 | second: 1 141 | data: 142 | first: 143 | name: _Glossiness 144 | second: 0.052 145 | data: 146 | first: 147 | name: _BumpScale 148 | second: 1 149 | data: 150 | first: 151 | name: _OcclusionStrength 152 | second: 1 153 | data: 154 | first: 155 | name: _DetailNormalMapScale 156 | second: 0.68 157 | data: 158 | first: 159 | name: _UVSec 160 | second: 0 161 | data: 162 | first: 163 | name: _Mode 164 | second: 0 165 | data: 166 | first: 167 | name: _Metallic 168 | second: 0 169 | data: 170 | first: 171 | name: _Lightmapping 172 | second: 1 173 | data: 174 | first: 175 | name: _EmissionScaleUI 176 | second: 1 177 | data: 178 | first: 179 | name: _SmoothnessInAlbedo 180 | second: 0 181 | data: 182 | first: 183 | name: _Orthonormalize 184 | second: 0 185 | data: 186 | first: 187 | name: _MaskyMixUVTile 188 | second: 70 189 | data: 190 | first: 191 | name: _MaskyMixBumpScale 192 | second: 1 193 | data: 194 | first: 195 | name: _MaskyMixMaskTile 196 | second: 2 197 | data: 198 | first: 199 | name: _MaskyMixMaskFalloff 200 | second: 0.49 201 | data: 202 | first: 203 | name: _MaskyMixMaskThresholdLow 204 | second: 0.891 205 | data: 206 | first: 207 | name: _MaskyMixMaskThresholdHi 208 | second: 1 209 | data: 210 | first: 211 | name: _PlaneReflectionBumpScale 212 | second: 0.4 213 | data: 214 | first: 215 | name: _PlaneReflectionBumpClamp 216 | second: 0.05 217 | data: 218 | first: 219 | name: _CullMode 220 | second: 2 221 | data: 222 | first: 223 | name: _EmissionTemperature 224 | second: 0 225 | data: 226 | first: 227 | name: _MetaAlbedoDesaturation 228 | second: 0 229 | m_Colors: 230 | data: 231 | first: 232 | name: _EmissionColor 233 | second: {r: 0, g: 0, b: 0, a: 1} 234 | data: 235 | first: 236 | name: _Color 237 | second: {r: 0.58823526, g: 0.58823526, b: 0.58823526, a: 1} 238 | data: 239 | first: 240 | name: _SpecColor 241 | second: {r: 0.2, g: 0.2, b: 0.2, a: 1} 242 | data: 243 | first: 244 | name: _EmissionColorUI 245 | second: {r: 0, g: 0, b: 0, a: 1} 246 | data: 247 | first: 248 | name: _EmissionColorWithMapUI 249 | second: {r: 1, g: 1, b: 1, a: 1} 250 | data: 251 | first: 252 | name: _MaskyMixColor 253 | second: {r: 0.6911765, g: 0.6855686, b: 0.6708478, a: 0.5019608} 254 | data: 255 | first: 256 | name: _MaskyMixSpecColor 257 | second: {r: 0.20588237, g: 0.20588237, b: 0.20588237, a: 1} 258 | data: 259 | first: 260 | name: _MaskyMixWorldDirection 261 | second: {r: 0, g: 1, b: 0, a: 0} 262 | data: 263 | first: 264 | name: _MetaAlbedoTint 265 | second: {r: 1, g: 1, b: 1, a: 1} 266 | data: 267 | first: 268 | name: _MetaAlbedoAdd 269 | second: {r: 0, g: 0, b: 0, a: 0} 270 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks/Materials/MountainPeak_01.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4dd2a26280f36a94d8f661ba1aeca363 3 | NativeFormatImporter: 4 | userData: 5 | assetBundleName: 6 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks/MountainPeak_01.FBX: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlightlyMad/VolumetricLights/d20b6f9a47ae857e1d313b147db2df3ef44b9196/Assets/Models/Terrain/MountainPeaks/MountainPeak_01.FBX -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks/MountainPeak_01.FBX.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 50716aa90ba61de45af936f92c27ce53 3 | ModelImporter: 4 | serializedVersion: 18 5 | fileIDToRecycleName: 6 | 100000: //RootNode 7 | 400000: //RootNode 8 | 2300000: //RootNode 9 | 3300000: //RootNode 10 | 4300000: MountainPeak_01 11 | 9500000: //RootNode 12 | materials: 13 | importMaterials: 1 14 | materialName: 0 15 | materialSearch: 1 16 | animations: 17 | legacyGenerateAnimations: 4 18 | bakeSimulation: 0 19 | optimizeGameObjects: 0 20 | motionNodeName: 21 | pivotNodeName: 22 | animationCompression: 1 23 | animationRotationError: .5 24 | animationPositionError: .5 25 | animationScaleError: .5 26 | animationWrapMode: 0 27 | extraExposedTransformPaths: [] 28 | clipAnimations: [] 29 | isReadable: 1 30 | meshes: 31 | lODScreenPercentages: [] 32 | globalScale: 100 33 | meshCompression: 0 34 | addColliders: 0 35 | importBlendShapes: 1 36 | swapUVChannels: 0 37 | generateSecondaryUV: 0 38 | useFileUnits: 1 39 | optimizeMeshForGPU: 1 40 | keepQuads: 0 41 | weldVertices: 1 42 | secondaryUVAngleDistortion: 8 43 | secondaryUVAreaDistortion: 15.000001 44 | secondaryUVHardAngle: 88 45 | secondaryUVPackMargin: 4 46 | useFileScale: 1 47 | tangentSpace: 48 | normalSmoothAngle: 60 49 | splitTangentsAcrossUV: 1 50 | normalImportMode: 0 51 | tangentImportMode: 1 52 | importAnimation: 1 53 | copyAvatar: 0 54 | humanDescription: 55 | human: [] 56 | skeleton: [] 57 | armTwist: .5 58 | foreArmTwist: .5 59 | upperLegTwist: .5 60 | legTwist: .5 61 | armStretch: .0500000007 62 | legStretch: .0500000007 63 | feetSpacing: 0 64 | rootMotionBoneName: 65 | lastHumanDescriptionAvatarSource: {instanceID: 0} 66 | animationType: 0 67 | additionalBone: 0 68 | userData: 69 | assetBundleName: 70 | -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks/MountainPeak_01_NM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlightlyMad/VolumetricLights/d20b6f9a47ae857e1d313b147db2df3ef44b9196/Assets/Models/Terrain/MountainPeaks/MountainPeak_01_NM.png -------------------------------------------------------------------------------- /Assets/Models/Terrain/MountainPeaks/MountainPeak_01_NM.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74123bffa53134540bc02436db0cbe8b 3 | timeCreated: 1460469004 4 | licenseType: Pro 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 1 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 0 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 1 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 0 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 1 34 | mipBias: -1 35 | wrapMode: 0 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 0 49 | textureType: 1 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5c03e3a38a6cda429ca6026cde56a5c 3 | folderAsset: yes 4 | timeCreated: 1460465907 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Prefabs/Mountains.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &109682 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_PrefabParentObject: {fileID: 0} 7 | m_PrefabInternal: {fileID: 100100000} 8 | serializedVersion: 4 9 | m_Component: 10 | - 4: {fileID: 412958} 11 | - 33: {fileID: 3375540} 12 | - 23: {fileID: 2314582} 13 | m_Layer: 0 14 | m_Name: MountainPeak_01 (3) 15 | m_TagString: Untagged 16 | m_Icon: {fileID: 0} 17 | m_NavMeshLayer: 0 18 | m_StaticEditorFlags: 4294967294 19 | m_IsActive: 1 20 | --- !u!1 &130304 21 | GameObject: 22 | m_ObjectHideFlags: 0 23 | m_PrefabParentObject: {fileID: 0} 24 | m_PrefabInternal: {fileID: 100100000} 25 | serializedVersion: 4 26 | m_Component: 27 | - 4: {fileID: 474104} 28 | m_Layer: 0 29 | m_Name: Mountains 30 | m_TagString: Untagged 31 | m_Icon: {fileID: 0} 32 | m_NavMeshLayer: 0 33 | m_StaticEditorFlags: 0 34 | m_IsActive: 1 35 | --- !u!1 &158290 36 | GameObject: 37 | m_ObjectHideFlags: 0 38 | m_PrefabParentObject: {fileID: 0} 39 | m_PrefabInternal: {fileID: 100100000} 40 | serializedVersion: 4 41 | m_Component: 42 | - 4: {fileID: 408694} 43 | - 33: {fileID: 3320276} 44 | - 23: {fileID: 2376836} 45 | m_Layer: 0 46 | m_Name: MountainPeak_01 (1) 47 | m_TagString: Untagged 48 | m_Icon: {fileID: 0} 49 | m_NavMeshLayer: 0 50 | m_StaticEditorFlags: 4294967294 51 | m_IsActive: 1 52 | --- !u!1 &163502 53 | GameObject: 54 | m_ObjectHideFlags: 0 55 | m_PrefabParentObject: {fileID: 0} 56 | m_PrefabInternal: {fileID: 100100000} 57 | serializedVersion: 4 58 | m_Component: 59 | - 4: {fileID: 436054} 60 | - 33: {fileID: 3356342} 61 | - 23: {fileID: 2313102} 62 | m_Layer: 0 63 | m_Name: MountainPeak_01 (5) 64 | m_TagString: Untagged 65 | m_Icon: {fileID: 0} 66 | m_NavMeshLayer: 0 67 | m_StaticEditorFlags: 4294967294 68 | m_IsActive: 1 69 | --- !u!1 &163954 70 | GameObject: 71 | m_ObjectHideFlags: 0 72 | m_PrefabParentObject: {fileID: 0} 73 | m_PrefabInternal: {fileID: 100100000} 74 | serializedVersion: 4 75 | m_Component: 76 | - 4: {fileID: 476952} 77 | - 33: {fileID: 3323568} 78 | - 23: {fileID: 2384640} 79 | m_Layer: 0 80 | m_Name: MountainPeak_01 (4) 81 | m_TagString: Untagged 82 | m_Icon: {fileID: 0} 83 | m_NavMeshLayer: 0 84 | m_StaticEditorFlags: 4294967294 85 | m_IsActive: 1 86 | --- !u!1 &165350 87 | GameObject: 88 | m_ObjectHideFlags: 0 89 | m_PrefabParentObject: {fileID: 0} 90 | m_PrefabInternal: {fileID: 100100000} 91 | serializedVersion: 4 92 | m_Component: 93 | - 4: {fileID: 401430} 94 | - 33: {fileID: 3320972} 95 | - 23: {fileID: 2307894} 96 | m_Layer: 0 97 | m_Name: MountainPeak_01 98 | m_TagString: Untagged 99 | m_Icon: {fileID: 0} 100 | m_NavMeshLayer: 0 101 | m_StaticEditorFlags: 4294967294 102 | m_IsActive: 1 103 | --- !u!1 &192096 104 | GameObject: 105 | m_ObjectHideFlags: 0 106 | m_PrefabParentObject: {fileID: 0} 107 | m_PrefabInternal: {fileID: 100100000} 108 | serializedVersion: 4 109 | m_Component: 110 | - 4: {fileID: 424582} 111 | - 33: {fileID: 3366948} 112 | - 23: {fileID: 2317950} 113 | m_Layer: 0 114 | m_Name: MountainPeak_01 (2) 115 | m_TagString: Untagged 116 | m_Icon: {fileID: 0} 117 | m_NavMeshLayer: 0 118 | m_StaticEditorFlags: 4294967294 119 | m_IsActive: 1 120 | --- !u!4 &401430 121 | Transform: 122 | m_ObjectHideFlags: 1 123 | m_PrefabParentObject: {fileID: 0} 124 | m_PrefabInternal: {fileID: 100100000} 125 | m_GameObject: {fileID: 165350} 126 | m_LocalRotation: {x: -0.6118447, y: 0.35446602, z: 0.35446724, w: 0.6118439} 127 | m_LocalPosition: {x: 316, y: -6, z: 1036} 128 | m_LocalScale: {x: 9.460779, y: 9.460791, z: 2.469411} 129 | m_Children: [] 130 | m_Father: {fileID: 474104} 131 | m_RootOrder: 4 132 | --- !u!4 &408694 133 | Transform: 134 | m_ObjectHideFlags: 1 135 | m_PrefabParentObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 100100000} 137 | m_GameObject: {fileID: 158290} 138 | m_LocalRotation: {x: 0.7002055, y: -0.098550305, z: -0.09854928, w: -0.70020586} 139 | m_LocalPosition: {x: 573.568, y: -3.751, z: 338.411} 140 | m_LocalScale: {x: 14.092494, y: 14.092509, z: 6.0968456} 141 | m_Children: [] 142 | m_Father: {fileID: 474104} 143 | m_RootOrder: 3 144 | --- !u!4 &412958 145 | Transform: 146 | m_ObjectHideFlags: 1 147 | m_PrefabParentObject: {fileID: 0} 148 | m_PrefabInternal: {fileID: 100100000} 149 | m_GameObject: {fileID: 109682} 150 | m_LocalRotation: {x: -0.5991481, y: -0.3755284, z: -0.37552708, w: 0.599149} 151 | m_LocalPosition: {x: -243, y: -2, z: -200} 152 | m_LocalScale: {x: 14.092494, y: 14.092509, z: 5.7472706} 153 | m_Children: [] 154 | m_Father: {fileID: 474104} 155 | m_RootOrder: 1 156 | --- !u!4 &424582 157 | Transform: 158 | m_ObjectHideFlags: 1 159 | m_PrefabParentObject: {fileID: 0} 160 | m_PrefabInternal: {fileID: 100100000} 161 | m_GameObject: {fileID: 192096} 162 | m_LocalRotation: {x: -0.36221436, y: 0.60729, z: 0.60728973, w: 0.36221367} 163 | m_LocalPosition: {x: -771.032, y: -8.751, z: 105.411} 164 | m_LocalScale: {x: 14.092493, y: 9.158827, z: 4.4815593} 165 | m_Children: [] 166 | m_Father: {fileID: 474104} 167 | m_RootOrder: 2 168 | --- !u!4 &436054 169 | Transform: 170 | m_ObjectHideFlags: 1 171 | m_PrefabParentObject: {fileID: 0} 172 | m_PrefabInternal: {fileID: 100100000} 173 | m_GameObject: {fileID: 163502} 174 | m_LocalRotation: {x: -0.47248, y: 0.5260825, z: 0.52608263, w: 0.47247952} 175 | m_LocalPosition: {x: 439.4461, y: -8.999954, z: -959.27985} 176 | m_LocalScale: {x: 18.15514, y: 18.155165, z: 10.773119} 177 | m_Children: [] 178 | m_Father: {fileID: 474104} 179 | m_RootOrder: 5 180 | --- !u!4 &474104 181 | Transform: 182 | m_ObjectHideFlags: 1 183 | m_PrefabParentObject: {fileID: 0} 184 | m_PrefabInternal: {fileID: 100100000} 185 | m_GameObject: {fileID: 130304} 186 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 187 | m_LocalPosition: {x: -57.368, y: 0.79, z: 110.89} 188 | m_LocalScale: {x: 0.20889461, y: 0.20889461, z: 0.20889461} 189 | m_Children: 190 | - {fileID: 476952} 191 | - {fileID: 412958} 192 | - {fileID: 424582} 193 | - {fileID: 408694} 194 | - {fileID: 401430} 195 | - {fileID: 436054} 196 | m_Father: {fileID: 0} 197 | m_RootOrder: 0 198 | --- !u!4 &476952 199 | Transform: 200 | m_ObjectHideFlags: 1 201 | m_PrefabParentObject: {fileID: 0} 202 | m_PrefabInternal: {fileID: 100100000} 203 | m_GameObject: {fileID: 163954} 204 | m_LocalRotation: {x: -0.41450214, y: 0.5728771, z: 0.57287717, w: 0.41450167} 205 | m_LocalPosition: {x: -603.032, y: -5.751, z: 817.411} 206 | m_LocalScale: {x: 18.155136, y: 18.15516, z: 4.448384} 207 | m_Children: [] 208 | m_Father: {fileID: 474104} 209 | m_RootOrder: 0 210 | --- !u!23 &2307894 211 | MeshRenderer: 212 | m_ObjectHideFlags: 1 213 | m_PrefabParentObject: {fileID: 0} 214 | m_PrefabInternal: {fileID: 100100000} 215 | m_GameObject: {fileID: 165350} 216 | m_Enabled: 1 217 | m_CastShadows: 1 218 | m_ReceiveShadows: 1 219 | m_Materials: 220 | - {fileID: 2100000, guid: 4dd2a26280f36a94d8f661ba1aeca363, type: 2} 221 | m_SubsetIndices: 222 | m_StaticBatchRoot: {fileID: 0} 223 | m_UseLightProbes: 1 224 | m_ReflectionProbeUsage: 1 225 | m_ProbeAnchor: {fileID: 0} 226 | m_ScaleInLightmap: 1 227 | m_PreserveUVs: 0 228 | m_IgnoreNormalsForChartDetection: 0 229 | m_ImportantGI: 0 230 | m_MinimumChartSize: 4 231 | m_AutoUVMaxDistance: 0.5 232 | m_AutoUVMaxAngle: 89 233 | m_LightmapParameters: {fileID: 0} 234 | m_SortingLayerID: 0 235 | m_SortingOrder: 0 236 | --- !u!23 &2313102 237 | MeshRenderer: 238 | m_ObjectHideFlags: 1 239 | m_PrefabParentObject: {fileID: 0} 240 | m_PrefabInternal: {fileID: 100100000} 241 | m_GameObject: {fileID: 163502} 242 | m_Enabled: 1 243 | m_CastShadows: 1 244 | m_ReceiveShadows: 1 245 | m_Materials: 246 | - {fileID: 2100000, guid: 4dd2a26280f36a94d8f661ba1aeca363, type: 2} 247 | m_SubsetIndices: 248 | m_StaticBatchRoot: {fileID: 0} 249 | m_UseLightProbes: 1 250 | m_ReflectionProbeUsage: 1 251 | m_ProbeAnchor: {fileID: 0} 252 | m_ScaleInLightmap: 1 253 | m_PreserveUVs: 0 254 | m_IgnoreNormalsForChartDetection: 0 255 | m_ImportantGI: 0 256 | m_MinimumChartSize: 4 257 | m_AutoUVMaxDistance: 0.5 258 | m_AutoUVMaxAngle: 89 259 | m_LightmapParameters: {fileID: 0} 260 | m_SortingLayerID: 0 261 | m_SortingOrder: 0 262 | --- !u!23 &2314582 263 | MeshRenderer: 264 | m_ObjectHideFlags: 1 265 | m_PrefabParentObject: {fileID: 0} 266 | m_PrefabInternal: {fileID: 100100000} 267 | m_GameObject: {fileID: 109682} 268 | m_Enabled: 1 269 | m_CastShadows: 1 270 | m_ReceiveShadows: 1 271 | m_Materials: 272 | - {fileID: 2100000, guid: 4dd2a26280f36a94d8f661ba1aeca363, type: 2} 273 | m_SubsetIndices: 274 | m_StaticBatchRoot: {fileID: 0} 275 | m_UseLightProbes: 1 276 | m_ReflectionProbeUsage: 1 277 | m_ProbeAnchor: {fileID: 0} 278 | m_ScaleInLightmap: 1 279 | m_PreserveUVs: 0 280 | m_IgnoreNormalsForChartDetection: 0 281 | m_ImportantGI: 0 282 | m_MinimumChartSize: 4 283 | m_AutoUVMaxDistance: 0.5 284 | m_AutoUVMaxAngle: 89 285 | m_LightmapParameters: {fileID: 0} 286 | m_SortingLayerID: 0 287 | m_SortingOrder: 0 288 | --- !u!23 &2317950 289 | MeshRenderer: 290 | m_ObjectHideFlags: 1 291 | m_PrefabParentObject: {fileID: 0} 292 | m_PrefabInternal: {fileID: 100100000} 293 | m_GameObject: {fileID: 192096} 294 | m_Enabled: 1 295 | m_CastShadows: 1 296 | m_ReceiveShadows: 1 297 | m_Materials: 298 | - {fileID: 2100000, guid: 4dd2a26280f36a94d8f661ba1aeca363, type: 2} 299 | m_SubsetIndices: 300 | m_StaticBatchRoot: {fileID: 0} 301 | m_UseLightProbes: 1 302 | m_ReflectionProbeUsage: 1 303 | m_ProbeAnchor: {fileID: 0} 304 | m_ScaleInLightmap: 1 305 | m_PreserveUVs: 0 306 | m_IgnoreNormalsForChartDetection: 0 307 | m_ImportantGI: 0 308 | m_MinimumChartSize: 4 309 | m_AutoUVMaxDistance: 0.5 310 | m_AutoUVMaxAngle: 89 311 | m_LightmapParameters: {fileID: 0} 312 | m_SortingLayerID: 0 313 | m_SortingOrder: 0 314 | --- !u!23 &2376836 315 | MeshRenderer: 316 | m_ObjectHideFlags: 1 317 | m_PrefabParentObject: {fileID: 0} 318 | m_PrefabInternal: {fileID: 100100000} 319 | m_GameObject: {fileID: 158290} 320 | m_Enabled: 1 321 | m_CastShadows: 1 322 | m_ReceiveShadows: 1 323 | m_Materials: 324 | - {fileID: 2100000, guid: 4dd2a26280f36a94d8f661ba1aeca363, type: 2} 325 | m_SubsetIndices: 326 | m_StaticBatchRoot: {fileID: 0} 327 | m_UseLightProbes: 1 328 | m_ReflectionProbeUsage: 1 329 | m_ProbeAnchor: {fileID: 0} 330 | m_ScaleInLightmap: 1 331 | m_PreserveUVs: 0 332 | m_IgnoreNormalsForChartDetection: 0 333 | m_ImportantGI: 0 334 | m_MinimumChartSize: 4 335 | m_AutoUVMaxDistance: 0.5 336 | m_AutoUVMaxAngle: 89 337 | m_LightmapParameters: {fileID: 0} 338 | m_SortingLayerID: 0 339 | m_SortingOrder: 0 340 | --- !u!23 &2384640 341 | MeshRenderer: 342 | m_ObjectHideFlags: 1 343 | m_PrefabParentObject: {fileID: 0} 344 | m_PrefabInternal: {fileID: 100100000} 345 | m_GameObject: {fileID: 163954} 346 | m_Enabled: 1 347 | m_CastShadows: 1 348 | m_ReceiveShadows: 1 349 | m_Materials: 350 | - {fileID: 2100000, guid: 4dd2a26280f36a94d8f661ba1aeca363, type: 2} 351 | m_SubsetIndices: 352 | m_StaticBatchRoot: {fileID: 0} 353 | m_UseLightProbes: 1 354 | m_ReflectionProbeUsage: 1 355 | m_ProbeAnchor: {fileID: 0} 356 | m_ScaleInLightmap: 1 357 | m_PreserveUVs: 0 358 | m_IgnoreNormalsForChartDetection: 0 359 | m_ImportantGI: 0 360 | m_MinimumChartSize: 4 361 | m_AutoUVMaxDistance: 0.5 362 | m_AutoUVMaxAngle: 89 363 | m_LightmapParameters: {fileID: 0} 364 | m_SortingLayerID: 0 365 | m_SortingOrder: 0 366 | --- !u!33 &3320276 367 | MeshFilter: 368 | m_ObjectHideFlags: 1 369 | m_PrefabParentObject: {fileID: 0} 370 | m_PrefabInternal: {fileID: 100100000} 371 | m_GameObject: {fileID: 158290} 372 | m_Mesh: {fileID: 4300000, guid: 50716aa90ba61de45af936f92c27ce53, type: 3} 373 | --- !u!33 &3320972 374 | MeshFilter: 375 | m_ObjectHideFlags: 1 376 | m_PrefabParentObject: {fileID: 0} 377 | m_PrefabInternal: {fileID: 100100000} 378 | m_GameObject: {fileID: 165350} 379 | m_Mesh: {fileID: 4300000, guid: 50716aa90ba61de45af936f92c27ce53, type: 3} 380 | --- !u!33 &3323568 381 | MeshFilter: 382 | m_ObjectHideFlags: 1 383 | m_PrefabParentObject: {fileID: 0} 384 | m_PrefabInternal: {fileID: 100100000} 385 | m_GameObject: {fileID: 163954} 386 | m_Mesh: {fileID: 4300000, guid: 50716aa90ba61de45af936f92c27ce53, type: 3} 387 | --- !u!33 &3356342 388 | MeshFilter: 389 | m_ObjectHideFlags: 1 390 | m_PrefabParentObject: {fileID: 0} 391 | m_PrefabInternal: {fileID: 100100000} 392 | m_GameObject: {fileID: 163502} 393 | m_Mesh: {fileID: 4300000, guid: 50716aa90ba61de45af936f92c27ce53, type: 3} 394 | --- !u!33 &3366948 395 | MeshFilter: 396 | m_ObjectHideFlags: 1 397 | m_PrefabParentObject: {fileID: 0} 398 | m_PrefabInternal: {fileID: 100100000} 399 | m_GameObject: {fileID: 192096} 400 | m_Mesh: {fileID: 4300000, guid: 50716aa90ba61de45af936f92c27ce53, type: 3} 401 | --- !u!33 &3375540 402 | MeshFilter: 403 | m_ObjectHideFlags: 1 404 | m_PrefabParentObject: {fileID: 0} 405 | m_PrefabInternal: {fileID: 100100000} 406 | m_GameObject: {fileID: 109682} 407 | m_Mesh: {fileID: 4300000, guid: 50716aa90ba61de45af936f92c27ce53, type: 3} 408 | --- !u!1001 &100100000 409 | Prefab: 410 | m_ObjectHideFlags: 1 411 | serializedVersion: 2 412 | m_Modification: 413 | m_TransformParent: {fileID: 0} 414 | m_Modifications: [] 415 | m_RemovedComponents: [] 416 | m_ParentPrefab: {fileID: 0} 417 | m_RootGameObject: {fileID: 130304} 418 | m_IsPrefabParent: 1 419 | -------------------------------------------------------------------------------- /Assets/Prefabs/Mountains.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5335c8f26bfe754b960f5d390edcb98 3 | timeCreated: 1460397275 4 | licenseType: Free 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 296b1c9e2afe56648b01cafddf003774 3 | folderAsset: yes 4 | timeCreated: 1459178233 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Resources/NoiseVolume.bytes: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlightlyMad/VolumetricLights/d20b6f9a47ae857e1d313b147db2df3ef44b9196/Assets/Resources/NoiseVolume.bytes -------------------------------------------------------------------------------- /Assets/Resources/NoiseVolume.bytes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f63cb0bcffcbc504386c7eb3ecb543d4 3 | timeCreated: 1455573184 4 | licenseType: Free 5 | TextScriptImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9a5a6721d6f50574386131d1b84aac61 3 | folderAsset: yes 4 | timeCreated: 1459178233 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/VolumetricLight.cs: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2016, Michal Skalsky 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modification, 5 | // are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // 3. Neither the name of the copyright holder nor the names of its contributors 15 | // may be used to endorse or promote products derived from this software without 16 | // specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 19 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT 21 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | 29 | 30 | using UnityEngine; 31 | using System.Collections; 32 | using UnityEngine.Rendering; 33 | using System; 34 | 35 | [RequireComponent(typeof(Light))] 36 | public class VolumetricLight : MonoBehaviour 37 | { 38 | public event Action CustomRenderEvent; 39 | 40 | private Light _light; 41 | private Material _material; 42 | private CommandBuffer _commandBuffer; 43 | private CommandBuffer _cascadeShadowCommandBuffer; 44 | 45 | [Range(1, 64)] 46 | public int SampleCount = 8; 47 | [Range(0.0f, 1.0f)] 48 | public float ScatteringCoef = 0.5f; 49 | [Range(0.0f, 0.1f)] 50 | public float ExtinctionCoef = 0.01f; 51 | [Range(0.0f, 1.0f)] 52 | public float SkyboxExtinctionCoef = 0.9f; 53 | [Range(0.0f, 0.999f)] 54 | public float MieG = 0.1f; 55 | public bool HeightFog = false; 56 | [Range(0, 0.5f)] 57 | public float HeightScale = 0.10f; 58 | public float GroundLevel = 0; 59 | public bool Noise = false; 60 | public float NoiseScale = 0.015f; 61 | public float NoiseIntensity = 1.0f; 62 | public float NoiseIntensityOffset = 0.3f; 63 | public Vector2 NoiseVelocity = new Vector2(3.0f, 3.0f); 64 | 65 | [Tooltip("")] 66 | public float MaxRayLength = 400.0f; 67 | 68 | public Light Light { get { return _light; } } 69 | public Material VolumetricMaterial { get { return _material; } } 70 | 71 | private Vector4[] _frustumCorners = new Vector4[4]; 72 | 73 | private bool _reversedZ = false; 74 | 75 | /// 76 | /// 77 | /// 78 | void Start() 79 | { 80 | #if UNITY_5_5_OR_NEWER 81 | if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11 || SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D12 || 82 | SystemInfo.graphicsDeviceType == GraphicsDeviceType.Metal || SystemInfo.graphicsDeviceType == GraphicsDeviceType.PlayStation4 || 83 | SystemInfo.graphicsDeviceType == GraphicsDeviceType.Vulkan || SystemInfo.graphicsDeviceType == GraphicsDeviceType.XboxOne) 84 | { 85 | _reversedZ = true; 86 | } 87 | #endif 88 | 89 | _commandBuffer = new CommandBuffer(); 90 | _commandBuffer.name = "Light Command Buffer"; 91 | 92 | _cascadeShadowCommandBuffer = new CommandBuffer(); 93 | _cascadeShadowCommandBuffer.name = "Dir Light Command Buffer"; 94 | _cascadeShadowCommandBuffer.SetGlobalTexture("_CascadeShadowMapTexture", new UnityEngine.Rendering.RenderTargetIdentifier(UnityEngine.Rendering.BuiltinRenderTextureType.CurrentActive)); 95 | 96 | _light = GetComponent(); 97 | //_light.RemoveAllCommandBuffers(); 98 | if(_light.type == LightType.Directional) 99 | { 100 | _light.AddCommandBuffer(LightEvent.BeforeScreenspaceMask, _commandBuffer); 101 | _light.AddCommandBuffer(LightEvent.AfterShadowMap, _cascadeShadowCommandBuffer); 102 | 103 | } 104 | else 105 | _light.AddCommandBuffer(LightEvent.AfterShadowMap, _commandBuffer); 106 | 107 | Shader shader = Shader.Find("Sandbox/VolumetricLight"); 108 | if (shader == null) 109 | throw new Exception("Critical Error: \"Sandbox/VolumetricLight\" shader is missing. Make sure it is included in \"Always Included Shaders\" in ProjectSettings/Graphics."); 110 | _material = new Material(shader); // new Material(VolumetricLightRenderer.GetLightMaterial()); 111 | } 112 | 113 | /// 114 | /// 115 | /// 116 | void OnEnable() 117 | { 118 | VolumetricLightRenderer.PreRenderEvent += VolumetricLightRenderer_PreRenderEvent; 119 | } 120 | 121 | /// 122 | /// 123 | /// 124 | void OnDisable() 125 | { 126 | VolumetricLightRenderer.PreRenderEvent -= VolumetricLightRenderer_PreRenderEvent; 127 | } 128 | 129 | /// 130 | /// 131 | /// 132 | public void OnDestroy() 133 | { 134 | Destroy(_material); 135 | } 136 | 137 | /// 138 | /// 139 | /// 140 | /// 141 | /// 142 | private void VolumetricLightRenderer_PreRenderEvent(VolumetricLightRenderer renderer, Matrix4x4 viewProj) 143 | { 144 | // light was destroyed without deregistring, deregister now 145 | if (_light == null || _light.gameObject == null) 146 | { 147 | VolumetricLightRenderer.PreRenderEvent -= VolumetricLightRenderer_PreRenderEvent; 148 | } 149 | 150 | if (!_light.gameObject.activeInHierarchy || _light.enabled == false) 151 | return; 152 | 153 | _material.SetVector("_CameraForward", Camera.current.transform.forward); 154 | 155 | _material.SetInt("_SampleCount", SampleCount); 156 | _material.SetVector("_NoiseVelocity", new Vector4(NoiseVelocity.x, NoiseVelocity.y) * NoiseScale); 157 | _material.SetVector("_NoiseData", new Vector4(NoiseScale, NoiseIntensity, NoiseIntensityOffset)); 158 | _material.SetVector("_MieG", new Vector4(1 - (MieG * MieG), 1 + (MieG * MieG), 2 * MieG, 1.0f / (4.0f * Mathf.PI))); 159 | _material.SetVector("_VolumetricLight", new Vector4(ScatteringCoef, ExtinctionCoef, _light.range, 1.0f - SkyboxExtinctionCoef)); 160 | 161 | _material.SetTexture("_CameraDepthTexture", renderer.GetVolumeLightDepthBuffer()); 162 | 163 | //if (renderer.Resolution == VolumetricLightRenderer.VolumtericResolution.Full) 164 | { 165 | //_material.SetFloat("_ZTest", (int)UnityEngine.Rendering.CompareFunction.LessEqual); 166 | //_material.DisableKeyword("MANUAL_ZTEST"); 167 | } 168 | //else 169 | { 170 | _material.SetFloat("_ZTest", (int)UnityEngine.Rendering.CompareFunction.Always); 171 | // downsampled light buffer can't use native zbuffer for ztest, try to perform ztest in pixel shader to avoid ray marching for occulded geometry 172 | //_material.EnableKeyword("MANUAL_ZTEST"); 173 | } 174 | 175 | if (HeightFog) 176 | { 177 | _material.EnableKeyword("HEIGHT_FOG"); 178 | 179 | _material.SetVector("_HeightFog", new Vector4(GroundLevel, HeightScale)); 180 | } 181 | else 182 | { 183 | _material.DisableKeyword("HEIGHT_FOG"); 184 | } 185 | 186 | if(_light.type == LightType.Point) 187 | { 188 | SetupPointLight(renderer, viewProj); 189 | } 190 | else if(_light.type == LightType.Spot) 191 | { 192 | SetupSpotLight(renderer, viewProj); 193 | } 194 | else if (_light.type == LightType.Directional) 195 | { 196 | SetupDirectionalLight(renderer, viewProj); 197 | } 198 | } 199 | 200 | /// 201 | /// 202 | /// 203 | /// 204 | /// 205 | private void SetupPointLight(VolumetricLightRenderer renderer, Matrix4x4 viewProj) 206 | { 207 | _commandBuffer.Clear(); 208 | 209 | int pass = 0; 210 | if (!IsCameraInPointLightBounds()) 211 | pass = 2; 212 | 213 | _material.SetPass(pass); 214 | 215 | Mesh mesh = VolumetricLightRenderer.GetPointLightMesh(); 216 | 217 | float scale = _light.range * 2.0f; 218 | Matrix4x4 world = Matrix4x4.TRS(transform.position, _light.transform.rotation, new Vector3(scale, scale, scale)); 219 | 220 | _material.SetMatrix("_WorldViewProj", viewProj * world); 221 | _material.SetMatrix("_WorldView", Camera.current.worldToCameraMatrix * world); 222 | 223 | if (Noise) 224 | _material.EnableKeyword("NOISE"); 225 | else 226 | _material.DisableKeyword("NOISE"); 227 | 228 | _material.SetVector("_LightPos", new Vector4(_light.transform.position.x, _light.transform.position.y, _light.transform.position.z, 1.0f / (_light.range * _light.range))); 229 | _material.SetColor("_LightColor", _light.color * _light.intensity); 230 | 231 | if (_light.cookie == null) 232 | { 233 | _material.EnableKeyword("POINT"); 234 | _material.DisableKeyword("POINT_COOKIE"); 235 | } 236 | else 237 | { 238 | Matrix4x4 view = Matrix4x4.TRS(_light.transform.position, _light.transform.rotation, Vector3.one).inverse; 239 | _material.SetMatrix("_MyLightMatrix0", view); 240 | 241 | _material.EnableKeyword("POINT_COOKIE"); 242 | _material.DisableKeyword("POINT"); 243 | 244 | _material.SetTexture("_LightTexture0", _light.cookie); 245 | } 246 | 247 | bool forceShadowsOff = false; 248 | if ((_light.transform.position - Camera.current.transform.position).magnitude >= QualitySettings.shadowDistance) 249 | forceShadowsOff = true; 250 | 251 | if (_light.shadows != LightShadows.None && forceShadowsOff == false) 252 | { 253 | _material.EnableKeyword("SHADOWS_CUBE"); 254 | _commandBuffer.SetGlobalTexture("_ShadowMapTexture", BuiltinRenderTextureType.CurrentActive); 255 | _commandBuffer.SetRenderTarget(renderer.GetVolumeLightBuffer()); 256 | 257 | _commandBuffer.DrawMesh(mesh, world, _material, 0, pass); 258 | 259 | if (CustomRenderEvent != null) 260 | CustomRenderEvent(renderer, this, _commandBuffer, viewProj); 261 | } 262 | else 263 | { 264 | _material.DisableKeyword("SHADOWS_CUBE"); 265 | renderer.GlobalCommandBuffer.DrawMesh(mesh, world, _material, 0, pass); 266 | 267 | if (CustomRenderEvent != null) 268 | CustomRenderEvent(renderer, this, renderer.GlobalCommandBuffer, viewProj); 269 | } 270 | } 271 | 272 | /// 273 | /// 274 | /// 275 | /// 276 | /// 277 | private void SetupSpotLight(VolumetricLightRenderer renderer, Matrix4x4 viewProj) 278 | { 279 | _commandBuffer.Clear(); 280 | 281 | int pass = 1; 282 | if (!IsCameraInSpotLightBounds()) 283 | { 284 | pass = 3; 285 | } 286 | 287 | Mesh mesh = VolumetricLightRenderer.GetSpotLightMesh(); 288 | 289 | float scale = _light.range; 290 | float angleScale = Mathf.Tan((_light.spotAngle + 1) * 0.5f * Mathf.Deg2Rad) * _light.range; 291 | 292 | Matrix4x4 world = Matrix4x4.TRS(transform.position, transform.rotation, new Vector3(angleScale, angleScale, scale)); 293 | 294 | Matrix4x4 view = Matrix4x4.TRS(_light.transform.position, _light.transform.rotation, Vector3.one).inverse; 295 | 296 | Matrix4x4 clip = Matrix4x4.TRS(new Vector3(0.5f, 0.5f, 0.0f), Quaternion.identity, new Vector3(-0.5f, -0.5f, 1.0f)); 297 | Matrix4x4 proj = Matrix4x4.Perspective(_light.spotAngle, 1, 0, 1); 298 | 299 | _material.SetMatrix("_MyLightMatrix0", clip * proj * view); 300 | 301 | _material.SetMatrix("_WorldViewProj", viewProj * world); 302 | 303 | _material.SetVector("_LightPos", new Vector4(_light.transform.position.x, _light.transform.position.y, _light.transform.position.z, 1.0f / (_light.range * _light.range))); 304 | _material.SetVector("_LightColor", _light.color * _light.intensity); 305 | 306 | 307 | Vector3 apex = transform.position; 308 | Vector3 axis = transform.forward; 309 | // plane equation ax + by + cz + d = 0; precompute d here to lighten the shader 310 | Vector3 center = apex + axis * _light.range; 311 | float d = -Vector3.Dot(center, axis); 312 | 313 | // update material 314 | _material.SetFloat("_PlaneD", d); 315 | _material.SetFloat("_CosAngle", Mathf.Cos((_light.spotAngle + 1) * 0.5f * Mathf.Deg2Rad)); 316 | 317 | _material.SetVector("_ConeApex", new Vector4(apex.x, apex.y, apex.z)); 318 | _material.SetVector("_ConeAxis", new Vector4(axis.x, axis.y, axis.z)); 319 | 320 | _material.EnableKeyword("SPOT"); 321 | 322 | if (Noise) 323 | _material.EnableKeyword("NOISE"); 324 | else 325 | _material.DisableKeyword("NOISE"); 326 | 327 | if (_light.cookie == null) 328 | { 329 | _material.SetTexture("_LightTexture0", VolumetricLightRenderer.GetDefaultSpotCookie()); 330 | } 331 | else 332 | { 333 | _material.SetTexture("_LightTexture0", _light.cookie); 334 | } 335 | 336 | bool forceShadowsOff = false; 337 | if ((_light.transform.position - Camera.current.transform.position).magnitude >= QualitySettings.shadowDistance) 338 | forceShadowsOff = true; 339 | 340 | if (_light.shadows != LightShadows.None && forceShadowsOff == false) 341 | { 342 | clip = Matrix4x4.TRS(new Vector3(0.5f, 0.5f, 0.5f), Quaternion.identity, new Vector3(0.5f, 0.5f, 0.5f)); 343 | 344 | if(_reversedZ) 345 | proj = Matrix4x4.Perspective(_light.spotAngle, 1, _light.range, _light.shadowNearPlane); 346 | else 347 | proj = Matrix4x4.Perspective(_light.spotAngle, 1, _light.shadowNearPlane, _light.range); 348 | 349 | Matrix4x4 m = clip * proj; 350 | m[0, 2] *= -1; 351 | m[1, 2] *= -1; 352 | m[2, 2] *= -1; 353 | m[3, 2] *= -1; 354 | 355 | //view = _light.transform.worldToLocalMatrix; 356 | _material.SetMatrix("_MyWorld2Shadow", m * view); 357 | _material.SetMatrix("_WorldView", m * view); 358 | 359 | _material.EnableKeyword("SHADOWS_DEPTH"); 360 | _commandBuffer.SetGlobalTexture("_ShadowMapTexture", BuiltinRenderTextureType.CurrentActive); 361 | _commandBuffer.SetRenderTarget(renderer.GetVolumeLightBuffer()); 362 | 363 | _commandBuffer.DrawMesh(mesh, world, _material, 0, pass); 364 | 365 | if (CustomRenderEvent != null) 366 | CustomRenderEvent(renderer, this, _commandBuffer, viewProj); 367 | } 368 | else 369 | { 370 | _material.DisableKeyword("SHADOWS_DEPTH"); 371 | renderer.GlobalCommandBuffer.DrawMesh(mesh, world, _material, 0, pass); 372 | 373 | if (CustomRenderEvent != null) 374 | CustomRenderEvent(renderer, this, renderer.GlobalCommandBuffer, viewProj); 375 | } 376 | } 377 | 378 | /// 379 | /// 380 | /// 381 | /// 382 | /// 383 | private void SetupDirectionalLight(VolumetricLightRenderer renderer, Matrix4x4 viewProj) 384 | { 385 | _commandBuffer.Clear(); 386 | 387 | int pass = 4; 388 | 389 | _material.SetPass(pass); 390 | 391 | if (Noise) 392 | _material.EnableKeyword("NOISE"); 393 | else 394 | _material.DisableKeyword("NOISE"); 395 | 396 | _material.SetVector("_LightDir", new Vector4(_light.transform.forward.x, _light.transform.forward.y, _light.transform.forward.z, 1.0f / (_light.range * _light.range))); 397 | _material.SetVector("_LightColor", _light.color * _light.intensity); 398 | _material.SetFloat("_MaxRayLength", MaxRayLength); 399 | 400 | if (_light.cookie == null) 401 | { 402 | _material.EnableKeyword("DIRECTIONAL"); 403 | _material.DisableKeyword("DIRECTIONAL_COOKIE"); 404 | } 405 | else 406 | { 407 | _material.EnableKeyword("DIRECTIONAL_COOKIE"); 408 | _material.DisableKeyword("DIRECTIONAL"); 409 | 410 | _material.SetTexture("_LightTexture0", _light.cookie); 411 | } 412 | 413 | // setup frustum corners for world position reconstruction 414 | // bottom left 415 | _frustumCorners[0] = Camera.current.ViewportToWorldPoint(new Vector3(0, 0, Camera.current.farClipPlane)); 416 | // top left 417 | _frustumCorners[2] = Camera.current.ViewportToWorldPoint(new Vector3(0, 1, Camera.current.farClipPlane)); 418 | // top right 419 | _frustumCorners[3] = Camera.current.ViewportToWorldPoint(new Vector3(1, 1, Camera.current.farClipPlane)); 420 | // bottom right 421 | _frustumCorners[1] = Camera.current.ViewportToWorldPoint(new Vector3(1, 0, Camera.current.farClipPlane)); 422 | 423 | #if UNITY_5_4_OR_NEWER 424 | _material.SetVectorArray("_FrustumCorners", _frustumCorners); 425 | #else 426 | _material.SetVector("_FrustumCorners0", _frustumCorners[0]); 427 | _material.SetVector("_FrustumCorners1", _frustumCorners[1]); 428 | _material.SetVector("_FrustumCorners2", _frustumCorners[2]); 429 | _material.SetVector("_FrustumCorners3", _frustumCorners[3]); 430 | #endif 431 | 432 | Texture nullTexture = null; 433 | if (_light.shadows != LightShadows.None) 434 | { 435 | _material.EnableKeyword("SHADOWS_DEPTH"); 436 | _commandBuffer.Blit(nullTexture, renderer.GetVolumeLightBuffer(), _material, pass); 437 | 438 | if (CustomRenderEvent != null) 439 | CustomRenderEvent(renderer, this, _commandBuffer, viewProj); 440 | } 441 | else 442 | { 443 | _material.DisableKeyword("SHADOWS_DEPTH"); 444 | renderer.GlobalCommandBuffer.Blit(nullTexture, renderer.GetVolumeLightBuffer(), _material, pass); 445 | 446 | if (CustomRenderEvent != null) 447 | CustomRenderEvent(renderer, this, renderer.GlobalCommandBuffer, viewProj); 448 | } 449 | } 450 | 451 | /// 452 | /// 453 | /// 454 | /// 455 | private bool IsCameraInPointLightBounds() 456 | { 457 | float distanceSqr = (_light.transform.position - Camera.current.transform.position).sqrMagnitude; 458 | float extendedRange = _light.range + 1; 459 | if (distanceSqr < (extendedRange * extendedRange)) 460 | return true; 461 | return false; 462 | } 463 | 464 | /// 465 | /// 466 | /// 467 | /// 468 | private bool IsCameraInSpotLightBounds() 469 | { 470 | // check range 471 | float distance = Vector3.Dot(_light.transform.forward, (Camera.current.transform.position - _light.transform.position)); 472 | float extendedRange = _light.range + 1; 473 | if (distance > (extendedRange)) 474 | return false; 475 | 476 | // check angle 477 | float cosAngle = Vector3.Dot(transform.forward, (Camera.current.transform.position - _light.transform.position).normalized); 478 | if((Mathf.Acos(cosAngle) * Mathf.Rad2Deg) > (_light.spotAngle + 3) * 0.5f) 479 | return false; 480 | 481 | return true; 482 | } 483 | } 484 | -------------------------------------------------------------------------------- /Assets/Scripts/VolumetricLight.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dafc90245bfe9e2408e358f71deace2a 3 | timeCreated: 1459178235 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/VolumetricLightRenderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1eed1d9cbe64423499f1fefc0ce50417 3 | timeCreated: 1459178234 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 26de6d8bd1830d947b9ff5d5ff7639bb 3 | folderAsset: yes 4 | timeCreated: 1459178233 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/BilateralBlur.shader: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2016, Michal Skalsky 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modification, 5 | // are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // 3. Neither the name of the copyright holder nor the names of its contributors 15 | // may be used to endorse or promote products derived from this software without 16 | // specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 19 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT 21 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | 29 | 30 | Shader "Hidden/BilateralBlur" 31 | { 32 | Properties 33 | { 34 | _MainTex("Texture", any) = "" {} 35 | } 36 | SubShader 37 | { 38 | // No culling or depth 39 | Cull Off ZWrite Off ZTest Always 40 | 41 | CGINCLUDE 42 | 43 | //-------------------------------------------------------------------------------------------- 44 | // Downsample, bilateral blur and upsample config 45 | //-------------------------------------------------------------------------------------------- 46 | // method used to downsample depth buffer: 0 = min; 1 = max; 2 = min/max in chessboard pattern 47 | #define DOWNSAMPLE_DEPTH_MODE 2 48 | #define UPSAMPLE_DEPTH_THRESHOLD 1.5f 49 | #define BLUR_DEPTH_FACTOR 0.5 50 | #define GAUSS_BLUR_DEVIATION 1.5 51 | #define FULL_RES_BLUR_KERNEL_SIZE 7 52 | #define HALF_RES_BLUR_KERNEL_SIZE 5 53 | #define QUARTER_RES_BLUR_KERNEL_SIZE 6 54 | //-------------------------------------------------------------------------------------------- 55 | 56 | #define PI 3.1415927f 57 | 58 | #include "UnityCG.cginc" 59 | 60 | UNITY_DECLARE_TEX2D(_CameraDepthTexture); 61 | UNITY_DECLARE_TEX2D(_HalfResDepthBuffer); 62 | UNITY_DECLARE_TEX2D(_QuarterResDepthBuffer); 63 | UNITY_DECLARE_TEX2D(_HalfResColor); 64 | UNITY_DECLARE_TEX2D(_QuarterResColor); 65 | UNITY_DECLARE_TEX2D(_MainTex); 66 | 67 | float4 _CameraDepthTexture_TexelSize; 68 | float4 _HalfResDepthBuffer_TexelSize; 69 | float4 _QuarterResDepthBuffer_TexelSize; 70 | 71 | struct appdata 72 | { 73 | float4 vertex : POSITION; 74 | float2 uv : TEXCOORD0; 75 | }; 76 | 77 | struct v2f 78 | { 79 | float2 uv : TEXCOORD0; 80 | float4 vertex : SV_POSITION; 81 | }; 82 | 83 | struct v2fDownsample 84 | { 85 | #if SHADER_TARGET > 40 86 | float2 uv : TEXCOORD0; 87 | #else 88 | float2 uv00 : TEXCOORD0; 89 | float2 uv01 : TEXCOORD1; 90 | float2 uv10 : TEXCOORD2; 91 | float2 uv11 : TEXCOORD3; 92 | #endif 93 | float4 vertex : SV_POSITION; 94 | }; 95 | 96 | struct v2fUpsample 97 | { 98 | float2 uv : TEXCOORD0; 99 | float2 uv00 : TEXCOORD1; 100 | float2 uv01 : TEXCOORD2; 101 | float2 uv10 : TEXCOORD3; 102 | float2 uv11 : TEXCOORD4; 103 | float4 vertex : SV_POSITION; 104 | }; 105 | 106 | v2f vert(appdata v) 107 | { 108 | v2f o; 109 | o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); 110 | o.uv = v.uv; 111 | return o; 112 | } 113 | 114 | //----------------------------------------------------------------------------------------- 115 | // vertDownsampleDepth 116 | //----------------------------------------------------------------------------------------- 117 | v2fDownsample vertDownsampleDepth(appdata v, float2 texelSize) 118 | { 119 | v2fDownsample o; 120 | o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); 121 | #if SHADER_TARGET > 40 122 | o.uv = v.uv; 123 | #else 124 | o.uv00 = v.uv - 0.5 * texelSize.xy; 125 | o.uv10 = o.uv00 + float2(texelSize.x, 0); 126 | o.uv01 = o.uv00 + float2(0, texelSize.y); 127 | o.uv11 = o.uv00 + texelSize.xy; 128 | #endif 129 | return o; 130 | } 131 | 132 | //----------------------------------------------------------------------------------------- 133 | // vertUpsample 134 | //----------------------------------------------------------------------------------------- 135 | v2fUpsample vertUpsample(appdata v, float2 texelSize) 136 | { 137 | v2fUpsample o; 138 | o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); 139 | o.uv = v.uv; 140 | 141 | o.uv00 = v.uv - 0.5 * texelSize.xy; 142 | o.uv10 = o.uv00 + float2(texelSize.x, 0); 143 | o.uv01 = o.uv00 + float2(0, texelSize.y); 144 | o.uv11 = o.uv00 + texelSize.xy; 145 | return o; 146 | } 147 | 148 | //----------------------------------------------------------------------------------------- 149 | // BilateralUpsample 150 | //----------------------------------------------------------------------------------------- 151 | float4 BilateralUpsample(v2fUpsample input, Texture2D hiDepth, Texture2D loDepth, Texture2D loColor, SamplerState linearSampler, SamplerState pointSampler) 152 | { 153 | const float threshold = UPSAMPLE_DEPTH_THRESHOLD; 154 | float4 highResDepth = LinearEyeDepth(hiDepth.Sample(pointSampler, input.uv)).xxxx; 155 | float4 lowResDepth; 156 | 157 | lowResDepth[0] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv00)); 158 | lowResDepth[1] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv10)); 159 | lowResDepth[2] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv01)); 160 | lowResDepth[3] = LinearEyeDepth(loDepth.Sample(pointSampler, input.uv11)); 161 | 162 | float4 depthDiff = abs(lowResDepth - highResDepth); 163 | 164 | float accumDiff = dot(depthDiff, float4(1, 1, 1, 1)); 165 | 166 | [branch] 167 | if (accumDiff < threshold) // small error, not an edge -> use bilinear filter 168 | { 169 | return loColor.Sample(linearSampler, input.uv); 170 | } 171 | 172 | // find nearest sample 173 | float minDepthDiff = depthDiff[0]; 174 | float2 nearestUv = input.uv00; 175 | 176 | if (depthDiff[1] < minDepthDiff) 177 | { 178 | nearestUv = input.uv10; 179 | minDepthDiff = depthDiff[1]; 180 | } 181 | 182 | if (depthDiff[2] < minDepthDiff) 183 | { 184 | nearestUv = input.uv01; 185 | minDepthDiff = depthDiff[2]; 186 | } 187 | 188 | if (depthDiff[3] < minDepthDiff) 189 | { 190 | nearestUv = input.uv11; 191 | minDepthDiff = depthDiff[3]; 192 | } 193 | 194 | return loColor.Sample(pointSampler, nearestUv); 195 | } 196 | 197 | //----------------------------------------------------------------------------------------- 198 | // DownsampleDepth 199 | //----------------------------------------------------------------------------------------- 200 | float DownsampleDepth(v2fDownsample input, Texture2D depthTexture, SamplerState depthSampler) 201 | { 202 | #if SHADER_TARGET > 40 203 | float4 depth = depthTexture.Gather(depthSampler, input.uv); 204 | #else 205 | float4 depth; 206 | depth.x = depthTexture.Sample(depthSampler, input.uv00).x; 207 | depth.y = depthTexture.Sample(depthSampler, input.uv01).x; 208 | depth.z = depthTexture.Sample(depthSampler, input.uv10).x; 209 | depth.w = depthTexture.Sample(depthSampler, input.uv11).x; 210 | 211 | #endif 212 | 213 | #if DOWNSAMPLE_DEPTH_MODE == 0 // min depth 214 | return min(min(depth.x, depth.y), min(depth.z, depth.w)); 215 | #elif DOWNSAMPLE_DEPTH_MODE == 1 // max depth 216 | return max(max(depth.x, depth.y), max(depth.z, depth.w)); 217 | #elif DOWNSAMPLE_DEPTH_MODE == 2 // min/max depth in chessboard pattern 218 | 219 | float minDepth = min(min(depth.x, depth.y), min(depth.z, depth.w)); 220 | float maxDepth = max(max(depth.x, depth.y), max(depth.z, depth.w)); 221 | 222 | // chessboard pattern 223 | int2 position = input.vertex.xy % 2; 224 | int index = position.x + position.y; 225 | return index == 1 ? minDepth : maxDepth; 226 | #endif 227 | } 228 | 229 | //----------------------------------------------------------------------------------------- 230 | // GaussianWeight 231 | //----------------------------------------------------------------------------------------- 232 | float GaussianWeight(float offset, float deviation) 233 | { 234 | float weight = 1.0f / sqrt(2.0f * PI * deviation * deviation); 235 | weight *= exp(-(offset * offset) / (2.0f * deviation * deviation)); 236 | return weight; 237 | } 238 | 239 | //----------------------------------------------------------------------------------------- 240 | // BilateralBlur 241 | //----------------------------------------------------------------------------------------- 242 | float4 BilateralBlur(v2f input, int2 direction, Texture2D depth, SamplerState depthSampler, const int kernelRadius, float2 pixelSize) 243 | { 244 | //const float deviation = kernelRadius / 2.5; 245 | const float deviation = kernelRadius / GAUSS_BLUR_DEVIATION; // make it really strong 246 | 247 | float2 uv = input.uv; 248 | float4 centerColor = _MainTex.Sample(sampler_MainTex, uv); 249 | float3 color = centerColor.xyz; 250 | //return float4(color, 1); 251 | float centerDepth = (LinearEyeDepth(depth.Sample(depthSampler, uv))); 252 | 253 | float weightSum = 0; 254 | 255 | // gaussian weight is computed from constants only -> will be computed in compile time 256 | float weight = GaussianWeight(0, deviation); 257 | color *= weight; 258 | weightSum += weight; 259 | 260 | [unroll] for (int i = -kernelRadius; i < 0; i += 1) 261 | { 262 | float2 offset = (direction * i); 263 | float3 sampleColor = _MainTex.Sample(sampler_MainTex, input.uv, offset); 264 | float sampleDepth = (LinearEyeDepth(depth.Sample(depthSampler, input.uv, offset))); 265 | 266 | float depthDiff = abs(centerDepth - sampleDepth); 267 | float dFactor = depthDiff * BLUR_DEPTH_FACTOR; 268 | float w = exp(-(dFactor * dFactor)); 269 | 270 | // gaussian weight is computed from constants only -> will be computed in compile time 271 | weight = GaussianWeight(i, deviation) * w; 272 | 273 | color += weight * sampleColor; 274 | weightSum += weight; 275 | } 276 | 277 | [unroll] for (i = 1; i <= kernelRadius; i += 1) 278 | { 279 | float2 offset = (direction * i); 280 | float3 sampleColor = _MainTex.Sample(sampler_MainTex, input.uv, offset); 281 | float sampleDepth = (LinearEyeDepth(depth.Sample(depthSampler, input.uv, offset))); 282 | 283 | float depthDiff = abs(centerDepth - sampleDepth); 284 | float dFactor = depthDiff * BLUR_DEPTH_FACTOR; 285 | float w = exp(-(dFactor * dFactor)); 286 | 287 | // gaussian weight is computed from constants only -> will be computed in compile time 288 | weight = GaussianWeight(i, deviation) * w; 289 | 290 | color += weight * sampleColor; 291 | weightSum += weight; 292 | } 293 | 294 | color /= weightSum; 295 | return float4(color, centerColor.w); 296 | } 297 | 298 | ENDCG 299 | 300 | // pass 0 - horizontal blur (hires) 301 | Pass 302 | { 303 | CGPROGRAM 304 | #pragma vertex vert 305 | #pragma fragment horizontalFrag 306 | #pragma target 4.0 307 | 308 | fixed4 horizontalFrag(v2f input) : SV_Target 309 | { 310 | return BilateralBlur(input, int2(1, 0), _CameraDepthTexture, sampler_CameraDepthTexture, FULL_RES_BLUR_KERNEL_SIZE, _CameraDepthTexture_TexelSize.xy); 311 | } 312 | 313 | ENDCG 314 | } 315 | 316 | // pass 1 - vertical blur (hires) 317 | Pass 318 | { 319 | CGPROGRAM 320 | #pragma vertex vert 321 | #pragma fragment verticalFrag 322 | #pragma target 4.0 323 | 324 | fixed4 verticalFrag(v2f input) : SV_Target 325 | { 326 | return BilateralBlur(input, int2(0, 1), _CameraDepthTexture, sampler_CameraDepthTexture, FULL_RES_BLUR_KERNEL_SIZE, _CameraDepthTexture_TexelSize.xy); 327 | } 328 | 329 | ENDCG 330 | } 331 | 332 | // pass 2 - horizontal blur (lores) 333 | Pass 334 | { 335 | CGPROGRAM 336 | #pragma vertex vert 337 | #pragma fragment horizontalFrag 338 | #pragma target 4.0 339 | 340 | fixed4 horizontalFrag(v2f input) : SV_Target 341 | { 342 | return BilateralBlur(input, int2(1, 0), _HalfResDepthBuffer, sampler_HalfResDepthBuffer, HALF_RES_BLUR_KERNEL_SIZE, _HalfResDepthBuffer_TexelSize.xy); 343 | } 344 | 345 | ENDCG 346 | } 347 | 348 | // pass 3 - vertical blur (lores) 349 | Pass 350 | { 351 | CGPROGRAM 352 | #pragma vertex vert 353 | #pragma fragment verticalFrag 354 | #pragma target 4.0 355 | 356 | fixed4 verticalFrag(v2f input) : SV_Target 357 | { 358 | return BilateralBlur(input, int2(0, 1), _HalfResDepthBuffer, sampler_HalfResDepthBuffer, HALF_RES_BLUR_KERNEL_SIZE, _HalfResDepthBuffer_TexelSize.xy); 359 | } 360 | 361 | ENDCG 362 | } 363 | 364 | // pass 4 - downsample depth to half 365 | Pass 366 | { 367 | CGPROGRAM 368 | #pragma vertex vertHalfDepth 369 | #pragma fragment frag 370 | #pragma target gl4.1 371 | 372 | v2fDownsample vertHalfDepth(appdata v) 373 | { 374 | return vertDownsampleDepth(v, _CameraDepthTexture_TexelSize); 375 | } 376 | 377 | float frag(v2fDownsample input) : SV_Target 378 | { 379 | return DownsampleDepth(input, _CameraDepthTexture, sampler_CameraDepthTexture); 380 | } 381 | 382 | ENDCG 383 | } 384 | 385 | // pass 5 - bilateral upsample 386 | Pass 387 | { 388 | Blend One Zero 389 | 390 | CGPROGRAM 391 | #pragma vertex vertUpsampleToFull 392 | #pragma fragment frag 393 | #pragma target 4.0 394 | 395 | v2fUpsample vertUpsampleToFull(appdata v) 396 | { 397 | return vertUpsample(v, _HalfResDepthBuffer_TexelSize); 398 | } 399 | float4 frag(v2fUpsample input) : SV_Target 400 | { 401 | return BilateralUpsample(input, _CameraDepthTexture, _HalfResDepthBuffer, _HalfResColor, sampler_HalfResColor, sampler_HalfResDepthBuffer); 402 | } 403 | 404 | ENDCG 405 | } 406 | 407 | // pass 6 - downsample depth to quarter 408 | Pass 409 | { 410 | CGPROGRAM 411 | #pragma vertex vertQuarterDepth 412 | #pragma fragment frag 413 | #pragma target gl4.1 414 | 415 | v2fDownsample vertQuarterDepth(appdata v) 416 | { 417 | return vertDownsampleDepth(v, _HalfResDepthBuffer_TexelSize); 418 | } 419 | 420 | float frag(v2fDownsample input) : SV_Target 421 | { 422 | return DownsampleDepth(input, _HalfResDepthBuffer, sampler_HalfResDepthBuffer); 423 | } 424 | 425 | ENDCG 426 | } 427 | 428 | // pass 7 - bilateral upsample quarter to full 429 | Pass 430 | { 431 | Blend One Zero 432 | 433 | CGPROGRAM 434 | #pragma vertex vertUpsampleToFull 435 | #pragma fragment frag 436 | #pragma target 4.0 437 | 438 | v2fUpsample vertUpsampleToFull(appdata v) 439 | { 440 | return vertUpsample(v, _QuarterResDepthBuffer_TexelSize); 441 | } 442 | float4 frag(v2fUpsample input) : SV_Target 443 | { 444 | return BilateralUpsample(input, _CameraDepthTexture, _QuarterResDepthBuffer, _QuarterResColor, sampler_QuarterResColor, sampler_QuarterResDepthBuffer); 445 | } 446 | 447 | ENDCG 448 | } 449 | 450 | // pass 8 - horizontal blur (quarter res) 451 | Pass 452 | { 453 | CGPROGRAM 454 | #pragma vertex vert 455 | #pragma fragment horizontalFrag 456 | #pragma target 4.0 457 | 458 | fixed4 horizontalFrag(v2f input) : SV_Target 459 | { 460 | return BilateralBlur(input, int2(1, 0), _QuarterResDepthBuffer, sampler_QuarterResDepthBuffer, QUARTER_RES_BLUR_KERNEL_SIZE, _QuarterResDepthBuffer_TexelSize.xy); 461 | } 462 | 463 | ENDCG 464 | } 465 | 466 | // pass 9 - vertical blur (quarter res) 467 | Pass 468 | { 469 | CGPROGRAM 470 | #pragma vertex vert 471 | #pragma fragment verticalFrag 472 | #pragma target 4.0 473 | 474 | fixed4 verticalFrag(v2f input) : SV_Target 475 | { 476 | return BilateralBlur(input, int2(0, 1), _QuarterResDepthBuffer, sampler_QuarterResDepthBuffer, QUARTER_RES_BLUR_KERNEL_SIZE, _QuarterResDepthBuffer_TexelSize.xy); 477 | } 478 | 479 | ENDCG 480 | } 481 | 482 | // pass 10 - downsample depth to half (fallback for DX10) 483 | Pass 484 | { 485 | CGPROGRAM 486 | #pragma vertex vertHalfDepth 487 | #pragma fragment frag 488 | #pragma target 4.0 489 | 490 | v2fDownsample vertHalfDepth(appdata v) 491 | { 492 | return vertDownsampleDepth(v, _CameraDepthTexture_TexelSize); 493 | } 494 | 495 | float frag(v2fDownsample input) : SV_Target 496 | { 497 | return DownsampleDepth(input, _CameraDepthTexture, sampler_CameraDepthTexture); 498 | } 499 | 500 | ENDCG 501 | } 502 | 503 | // pass 11 - downsample depth to quarter (fallback for DX10) 504 | Pass 505 | { 506 | CGPROGRAM 507 | #pragma vertex vertQuarterDepth 508 | #pragma fragment frag 509 | #pragma target 4.0 510 | 511 | v2fDownsample vertQuarterDepth(appdata v) 512 | { 513 | return vertDownsampleDepth(v, _HalfResDepthBuffer_TexelSize); 514 | } 515 | 516 | float frag(v2fDownsample input) : SV_Target 517 | { 518 | return DownsampleDepth(input, _HalfResDepthBuffer, sampler_HalfResDepthBuffer); 519 | } 520 | 521 | ENDCG 522 | } 523 | } 524 | } 525 | -------------------------------------------------------------------------------- /Assets/Shaders/BilateralBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d297a5d5cdd4e7f469b33e9f468e00d1 3 | timeCreated: 1459178236 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/BlitAdd.shader: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2016, Michal Skalsky 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modification, 5 | // are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // 3. Neither the name of the copyright holder nor the names of its contributors 15 | // may be used to endorse or promote products derived from this software without 16 | // specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 19 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT 21 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | 29 | 30 | Shader "Hidden/BlitAdd" 31 | { 32 | Properties{ _MainTex("Texture", any) = "" {} } 33 | SubShader 34 | { 35 | Pass 36 | { 37 | ZTest Always Cull Off ZWrite Off 38 | Blend One Zero 39 | 40 | CGPROGRAM 41 | #pragma vertex vert 42 | #pragma fragment frag 43 | 44 | #include "UnityCG.cginc" 45 | 46 | sampler2D _MainTex; 47 | sampler2D _Source; 48 | uniform float4 _MainTex_ST; 49 | float4 _Source_TexelSize; 50 | 51 | struct appdata_t 52 | { 53 | float4 vertex : POSITION; 54 | float2 texcoord : TEXCOORD0; 55 | }; 56 | 57 | struct v2f 58 | { 59 | float4 vertex : SV_POSITION; 60 | float2 texcoord : TEXCOORD0; 61 | }; 62 | 63 | v2f vert(appdata_t v) 64 | { 65 | v2f o; 66 | o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); 67 | o.texcoord = TRANSFORM_TEX(v.texcoord.xy, _MainTex); 68 | 69 | return o; 70 | } 71 | 72 | fixed4 frag(v2f i) : SV_Target 73 | { 74 | float4 main = tex2D(_MainTex, i.texcoord); 75 | 76 | #if UNITY_UV_STARTS_AT_TOP 77 | if (_Source_TexelSize.y < 0) 78 | i.texcoord.y = 1 - i.texcoord.y; 79 | #endif 80 | float4 source = tex2D(_Source, i.texcoord); 81 | 82 | source *= main.w; 83 | source.xyz += main.xyz; 84 | return source; 85 | } 86 | ENDCG 87 | } 88 | } 89 | Fallback Off 90 | } 91 | -------------------------------------------------------------------------------- /Assets/Shaders/BlitAdd.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c2282c5842bb6d74d999852919953d40 3 | timeCreated: 1459178236 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/VolumetricLight.shader: -------------------------------------------------------------------------------- 1 | // Copyright(c) 2016, Michal Skalsky 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without modification, 5 | // are permitted provided that the following conditions are met: 6 | // 7 | // 1. Redistributions of source code must retain the above copyright notice, 8 | // this list of conditions and the following disclaimer. 9 | // 10 | // 2. Redistributions in binary form must reproduce the above copyright notice, 11 | // this list of conditions and the following disclaimer in the documentation 12 | // and/or other materials provided with the distribution. 13 | // 14 | // 3. Neither the name of the copyright holder nor the names of its contributors 15 | // may be used to endorse or promote products derived from this software without 16 | // specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 19 | // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT 21 | // SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 23 | // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 25 | // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | 28 | 29 | 30 | Shader "Sandbox/VolumetricLight" 31 | { 32 | Properties 33 | { 34 | [HideInInspector]_MainTex ("Texture", 2D) = "white" {} 35 | [HideInInspector]_ZTest ("ZTest", Float) = 0 36 | [HideInInspector]_LightColor("_LightColor", Color) = (1,1,1,1) 37 | } 38 | SubShader 39 | { 40 | Tags { "RenderType"="Opaque" } 41 | LOD 100 42 | 43 | CGINCLUDE 44 | 45 | #if defined(SHADOWS_DEPTH) || defined(SHADOWS_CUBE) 46 | #define SHADOWS_NATIVE 47 | #endif 48 | 49 | #include "UnityCG.cginc" 50 | #include "UnityDeferredLibrary.cginc" 51 | 52 | sampler3D _NoiseTexture; 53 | sampler2D _DitherTexture; 54 | 55 | float4 _FrustumCorners[4]; 56 | 57 | struct appdata 58 | { 59 | float4 vertex : POSITION; 60 | }; 61 | 62 | float4x4 _WorldViewProj; 63 | float4x4 _MyLightMatrix0; 64 | float4x4 _MyWorld2Shadow; 65 | 66 | float3 _CameraForward; 67 | 68 | // x: scattering coef, y: extinction coef, z: range w: skybox extinction coef 69 | float4 _VolumetricLight; 70 | // x: 1 - g^2, y: 1 + g^2, z: 2*g, w: 1/4pi 71 | float4 _MieG; 72 | 73 | // x: scale, y: intensity, z: intensity offset 74 | float4 _NoiseData; 75 | // x: x velocity, y: z velocity 76 | float4 _NoiseVelocity; 77 | // x: ground level, y: height scale, z: unused, w: unused 78 | float4 _HeightFog; 79 | //float4 _LightDir; 80 | 81 | float _MaxRayLength; 82 | 83 | int _SampleCount; 84 | 85 | struct v2f 86 | { 87 | float4 pos : SV_POSITION; 88 | float4 uv : TEXCOORD0; 89 | float3 wpos : TEXCOORD1; 90 | }; 91 | 92 | v2f vert(appdata v) 93 | { 94 | v2f o; 95 | o.pos = mul(_WorldViewProj, v.vertex); 96 | o.uv = ComputeScreenPos(o.pos); 97 | o.wpos = mul(_Object2World, v.vertex); 98 | return o; 99 | } 100 | 101 | //----------------------------------------------------------------------------------------- 102 | // GetCascadeWeights_SplitSpheres 103 | //----------------------------------------------------------------------------------------- 104 | inline fixed4 GetCascadeWeights_SplitSpheres(float3 wpos) 105 | { 106 | float3 fromCenter0 = wpos.xyz - unity_ShadowSplitSpheres[0].xyz; 107 | float3 fromCenter1 = wpos.xyz - unity_ShadowSplitSpheres[1].xyz; 108 | float3 fromCenter2 = wpos.xyz - unity_ShadowSplitSpheres[2].xyz; 109 | float3 fromCenter3 = wpos.xyz - unity_ShadowSplitSpheres[3].xyz; 110 | float4 distances2 = float4(dot(fromCenter0, fromCenter0), dot(fromCenter1, fromCenter1), dot(fromCenter2, fromCenter2), dot(fromCenter3, fromCenter3)); 111 | 112 | fixed4 weights = float4(distances2 < unity_ShadowSplitSqRadii); 113 | weights.yzw = saturate(weights.yzw - weights.xyz); 114 | return weights; 115 | } 116 | 117 | //----------------------------------------------------------------------------------------- 118 | // GetCascadeShadowCoord 119 | //----------------------------------------------------------------------------------------- 120 | inline float4 GetCascadeShadowCoord(float4 wpos, fixed4 cascadeWeights) 121 | { 122 | float3 sc0 = mul(unity_World2Shadow[0], wpos).xyz; 123 | float3 sc1 = mul(unity_World2Shadow[1], wpos).xyz; 124 | float3 sc2 = mul(unity_World2Shadow[2], wpos).xyz; 125 | float3 sc3 = mul(unity_World2Shadow[3], wpos).xyz; 126 | 127 | float4 shadowMapCoordinate = float4(sc0 * cascadeWeights[0] + sc1 * cascadeWeights[1] + sc2 * cascadeWeights[2] + sc3 * cascadeWeights[3], 1); 128 | #if defined(UNITY_REVERSED_Z) 129 | float noCascadeWeights = 1 - dot(cascadeWeights, float4(1, 1, 1, 1)); 130 | shadowMapCoordinate.z += noCascadeWeights; 131 | #endif 132 | return shadowMapCoordinate; 133 | } 134 | 135 | UNITY_DECLARE_SHADOWMAP(_CascadeShadowMapTexture); 136 | 137 | //----------------------------------------------------------------------------------------- 138 | // GetLightAttenuation 139 | //----------------------------------------------------------------------------------------- 140 | float GetLightAttenuation(float3 wpos) 141 | { 142 | float atten = 0; 143 | #if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) 144 | atten = 1; 145 | #if defined (SHADOWS_DEPTH) 146 | // sample cascade shadow map 147 | float4 cascadeWeights = GetCascadeWeights_SplitSpheres(wpos); 148 | bool inside = dot(cascadeWeights, float4(1, 1, 1, 1)) < 4; 149 | float4 samplePos = GetCascadeShadowCoord(float4(wpos, 1), cascadeWeights); 150 | 151 | atten = inside ? UNITY_SAMPLE_SHADOW(_CascadeShadowMapTexture, samplePos.xyz) : 1.0f; 152 | atten = _LightShadowData.r + atten * (1 - _LightShadowData.r); 153 | //atten = inside ? tex2Dproj(_ShadowMapTexture, float4((samplePos).xyz, 1)).r : 1.0f; 154 | #endif 155 | #if defined (DIRECTIONAL_COOKIE) 156 | // NOT IMPLEMENTED 157 | #endif 158 | #elif defined (SPOT) 159 | float3 tolight = _LightPos.xyz - wpos; 160 | half3 lightDir = normalize(tolight); 161 | 162 | float4 uvCookie = mul(_MyLightMatrix0, float4(wpos, 1)); 163 | // negative bias because http://aras-p.info/blog/2010/01/07/screenspace-vs-mip-mapping/ 164 | atten = tex2Dbias(_LightTexture0, float4(uvCookie.xy / uvCookie.w, 0, -8)).w; 165 | atten *= uvCookie.w < 0; 166 | float att = dot(tolight, tolight) * _LightPos.w; 167 | atten *= tex2D(_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL; 168 | 169 | #if defined(SHADOWS_DEPTH) 170 | float4 shadowCoord = mul(_MyWorld2Shadow, float4(wpos, 1)); 171 | atten *= saturate(UnitySampleShadowmap(shadowCoord)); 172 | #endif 173 | #elif defined (POINT) || defined (POINT_COOKIE) 174 | float3 tolight = wpos - _LightPos.xyz; 175 | half3 lightDir = -normalize(tolight); 176 | 177 | float att = dot(tolight, tolight) * _LightPos.w; 178 | atten = tex2D(_LightTextureB0, att.rr).UNITY_ATTEN_CHANNEL; 179 | 180 | atten *= UnityDeferredComputeShadow(tolight, 0, float2(0, 0)); 181 | 182 | #if defined (POINT_COOKIE) 183 | atten *= texCUBEbias(_LightTexture0, float4(mul(_MyLightMatrix0, half4(wpos, 1)).xyz, -8)).w; 184 | #endif //POINT_COOKIE 185 | #endif 186 | return atten; 187 | } 188 | 189 | //----------------------------------------------------------------------------------------- 190 | // ApplyHeightFog 191 | //----------------------------------------------------------------------------------------- 192 | void ApplyHeightFog(float3 wpos, inout float density) 193 | { 194 | #ifdef HEIGHT_FOG 195 | density *= exp(-(wpos.y + _HeightFog.x) * _HeightFog.y); 196 | #endif 197 | } 198 | 199 | //----------------------------------------------------------------------------------------- 200 | // GetDensity 201 | //----------------------------------------------------------------------------------------- 202 | float GetDensity(float3 wpos) 203 | { 204 | float density = 1; 205 | #ifdef NOISE 206 | float noise = tex3D(_NoiseTexture, frac(wpos * _NoiseData.x + float3(_Time.y * _NoiseVelocity.x, 0, _Time.y * _NoiseVelocity.y))); 207 | noise = saturate(noise - _NoiseData.z) * _NoiseData.y; 208 | density = saturate(noise); 209 | #endif 210 | ApplyHeightFog(wpos, density); 211 | 212 | return density; 213 | } 214 | 215 | //----------------------------------------------------------------------------------------- 216 | // MieScattering 217 | //----------------------------------------------------------------------------------------- 218 | float MieScattering(float cosAngle, float4 g) 219 | { 220 | return g.w * (g.x / (pow(g.y - g.z * cosAngle, 1.5))); 221 | } 222 | 223 | //----------------------------------------------------------------------------------------- 224 | // RayMarch 225 | //----------------------------------------------------------------------------------------- 226 | float4 RayMarch(float2 screenPos, float3 rayStart, float3 rayDir, float rayLength) 227 | { 228 | #ifdef DITHER_4_4 229 | float2 interleavedPos = (fmod(floor(screenPos.xy), 4.0)); 230 | float offset = tex2D(_DitherTexture, interleavedPos / 4.0 + float2(0.5 / 4.0, 0.5 / 4.0)).w; 231 | #else 232 | float2 interleavedPos = (fmod(floor(screenPos.xy), 8.0)); 233 | float offset = tex2D(_DitherTexture, interleavedPos / 8.0 + float2(0.5 / 8.0, 0.5 / 8.0)).w; 234 | #endif 235 | 236 | int stepCount = _SampleCount; 237 | 238 | float stepSize = rayLength / stepCount; 239 | float3 step = rayDir * stepSize; 240 | 241 | float3 currentPosition = rayStart + step * offset; 242 | 243 | float4 vlight = 0; 244 | 245 | float cosAngle; 246 | #if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) 247 | float extinction = 0; 248 | cosAngle = dot(_LightDir.xyz, -rayDir); 249 | #else 250 | // we don't know about density between camera and light's volume, assume 0.5 251 | float extinction = length(_WorldSpaceCameraPos - currentPosition) * _VolumetricLight.y * 0.5; 252 | #endif 253 | [loop] 254 | for (int i = 0; i < stepCount; ++i) 255 | { 256 | float atten = GetLightAttenuation(currentPosition); 257 | float density = GetDensity(currentPosition); 258 | 259 | float scattering = _VolumetricLight.x * stepSize * density; 260 | extinction += _VolumetricLight.y * stepSize * density;// +scattering; 261 | 262 | float4 light = atten * scattering * exp(-extinction); 263 | 264 | //#if PHASE_FUNCTOIN 265 | #if !defined (DIRECTIONAL) && !defined (DIRECTIONAL_COOKIE) 266 | // phase functino for spot and point lights 267 | float3 tolight = normalize(currentPosition - _LightPos.xyz); 268 | cosAngle = dot(tolight, -rayDir); 269 | light *= MieScattering(cosAngle, _MieG); 270 | #endif 271 | //#endif 272 | vlight += light; 273 | 274 | currentPosition += step; 275 | } 276 | 277 | #if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) 278 | // apply phase function for dir light 279 | vlight *= MieScattering(cosAngle, _MieG); 280 | #endif 281 | 282 | // apply light's color 283 | vlight *= _LightColor; 284 | 285 | vlight = max(0, vlight); 286 | #if defined (DIRECTIONAL) || defined (DIRECTIONAL_COOKIE) // use "proper" out-scattering/absorption for dir light 287 | vlight.w = exp(-extinction); 288 | #else 289 | vlight.w = 0; 290 | #endif 291 | return vlight; 292 | } 293 | 294 | //----------------------------------------------------------------------------------------- 295 | // RayConeIntersect 296 | //----------------------------------------------------------------------------------------- 297 | float2 RayConeIntersect(in float3 f3ConeApex, in float3 f3ConeAxis, in float fCosAngle, in float3 f3RayStart, in float3 f3RayDir) 298 | { 299 | float inf = 10000; 300 | f3RayStart -= f3ConeApex; 301 | float a = dot(f3RayDir, f3ConeAxis); 302 | float b = dot(f3RayDir, f3RayDir); 303 | float c = dot(f3RayStart, f3ConeAxis); 304 | float d = dot(f3RayStart, f3RayDir); 305 | float e = dot(f3RayStart, f3RayStart); 306 | fCosAngle *= fCosAngle; 307 | float A = a*a - b*fCosAngle; 308 | float B = 2 * (c*a - d*fCosAngle); 309 | float C = c*c - e*fCosAngle; 310 | float D = B*B - 4 * A*C; 311 | 312 | if (D > 0) 313 | { 314 | D = sqrt(D); 315 | float2 t = (-B + sign(A)*float2(-D, +D)) / (2 * A); 316 | bool2 b2IsCorrect = c + a * t > 0 && t > 0; 317 | t = t * b2IsCorrect + !b2IsCorrect * (inf); 318 | return t; 319 | } 320 | else // no intersection 321 | return inf; 322 | } 323 | 324 | //----------------------------------------------------------------------------------------- 325 | // RayPlaneIntersect 326 | //----------------------------------------------------------------------------------------- 327 | float RayPlaneIntersect(in float3 planeNormal, in float planeD, in float3 rayOrigin, in float3 rayDir) 328 | { 329 | float NdotD = dot(planeNormal, rayDir); 330 | float NdotO = dot(planeNormal, rayOrigin); 331 | 332 | float t = -(NdotO + planeD) / NdotD; 333 | if (t < 0) 334 | t = 100000; 335 | return t; 336 | } 337 | 338 | ENDCG 339 | 340 | // pass 0 - point light, camera inside 341 | Pass 342 | { 343 | ZTest Off 344 | Cull Front 345 | ZWrite Off 346 | Blend One One 347 | 348 | CGPROGRAM 349 | #pragma vertex vert 350 | #pragma fragment fragPointInside 351 | #pragma target 4.0 352 | 353 | #define UNITY_HDR_ON 354 | 355 | #pragma shader_feature HEIGHT_FOG 356 | #pragma shader_feature NOISE 357 | #pragma shader_feature SHADOWS_CUBE 358 | #pragma shader_feature POINT_COOKIE 359 | #pragma shader_feature POINT 360 | 361 | #ifdef SHADOWS_DEPTH 362 | #define SHADOWS_NATIVE 363 | #endif 364 | 365 | 366 | fixed4 fragPointInside(v2f i) : SV_Target 367 | { 368 | float2 uv = i.uv.xy / i.uv.w; 369 | 370 | // read depth and reconstruct world position 371 | float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 372 | 373 | float3 rayStart = _WorldSpaceCameraPos; 374 | float3 rayEnd = i.wpos; 375 | 376 | float3 rayDir = (rayEnd - rayStart); 377 | float rayLength = length(rayDir); 378 | 379 | rayDir /= rayLength; 380 | 381 | float linearDepth = LinearEyeDepth(depth); 382 | float projectedDepth = linearDepth / dot(_CameraForward, rayDir); 383 | rayLength = min(rayLength, projectedDepth); 384 | 385 | return RayMarch(i.pos.xy, rayStart, rayDir, rayLength); 386 | } 387 | ENDCG 388 | } 389 | 390 | // pass 1 - spot light, camera inside 391 | Pass 392 | { 393 | ZTest Off 394 | Cull Front 395 | ZWrite Off 396 | Blend One One 397 | 398 | CGPROGRAM 399 | #pragma vertex vert 400 | #pragma fragment fragPointInside 401 | #pragma target 4.0 402 | 403 | #define UNITY_HDR_ON 404 | 405 | #pragma shader_feature HEIGHT_FOG 406 | #pragma shader_feature NOISE 407 | #pragma shader_feature SHADOWS_DEPTH 408 | #pragma shader_feature SPOT 409 | 410 | #ifdef SHADOWS_DEPTH 411 | #define SHADOWS_NATIVE 412 | #endif 413 | 414 | fixed4 fragPointInside(v2f i) : SV_Target 415 | { 416 | float2 uv = i.uv.xy / i.uv.w; 417 | 418 | // read depth and reconstruct world position 419 | float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 420 | 421 | float3 rayStart = _WorldSpaceCameraPos; 422 | float3 rayEnd = i.wpos; 423 | 424 | float3 rayDir = (rayEnd - rayStart); 425 | float rayLength = length(rayDir); 426 | 427 | rayDir /= rayLength; 428 | 429 | float linearDepth = LinearEyeDepth(depth); 430 | float projectedDepth = linearDepth / dot(_CameraForward, rayDir); 431 | rayLength = min(rayLength, projectedDepth); 432 | 433 | return RayMarch(i.pos.xy, rayStart, rayDir, rayLength); 434 | } 435 | ENDCG 436 | } 437 | 438 | // pass 2 - point light, camera outside 439 | Pass 440 | { 441 | //ZTest Off 442 | ZTest [_ZTest] 443 | Cull Back 444 | ZWrite Off 445 | Blend One One 446 | 447 | CGPROGRAM 448 | #pragma vertex vert 449 | #pragma fragment fragPointOutside 450 | #pragma target 4.0 451 | 452 | #define UNITY_HDR_ON 453 | 454 | #pragma shader_feature HEIGHT_FOG 455 | #pragma shader_feature SHADOWS_CUBE 456 | #pragma shader_feature NOISE 457 | //#pragma multi_compile POINT POINT_COOKIE 458 | #pragma shader_feature POINT_COOKIE 459 | #pragma shader_feature POINT 460 | 461 | fixed4 fragPointOutside(v2f i) : SV_Target 462 | { 463 | float2 uv = i.uv.xy / i.uv.w; 464 | 465 | // read depth and reconstruct world position 466 | float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 467 | 468 | float3 rayStart = _WorldSpaceCameraPos; 469 | float3 rayEnd = i.wpos; 470 | 471 | float3 rayDir = (rayEnd - rayStart); 472 | float rayLength = length(rayDir); 473 | 474 | rayDir /= rayLength; 475 | 476 | float3 lightToCamera = _WorldSpaceCameraPos - _LightPos; 477 | 478 | float b = dot(rayDir, lightToCamera); 479 | float c = dot(lightToCamera, lightToCamera) - (_VolumetricLight.z * _VolumetricLight.z); 480 | 481 | float d = sqrt((b*b) - c); 482 | float start = -b - d; 483 | float end = -b + d; 484 | 485 | float linearDepth = LinearEyeDepth(depth); 486 | float projectedDepth = linearDepth / dot(_CameraForward, rayDir); 487 | end = min(end, projectedDepth); 488 | 489 | rayStart = rayStart + rayDir * start; 490 | rayLength = end - start; 491 | 492 | return RayMarch(i.pos.xy, rayStart, rayDir, rayLength); 493 | } 494 | ENDCG 495 | } 496 | 497 | // pass 3 - spot light, camera outside 498 | Pass 499 | { 500 | //ZTest Off 501 | ZTest[_ZTest] 502 | Cull Back 503 | ZWrite Off 504 | Blend One One 505 | 506 | CGPROGRAM 507 | #pragma vertex vert 508 | #pragma fragment fragSpotOutside 509 | #pragma target 4.0 510 | 511 | #define UNITY_HDR_ON 512 | 513 | #pragma shader_feature HEIGHT_FOG 514 | #pragma shader_feature SHADOWS_DEPTH 515 | #pragma shader_feature NOISE 516 | #pragma shader_feature SPOT 517 | 518 | #ifdef SHADOWS_DEPTH 519 | #define SHADOWS_NATIVE 520 | #endif 521 | 522 | float _CosAngle; 523 | float4 _ConeAxis; 524 | float4 _ConeApex; 525 | float _PlaneD; 526 | 527 | fixed4 fragSpotOutside(v2f i) : SV_Target 528 | { 529 | float2 uv = i.uv.xy / i.uv.w; 530 | 531 | // read depth and reconstruct world position 532 | float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 533 | 534 | float3 rayStart = _WorldSpaceCameraPos; 535 | float3 rayEnd = i.wpos; 536 | 537 | float3 rayDir = (rayEnd - rayStart); 538 | float rayLength = length(rayDir); 539 | 540 | rayDir /= rayLength; 541 | 542 | 543 | // inside cone 544 | float3 r1 = rayEnd + rayDir * 0.001; 545 | 546 | // plane intersection 547 | float planeCoord = RayPlaneIntersect(_ConeAxis, _PlaneD, r1, rayDir); 548 | // ray cone intersection 549 | float2 lineCoords = RayConeIntersect(_ConeApex, _ConeAxis, _CosAngle, r1, rayDir); 550 | 551 | float linearDepth = LinearEyeDepth(depth); 552 | float projectedDepth = linearDepth / dot(_CameraForward, rayDir); 553 | 554 | float z = (projectedDepth - rayLength); 555 | rayLength = min(planeCoord, min(lineCoords.x, lineCoords.y)); 556 | rayLength = min(rayLength, z); 557 | 558 | return RayMarch(i.pos.xy, rayEnd, rayDir, rayLength); 559 | } 560 | ENDCG 561 | } 562 | 563 | // pass 4 - directional light 564 | Pass 565 | { 566 | ZTest Off 567 | Cull Off 568 | ZWrite Off 569 | Blend One One, One Zero 570 | 571 | CGPROGRAM 572 | 573 | #pragma vertex vertDir 574 | #pragma fragment fragDir 575 | #pragma target 4.0 576 | 577 | #define UNITY_HDR_ON 578 | 579 | #pragma shader_feature HEIGHT_FOG 580 | #pragma shader_feature NOISE 581 | #pragma shader_feature SHADOWS_DEPTH 582 | #pragma shader_feature DIRECTIONAL_COOKIE 583 | #pragma shader_feature DIRECTIONAL 584 | 585 | #ifdef SHADOWS_DEPTH 586 | #define SHADOWS_NATIVE 587 | #endif 588 | 589 | struct VSInput 590 | { 591 | float4 vertex : POSITION; 592 | float2 uv : TEXCOORD0; 593 | uint vertexId : SV_VertexID; 594 | }; 595 | 596 | struct PSInput 597 | { 598 | float4 pos : SV_POSITION; 599 | float2 uv : TEXCOORD0; 600 | float3 wpos : TEXCOORD1; 601 | }; 602 | 603 | PSInput vertDir(VSInput i) 604 | { 605 | PSInput o; 606 | 607 | o.pos = mul(UNITY_MATRIX_MVP, i.vertex); 608 | o.uv = i.uv; 609 | 610 | // SV_VertexId doesn't work on OpenGL for some reason -> reconstruct id from uv 611 | //o.wpos = _FrustumCorners[i.vertexId]; 612 | o.wpos = _FrustumCorners[i.uv.x + i.uv.y*2]; 613 | 614 | return o; 615 | } 616 | 617 | fixed4 fragDir(PSInput i) : SV_Target 618 | { 619 | float2 uv = i.uv.xy; 620 | float depth = SAMPLE_DEPTH_TEXTURE(_CameraDepthTexture, uv); 621 | float linearDepth = Linear01Depth(depth); 622 | 623 | float3 wpos = i.wpos; 624 | float3 rayStart = _WorldSpaceCameraPos; 625 | float3 rayDir = wpos - _WorldSpaceCameraPos; 626 | rayDir *= linearDepth; 627 | 628 | float rayLength = length(rayDir); 629 | rayDir /= rayLength; 630 | 631 | rayLength = min(rayLength, _MaxRayLength); 632 | 633 | float4 color = RayMarch(i.pos.xy, rayStart, rayDir, rayLength); 634 | 635 | if (linearDepth > 0.999999) 636 | { 637 | color.w = lerp(color.w, 1, _VolumetricLight.w); 638 | } 639 | return color; 640 | } 641 | ENDCG 642 | } 643 | } 644 | } 645 | -------------------------------------------------------------------------------- /Assets/Shaders/VolumetricLight.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f1531a9bd4087ff468de8de09f6ba126 3 | timeCreated: 1459178237 4 | licenseType: Free 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8b36bcde4aee85a4ca42666be9a03e7e 3 | folderAsset: yes 4 | timeCreated: 1460465907 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 49e310ca7bf18b24b98aa6fdaa7c0665 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3aca379aa83f53844b43d6d3cc517740 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a01d87c0e5338d448940bc79f32e0c51 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/PostEffectsBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [RequireComponent (typeof(Camera))] 8 | public class PostEffectsBase : MonoBehaviour 9 | { 10 | protected bool supportHDRTextures = true; 11 | protected bool supportDX11 = false; 12 | protected bool isSupported = true; 13 | 14 | protected Material CheckShaderAndCreateMaterial ( Shader s, Material m2Create) 15 | { 16 | if (!s) 17 | { 18 | Debug.Log("Missing shader in " + ToString ()); 19 | enabled = false; 20 | return null; 21 | } 22 | 23 | if (s.isSupported && m2Create && m2Create.shader == s) 24 | return m2Create; 25 | 26 | if (!s.isSupported) 27 | { 28 | NotSupported (); 29 | Debug.Log("The shader " + s.ToString() + " on effect "+ToString()+" is not supported on this platform!"); 30 | return null; 31 | } 32 | else 33 | { 34 | m2Create = new Material (s); 35 | m2Create.hideFlags = HideFlags.DontSave; 36 | if (m2Create) 37 | return m2Create; 38 | else return null; 39 | } 40 | } 41 | 42 | 43 | protected Material CreateMaterial (Shader s, Material m2Create) 44 | { 45 | if (!s) 46 | { 47 | Debug.Log ("Missing shader in " + ToString ()); 48 | return null; 49 | } 50 | 51 | if (m2Create && (m2Create.shader == s) && (s.isSupported)) 52 | return m2Create; 53 | 54 | if (!s.isSupported) 55 | { 56 | return null; 57 | } 58 | else 59 | { 60 | m2Create = new Material (s); 61 | m2Create.hideFlags = HideFlags.DontSave; 62 | if (m2Create) 63 | return m2Create; 64 | else return null; 65 | } 66 | } 67 | 68 | void OnEnable () 69 | { 70 | isSupported = true; 71 | } 72 | 73 | protected bool CheckSupport () 74 | { 75 | return CheckSupport (false); 76 | } 77 | 78 | 79 | public virtual bool CheckResources () 80 | { 81 | Debug.LogWarning ("CheckResources () for " + ToString() + " should be overwritten."); 82 | return isSupported; 83 | } 84 | 85 | 86 | protected void Start () 87 | { 88 | CheckResources (); 89 | } 90 | 91 | protected bool CheckSupport (bool needDepth) 92 | { 93 | isSupported = true; 94 | supportHDRTextures = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.ARGBHalf); 95 | supportDX11 = SystemInfo.graphicsShaderLevel >= 50 && SystemInfo.supportsComputeShaders; 96 | 97 | if (!SystemInfo.supportsImageEffects || !SystemInfo.supportsRenderTextures) 98 | { 99 | NotSupported (); 100 | return false; 101 | } 102 | 103 | if (needDepth && !SystemInfo.SupportsRenderTextureFormat (RenderTextureFormat.Depth)) 104 | { 105 | NotSupported (); 106 | return false; 107 | } 108 | 109 | if (needDepth) 110 | GetComponent().depthTextureMode |= DepthTextureMode.Depth; 111 | 112 | return true; 113 | } 114 | 115 | protected bool CheckSupport (bool needDepth, bool needHdr) 116 | { 117 | if (!CheckSupport(needDepth)) 118 | return false; 119 | 120 | if (needHdr && !supportHDRTextures) 121 | { 122 | NotSupported (); 123 | return false; 124 | } 125 | 126 | return true; 127 | } 128 | 129 | 130 | public bool Dx11Support () 131 | { 132 | return supportDX11; 133 | } 134 | 135 | 136 | protected void ReportAutoDisable () 137 | { 138 | Debug.LogWarning ("The image effect " + ToString() + " has been disabled as it's not supported on the current platform."); 139 | } 140 | 141 | // deprecated but needed for old effects to survive upgrading 142 | bool CheckShader (Shader s) 143 | { 144 | Debug.Log("The shader " + s.ToString () + " on effect "+ ToString () + " is not part of the Unity 3.2+ effects suite anymore. For best performance and quality, please ensure you are using the latest Standard Assets Image Effects (Pro only) package."); 145 | if (!s.isSupported) 146 | { 147 | NotSupported (); 148 | return false; 149 | } 150 | else 151 | { 152 | return false; 153 | } 154 | } 155 | 156 | 157 | protected void NotSupported () 158 | { 159 | enabled = false; 160 | isSupported = false; 161 | return; 162 | } 163 | 164 | 165 | protected void DrawBorder (RenderTexture dest, Material material) 166 | { 167 | float x1; 168 | float x2; 169 | float y1; 170 | float y2; 171 | 172 | RenderTexture.active = dest; 173 | bool invertY = true; // source.texelSize.y < 0.0ff; 174 | // Set up the simple Matrix 175 | GL.PushMatrix(); 176 | GL.LoadOrtho(); 177 | 178 | for (int i = 0; i < material.passCount; i++) 179 | { 180 | material.SetPass(i); 181 | 182 | float y1_; float y2_; 183 | if (invertY) 184 | { 185 | y1_ = 1.0f; y2_ = 0.0f; 186 | } 187 | else 188 | { 189 | y1_ = 0.0f; y2_ = 1.0f; 190 | } 191 | 192 | // left 193 | x1 = 0.0f; 194 | x2 = 0.0f + 1.0f/(dest.width*1.0f); 195 | y1 = 0.0f; 196 | y2 = 1.0f; 197 | GL.Begin(GL.QUADS); 198 | 199 | GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f); 200 | GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f); 201 | GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f); 202 | GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f); 203 | 204 | // right 205 | x1 = 1.0f - 1.0f/(dest.width*1.0f); 206 | x2 = 1.0f; 207 | y1 = 0.0f; 208 | y2 = 1.0f; 209 | 210 | GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f); 211 | GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f); 212 | GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f); 213 | GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f); 214 | 215 | // top 216 | x1 = 0.0f; 217 | x2 = 1.0f; 218 | y1 = 0.0f; 219 | y2 = 0.0f + 1.0f/(dest.height*1.0f); 220 | 221 | GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f); 222 | GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f); 223 | GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f); 224 | GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f); 225 | 226 | // bottom 227 | x1 = 0.0f; 228 | x2 = 1.0f; 229 | y1 = 1.0f - 1.0f/(dest.height*1.0f); 230 | y2 = 1.0f; 231 | 232 | GL.TexCoord2(0.0f, y1_); GL.Vertex3(x1, y1, 0.1f); 233 | GL.TexCoord2(1.0f, y1_); GL.Vertex3(x2, y1, 0.1f); 234 | GL.TexCoord2(1.0f, y2_); GL.Vertex3(x2, y2, 0.1f); 235 | GL.TexCoord2(0.0f, y2_); GL.Vertex3(x1, y2, 0.1f); 236 | 237 | GL.End(); 238 | } 239 | 240 | GL.PopMatrix(); 241 | } 242 | } 243 | } 244 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/PostEffectsBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97cf3b0e233bef448aaf387f072e04ab 3 | timeCreated: 1460409866 4 | licenseType: Free 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Tonemapping.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace UnityStandardAssets.ImageEffects 5 | { 6 | [ExecuteInEditMode] 7 | [RequireComponent(typeof (Camera))] 8 | [AddComponentMenu("Image Effects/Color Adjustments/Tonemapping")] 9 | public class Tonemapping : PostEffectsBase 10 | { 11 | public enum TonemapperType 12 | { 13 | SimpleReinhard, 14 | UserCurve, 15 | Hable, 16 | Photographic, 17 | OptimizedHejiDawson, 18 | AdaptiveReinhard, 19 | AdaptiveReinhardAutoWhite, 20 | }; 21 | 22 | public enum AdaptiveTexSize 23 | { 24 | Square16 = 16, 25 | Square32 = 32, 26 | Square64 = 64, 27 | Square128 = 128, 28 | Square256 = 256, 29 | Square512 = 512, 30 | Square1024 = 1024, 31 | }; 32 | 33 | public TonemapperType type = TonemapperType.Photographic; 34 | public AdaptiveTexSize adaptiveTextureSize = AdaptiveTexSize.Square256; 35 | 36 | // CURVE parameter 37 | public AnimationCurve remapCurve; 38 | private Texture2D curveTex = null; 39 | 40 | // UNCHARTED parameter 41 | public float exposureAdjustment = 1.5f; 42 | 43 | // REINHARD parameter 44 | public float middleGrey = 0.4f; 45 | public float white = 2.0f; 46 | public float adaptionSpeed = 1.5f; 47 | 48 | // usual & internal stuff 49 | public Shader tonemapper = null; 50 | public bool validRenderTextureFormat = true; 51 | private Material tonemapMaterial = null; 52 | private RenderTexture rt = null; 53 | private RenderTextureFormat rtFormat = RenderTextureFormat.ARGBHalf; 54 | 55 | 56 | public override bool CheckResources() 57 | { 58 | CheckSupport(false, true); 59 | 60 | tonemapMaterial = CheckShaderAndCreateMaterial(tonemapper, tonemapMaterial); 61 | if (!curveTex && type == TonemapperType.UserCurve) 62 | { 63 | curveTex = new Texture2D(256, 1, TextureFormat.ARGB32, false, true); 64 | curveTex.filterMode = FilterMode.Bilinear; 65 | curveTex.wrapMode = TextureWrapMode.Clamp; 66 | curveTex.hideFlags = HideFlags.DontSave; 67 | } 68 | 69 | if (!isSupported) 70 | ReportAutoDisable(); 71 | return isSupported; 72 | } 73 | 74 | 75 | public float UpdateCurve() 76 | { 77 | float range = 1.0f; 78 | if (remapCurve.keys.Length < 1) 79 | remapCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(2, 1)); 80 | if (remapCurve != null) 81 | { 82 | if (remapCurve.length > 0) 83 | range = remapCurve[remapCurve.length - 1].time; 84 | for (float i = 0.0f; i <= 1.0f; i += 1.0f/255.0f) 85 | { 86 | float c = remapCurve.Evaluate(i*1.0f*range); 87 | curveTex.SetPixel((int) Mathf.Floor(i*255.0f), 0, new Color(c, c, c)); 88 | } 89 | curveTex.Apply(); 90 | } 91 | return 1.0f/range; 92 | } 93 | 94 | 95 | private void OnDisable() 96 | { 97 | if (rt) 98 | { 99 | DestroyImmediate(rt); 100 | rt = null; 101 | } 102 | if (tonemapMaterial) 103 | { 104 | DestroyImmediate(tonemapMaterial); 105 | tonemapMaterial = null; 106 | } 107 | if (curveTex) 108 | { 109 | DestroyImmediate(curveTex); 110 | curveTex = null; 111 | } 112 | } 113 | 114 | 115 | private bool CreateInternalRenderTexture() 116 | { 117 | if (rt) 118 | { 119 | return false; 120 | } 121 | rtFormat = SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RGHalf) ? RenderTextureFormat.RGHalf : RenderTextureFormat.ARGBHalf; 122 | rt = new RenderTexture(1, 1, 0, rtFormat); 123 | rt.hideFlags = HideFlags.DontSave; 124 | return true; 125 | } 126 | 127 | 128 | // attribute indicates that the image filter chain will continue in LDR 129 | [ImageEffectTransformsToLDR] 130 | private void OnRenderImage(RenderTexture source, RenderTexture destination) 131 | { 132 | if (CheckResources() == false) 133 | { 134 | Graphics.Blit(source, destination); 135 | return; 136 | } 137 | 138 | #if UNITY_EDITOR 139 | validRenderTextureFormat = true; 140 | if (source.format != RenderTextureFormat.ARGBHalf) 141 | { 142 | validRenderTextureFormat = false; 143 | } 144 | #endif 145 | 146 | // clamp some values to not go out of a valid range 147 | 148 | exposureAdjustment = exposureAdjustment < 0.001f ? 0.001f : exposureAdjustment; 149 | 150 | // SimpleReinhard tonemappers (local, non adaptive) 151 | 152 | if (type == TonemapperType.UserCurve) 153 | { 154 | float rangeScale = UpdateCurve(); 155 | tonemapMaterial.SetFloat("_RangeScale", rangeScale); 156 | tonemapMaterial.SetTexture("_Curve", curveTex); 157 | Graphics.Blit(source, destination, tonemapMaterial, 4); 158 | return; 159 | } 160 | 161 | if (type == TonemapperType.SimpleReinhard) 162 | { 163 | tonemapMaterial.SetFloat("_ExposureAdjustment", exposureAdjustment); 164 | Graphics.Blit(source, destination, tonemapMaterial, 6); 165 | return; 166 | } 167 | 168 | if (type == TonemapperType.Hable) 169 | { 170 | tonemapMaterial.SetFloat("_ExposureAdjustment", exposureAdjustment); 171 | Graphics.Blit(source, destination, tonemapMaterial, 5); 172 | return; 173 | } 174 | 175 | if (type == TonemapperType.Photographic) 176 | { 177 | tonemapMaterial.SetFloat("_ExposureAdjustment", exposureAdjustment); 178 | Graphics.Blit(source, destination, tonemapMaterial, 8); 179 | return; 180 | } 181 | 182 | if (type == TonemapperType.OptimizedHejiDawson) 183 | { 184 | tonemapMaterial.SetFloat("_ExposureAdjustment", 0.5f*exposureAdjustment); 185 | Graphics.Blit(source, destination, tonemapMaterial, 7); 186 | return; 187 | } 188 | 189 | // still here? 190 | // => adaptive tone mapping: 191 | // builds an average log luminance, tonemaps according to 192 | // middle grey and white values (user controlled) 193 | 194 | // AdaptiveReinhardAutoWhite will calculate white value automagically 195 | 196 | bool freshlyBrewedInternalRt = CreateInternalRenderTexture(); // this retrieves rtFormat, so should happen before rt allocations 197 | 198 | RenderTexture rtSquared = RenderTexture.GetTemporary((int) adaptiveTextureSize, (int) adaptiveTextureSize, 0, rtFormat); 199 | Graphics.Blit(source, rtSquared); 200 | 201 | int downsample = (int) Mathf.Log(rtSquared.width*1.0f, 2); 202 | 203 | int div = 2; 204 | var rts = new RenderTexture[downsample]; 205 | for (int i = 0; i < downsample; i++) 206 | { 207 | rts[i] = RenderTexture.GetTemporary(rtSquared.width/div, rtSquared.width/div, 0, rtFormat); 208 | div *= 2; 209 | } 210 | 211 | // downsample pyramid 212 | 213 | var lumRt = rts[downsample - 1]; 214 | Graphics.Blit(rtSquared, rts[0], tonemapMaterial, 1); 215 | if (type == TonemapperType.AdaptiveReinhardAutoWhite) 216 | { 217 | for (int i = 0; i < downsample - 1; i++) 218 | { 219 | Graphics.Blit(rts[i], rts[i + 1], tonemapMaterial, 9); 220 | lumRt = rts[i + 1]; 221 | } 222 | } 223 | else if (type == TonemapperType.AdaptiveReinhard) 224 | { 225 | for (int i = 0; i < downsample - 1; i++) 226 | { 227 | Graphics.Blit(rts[i], rts[i + 1]); 228 | lumRt = rts[i + 1]; 229 | } 230 | } 231 | 232 | // we have the needed values, let's apply adaptive tonemapping 233 | 234 | adaptionSpeed = adaptionSpeed < 0.001f ? 0.001f : adaptionSpeed; 235 | tonemapMaterial.SetFloat("_AdaptionSpeed", adaptionSpeed); 236 | 237 | rt.MarkRestoreExpected(); // keeping luminance values between frames, RT restore expected 238 | 239 | #if UNITY_EDITOR 240 | if (Application.isPlaying && !freshlyBrewedInternalRt) 241 | Graphics.Blit(lumRt, rt, tonemapMaterial, 2); 242 | else 243 | Graphics.Blit(lumRt, rt, tonemapMaterial, 3); 244 | #else 245 | Graphics.Blit (lumRt, rt, tonemapMaterial, freshlyBrewedInternalRt ? 3 : 2); 246 | #endif 247 | 248 | middleGrey = middleGrey < 0.001f ? 0.001f : middleGrey; 249 | tonemapMaterial.SetVector("_HdrParams", new Vector4(middleGrey, middleGrey, middleGrey, white*white)); 250 | tonemapMaterial.SetTexture("_SmallTex", rt); 251 | if (type == TonemapperType.AdaptiveReinhard) 252 | { 253 | Graphics.Blit(source, destination, tonemapMaterial, 0); 254 | } 255 | else if (type == TonemapperType.AdaptiveReinhardAutoWhite) 256 | { 257 | Graphics.Blit(source, destination, tonemapMaterial, 10); 258 | } 259 | else 260 | { 261 | Debug.LogError("No valid adaptive tonemapper type found!"); 262 | Graphics.Blit(source, destination); // at least we get the TransformToLDR effect 263 | } 264 | 265 | // cleanup for adaptive 266 | 267 | for (int i = 0; i < downsample; i++) 268 | { 269 | RenderTexture.ReleaseTemporary(rts[i]); 270 | } 271 | RenderTexture.ReleaseTemporary(rtSquared); 272 | } 273 | } 274 | } 275 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Scripts/Tonemapping.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e50e925fb93c78246bf995d9dc3a2330 3 | MonoImporter: 4 | serializedVersion: 2 5 | defaultReferences: 6 | - tonemapper: {fileID: 4800000, guid: 003377fc2620a44939dadde6fe3f8190, type: 3} 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2a3aa8f31b35a024989e1080baa903ea 3 | folderAsset: yes 4 | timeCreated: 1460409800 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Tonemapper.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/Tonemapper" { 2 | Properties { 3 | _MainTex ("", 2D) = "black" {} 4 | _SmallTex ("", 2D) = "grey" {} 5 | _Curve ("", 2D) = "black" {} 6 | } 7 | 8 | CGINCLUDE 9 | 10 | #include "UnityCG.cginc" 11 | 12 | struct v2f { 13 | float4 pos : SV_POSITION; 14 | float2 uv : TEXCOORD0; 15 | }; 16 | 17 | sampler2D _MainTex; 18 | sampler2D _SmallTex; 19 | sampler2D _Curve; 20 | 21 | float4 _HdrParams; 22 | float2 intensity; 23 | float4 _MainTex_TexelSize; 24 | float _AdaptionSpeed; 25 | float _ExposureAdjustment; 26 | float _RangeScale; 27 | 28 | v2f vert( appdata_img v ) 29 | { 30 | v2f o; 31 | o.pos = mul(UNITY_MATRIX_MVP, v.vertex); 32 | o.uv = v.texcoord.xy; 33 | return o; 34 | } 35 | 36 | float4 fragLog(v2f i) : SV_Target 37 | { 38 | const float DELTA = 0.0001f; 39 | 40 | float fLogLumSum = 0.0f; 41 | 42 | fLogLumSum += log( Luminance(tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(-1,-1)).rgb) + DELTA); 43 | fLogLumSum += log( Luminance(tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(1,1)).rgb) + DELTA); 44 | fLogLumSum += log( Luminance(tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(-1,1)).rgb) + DELTA); 45 | fLogLumSum += log( Luminance(tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(1,-1)).rgb) + DELTA); 46 | 47 | float avg = fLogLumSum / 4.0; 48 | return float4(avg, avg, avg, avg); 49 | } 50 | 51 | float4 fragExp(v2f i) : SV_Target 52 | { 53 | float2 lum = float2(0.0f, 0.0f); 54 | 55 | lum += tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(-1,-1)).xy; 56 | lum += tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(1,1)).xy; 57 | lum += tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(1,-1)).xy; 58 | lum += tex2D(_MainTex, i.uv + _MainTex_TexelSize.xy * float2(-1,1)).xy; 59 | 60 | lum = exp(lum / 4.0f); 61 | 62 | return float4(lum.x, lum.y, lum.x, saturate(0.0125 * _AdaptionSpeed)); 63 | } 64 | 65 | float3 ToCIE(float3 FullScreenImage) 66 | { 67 | // RGB -> XYZ conversion 68 | // http://www.w3.org/Graphics/Color/sRGB 69 | // The official sRGB to XYZ conversion matrix is (following ITU-R BT.709) 70 | // 0.4125 0.3576 0.1805 71 | // 0.2126 0.7152 0.0722 72 | // 0.0193 0.1192 0.9505 73 | 74 | float3x3 RGB2XYZ = {0.5141364, 0.3238786, 0.16036376, 0.265068, 0.67023428, 0.06409157, 0.0241188, 0.1228178, 0.84442666}; 75 | 76 | float3 XYZ = mul(RGB2XYZ, FullScreenImage.rgb); 77 | 78 | // XYZ -> Yxy conversion 79 | 80 | float3 Yxy; 81 | 82 | Yxy.r = XYZ.g; 83 | 84 | // x = X / (X + Y + Z) 85 | // y = X / (X + Y + Z) 86 | 87 | float temp = dot(float3(1.0,1.0,1.0), XYZ.rgb); 88 | 89 | Yxy.gb = XYZ.rg / temp; 90 | 91 | return Yxy; 92 | } 93 | 94 | float3 FromCIE(float3 Yxy) 95 | { 96 | float3 XYZ; 97 | // Yxy -> XYZ conversion 98 | XYZ.r = Yxy.r * Yxy.g / Yxy. b; 99 | 100 | // X = Y * x / y 101 | XYZ.g = Yxy.r; 102 | 103 | // copy luminance Y 104 | XYZ.b = Yxy.r * (1 - Yxy.g - Yxy.b) / Yxy.b; 105 | 106 | // Z = Y * (1-x-y) / y 107 | 108 | // XYZ -> RGB conversion 109 | // The official XYZ to sRGB conversion matrix is (following ITU-R BT.709) 110 | // 3.2410 -1.5374 -0.4986 111 | // -0.9692 1.8760 0.0416 112 | // 0.0556 -0.2040 1.0570 113 | 114 | float3x3 XYZ2RGB = { 2.5651,-1.1665,-0.3986, -1.0217, 1.9777, 0.0439, 0.0753, -0.2543, 1.1892}; 115 | 116 | return mul(XYZ2RGB, XYZ); 117 | } 118 | 119 | // NOTE/OPTIMIZATION: we're not going the extra CIE detour anymore, but 120 | // scale with the OUT/IN luminance ratio,this is sooooo much faster 121 | 122 | float4 fragAdaptive(v2f i) : SV_Target 123 | { 124 | float avgLum = tex2D(_SmallTex, i.uv).x; 125 | float4 color = tex2D (_MainTex, i.uv); 126 | 127 | float cieLum = max(0.000001, Luminance(color.rgb)); //ToCIE(color.rgb); 128 | 129 | float lumScaled = cieLum * _HdrParams.z / (0.001 + avgLum.x); 130 | 131 | lumScaled = (lumScaled * (1.0f + lumScaled / (_HdrParams.w)))/(1.0f + lumScaled); 132 | 133 | //cie.r = lumScaled; 134 | 135 | color.rgb = color.rgb * (lumScaled / cieLum); 136 | 137 | //color.rgb = FromCIE(cie); 138 | return color; 139 | } 140 | 141 | float4 fragAdaptiveAutoWhite(v2f i) : SV_Target 142 | { 143 | float2 avgLum = tex2D(_SmallTex, i.uv).xy; 144 | float4 color = tex2D(_MainTex, i.uv); 145 | 146 | float cieLum = max(0.000001, Luminance(color.rgb)); //ToCIE(color.rgb); 147 | 148 | float lumScaled = cieLum * _HdrParams.z / (0.001 + avgLum.x); 149 | 150 | lumScaled = (lumScaled * (1.0f + lumScaled / (avgLum.y*avgLum.y)))/(1.0f + lumScaled); 151 | 152 | //cie.r = lumScaled; 153 | 154 | color.rgb = color.rgb * (lumScaled / cieLum); 155 | 156 | //color.rgb = FromCIE(cie); 157 | return color; 158 | } 159 | 160 | float4 fragCurve(v2f i) : SV_Target 161 | { 162 | float4 color = tex2D(_MainTex, i.uv); 163 | float3 cie = ToCIE(color.rgb); 164 | 165 | // Remap to new lum range 166 | float newLum = tex2D(_Curve, float2(cie.r * _RangeScale, 0.5)).r; 167 | cie.r = newLum; 168 | color.rgb = FromCIE(cie); 169 | 170 | return color; 171 | } 172 | 173 | float4 fragHable(v2f i) : SV_Target 174 | { 175 | const float A = 0.15; 176 | const float B = 0.50; 177 | const float C = 0.10; 178 | const float D = 0.20; 179 | const float E = 0.02; 180 | const float F = 0.30; 181 | const float W = 11.2; 182 | 183 | float3 texColor = tex2D(_MainTex, i.uv).rgb; 184 | texColor *= _ExposureAdjustment; 185 | 186 | float ExposureBias = 2.0; 187 | float3 x = ExposureBias*texColor; 188 | float3 curr = ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F; 189 | 190 | x = W; 191 | float3 whiteScale = 1.0f/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F); 192 | float3 color = curr*whiteScale; 193 | 194 | // float3 retColor = pow(color,1/2.2); // we have SRGB write enabled at this stage 195 | 196 | return float4(color, 1.0); 197 | } 198 | 199 | // we are doing it on luminance here (better color preservation, but some other problems like very fast saturation) 200 | float4 fragSimpleReinhard(v2f i) : SV_Target 201 | { 202 | float4 texColor = tex2D(_MainTex, i.uv); 203 | float lum = Luminance(texColor.rgb); 204 | float lumTm = lum * _ExposureAdjustment; 205 | float scale = lumTm / (1+lumTm); 206 | return float4(texColor.rgb * scale / lum, texColor.a); 207 | } 208 | 209 | float4 fragOptimizedHejiDawson(v2f i) : SV_Target 210 | { 211 | float4 texColor = tex2D(_MainTex, i.uv ); 212 | texColor *= _ExposureAdjustment; 213 | float4 X = max(float4(0.0,0.0,0.0,0.0), texColor-0.004); 214 | float4 retColor = (X*(6.2*X+.5))/(X*(6.2*X+1.7)+0.06); 215 | return retColor*retColor; 216 | } 217 | 218 | float4 fragPhotographic(v2f i) : SV_Target 219 | { 220 | float4 texColor = tex2D(_MainTex, i.uv); 221 | return 1-exp2(-_ExposureAdjustment * texColor); 222 | } 223 | 224 | float4 fragDownsample(v2f i) : SV_Target 225 | { 226 | float4 tapA = tex2D(_MainTex, i.uv + _MainTex_TexelSize * 0.5); 227 | float4 tapB = tex2D(_MainTex, i.uv - _MainTex_TexelSize * 0.5); 228 | float4 tapC = tex2D(_MainTex, i.uv + _MainTex_TexelSize * float2(0.5,-0.5)); 229 | float4 tapD = tex2D(_MainTex, i.uv - _MainTex_TexelSize * float2(0.5,-0.5)); 230 | 231 | float4 average = (tapA+tapB+tapC+tapD)/4; 232 | average.y = max(max(tapA.y,tapB.y), max(tapC.y,tapD.y)); 233 | 234 | return average; 235 | } 236 | 237 | ENDCG 238 | 239 | Subshader { 240 | // adaptive reinhhard apply 241 | Pass { 242 | ZTest Always Cull Off ZWrite Off 243 | 244 | CGPROGRAM 245 | #pragma vertex vert 246 | #pragma fragment fragAdaptive 247 | ENDCG 248 | } 249 | 250 | // 1 251 | Pass { 252 | ZTest Always Cull Off ZWrite Off 253 | 254 | CGPROGRAM 255 | #pragma vertex vert 256 | #pragma fragment fragLog 257 | ENDCG 258 | } 259 | // 2 260 | Pass { 261 | ZTest Always Cull Off ZWrite Off 262 | Blend SrcAlpha OneMinusSrcAlpha 263 | 264 | CGPROGRAM 265 | #pragma vertex vert 266 | #pragma fragment fragExp 267 | ENDCG 268 | } 269 | // 3 270 | Pass { 271 | ZTest Always Cull Off ZWrite Off 272 | 273 | Blend Off 274 | 275 | CGPROGRAM 276 | #pragma vertex vert 277 | #pragma fragment fragExp 278 | ENDCG 279 | } 280 | 281 | // 4 user controllable tonemap curve 282 | Pass { 283 | ZTest Always Cull Off ZWrite Off 284 | 285 | CGPROGRAM 286 | #pragma vertex vert 287 | #pragma fragment fragCurve 288 | ENDCG 289 | } 290 | 291 | // 5 tonemapping in uncharted 292 | Pass { 293 | ZTest Always Cull Off ZWrite Off 294 | 295 | CGPROGRAM 296 | #pragma vertex vert 297 | #pragma fragment fragHable 298 | ENDCG 299 | } 300 | 301 | // 6 simple tonemapping based reinhard 302 | Pass { 303 | ZTest Always Cull Off ZWrite Off 304 | 305 | CGPROGRAM 306 | #pragma vertex vert 307 | #pragma fragment fragSimpleReinhard 308 | ENDCG 309 | } 310 | 311 | // 7 OptimizedHejiDawson 312 | Pass { 313 | ZTest Always Cull Off ZWrite Off 314 | 315 | CGPROGRAM 316 | #pragma vertex vert 317 | #pragma fragment fragOptimizedHejiDawson 318 | ENDCG 319 | } 320 | 321 | // 8 Photographic 322 | Pass { 323 | ZTest Always Cull Off ZWrite Off 324 | 325 | CGPROGRAM 326 | #pragma vertex vert 327 | #pragma fragment fragPhotographic 328 | ENDCG 329 | } 330 | 331 | // 9 Downsample with auto white detection 332 | Pass { 333 | ZTest Always Cull Off ZWrite Off 334 | 335 | CGPROGRAM 336 | #pragma vertex vert 337 | #pragma fragment fragDownsample 338 | ENDCG 339 | } 340 | 341 | // 10 adaptive reinhhard apply with auto white 342 | Pass { 343 | ZTest Always Cull Off ZWrite Off 344 | 345 | CGPROGRAM 346 | #pragma vertex vert 347 | #pragma fragment fragAdaptiveAutoWhite 348 | ENDCG 349 | } 350 | } 351 | 352 | Fallback off 353 | 354 | } // shader 355 | -------------------------------------------------------------------------------- /Assets/Standard Assets/Effects/ImageEffects/Shaders/Tonemapper.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 003377fc2620a44939dadde6fe3f8190 3 | ShaderImporter: 4 | userData: 5 | -------------------------------------------------------------------------------- /Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f439f13d0d81684e86bfb6f6e6a0c33 3 | folderAsset: yes 4 | timeCreated: 1459178233 5 | licenseType: Free 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Textures/spot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SlightlyMad/VolumetricLights/d20b6f9a47ae857e1d313b147db2df3ef44b9196/Assets/Textures/spot.png -------------------------------------------------------------------------------- /Assets/Textures/spot.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5157bf6d690b6df458f6c0ce0c06d329 3 | timeCreated: 1456062990 4 | licenseType: Free 5 | TextureImporter: 6 | fileIDToRecycleName: {} 7 | serializedVersion: 2 8 | mipmaps: 9 | mipMapMode: 0 10 | enableMipMap: 1 11 | linearTexture: 0 12 | correctGamma: 0 13 | fadeOut: 0 14 | borderMipMap: 1 15 | mipMapFadeDistanceStart: 1 16 | mipMapFadeDistanceEnd: 3 17 | bumpmap: 18 | convertToNormalMap: 0 19 | externalNormalMap: 0 20 | heightScale: 0.25 21 | normalMapFilter: 0 22 | isReadable: 0 23 | grayScaleToAlpha: 1 24 | generateCubemap: 0 25 | cubemapConvolution: 0 26 | cubemapConvolutionSteps: 7 27 | cubemapConvolutionExponent: 1.5 28 | seamlessCubemap: 0 29 | textureFormat: -1 30 | maxTextureSize: 2048 31 | textureSettings: 32 | filterMode: -1 33 | aniso: 0 34 | mipBias: -1 35 | wrapMode: 1 36 | nPOTScale: 1 37 | lightmap: 0 38 | rGBM: 0 39 | compressionQuality: 50 40 | allowsAlphaSplitting: 0 41 | spriteMode: 0 42 | spriteExtrude: 1 43 | spriteMeshType: 1 44 | alignment: 0 45 | spritePivot: {x: 0.5, y: 0.5} 46 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 47 | spritePixelsToUnits: 100 48 | alphaIsTransparency: 0 49 | textureType: 4 50 | buildTargetSettings: [] 51 | spriteSheet: 52 | sprites: [] 53 | outline: [] 54 | spritePackingTag: 55 | userData: 56 | assetBundleName: 57 | assetBundleVariant: 58 | -------------------------------------------------------------------------------- /Assets/example.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: 0.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: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SkyboxMaterial: {fileID: 0} 29 | m_HaloStrength: 0.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: 6 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_LightingDataAsset: {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: 0.5 78 | agentHeight: 2 79 | agentSlope: 45 80 | agentClimb: 0.4 81 | ledgeDropHeight: 0 82 | maxJumpAcrossDistance: 0 83 | accuratePlacement: 0 84 | minRegionArea: 2 85 | cellSize: 0.16666667 86 | manualCellSize: 0 87 | m_NavMeshData: {fileID: 0} 88 | --- !u!1 &314343680 89 | GameObject: 90 | m_ObjectHideFlags: 0 91 | m_PrefabParentObject: {fileID: 0} 92 | m_PrefabInternal: {fileID: 0} 93 | serializedVersion: 4 94 | m_Component: 95 | - 4: {fileID: 314343681} 96 | m_Layer: 0 97 | m_Name: Geometry 98 | m_TagString: Untagged 99 | m_Icon: {fileID: 0} 100 | m_NavMeshLayer: 0 101 | m_StaticEditorFlags: 0 102 | m_IsActive: 1 103 | --- !u!4 &314343681 104 | Transform: 105 | m_ObjectHideFlags: 0 106 | m_PrefabParentObject: {fileID: 0} 107 | m_PrefabInternal: {fileID: 0} 108 | m_GameObject: {fileID: 314343680} 109 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 110 | m_LocalPosition: {x: 0, y: 0, z: 0} 111 | m_LocalScale: {x: 1, y: 1, z: 1} 112 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 113 | m_Children: 114 | - {fileID: 736972977} 115 | - {fileID: 1337299051} 116 | m_Father: {fileID: 0} 117 | m_RootOrder: 2 118 | --- !u!1 &618457759 119 | GameObject: 120 | m_ObjectHideFlags: 0 121 | m_PrefabParentObject: {fileID: 0} 122 | m_PrefabInternal: {fileID: 0} 123 | serializedVersion: 4 124 | m_Component: 125 | - 4: {fileID: 618457765} 126 | - 20: {fileID: 618457764} 127 | - 92: {fileID: 618457763} 128 | - 124: {fileID: 618457762} 129 | - 81: {fileID: 618457761} 130 | - 114: {fileID: 618457760} 131 | m_Layer: 0 132 | m_Name: Main Camera 133 | m_TagString: MainCamera 134 | m_Icon: {fileID: 0} 135 | m_NavMeshLayer: 0 136 | m_StaticEditorFlags: 0 137 | m_IsActive: 1 138 | --- !u!114 &618457760 139 | MonoBehaviour: 140 | m_ObjectHideFlags: 0 141 | m_PrefabParentObject: {fileID: 0} 142 | m_PrefabInternal: {fileID: 0} 143 | m_GameObject: {fileID: 618457759} 144 | m_Enabled: 1 145 | m_EditorHideFlags: 0 146 | m_Script: {fileID: 11500000, guid: 1eed1d9cbe64423499f1fefc0ce50417, type: 3} 147 | m_Name: 148 | m_EditorClassIdentifier: 149 | Resolution: 1 150 | DefaultSpotCookie: {fileID: 2800000, guid: 5157bf6d690b6df458f6c0ce0c06d329, type: 3} 151 | --- !u!81 &618457761 152 | AudioListener: 153 | m_ObjectHideFlags: 0 154 | m_PrefabParentObject: {fileID: 0} 155 | m_PrefabInternal: {fileID: 0} 156 | m_GameObject: {fileID: 618457759} 157 | m_Enabled: 1 158 | --- !u!124 &618457762 159 | Behaviour: 160 | m_ObjectHideFlags: 0 161 | m_PrefabParentObject: {fileID: 0} 162 | m_PrefabInternal: {fileID: 0} 163 | m_GameObject: {fileID: 618457759} 164 | m_Enabled: 1 165 | --- !u!92 &618457763 166 | Behaviour: 167 | m_ObjectHideFlags: 0 168 | m_PrefabParentObject: {fileID: 0} 169 | m_PrefabInternal: {fileID: 0} 170 | m_GameObject: {fileID: 618457759} 171 | m_Enabled: 1 172 | --- !u!20 &618457764 173 | Camera: 174 | m_ObjectHideFlags: 0 175 | m_PrefabParentObject: {fileID: 0} 176 | m_PrefabInternal: {fileID: 0} 177 | m_GameObject: {fileID: 618457759} 178 | m_Enabled: 1 179 | serializedVersion: 2 180 | m_ClearFlags: 1 181 | m_BackGroundColor: {r: 0.20588237, g: 0.20588237, b: 0.20588237, a: 0.019607844} 182 | m_NormalizedViewPortRect: 183 | serializedVersion: 2 184 | x: 0 185 | y: 0 186 | width: 1 187 | height: 1 188 | near clip plane: 0.3 189 | far clip plane: 1000 190 | field of view: 60 191 | orthographic: 0 192 | orthographic size: 5 193 | m_Depth: -1 194 | m_CullingMask: 195 | serializedVersion: 2 196 | m_Bits: 4294967295 197 | m_RenderingPath: -1 198 | m_TargetTexture: {fileID: 0} 199 | m_TargetDisplay: 0 200 | m_TargetEye: 3 201 | m_HDR: 1 202 | m_OcclusionCulling: 1 203 | m_StereoConvergence: 10 204 | m_StereoSeparation: 0.022 205 | m_StereoMirrorMode: 0 206 | --- !u!4 &618457765 207 | Transform: 208 | m_ObjectHideFlags: 0 209 | m_PrefabParentObject: {fileID: 0} 210 | m_PrefabInternal: {fileID: 0} 211 | m_GameObject: {fileID: 618457759} 212 | m_LocalRotation: {x: 0.012192163, y: -0.9819606, z: 0.06817209, w: 0.17594677} 213 | m_LocalPosition: {x: 2.4789526, y: 3.231971, z: 11.631844} 214 | m_LocalScale: {x: 1, y: 1, z: 1} 215 | m_LocalEulerAnglesHint: {x: 7.9421997, y: -159.683, z: 0.0026} 216 | m_Children: [] 217 | m_Father: {fileID: 0} 218 | m_RootOrder: 0 219 | --- !u!1 &736972973 220 | GameObject: 221 | m_ObjectHideFlags: 0 222 | m_PrefabParentObject: {fileID: 0} 223 | m_PrefabInternal: {fileID: 0} 224 | serializedVersion: 4 225 | m_Component: 226 | - 4: {fileID: 736972977} 227 | - 33: {fileID: 736972976} 228 | - 64: {fileID: 736972975} 229 | - 23: {fileID: 736972974} 230 | m_Layer: 0 231 | m_Name: Plane 232 | m_TagString: Untagged 233 | m_Icon: {fileID: 0} 234 | m_NavMeshLayer: 0 235 | m_StaticEditorFlags: 0 236 | m_IsActive: 1 237 | --- !u!23 &736972974 238 | MeshRenderer: 239 | m_ObjectHideFlags: 0 240 | m_PrefabParentObject: {fileID: 0} 241 | m_PrefabInternal: {fileID: 0} 242 | m_GameObject: {fileID: 736972973} 243 | m_Enabled: 1 244 | m_CastShadows: 1 245 | m_ReceiveShadows: 1 246 | m_Materials: 247 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 248 | m_SubsetIndices: 249 | m_StaticBatchRoot: {fileID: 0} 250 | m_UseLightProbes: 1 251 | m_ReflectionProbeUsage: 1 252 | m_ProbeAnchor: {fileID: 0} 253 | m_ScaleInLightmap: 1 254 | m_PreserveUVs: 1 255 | m_IgnoreNormalsForChartDetection: 0 256 | m_ImportantGI: 0 257 | m_MinimumChartSize: 4 258 | m_AutoUVMaxDistance: 0.5 259 | m_AutoUVMaxAngle: 89 260 | m_LightmapParameters: {fileID: 0} 261 | m_SortingLayerID: 0 262 | m_SortingOrder: 0 263 | --- !u!64 &736972975 264 | MeshCollider: 265 | m_ObjectHideFlags: 0 266 | m_PrefabParentObject: {fileID: 0} 267 | m_PrefabInternal: {fileID: 0} 268 | m_GameObject: {fileID: 736972973} 269 | m_Material: {fileID: 0} 270 | m_IsTrigger: 0 271 | m_Enabled: 1 272 | serializedVersion: 2 273 | m_Convex: 0 274 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 275 | --- !u!33 &736972976 276 | MeshFilter: 277 | m_ObjectHideFlags: 0 278 | m_PrefabParentObject: {fileID: 0} 279 | m_PrefabInternal: {fileID: 0} 280 | m_GameObject: {fileID: 736972973} 281 | m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} 282 | --- !u!4 &736972977 283 | Transform: 284 | m_ObjectHideFlags: 0 285 | m_PrefabParentObject: {fileID: 0} 286 | m_PrefabInternal: {fileID: 0} 287 | m_GameObject: {fileID: 736972973} 288 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 289 | m_LocalPosition: {x: 0, y: 0, z: 0} 290 | m_LocalScale: {x: 10, y: 10, z: 10} 291 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 292 | m_Children: [] 293 | m_Father: {fileID: 314343681} 294 | m_RootOrder: 0 295 | --- !u!1 &811935693 296 | GameObject: 297 | m_ObjectHideFlags: 0 298 | m_PrefabParentObject: {fileID: 0} 299 | m_PrefabInternal: {fileID: 0} 300 | serializedVersion: 4 301 | m_Component: 302 | - 4: {fileID: 811935696} 303 | - 108: {fileID: 811935695} 304 | - 114: {fileID: 811935694} 305 | m_Layer: 0 306 | m_Name: Spotlight 307 | m_TagString: Untagged 308 | m_Icon: {fileID: 0} 309 | m_NavMeshLayer: 0 310 | m_StaticEditorFlags: 0 311 | m_IsActive: 1 312 | --- !u!114 &811935694 313 | MonoBehaviour: 314 | m_ObjectHideFlags: 0 315 | m_PrefabParentObject: {fileID: 0} 316 | m_PrefabInternal: {fileID: 0} 317 | m_GameObject: {fileID: 811935693} 318 | m_Enabled: 1 319 | m_EditorHideFlags: 0 320 | m_Script: {fileID: 11500000, guid: dafc90245bfe9e2408e358f71deace2a, type: 3} 321 | m_Name: 322 | m_EditorClassIdentifier: 323 | SampleCount: 12 324 | ScatteringCoef: 0.815 325 | ExtinctionCoef: 0.0031 326 | SkyboxExtinctionCoef: 0.9 327 | MieG: 0.1 328 | HeightFog: 0 329 | HeightScale: 0.1 330 | GroundLevel: 0 331 | Noise: 1 332 | NoiseScale: 0.15 333 | NoiseIntensity: 3.44 334 | NoiseIntensityOffset: 0.2 335 | NoiseVelocity: {x: 1, y: 0.3} 336 | MaxRayLength: 400 337 | --- !u!108 &811935695 338 | Light: 339 | m_ObjectHideFlags: 0 340 | m_PrefabParentObject: {fileID: 0} 341 | m_PrefabInternal: {fileID: 0} 342 | m_GameObject: {fileID: 811935693} 343 | m_Enabled: 1 344 | serializedVersion: 6 345 | m_Type: 0 346 | m_Color: {r: 1, g: 1, b: 1, a: 1} 347 | m_Intensity: 1.5 348 | m_Range: 14.38 349 | m_SpotAngle: 74.65 350 | m_CookieSize: 10 351 | m_Shadows: 352 | m_Type: 1 353 | m_Resolution: -1 354 | m_Strength: 1 355 | m_Bias: 0.05 356 | m_NormalBias: 0.4 357 | m_NearPlane: 0.2 358 | m_Cookie: {fileID: 0} 359 | m_DrawHalo: 0 360 | m_Flare: {fileID: 0} 361 | m_RenderMode: 0 362 | m_CullingMask: 363 | serializedVersion: 2 364 | m_Bits: 4294967295 365 | m_Lightmapping: 4 366 | m_BounceIntensity: 1 367 | m_ShadowRadius: 0 368 | m_ShadowAngle: 0 369 | m_AreaSize: {x: 1, y: 1} 370 | --- !u!4 &811935696 371 | Transform: 372 | m_ObjectHideFlags: 0 373 | m_PrefabParentObject: {fileID: 0} 374 | m_PrefabInternal: {fileID: 0} 375 | m_GameObject: {fileID: 811935693} 376 | m_LocalRotation: {x: 0.68689036, y: -0.16787423, z: -0.16787423, w: 0.68689024} 377 | m_LocalPosition: {x: 3.1, y: 6.38, z: -0.89} 378 | m_LocalScale: {x: 1, y: 1, z: 1} 379 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 380 | m_Children: [] 381 | m_Father: {fileID: 0} 382 | m_RootOrder: 1 383 | --- !u!1 &1337299047 384 | GameObject: 385 | m_ObjectHideFlags: 0 386 | m_PrefabParentObject: {fileID: 0} 387 | m_PrefabInternal: {fileID: 0} 388 | serializedVersion: 4 389 | m_Component: 390 | - 4: {fileID: 1337299051} 391 | - 33: {fileID: 1337299050} 392 | - 65: {fileID: 1337299049} 393 | - 23: {fileID: 1337299048} 394 | m_Layer: 0 395 | m_Name: Cube 396 | m_TagString: Untagged 397 | m_Icon: {fileID: 0} 398 | m_NavMeshLayer: 0 399 | m_StaticEditorFlags: 0 400 | m_IsActive: 1 401 | --- !u!23 &1337299048 402 | MeshRenderer: 403 | m_ObjectHideFlags: 0 404 | m_PrefabParentObject: {fileID: 0} 405 | m_PrefabInternal: {fileID: 0} 406 | m_GameObject: {fileID: 1337299047} 407 | m_Enabled: 1 408 | m_CastShadows: 1 409 | m_ReceiveShadows: 1 410 | m_Materials: 411 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 412 | m_SubsetIndices: 413 | m_StaticBatchRoot: {fileID: 0} 414 | m_UseLightProbes: 1 415 | m_ReflectionProbeUsage: 1 416 | m_ProbeAnchor: {fileID: 0} 417 | m_ScaleInLightmap: 1 418 | m_PreserveUVs: 1 419 | m_IgnoreNormalsForChartDetection: 0 420 | m_ImportantGI: 0 421 | m_MinimumChartSize: 4 422 | m_AutoUVMaxDistance: 0.5 423 | m_AutoUVMaxAngle: 89 424 | m_LightmapParameters: {fileID: 0} 425 | m_SortingLayerID: 0 426 | m_SortingOrder: 0 427 | --- !u!65 &1337299049 428 | BoxCollider: 429 | m_ObjectHideFlags: 0 430 | m_PrefabParentObject: {fileID: 0} 431 | m_PrefabInternal: {fileID: 0} 432 | m_GameObject: {fileID: 1337299047} 433 | m_Material: {fileID: 0} 434 | m_IsTrigger: 0 435 | m_Enabled: 1 436 | serializedVersion: 2 437 | m_Size: {x: 1, y: 1, z: 1} 438 | m_Center: {x: 0, y: 0, z: 0} 439 | --- !u!33 &1337299050 440 | MeshFilter: 441 | m_ObjectHideFlags: 0 442 | m_PrefabParentObject: {fileID: 0} 443 | m_PrefabInternal: {fileID: 0} 444 | m_GameObject: {fileID: 1337299047} 445 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 446 | --- !u!4 &1337299051 447 | Transform: 448 | m_ObjectHideFlags: 0 449 | m_PrefabParentObject: {fileID: 0} 450 | m_PrefabInternal: {fileID: 0} 451 | m_GameObject: {fileID: 1337299047} 452 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 453 | m_LocalPosition: {x: 0.89, y: 2.43, z: -0.87} 454 | m_LocalScale: {x: 2.99, y: 0.4, z: 3.47} 455 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 456 | m_Children: [] 457 | m_Father: {fileID: 314343681} 458 | m_RootOrder: 1 459 | -------------------------------------------------------------------------------- /Assets/example.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e793d21c9aad8248ad80f4955e2e5e2 3 | timeCreated: 1459178233 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/spotlight.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: 0.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: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 1, g: 1, b: 1, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 0.15 27 | m_AmbientMode: 3 28 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 29 | m_HaloStrength: 0.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: 1 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: 6 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: 0 54 | m_EnableRealtimeLightmaps: 0 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_LightingDataAsset: {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: 0.5 78 | agentHeight: 2 79 | agentSlope: 45 80 | agentClimb: 0.4 81 | ledgeDropHeight: 0 82 | maxJumpAcrossDistance: 0 83 | accuratePlacement: 0 84 | minRegionArea: 2 85 | cellSize: 0.16666667 86 | manualCellSize: 0 87 | m_NavMeshData: {fileID: 0} 88 | --- !u!1 &673637836 89 | GameObject: 90 | m_ObjectHideFlags: 0 91 | m_PrefabParentObject: {fileID: 0} 92 | m_PrefabInternal: {fileID: 0} 93 | serializedVersion: 4 94 | m_Component: 95 | - 4: {fileID: 673637839} 96 | - 108: {fileID: 673637838} 97 | - 114: {fileID: 673637837} 98 | m_Layer: 0 99 | m_Name: Spotlight 100 | m_TagString: Untagged 101 | m_Icon: {fileID: 0} 102 | m_NavMeshLayer: 0 103 | m_StaticEditorFlags: 0 104 | m_IsActive: 1 105 | --- !u!114 &673637837 106 | MonoBehaviour: 107 | m_ObjectHideFlags: 0 108 | m_PrefabParentObject: {fileID: 0} 109 | m_PrefabInternal: {fileID: 0} 110 | m_GameObject: {fileID: 673637836} 111 | m_Enabled: 1 112 | m_EditorHideFlags: 0 113 | m_Script: {fileID: 11500000, guid: dafc90245bfe9e2408e358f71deace2a, type: 3} 114 | m_Name: 115 | m_EditorClassIdentifier: 116 | SampleCount: 12 117 | ScatteringCoef: 0.25 118 | ExtinctionCoef: 0.01 119 | SkyboxExtinctionCoef: 0.9 120 | MieG: 0.1 121 | HeightFog: 0 122 | HeightScale: 0.1 123 | GroundLevel: 0 124 | Noise: 1 125 | NoiseScale: 0.015 126 | NoiseIntensity: 3.84 127 | NoiseIntensityOffset: 0.3 128 | NoiseVelocity: {x: 8, y: 3} 129 | MaxRayLength: 400 130 | --- !u!108 &673637838 131 | Light: 132 | m_ObjectHideFlags: 0 133 | m_PrefabParentObject: {fileID: 0} 134 | m_PrefabInternal: {fileID: 0} 135 | m_GameObject: {fileID: 673637836} 136 | m_Enabled: 1 137 | serializedVersion: 6 138 | m_Type: 0 139 | m_Color: {r: 1, g: 0.21528977, b: 0.09558821, a: 1} 140 | m_Intensity: 1 141 | m_Range: 107.61 142 | m_SpotAngle: 70.9 143 | m_CookieSize: 10 144 | m_Shadows: 145 | m_Type: 1 146 | m_Resolution: -1 147 | m_Strength: 1 148 | m_Bias: 0.05 149 | m_NormalBias: 0.4 150 | m_NearPlane: 0.2 151 | m_Cookie: {fileID: 0} 152 | m_DrawHalo: 0 153 | m_Flare: {fileID: 0} 154 | m_RenderMode: 0 155 | m_CullingMask: 156 | serializedVersion: 2 157 | m_Bits: 4294967295 158 | m_Lightmapping: 4 159 | m_BounceIntensity: 1 160 | m_ShadowRadius: 0 161 | m_ShadowAngle: 0 162 | m_AreaSize: {x: 1, y: 1} 163 | --- !u!4 &673637839 164 | Transform: 165 | m_ObjectHideFlags: 0 166 | m_PrefabParentObject: {fileID: 0} 167 | m_PrefabInternal: {fileID: 0} 168 | m_GameObject: {fileID: 673637836} 169 | m_LocalRotation: {x: -0.2824499, y: 0.33989105, z: -0.12177292, w: -0.8887449} 170 | m_LocalPosition: {x: 11.200905, y: 41.327652, z: 120.51096} 171 | m_LocalScale: {x: 1, y: 1, z: 1} 172 | m_Children: [] 173 | m_Father: {fileID: 0} 174 | m_RootOrder: 1 175 | --- !u!1001 &1291845253 176 | Prefab: 177 | m_ObjectHideFlags: 0 178 | serializedVersion: 2 179 | m_Modification: 180 | m_TransformParent: {fileID: 0} 181 | m_Modifications: 182 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 183 | propertyPath: m_LocalPosition.x 184 | value: -57.368 185 | objectReference: {fileID: 0} 186 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 187 | propertyPath: m_LocalPosition.y 188 | value: 0.79 189 | objectReference: {fileID: 0} 190 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 191 | propertyPath: m_LocalPosition.z 192 | value: 110.89 193 | objectReference: {fileID: 0} 194 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 195 | propertyPath: m_LocalRotation.x 196 | value: 0 197 | objectReference: {fileID: 0} 198 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 199 | propertyPath: m_LocalRotation.y 200 | value: 0 201 | objectReference: {fileID: 0} 202 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 203 | propertyPath: m_LocalRotation.z 204 | value: 0 205 | objectReference: {fileID: 0} 206 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 207 | propertyPath: m_LocalRotation.w 208 | value: 1 209 | objectReference: {fileID: 0} 210 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 211 | propertyPath: m_RootOrder 212 | value: 2 213 | objectReference: {fileID: 0} 214 | - target: {fileID: 436054, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 215 | propertyPath: m_LocalPosition.x 216 | value: 927 217 | objectReference: {fileID: 0} 218 | - target: {fileID: 436054, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 219 | propertyPath: m_LocalPosition.z 220 | value: -794 221 | objectReference: {fileID: 0} 222 | - target: {fileID: 436054, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 223 | propertyPath: m_LocalPosition.y 224 | value: -9 225 | objectReference: {fileID: 0} 226 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 227 | propertyPath: m_LocalPosition.x 228 | value: -23 229 | objectReference: {fileID: 0} 230 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 231 | propertyPath: m_LocalPosition.z 232 | value: -160 233 | objectReference: {fileID: 0} 234 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 235 | propertyPath: m_LocalRotation.x 236 | value: -0.0714657 237 | objectReference: {fileID: 0} 238 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 239 | propertyPath: m_LocalRotation.y 240 | value: -0.70348614 241 | objectReference: {fileID: 0} 242 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 243 | propertyPath: m_LocalRotation.z 244 | value: -0.7034859 245 | objectReference: {fileID: 0} 246 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 247 | propertyPath: m_LocalRotation.w 248 | value: 0.07146737 249 | objectReference: {fileID: 0} 250 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 251 | propertyPath: m_LocalPosition.y 252 | value: -2 253 | objectReference: {fileID: 0} 254 | - target: {fileID: 424582, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 255 | propertyPath: m_LocalPosition.x 256 | value: -625 257 | objectReference: {fileID: 0} 258 | - target: {fileID: 424582, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 259 | propertyPath: m_LocalPosition.z 260 | value: 51 261 | objectReference: {fileID: 0} 262 | - target: {fileID: 424582, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 263 | propertyPath: m_LocalPosition.y 264 | value: -9 265 | objectReference: {fileID: 0} 266 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 267 | propertyPath: m_LocalPosition.y 268 | value: -17 269 | objectReference: {fileID: 0} 270 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 271 | propertyPath: m_LocalScale.z 272 | value: 4.021897 273 | objectReference: {fileID: 0} 274 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 275 | propertyPath: m_LocalPosition.x 276 | value: 628 277 | objectReference: {fileID: 0} 278 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 279 | propertyPath: m_LocalPosition.z 280 | value: 527 281 | objectReference: {fileID: 0} 282 | m_RemovedComponents: [] 283 | m_ParentPrefab: {fileID: 100100000, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 284 | m_IsPrefabParent: 0 285 | --- !u!1 &2131109537 286 | GameObject: 287 | m_ObjectHideFlags: 0 288 | m_PrefabParentObject: {fileID: 0} 289 | m_PrefabInternal: {fileID: 0} 290 | serializedVersion: 4 291 | m_Component: 292 | - 4: {fileID: 2131109544} 293 | - 20: {fileID: 2131109543} 294 | - 92: {fileID: 2131109542} 295 | - 124: {fileID: 2131109541} 296 | - 81: {fileID: 2131109540} 297 | - 114: {fileID: 2131109539} 298 | - 114: {fileID: 2131109538} 299 | m_Layer: 0 300 | m_Name: Main Camera 301 | m_TagString: MainCamera 302 | m_Icon: {fileID: 0} 303 | m_NavMeshLayer: 0 304 | m_StaticEditorFlags: 0 305 | m_IsActive: 1 306 | --- !u!114 &2131109538 307 | MonoBehaviour: 308 | m_ObjectHideFlags: 0 309 | m_PrefabParentObject: {fileID: 0} 310 | m_PrefabInternal: {fileID: 0} 311 | m_GameObject: {fileID: 2131109537} 312 | m_Enabled: 1 313 | m_EditorHideFlags: 0 314 | m_Script: {fileID: 11500000, guid: e50e925fb93c78246bf995d9dc3a2330, type: 3} 315 | m_Name: 316 | m_EditorClassIdentifier: 317 | type: 3 318 | adaptiveTextureSize: 256 319 | remapCurve: 320 | serializedVersion: 2 321 | m_Curve: [] 322 | m_PreInfinity: 2 323 | m_PostInfinity: 2 324 | m_RotationOrder: 4 325 | exposureAdjustment: 1.5 326 | middleGrey: 0.4 327 | white: 2 328 | adaptionSpeed: 1.5 329 | tonemapper: {fileID: 4800000, guid: 003377fc2620a44939dadde6fe3f8190, type: 3} 330 | validRenderTextureFormat: 1 331 | --- !u!114 &2131109539 332 | MonoBehaviour: 333 | m_ObjectHideFlags: 0 334 | m_PrefabParentObject: {fileID: 0} 335 | m_PrefabInternal: {fileID: 0} 336 | m_GameObject: {fileID: 2131109537} 337 | m_Enabled: 1 338 | m_EditorHideFlags: 0 339 | m_Script: {fileID: 11500000, guid: 1eed1d9cbe64423499f1fefc0ce50417, type: 3} 340 | m_Name: 341 | m_EditorClassIdentifier: 342 | Resolution: 1 343 | DefaultSpotCookie: {fileID: 2800000, guid: 5157bf6d690b6df458f6c0ce0c06d329, type: 3} 344 | --- !u!81 &2131109540 345 | AudioListener: 346 | m_ObjectHideFlags: 0 347 | m_PrefabParentObject: {fileID: 0} 348 | m_PrefabInternal: {fileID: 0} 349 | m_GameObject: {fileID: 2131109537} 350 | m_Enabled: 1 351 | --- !u!124 &2131109541 352 | Behaviour: 353 | m_ObjectHideFlags: 0 354 | m_PrefabParentObject: {fileID: 0} 355 | m_PrefabInternal: {fileID: 0} 356 | m_GameObject: {fileID: 2131109537} 357 | m_Enabled: 1 358 | --- !u!92 &2131109542 359 | Behaviour: 360 | m_ObjectHideFlags: 0 361 | m_PrefabParentObject: {fileID: 0} 362 | m_PrefabInternal: {fileID: 0} 363 | m_GameObject: {fileID: 2131109537} 364 | m_Enabled: 1 365 | --- !u!20 &2131109543 366 | Camera: 367 | m_ObjectHideFlags: 0 368 | m_PrefabParentObject: {fileID: 0} 369 | m_PrefabInternal: {fileID: 0} 370 | m_GameObject: {fileID: 2131109537} 371 | m_Enabled: 1 372 | serializedVersion: 2 373 | m_ClearFlags: 2 374 | m_BackGroundColor: {r: 0.09310344, g: 0.09310344, b: 0.09310344, a: 0.019607844} 375 | m_NormalizedViewPortRect: 376 | serializedVersion: 2 377 | x: 0 378 | y: 0 379 | width: 1 380 | height: 1 381 | near clip plane: 0.3 382 | far clip plane: 1000 383 | field of view: 60 384 | orthographic: 0 385 | orthographic size: 5 386 | m_Depth: -1 387 | m_CullingMask: 388 | serializedVersion: 2 389 | m_Bits: 4294967295 390 | m_RenderingPath: 3 391 | m_TargetTexture: {fileID: 0} 392 | m_TargetDisplay: 0 393 | m_TargetEye: 3 394 | m_HDR: 1 395 | m_OcclusionCulling: 1 396 | m_StereoConvergence: 10 397 | m_StereoSeparation: 0.022 398 | m_StereoMirrorMode: 0 399 | --- !u!4 &2131109544 400 | Transform: 401 | m_ObjectHideFlags: 0 402 | m_PrefabParentObject: {fileID: 0} 403 | m_PrefabInternal: {fileID: 0} 404 | m_GameObject: {fileID: 2131109537} 405 | m_LocalRotation: {x: -0.016492851, y: 0.97115225, z: -0.14476961, w: -0.18876742} 406 | m_LocalPosition: {x: -0.93362576, y: 35.104366, z: 194.03326} 407 | m_LocalScale: {x: 1, y: 1, z: 1} 408 | m_Children: [] 409 | m_Father: {fileID: 0} 410 | m_RootOrder: 0 411 | -------------------------------------------------------------------------------- /Assets/spotlight.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 322a31a9f9b825548b1ca7467bb8b70d 3 | timeCreated: 1460415228 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/sun-fog.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 22cc313ace7d1404d8631be716b9f951 3 | timeCreated: 1460412338 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/sun-haze.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: 0.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: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 29 | m_HaloStrength: 0.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: 6 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_LightingDataAsset: {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: 0.5 78 | agentHeight: 2 79 | agentSlope: 45 80 | agentClimb: 0.4 81 | ledgeDropHeight: 0 82 | maxJumpAcrossDistance: 0 83 | accuratePlacement: 0 84 | minRegionArea: 2 85 | cellSize: 0.16666667 86 | manualCellSize: 0 87 | m_NavMeshData: {fileID: 0} 88 | --- !u!1 &712925684 89 | GameObject: 90 | m_ObjectHideFlags: 0 91 | m_PrefabParentObject: {fileID: 154310, guid: 2628a8c773506d9459e7e06a313fdd75, type: 2} 92 | m_PrefabInternal: {fileID: 0} 93 | serializedVersion: 4 94 | m_Component: 95 | - 4: {fileID: 712925687} 96 | - 108: {fileID: 712925686} 97 | - 114: {fileID: 712925685} 98 | m_Layer: 0 99 | m_Name: Directional Light 100 | m_TagString: Untagged 101 | m_Icon: {fileID: 0} 102 | m_NavMeshLayer: 0 103 | m_StaticEditorFlags: 0 104 | m_IsActive: 1 105 | --- !u!114 &712925685 106 | MonoBehaviour: 107 | m_ObjectHideFlags: 0 108 | m_PrefabParentObject: {fileID: 11460774, guid: 2628a8c773506d9459e7e06a313fdd75, 109 | type: 2} 110 | m_PrefabInternal: {fileID: 0} 111 | m_GameObject: {fileID: 712925684} 112 | m_Enabled: 1 113 | m_EditorHideFlags: 0 114 | m_Script: {fileID: 11500000, guid: dafc90245bfe9e2408e358f71deace2a, type: 3} 115 | m_Name: 116 | m_EditorClassIdentifier: 117 | SampleCount: 24 118 | ScatteringCoef: 0.003 119 | ExtinctionCoef: 0.002 120 | SkyboxExtinctionCoef: 0.864 121 | MieG: 0.675 122 | HeightFog: 0 123 | HeightScale: 0.1 124 | GroundLevel: 0 125 | Noise: 0 126 | NoiseScale: 0.015 127 | NoiseIntensity: 1 128 | NoiseIntensityOffset: 0.3 129 | NoiseVelocity: {x: 3, y: 3} 130 | MaxRayLength: 400 131 | --- !u!108 &712925686 132 | Light: 133 | m_ObjectHideFlags: 0 134 | m_PrefabParentObject: {fileID: 10811648, guid: 2628a8c773506d9459e7e06a313fdd75, 135 | type: 2} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 712925684} 138 | m_Enabled: 1 139 | serializedVersion: 6 140 | m_Type: 1 141 | m_Color: {r: 1, g: 0.95903194, b: 0.6463019, a: 1} 142 | m_Intensity: 1 143 | m_Range: 10 144 | m_SpotAngle: 30 145 | m_CookieSize: 10 146 | m_Shadows: 147 | m_Type: 2 148 | m_Resolution: -1 149 | m_Strength: 0.802 150 | m_Bias: 0.05 151 | m_NormalBias: 0.4 152 | m_NearPlane: 0.2 153 | m_Cookie: {fileID: 0} 154 | m_DrawHalo: 0 155 | m_Flare: {fileID: 0} 156 | m_RenderMode: 0 157 | m_CullingMask: 158 | serializedVersion: 2 159 | m_Bits: 4294967295 160 | m_Lightmapping: 4 161 | m_BounceIntensity: 1 162 | m_ShadowRadius: 0 163 | m_ShadowAngle: 0 164 | m_AreaSize: {x: 1, y: 1} 165 | --- !u!4 &712925687 166 | Transform: 167 | m_ObjectHideFlags: 0 168 | m_PrefabParentObject: {fileID: 406102, guid: 2628a8c773506d9459e7e06a313fdd75, type: 2} 169 | m_PrefabInternal: {fileID: 0} 170 | m_GameObject: {fileID: 712925684} 171 | m_LocalRotation: {x: -0.053384982, y: 0.2237638, z: -0.012274963, w: -0.97310287} 172 | m_LocalPosition: {x: 0, y: 3, z: 0} 173 | m_LocalScale: {x: 1, y: 1, z: 1} 174 | m_LocalEulerAnglesHint: {x: 6.2802, y: -25.9, z: -0.0001} 175 | m_Children: [] 176 | m_Father: {fileID: 0} 177 | m_RootOrder: 1 178 | --- !u!1001 &1291845253 179 | Prefab: 180 | m_ObjectHideFlags: 0 181 | serializedVersion: 2 182 | m_Modification: 183 | m_TransformParent: {fileID: 0} 184 | m_Modifications: 185 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 186 | propertyPath: m_LocalPosition.x 187 | value: -57.368 188 | objectReference: {fileID: 0} 189 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 190 | propertyPath: m_LocalPosition.y 191 | value: 0.79 192 | objectReference: {fileID: 0} 193 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 194 | propertyPath: m_LocalPosition.z 195 | value: 110.89 196 | objectReference: {fileID: 0} 197 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 198 | propertyPath: m_LocalRotation.x 199 | value: 0 200 | objectReference: {fileID: 0} 201 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 202 | propertyPath: m_LocalRotation.y 203 | value: 0 204 | objectReference: {fileID: 0} 205 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 206 | propertyPath: m_LocalRotation.z 207 | value: 0 208 | objectReference: {fileID: 0} 209 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 210 | propertyPath: m_LocalRotation.w 211 | value: 1 212 | objectReference: {fileID: 0} 213 | - target: {fileID: 474104, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 214 | propertyPath: m_RootOrder 215 | value: 2 216 | objectReference: {fileID: 0} 217 | - target: {fileID: 436054, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 218 | propertyPath: m_LocalPosition.x 219 | value: 927 220 | objectReference: {fileID: 0} 221 | - target: {fileID: 436054, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 222 | propertyPath: m_LocalPosition.z 223 | value: -794 224 | objectReference: {fileID: 0} 225 | - target: {fileID: 436054, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 226 | propertyPath: m_LocalPosition.y 227 | value: -9 228 | objectReference: {fileID: 0} 229 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 230 | propertyPath: m_LocalPosition.x 231 | value: -23 232 | objectReference: {fileID: 0} 233 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 234 | propertyPath: m_LocalPosition.z 235 | value: -160 236 | objectReference: {fileID: 0} 237 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 238 | propertyPath: m_LocalRotation.x 239 | value: -0.0714657 240 | objectReference: {fileID: 0} 241 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 242 | propertyPath: m_LocalRotation.y 243 | value: -0.70348614 244 | objectReference: {fileID: 0} 245 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 246 | propertyPath: m_LocalRotation.z 247 | value: -0.7034859 248 | objectReference: {fileID: 0} 249 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 250 | propertyPath: m_LocalRotation.w 251 | value: 0.07146737 252 | objectReference: {fileID: 0} 253 | - target: {fileID: 412958, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 254 | propertyPath: m_LocalPosition.y 255 | value: -2 256 | objectReference: {fileID: 0} 257 | - target: {fileID: 424582, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 258 | propertyPath: m_LocalPosition.x 259 | value: -625 260 | objectReference: {fileID: 0} 261 | - target: {fileID: 424582, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 262 | propertyPath: m_LocalPosition.z 263 | value: 51 264 | objectReference: {fileID: 0} 265 | - target: {fileID: 424582, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 266 | propertyPath: m_LocalPosition.y 267 | value: -9 268 | objectReference: {fileID: 0} 269 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 270 | propertyPath: m_LocalPosition.y 271 | value: -17 272 | objectReference: {fileID: 0} 273 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 274 | propertyPath: m_LocalScale.z 275 | value: 4.021897 276 | objectReference: {fileID: 0} 277 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 278 | propertyPath: m_LocalPosition.x 279 | value: 628 280 | objectReference: {fileID: 0} 281 | - target: {fileID: 408694, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 282 | propertyPath: m_LocalPosition.z 283 | value: 527 284 | objectReference: {fileID: 0} 285 | m_RemovedComponents: [] 286 | m_ParentPrefab: {fileID: 100100000, guid: d5335c8f26bfe754b960f5d390edcb98, type: 2} 287 | m_IsPrefabParent: 0 288 | --- !u!1 &2131109537 289 | GameObject: 290 | m_ObjectHideFlags: 0 291 | m_PrefabParentObject: {fileID: 0} 292 | m_PrefabInternal: {fileID: 0} 293 | serializedVersion: 4 294 | m_Component: 295 | - 4: {fileID: 2131109544} 296 | - 20: {fileID: 2131109543} 297 | - 92: {fileID: 2131109542} 298 | - 124: {fileID: 2131109541} 299 | - 81: {fileID: 2131109540} 300 | - 114: {fileID: 2131109539} 301 | - 114: {fileID: 2131109538} 302 | m_Layer: 0 303 | m_Name: Main Camera 304 | m_TagString: MainCamera 305 | m_Icon: {fileID: 0} 306 | m_NavMeshLayer: 0 307 | m_StaticEditorFlags: 0 308 | m_IsActive: 1 309 | --- !u!114 &2131109538 310 | MonoBehaviour: 311 | m_ObjectHideFlags: 0 312 | m_PrefabParentObject: {fileID: 0} 313 | m_PrefabInternal: {fileID: 0} 314 | m_GameObject: {fileID: 2131109537} 315 | m_Enabled: 1 316 | m_EditorHideFlags: 0 317 | m_Script: {fileID: 11500000, guid: e50e925fb93c78246bf995d9dc3a2330, type: 3} 318 | m_Name: 319 | m_EditorClassIdentifier: 320 | type: 3 321 | adaptiveTextureSize: 256 322 | remapCurve: 323 | serializedVersion: 2 324 | m_Curve: [] 325 | m_PreInfinity: 2 326 | m_PostInfinity: 2 327 | m_RotationOrder: 4 328 | exposureAdjustment: 1.5 329 | middleGrey: 0.4 330 | white: 2 331 | adaptionSpeed: 1.5 332 | tonemapper: {fileID: 4800000, guid: 003377fc2620a44939dadde6fe3f8190, type: 3} 333 | validRenderTextureFormat: 1 334 | --- !u!114 &2131109539 335 | MonoBehaviour: 336 | m_ObjectHideFlags: 0 337 | m_PrefabParentObject: {fileID: 0} 338 | m_PrefabInternal: {fileID: 0} 339 | m_GameObject: {fileID: 2131109537} 340 | m_Enabled: 1 341 | m_EditorHideFlags: 0 342 | m_Script: {fileID: 11500000, guid: 1eed1d9cbe64423499f1fefc0ce50417, type: 3} 343 | m_Name: 344 | m_EditorClassIdentifier: 345 | Resolution: 1 346 | DefaultSpotCookie: {fileID: 2800000, guid: 5157bf6d690b6df458f6c0ce0c06d329, type: 3} 347 | --- !u!81 &2131109540 348 | AudioListener: 349 | m_ObjectHideFlags: 0 350 | m_PrefabParentObject: {fileID: 0} 351 | m_PrefabInternal: {fileID: 0} 352 | m_GameObject: {fileID: 2131109537} 353 | m_Enabled: 1 354 | --- !u!124 &2131109541 355 | Behaviour: 356 | m_ObjectHideFlags: 0 357 | m_PrefabParentObject: {fileID: 0} 358 | m_PrefabInternal: {fileID: 0} 359 | m_GameObject: {fileID: 2131109537} 360 | m_Enabled: 1 361 | --- !u!92 &2131109542 362 | Behaviour: 363 | m_ObjectHideFlags: 0 364 | m_PrefabParentObject: {fileID: 0} 365 | m_PrefabInternal: {fileID: 0} 366 | m_GameObject: {fileID: 2131109537} 367 | m_Enabled: 1 368 | --- !u!20 &2131109543 369 | Camera: 370 | m_ObjectHideFlags: 0 371 | m_PrefabParentObject: {fileID: 0} 372 | m_PrefabInternal: {fileID: 0} 373 | m_GameObject: {fileID: 2131109537} 374 | m_Enabled: 1 375 | serializedVersion: 2 376 | m_ClearFlags: 1 377 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} 378 | m_NormalizedViewPortRect: 379 | serializedVersion: 2 380 | x: 0 381 | y: 0 382 | width: 1 383 | height: 1 384 | near clip plane: 0.3 385 | far clip plane: 1000 386 | field of view: 60 387 | orthographic: 0 388 | orthographic size: 5 389 | m_Depth: -1 390 | m_CullingMask: 391 | serializedVersion: 2 392 | m_Bits: 4294967295 393 | m_RenderingPath: 3 394 | m_TargetTexture: {fileID: 0} 395 | m_TargetDisplay: 0 396 | m_TargetEye: 3 397 | m_HDR: 1 398 | m_OcclusionCulling: 1 399 | m_StereoConvergence: 10 400 | m_StereoSeparation: 0.022 401 | m_StereoMirrorMode: 0 402 | --- !u!4 &2131109544 403 | Transform: 404 | m_ObjectHideFlags: 0 405 | m_PrefabParentObject: {fileID: 0} 406 | m_PrefabInternal: {fileID: 0} 407 | m_GameObject: {fileID: 2131109537} 408 | m_LocalRotation: {x: 0.0117569305, y: 0.99486643, z: -0.003636893, w: 0.100445814} 409 | m_LocalPosition: {x: -97.22835, y: 32.162876, z: 382.47165} 410 | m_LocalScale: {x: 1, y: 1, z: 1} 411 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 412 | m_Children: [] 413 | m_Father: {fileID: 0} 414 | m_RootOrder: 0 415 | -------------------------------------------------------------------------------- /Assets/sun-haze.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6a407a2d877fce74eafffebc76436773 3 | timeCreated: 1460412844 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/sun-height-fog.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8690048dd0f6983418cbdb680e3fe063 3 | timeCreated: 1460413248 4 | licenseType: Free 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Michal Skalsky 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of VolumetricLights nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_SolverIterationCount: 6 13 | m_QueriesHitTriggers: 1 14 | m_EnableAdaptiveForce: 0 15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 16 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | -------------------------------------------------------------------------------- /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: 1 12 | m_SpritePackerMode: 2 13 | m_SpritePackerPaddingPower: 1 14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 15 | m_ProjectGenerationRootNamespace: 16 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_LegacyDeferred: 14 | m_Mode: 1 15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 16 | m_AlwaysIncludedShaders: 17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0} 23 | - {fileID: 4800000, guid: d297a5d5cdd4e7f469b33e9f468e00d1, type: 3} 24 | - {fileID: 4800000, guid: c2282c5842bb6d74d999852919953d40, type: 3} 25 | - {fileID: 4800000, guid: f1531a9bd4087ff468de8de09f6ba126, type: 3} 26 | m_PreloadedShaders: [] 27 | m_ShaderSettings: 28 | useScreenSpaceShadows: 1 29 | m_BuildTargetShaderSettings: [] 30 | m_LightmapStripping: 0 31 | m_FogStripping: 0 32 | m_LightmapKeepPlain: 1 33 | m_LightmapKeepDirCombined: 1 34 | m_LightmapKeepDirSeparate: 1 35 | m_LightmapKeepDynamicPlain: 1 36 | m_LightmapKeepDynamicDirCombined: 1 37 | m_LightmapKeepDynamicDirSeparate: 1 38 | m_FogKeepLinear: 1 39 | m_FogKeepExp: 1 40 | m_FogKeepExp2: 1 41 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshAreas: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 26 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 8 7 | AndroidProfiler: 0 8 | defaultScreenOrientation: 4 9 | targetDevice: 2 10 | useOnDemandResources: 0 11 | accelerometerFrequency: 60 12 | companyName: DefaultCompany 13 | productName: VolumetricLights 14 | defaultCursor: {fileID: 0} 15 | cursorHotspot: {x: 0, y: 0} 16 | m_ShowUnitySplashScreen: 1 17 | m_VirtualRealitySplashScreen: {fileID: 0} 18 | defaultScreenWidth: 1024 19 | defaultScreenHeight: 768 20 | defaultScreenWidthWeb: 960 21 | defaultScreenHeightWeb: 600 22 | m_RenderingPath: 3 23 | m_MobileRenderingPath: 1 24 | m_ActiveColorSpace: 1 25 | m_MTRendering: 1 26 | m_MobileMTRendering: 0 27 | m_Stereoscopic3D: 0 28 | iosShowActivityIndicatorOnLoading: -1 29 | androidShowActivityIndicatorOnLoading: -1 30 | iosAppInBackgroundBehavior: 0 31 | displayResolutionDialog: 1 32 | iosAllowHTTPDownload: 1 33 | allowedAutorotateToPortrait: 1 34 | allowedAutorotateToPortraitUpsideDown: 1 35 | allowedAutorotateToLandscapeRight: 1 36 | allowedAutorotateToLandscapeLeft: 1 37 | useOSAutorotation: 1 38 | use32BitDisplayBuffer: 1 39 | disableDepthAndStencilBuffers: 0 40 | defaultIsFullScreen: 1 41 | defaultIsNativeResolution: 1 42 | runInBackground: 0 43 | captureSingleScreen: 0 44 | Override IPod Music: 0 45 | Prepare IOS For Recording: 0 46 | submitAnalytics: 1 47 | usePlayerLog: 1 48 | bakeCollisionMeshes: 0 49 | forceSingleInstance: 0 50 | resizableWindow: 0 51 | useMacAppStoreValidation: 0 52 | gpuSkinning: 0 53 | xboxPIXTextureCapture: 0 54 | xboxEnableAvatar: 0 55 | xboxEnableKinect: 0 56 | xboxEnableKinectAutoTracking: 0 57 | xboxEnableFitness: 0 58 | visibleInBackground: 0 59 | allowFullscreenSwitch: 1 60 | macFullscreenMode: 2 61 | d3d9FullscreenMode: 1 62 | d3d11FullscreenMode: 1 63 | xboxSpeechDB: 0 64 | xboxEnableHeadOrientation: 0 65 | xboxEnableGuest: 0 66 | xboxEnablePIXSampling: 0 67 | n3dsDisableStereoscopicView: 0 68 | n3dsEnableSharedListOpt: 1 69 | n3dsEnableVSync: 0 70 | uiUse16BitDepthBuffer: 0 71 | ignoreAlphaClear: 0 72 | xboxOneResolution: 0 73 | ps3SplashScreen: {fileID: 0} 74 | videoMemoryForVertexBuffers: 0 75 | psp2PowerMode: 0 76 | psp2AcquireBGM: 1 77 | wiiUTVResolution: 0 78 | wiiUGamePadMSAA: 1 79 | wiiUSupportsNunchuk: 0 80 | wiiUSupportsClassicController: 0 81 | wiiUSupportsBalanceBoard: 0 82 | wiiUSupportsMotionPlus: 0 83 | wiiUSupportsProController: 0 84 | wiiUAllowScreenCapture: 1 85 | wiiUControllerCount: 0 86 | m_SupportedAspectRatios: 87 | 4:3: 1 88 | 5:4: 1 89 | 16:10: 1 90 | 16:9: 1 91 | Others: 1 92 | bundleIdentifier: com.Company.ProductName 93 | bundleVersion: 1.0 94 | preloadedAssets: [] 95 | metroEnableIndependentInputSource: 0 96 | metroEnableLowLatencyPresentationAPI: 0 97 | xboxOneDisableKinectGpuReservation: 0 98 | virtualRealitySupported: 0 99 | productGUID: df8eb6b318b9ffd46aef8e9fd2d34245 100 | AndroidBundleVersionCode: 1 101 | AndroidMinSdkVersion: 9 102 | AndroidPreferredInstallLocation: 1 103 | aotOptions: 104 | apiCompatibilityLevel: 2 105 | stripEngineCode: 1 106 | iPhoneStrippingLevel: 0 107 | iPhoneScriptCallOptimization: 0 108 | iPhoneBuildNumber: 0 109 | ForceInternetPermission: 0 110 | ForceSDCardPermission: 0 111 | CreateWallpaper: 0 112 | APKExpansionFiles: 0 113 | preloadShaders: 0 114 | StripUnusedMeshComponents: 0 115 | VertexChannelCompressionMask: 116 | serializedVersion: 2 117 | m_Bits: 238 118 | iPhoneSdkVersion: 988 119 | iPhoneTargetOSVersion: 22 120 | uIPrerenderedIcon: 0 121 | uIRequiresPersistentWiFi: 0 122 | uIRequiresFullScreen: 1 123 | uIStatusBarHidden: 1 124 | uIExitOnSuspend: 0 125 | uIStatusBarStyle: 0 126 | iPhoneSplashScreen: {fileID: 0} 127 | iPhoneHighResSplashScreen: {fileID: 0} 128 | iPhoneTallHighResSplashScreen: {fileID: 0} 129 | iPhone47inSplashScreen: {fileID: 0} 130 | iPhone55inPortraitSplashScreen: {fileID: 0} 131 | iPhone55inLandscapeSplashScreen: {fileID: 0} 132 | iPadPortraitSplashScreen: {fileID: 0} 133 | iPadHighResPortraitSplashScreen: {fileID: 0} 134 | iPadLandscapeSplashScreen: {fileID: 0} 135 | iPadHighResLandscapeSplashScreen: {fileID: 0} 136 | appleTVSplashScreen: {fileID: 0} 137 | tvOSSmallIconLayers: [] 138 | tvOSLargeIconLayers: [] 139 | tvOSTopShelfImageLayers: [] 140 | iOSLaunchScreenType: 0 141 | iOSLaunchScreenPortrait: {fileID: 0} 142 | iOSLaunchScreenLandscape: {fileID: 0} 143 | iOSLaunchScreenBackgroundColor: 144 | serializedVersion: 2 145 | rgba: 0 146 | iOSLaunchScreenFillPct: 100 147 | iOSLaunchScreenSize: 100 148 | iOSLaunchScreenCustomXibPath: 149 | iOSLaunchScreeniPadType: 0 150 | iOSLaunchScreeniPadImage: {fileID: 0} 151 | iOSLaunchScreeniPadBackgroundColor: 152 | serializedVersion: 2 153 | rgba: 0 154 | iOSLaunchScreeniPadFillPct: 100 155 | iOSLaunchScreeniPadSize: 100 156 | iOSLaunchScreeniPadCustomXibPath: 157 | iOSDeviceRequirements: [] 158 | AndroidTargetDevice: 0 159 | AndroidSplashScreenScale: 0 160 | androidSplashScreen: {fileID: 0} 161 | AndroidKeystoreName: 162 | AndroidKeyaliasName: 163 | AndroidTVCompatibility: 1 164 | AndroidIsGame: 1 165 | androidEnableBanner: 1 166 | m_AndroidBanners: 167 | - width: 320 168 | height: 180 169 | banner: {fileID: 0} 170 | androidGamepadSupportLevel: 0 171 | resolutionDialogBanner: {fileID: 0} 172 | m_BuildTargetIcons: 173 | - m_BuildTarget: 174 | m_Icons: 175 | - serializedVersion: 2 176 | m_Icon: {fileID: 0} 177 | m_Width: 128 178 | m_Height: 128 179 | m_BuildTargetBatching: [] 180 | m_BuildTargetGraphicsAPIs: [] 181 | webPlayerTemplate: APPLICATION:Default 182 | m_TemplateCustomTags: {} 183 | wiiUTitleID: 0005000011000000 184 | wiiUGroupID: 00010000 185 | wiiUCommonSaveSize: 4096 186 | wiiUAccountSaveSize: 2048 187 | wiiUOlvAccessKey: 0 188 | wiiUTinCode: 0 189 | wiiUJoinGameId: 0 190 | wiiUJoinGameModeMask: 0000000000000000 191 | wiiUCommonBossSize: 0 192 | wiiUAccountBossSize: 0 193 | wiiUAddOnUniqueIDs: [] 194 | wiiUMainThreadStackSize: 3072 195 | wiiULoaderThreadStackSize: 1024 196 | wiiUSystemHeapSize: 128 197 | wiiUTVStartupScreen: {fileID: 0} 198 | wiiUGamePadStartupScreen: {fileID: 0} 199 | wiiUProfilerLibPath: 200 | actionOnDotNetUnhandledException: 1 201 | enableInternalProfiler: 0 202 | logObjCUncaughtExceptions: 1 203 | enableCrashReportAPI: 0 204 | locationUsageDescription: 205 | XboxTitleId: 206 | XboxImageXexPath: 207 | XboxSpaPath: 208 | XboxGenerateSpa: 0 209 | XboxDeployKinectResources: 0 210 | XboxSplashScreen: {fileID: 0} 211 | xboxEnableSpeech: 0 212 | xboxAdditionalTitleMemorySize: 0 213 | xboxDeployKinectHeadOrientation: 0 214 | xboxDeployKinectHeadPosition: 0 215 | ps3TitleConfigPath: 216 | ps3DLCConfigPath: 217 | ps3ThumbnailPath: 218 | ps3BackgroundPath: 219 | ps3SoundPath: 220 | ps3NPAgeRating: 12 221 | ps3TrophyCommId: 222 | ps3NpCommunicationPassphrase: 223 | ps3TrophyPackagePath: 224 | ps3BootCheckMaxSaveGameSizeKB: 128 225 | ps3TrophyCommSig: 226 | ps3SaveGameSlots: 1 227 | ps3TrialMode: 0 228 | ps3VideoMemoryForAudio: 0 229 | ps3EnableVerboseMemoryStats: 0 230 | ps3UseSPUForUmbra: 0 231 | ps3EnableMoveSupport: 1 232 | ps3DisableDolbyEncoding: 0 233 | ps4NPAgeRating: 12 234 | ps4NPTitleSecret: 235 | ps4NPTrophyPackPath: 236 | ps4ParentalLevel: 1 237 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 238 | ps4Category: 0 239 | ps4MasterVersion: 01.00 240 | ps4AppVersion: 01.00 241 | ps4AppType: 0 242 | ps4ParamSfxPath: 243 | ps4VideoOutPixelFormat: 0 244 | ps4VideoOutResolution: 4 245 | ps4PronunciationXMLPath: 246 | ps4PronunciationSIGPath: 247 | ps4BackgroundImagePath: 248 | ps4StartupImagePath: 249 | ps4SaveDataImagePath: 250 | ps4SdkOverride: 251 | ps4BGMPath: 252 | ps4ShareFilePath: 253 | ps4ShareOverlayImagePath: 254 | ps4PrivacyGuardImagePath: 255 | ps4NPtitleDatPath: 256 | ps4RemotePlayKeyAssignment: -1 257 | ps4RemotePlayKeyMappingDir: 258 | ps4EnterButtonAssignment: 1 259 | ps4ApplicationParam1: 0 260 | ps4ApplicationParam2: 0 261 | ps4ApplicationParam3: 0 262 | ps4ApplicationParam4: 0 263 | ps4DownloadDataSize: 0 264 | ps4GarlicHeapSize: 2048 265 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 266 | ps4pnSessions: 1 267 | ps4pnPresence: 1 268 | ps4pnFriends: 1 269 | ps4pnGameCustomData: 1 270 | playerPrefsSupport: 0 271 | ps4ReprojectionSupport: 0 272 | ps4UseAudio3dBackend: 0 273 | ps4SocialScreenEnabled: 0 274 | ps4Audio3dVirtualSpeakerCount: 14 275 | ps4attribCpuUsage: 0 276 | ps4PatchPkgPath: 277 | ps4PatchLatestPkgPath: 278 | ps4PatchChangeinfoPath: 279 | ps4attribUserManagement: 0 280 | ps4attribMoveSupport: 0 281 | ps4attrib3DSupport: 0 282 | ps4attribShareSupport: 0 283 | ps4IncludedModules: [] 284 | monoEnv: 285 | psp2Splashimage: {fileID: 0} 286 | psp2NPTrophyPackPath: 287 | psp2NPSupportGBMorGJP: 0 288 | psp2NPAgeRating: 12 289 | psp2NPTitleDatPath: 290 | psp2NPCommsID: 291 | psp2NPCommunicationsID: 292 | psp2NPCommsPassphrase: 293 | psp2NPCommsSig: 294 | psp2ParamSfxPath: 295 | psp2ManualPath: 296 | psp2LiveAreaGatePath: 297 | psp2LiveAreaBackroundPath: 298 | psp2LiveAreaPath: 299 | psp2LiveAreaTrialPath: 300 | psp2PatchChangeInfoPath: 301 | psp2PatchOriginalPackage: 302 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 303 | psp2KeystoneFile: 304 | psp2MemoryExpansionMode: 0 305 | psp2DRMType: 0 306 | psp2StorageType: 0 307 | psp2MediaCapacity: 0 308 | psp2DLCConfigPath: 309 | psp2ThumbnailPath: 310 | psp2BackgroundPath: 311 | psp2SoundPath: 312 | psp2TrophyCommId: 313 | psp2TrophyPackagePath: 314 | psp2PackagedResourcesPath: 315 | psp2SaveDataQuota: 10240 316 | psp2ParentalLevel: 1 317 | psp2ShortTitle: Not Set 318 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 319 | psp2Category: 0 320 | psp2MasterVersion: 01.00 321 | psp2AppVersion: 01.00 322 | psp2TVBootMode: 0 323 | psp2EnterButtonAssignment: 2 324 | psp2TVDisableEmu: 0 325 | psp2AllowTwitterDialog: 1 326 | psp2Upgradable: 0 327 | psp2HealthWarning: 0 328 | psp2UseLibLocation: 0 329 | psp2InfoBarOnStartup: 0 330 | psp2InfoBarColor: 0 331 | psmSplashimage: {fileID: 0} 332 | spritePackerPolicy: 333 | scriptingDefineSymbols: {} 334 | metroPackageName: VolumetricLights 335 | metroPackageVersion: 336 | metroCertificatePath: 337 | metroCertificatePassword: 338 | metroCertificateSubject: 339 | metroCertificateIssuer: 340 | metroCertificateNotAfter: 0000000000000000 341 | metroApplicationDescription: VolumetricLights 342 | wsaImages: {} 343 | metroTileShortName: 344 | metroCommandLineArgsFile: 345 | metroTileShowName: 0 346 | metroMediumTileShowName: 0 347 | metroLargeTileShowName: 0 348 | metroWideTileShowName: 0 349 | metroDefaultTileSize: 1 350 | metroTileForegroundText: 1 351 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 352 | metroSplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, 353 | a: 1} 354 | metroSplashScreenUseBackgroundColor: 1 355 | platformCapabilities: {} 356 | metroFTAName: 357 | metroFTAFileTypes: [] 358 | metroProtocolName: 359 | metroCompilationOverrides: 1 360 | blackberryDeviceAddress: 361 | blackberryDevicePassword: 362 | blackberryTokenPath: 363 | blackberryTokenExires: 364 | blackberryTokenAuthor: 365 | blackberryTokenAuthorId: 366 | blackberryCskPassword: 367 | blackberrySaveLogPath: 368 | blackberrySharedPermissions: 0 369 | blackberryCameraPermissions: 0 370 | blackberryGPSPermissions: 0 371 | blackberryDeviceIDPermissions: 0 372 | blackberryMicrophonePermissions: 0 373 | blackberryGamepadSupport: 0 374 | blackberryBuildId: 0 375 | blackberryLandscapeSplashScreen: {fileID: 0} 376 | blackberryPortraitSplashScreen: {fileID: 0} 377 | blackberrySquareSplashScreen: {fileID: 0} 378 | tizenProductDescription: 379 | tizenProductURL: 380 | tizenSigningProfileName: 381 | tizenGPSPermissions: 0 382 | tizenMicrophonePermissions: 0 383 | n3dsUseExtSaveData: 0 384 | n3dsCompressStaticMem: 1 385 | n3dsExtSaveDataNumber: 0x12345 386 | n3dsStackSize: 131072 387 | n3dsTargetPlatform: 2 388 | n3dsRegion: 7 389 | n3dsMediaSize: 0 390 | n3dsLogoStyle: 3 391 | n3dsTitle: GameName 392 | n3dsProductCode: 393 | n3dsApplicationId: 0xFF3FF 394 | stvDeviceAddress: 395 | stvProductDescription: 396 | stvProductAuthor: 397 | stvProductAuthorEmail: 398 | stvProductLink: 399 | stvProductCategory: 0 400 | XboxOneProductId: 401 | XboxOneUpdateKey: 402 | XboxOneSandboxId: 403 | XboxOneContentId: 404 | XboxOneTitleId: 405 | XboxOneSCId: 406 | XboxOneGameOsOverridePath: 407 | XboxOnePackagingOverridePath: 408 | XboxOneAppManifestOverridePath: 409 | XboxOnePackageEncryption: 0 410 | XboxOnePackageUpdateGranularity: 2 411 | XboxOneDescription: 412 | XboxOneIsContentPackage: 0 413 | XboxOneEnableGPUVariability: 0 414 | XboxOneSockets: {} 415 | XboxOneSplashScreen: {fileID: 0} 416 | XboxOneAllowedProductIds: [] 417 | XboxOnePersistentLocalStorageSize: 0 418 | intPropertyNames: 419 | - Android::ScriptingBackend 420 | - Standalone::ScriptingBackend 421 | - WebPlayer::ScriptingBackend 422 | Android::ScriptingBackend: 0 423 | Standalone::ScriptingBackend: 0 424 | WebPlayer::ScriptingBackend: 0 425 | boolPropertyNames: 426 | - XboxOne::enus 427 | XboxOne::enus: 1 428 | stringPropertyNames: [] 429 | cloudProjectId: 430 | projectName: 431 | organizationId: 432 | cloudEnabled: 0 433 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.3.4f1 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: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 2 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 2 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 0 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 2 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 2 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 1000 147 | shadowNearPlaneOffset: 2 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.19999999, z: 0.46666664} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 0 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | BlackBerry: 2 168 | GLES Emulation: 5 169 | Nintendo 3DS: 5 170 | PS3: 5 171 | PS4: 5 172 | PSM: 5 173 | PSP2: 2 174 | Samsung TV: 2 175 | Standalone: 5 176 | Tizen: 2 177 | WP8: 5 178 | Web: 5 179 | WebGL: 3 180 | WiiU: 5 181 | Windows Store Apps: 5 182 | XBOX360: 5 183 | XboxOne: 5 184 | iPhone: 2 185 | tvOS: 5 186 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/UnityAdsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!292 &1 4 | UnityAdsSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_InitializeOnStartup: 1 8 | m_TestMode: 0 9 | m_EnabledPlatforms: 4294967295 10 | m_IosGameId: 11 | m_AndroidGameId: 12 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | UnityPurchasingSettings: 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | UnityAnalyticsSettings: 10 | m_Enabled: 0 11 | m_InitializeOnStartup: 1 12 | m_TestMode: 0 13 | m_TestEventUrl: 14 | m_TestConfigUrl: 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Volumetric Lights for Unity 5 2 | [![IMAGE ALT TEXT HERE](https://bqu2ya.dm1.livefilestore.com/y4mSxIn4D7Zx9td_2NWn3yZu8UxWeqJKN4qdciZ0fCqO9ox290xR837Moux6HnPpWPkF8mi7oY26ZNF7n0eJfbPMNoBTtrMraKnghJ4XF13tCK2bBPybZVudlL1UU_gBkFyY7lt30UYbVJ-EZVaV2Z8C1DglijmBYelQfJyplssFe7oSklBvneGtDlhwDv1dougv2ZpHmipfzYRuR6fLeawlQ?width=1167&height=653&cropmode=none)](https://www.youtube.com/watch?v=JPxLCYXB-8A) [![IMAGE ALT TEXT HERE](https://agu0ya-dm2305.files.1drv.com/y4mnqQ4pzhZdF4k3Z7Fv_QApimv9POLR1ShQPoNg8wtUf7TzqFdWLY6Y8bxtyJhGQNRe8NLvy1GGoZsorNssr2h6fTsAfyi-F2LOIA4wzNY_7cS-1iEjVHyOCyOCTA0_8na3cmWvQ34gHBfyXOxxE6AZIjaVwCemZP7kSwaUNoNDyCPsCkx8vsdmxuwmuVcrH1rYblmFCaVH5za_EsrqM-qJA?width=1167&height=650&cropmode=none)](https://www.youtube.com/watch?v=ElaPJyzR504) 3 | 4 | Open source (BSD) extension for built-in Unity lights. It uses ray marching in light's volume to compute volumetric fog. This technique is similar to the one used in Killzone ([GPU Pro 5](http://www.amazon.com/GPU-Pro-Advanced-Rendering-Techniques/dp/1482208636): Volumetric Light Effects in Killzone Shadow Fall by Nathan Vos) 5 | 6 | Corresponding thread in Unity Forum can be found [here](http://forum.unity3d.com/threads/true-volumetric-lights-open-source-soon.390818/). 7 | 8 | ### Demo Project 9 | I developed this technology for my hobby project. It was never meant for real use and it is therefore little rough around the edges. 10 | 11 | You can see the demo on [Youtube](https://www.youtube.com/watch?v=JPxLCYXB-8A). 12 | Or you can try it for yourself: [Binary download](https://onedrive.live.com/redir?resid=D65A46249BFF9056!40295&authkey=!AAK3X7BJ_nr3IhE&ithint=file%2czip) 13 | ### Features 14 | * Volumetric fog effect for multiple lights. Point, spot and directional lights are fully supported. 15 | * Volumetric shadows 16 | * Volumetric light cookies 17 | * Volumetric noise implemented as animated 3D texture. 18 | 19 | ### Usage 20 | * Add VolumetricLightRenderer script to your camera and set default cookie texture for spot light. 21 | * Add VolumetricLight script to every light that you want to have volumetric fog. 22 | 23 | Volumetric lights will respect standard light's parameters like color, intensity, range, shadows and cookie. There are also additional parameters specific for volumetric lights. For example: 24 | * Sample count - number of raymarching samples (trade quality for performance) 25 | * Scattering Coef - scattering coefficient controls amount of light that is reflected towards camera. Makes the effect stronger. 26 | * Extinction Coef - controls amount of light absorbed or out-scattered with distance. Makes the effect weaker with increasing distance. It also attenuates existing scene color when used with directional lights. 27 | * Skybox Extinction Coef - Only affects directional light. It controls how much skybox is affected by Extinction coefficient. This technique ignores small air particles and decreasing particle density with altitude. That often makes skybox too "foggy". Skybox extinction coefficient can help with it. 28 | * MieG - controls mie scattering (controls how light is reflected with respect to light's direction) 29 | * Height Fog - toggle exponential height fog 30 | * Height Fog Scale - scale height fog 31 | * Noise - enable volumetric noise 32 | * Noise Scale - noise scale 33 | * Noise Speed - noise animation speed 34 | 35 | Several sample scenes are part of this project. 36 | 37 | #### Building a standalone player 38 | **_IMPORTANT_** - Standalone player will work only if all shaders are included in build! All shaders must be added into "Always Included Shaders" in ProjectSettings/Graphics. 39 | 40 | #### Example scene with different parameters 41 | * Low/High Scattering and Extinction parameters 42 | ![](https://agu1ya-dm2306.files.1drv.com/y4mgo5ud5huq-SUjw4z8gGjB_pnFcs5Le8t64E29kCLJ7WVPpmPLo79oi0BI2YPe6mCMiNOIAZnVNorlBrk6hULgNHbpWGmvLgFOnWEFbj1sRnDP6ml9WXuAFYmH9HZ68DKvTZpjU5VPEDNVRtl2UtsQMDJkR-T0N3V2CirkmHtGKATppk2FI5ffRgdRyEiKErUnEpZjhPk610xZS7JxaeLOA?width=2338&height=650&cropmode=none) 43 | * Low/High Mie G parameter 44 | ![](https://agupya-dm2pap001.files.1drv.com/y4mobk9viWO3q53gQlSGj7LiWmEt72ezfHqnMFYTziSGr2UBFEoIXgbTNZEfbrtG-Arznyc-6V19FunkGzO9K87fXVCI9EnYRAiFyHmmpBGrhPrl_pmpE-y_b01FJJdXLZ6GfGkzjd8Zr6CB8Ity2QYHWizx2saq8ZHPwG8fdajjUUQPSLO9nsY7irPHiGzXt846gJml1rK4QA5aGpMC13_3A?width=2338&height=650&cropmode=none) 45 | * High/Low Shadow Strength. This technique uses single scattering model. That makes areas in shadow unnaturally dark. Use Shadow Strength to "simulate" multiple scattering. 46 | ![](https://aguqya-dm2305.files.1drv.com/y4mQZxpA5UbrBUPIMo44IfWCpDPdJmn4kEdFab0EuyQVNXdfYIWG4v-nnmU4M0nSCcUpE8sLgq-DV5I21QMk3oDt-rS8o8SlahBJ6TKxVk-ejvmPZUojx9BDMrjzSjfYvy6eQxtMF9ksV2bYZqQOCNPYJmvp5TFzR_fP7aJv7XJhJ2tP3ioLLCenF5sBiuR1p5anj915BAl6vAi0n4iX0v53w?width=2338&height=650&cropmode=none) 47 | * Height fog with different scale 48 | ![](https://bqu4ya.dm2302.livefilestore.com/y4mmmE_KTmAE9MRLeoYFM3wkJZk7hVmA2rh6P4qPWDYv3p3w6kMwzSFnKkSjUir0LAf9YIRDsR_lUsd85dud97TtlHB03vwAtAJSViYPkzYo_IcqBcH87NENZM6lawDtOJaxorQhC0XMade8rVcGHKTPftLIV4E1OYHSKfqNCiNoNTJ2ezc3qwRtEFq4580Z-VsHIoo1eZZIgqyrN-cQr96hw?width=2338&height=650&cropmode=none) 49 | * High/Low Skybox Extinction parameter 50 | ![](https://bqu3ya.dm2302.livefilestore.com/y4mxWdkqeJLzQKmg9OI8Xd2PwtzTYi0M5s7TlIcVkOeLHWeEXz_OXSKSAEduhc4MQnC6rajZ1bWSxbKvJLRYj5GpHPAZu1fPijrKAfCg3nat0laIP06t5A6yIljMAd8yi7U0a_0ri0ipRhkW0Ep8d3gLqSFDppSvxrVQ4UgPJhSHJPGItDPbeM7wvHBxxrhcRWTlv2VQqqSG6_6hCxcLmh-fw?width=2338&height=650&cropmode=none) 51 | 52 | ### Rendering resolution 53 | Volumetric fog can be rendered in smaller resolution as an optimization. Set rendering resolution in VolumetricLightRenderer script. 54 | * Full resolution - best quality, poor performance. Serves as a "ground truth". 55 | * Half resolution - best quality/performance ratio. 56 | * Quarter resolution - experimental. Worse quality, best performance. 57 | 58 | ### Requirements 59 | * Unity 5 (tested on 5.3.4, 5.4 and 5.5) 60 | * DirectX 10/11 or OpenGL 4.1 and above 61 | * Tested on Windows and Mac but it should work on other platforms as well 62 | * VR isn't supported 63 | * Mobile devices aren't supported 64 | 65 | ### Known Limitations 66 | * ~~Currently requires HDR camera and deferred renderer~~ 67 | * ~~Currently requires DirectX 11~~ 68 | * Doesn't handle transparent geometry correctly (cutout is ok) 69 | * 3d noise texture is hard coded. VolumetricLightRenderer has custom dds file loader that loads one specific 3d texture (Unity doesn't support 3d textures loaded from file). File "NoiseVolume.bytes" has to be in Resources folder. 70 | * Shadow fading is not implemented 71 | * Parameters and thresholds for bilateral blur and upscale are hard-coded in shaders. Different projects may need different constants. Look into BilateralBlur.shader. There are several constants at the beginning that control downsampling, blur and upsampling. 72 | 73 | ### Technique overview 74 | * Create render target for volumetric light (volume light buffer) 75 | * Use CameraEvent.BeforeLighting to clear volume light buffer 76 | * For every volumetric light render light's volume geometry (sphere, cone, full-screen quad) 77 | * Use LightEvent.AfterShadowMap for shadow casting lights​ 78 | * Use CameraEvent.BeforeLighting for non-shadow casting lights​ 79 | * Perform raymarching in light's volume​ 80 | * Dithering is used to offset ray origin for neighbouring pixels​ 81 | * Use CameraEvent.AfterLighting to perform depth aware gaussian blur on volume light buffer 82 | * Add volume light buffer to Unity's built-in light buffer 83 | 84 | ### Possible improvements 85 | * Light's volume geometry is unnecessarily high poly 86 | * Ray marching is performed in view space and every sample is then transformed to shadow space. It would be better to perform ray marching in both spaces simultaneously. 87 | * Add temporal filter to improve image quality and stability in motion. Change sampling pattern every frame to get more ray marching steps at no additional cost (works only with temporal filter) 88 | * Bilateral blur and upscale can be improved 89 | * I didn't try to optimize the shaders, there is likely room for improvement. 90 | 91 | ### Donations 92 | I've been asked about donation button several times now. I don't feel very comfortable about it. I don't need the money. I have a well paid job. It could also give the impression that I would use the money for further development. But that is certainly not the case. 93 | 94 | But if you really like it and you want to brighten my day then you can always buy me a little gift. Send me [Amazon](https://www.amazon.com/Amazon-Amazon-com-eGift-Cards/dp/BT00DC6QU4) or [Steam](https://www.paypal-gifts.com/uk/brands/steam-digital-wallet-code.html) gift card and I'll buy myself something shiny. You can find my email in my profile. 95 | --------------------------------------------------------------------------------