├── .gitattributes ├── .gitignore ├── Assembly-CSharp.csproj.DotSettings ├── Assets ├── .DS_Store ├── Editor.meta ├── Editor │ ├── ToolUtilities.cs │ └── ToolUtilities.cs.meta ├── Materials.meta ├── Materials │ ├── Gaussian Blur.mat │ ├── Gaussian Blur.mat.meta │ ├── SRP Unlit.mat │ ├── SRP Unlit.mat.meta │ ├── Standard Opaque.mat │ ├── Standard Opaque.mat.meta │ ├── Test.mat │ └── Test.mat.meta ├── Plugins.meta ├── Plugins │ └── Editor.meta ├── Prefabs.meta ├── Profiles.meta ├── Profiles │ ├── SRPAsset.asset │ └── SRPAsset.asset.meta ├── Scenes.meta ├── Scenes │ ├── Empty.unity │ ├── Empty.unity.meta │ ├── PointLightTestScene.unity │ ├── PointLightTestScene.unity.meta │ ├── SampleScene.unity │ └── SampleScene.unity.meta ├── Scripts.meta ├── Scripts │ ├── CameraWanderer.cs │ ├── CameraWanderer.cs.meta │ ├── Extensions.cs │ ├── Extensions.cs.meta │ ├── FramerateCounter.cs │ ├── FramerateCounter.cs.meta │ ├── GraphicsUtils.cs │ ├── GraphicsUtils.cs.meta │ ├── LightManager.cs │ ├── LightManager.cs.meta │ ├── MaterialManager.cs │ ├── MaterialManager.cs.meta │ ├── OldSRPAsset.cs │ ├── OldSRPAsset.cs.meta │ ├── SRPAsset.cs │ ├── SRPAsset.cs.meta │ ├── ShaderManager.cs │ ├── ShaderManager.cs.meta │ ├── ShaderTagManager.cs │ ├── ShaderTagManager.cs.meta │ ├── TestBehaviour.cs │ └── TestBehaviour.cs.meta ├── Shaders.meta ├── Shaders │ ├── .DS_Store │ ├── AlphaTestDepthNormal.shader │ ├── AlphaTestDepthNormal.shader.meta │ ├── CBRCompute.compute │ ├── CBRCompute.compute.meta │ ├── ComputeUtils.hlsl │ ├── ComputeUtils.hlsl.meta │ ├── DebugCubemapArray.shader │ ├── DebugCubemapArray.shader.meta │ ├── DitherTransparentDepthNormal.shader │ ├── DitherTransparentDepthNormal.shader.meta │ ├── DitherTransparentLitColor.shader │ ├── DitherTransparentLitColor.shader.meta │ ├── DitherTransparentStencil.shader │ ├── DitherTransparentStencil.shader.meta │ ├── GaussianBlur.shader │ ├── GaussianBlur.shader.meta │ ├── GeneralCompute.compute │ ├── GeneralCompute.compute.meta │ ├── OpaqueDepth.shader │ ├── OpaqueDepth.shader.meta │ ├── OpaqueDepthNormal.shader │ ├── OpaqueDepthNormal.shader.meta │ ├── OpaqueLitColor.shader │ ├── OpaqueLitColor.shader.meta │ ├── SRPInclude.hlsl │ ├── SRPInclude.hlsl.meta │ ├── StandardBlit.shader │ ├── StandardBlit.shader.meta │ ├── TBRCompute.compute │ ├── TBRCompute.compute.meta │ ├── Test.shader │ ├── Test.shader.meta │ ├── TransparentDepth.shader │ ├── TransparentDepth.shader.meta │ ├── TransparentLitColor.shader │ ├── TransparentLitColor.shader.meta │ ├── Unlit.shader │ └── Unlit.shader.meta ├── Textures.meta └── Textures │ ├── Alpha Texture 0.png │ ├── Alpha Texture 0.png.meta │ ├── Alpha Texture 1.png │ ├── Alpha Texture 1.png.meta │ ├── Alpha Texture 2.png │ ├── Alpha Texture 2.png.meta │ ├── Test Texture.png │ └── Test Texture.png.meta ├── LICENSE ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── BurstAotSettings_StandaloneOSX.json ├── BurstAotSettings_StandaloneWindows.json ├── BurstAotSettings_WebGL.json ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── XRSettings.asset ├── README.md ├── SRP.sln.DotSettings └── UserSettings └── EditorUserSettings.asset /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Never ignore Asset meta data 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # TextMesh Pro files 20 | [Aa]ssets/TextMesh*Pro/ 21 | 22 | # Autogenerated Jetbrains Rider plugin 23 | [Aa]ssets/Plugins/Editor/JetBrains* 24 | 25 | # Visual Studio cache directory 26 | .vs/ 27 | 28 | # Gradle cache directory 29 | .gradle/ 30 | 31 | # Autogenerated VS/MD/Consulo solution and project files 32 | ExportedObj/ 33 | .consulo/ 34 | *.csproj 35 | *.unityproj 36 | *.sln 37 | *.suo 38 | *.tmp 39 | *.user 40 | *.userprefs 41 | *.pidb 42 | *.booproj 43 | *.svd 44 | *.pdb 45 | *.mdb 46 | *.opendb 47 | *.VC.db 48 | 49 | # Unity3D generated meta files 50 | *.pidb.meta 51 | *.pdb.meta 52 | *.mdb.meta 53 | 54 | # Unity3D generated file on crash reports 55 | sysinfo.txt 56 | 57 | # Builds 58 | *.apk 59 | *.unitypackage 60 | 61 | # Crashlytics generated file 62 | crashlytics-build.properties 63 | 64 | # Jetbrains 65 | .idea 66 | 67 | # macOS File 68 | *.DS_Store 69 | *.DS_STORE 70 | *.ds_store 71 | 72 | Assets/Shaders/.vscode/settings.json 73 | -------------------------------------------------------------------------------- /Assembly-CSharp.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | CSharp73 -------------------------------------------------------------------------------- /Assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuardHei/SRP/57abd23054c2414a0d43d17472144866ee2da09e/Assets/.DS_Store -------------------------------------------------------------------------------- /Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6aab5d3437b3449585f3c31f734bc743 3 | timeCreated: 1562485702 -------------------------------------------------------------------------------- /Assets/Editor/ToolUtilities.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Unity.Mathematics; 3 | using UnityEditor; 4 | using UnityEngine; 5 | using Debug = UnityEngine.Debug; 6 | 7 | public class ToolUtilities { 8 | 9 | [MenuItem("Tools/Processor Info")] 10 | public static void ProcessorInfo() { 11 | Debug.Log("Processor Count : " + SystemInfo.processorCount); 12 | Debug.Log("Processor Type : " + SystemInfo.processorType); 13 | Debug.Log("Processor Frequency : " + SystemInfo.processorFrequency + " MHz"); 14 | } 15 | 16 | [MenuItem("Tools/Supported Render Texture Formats")] 17 | public static void SupportedRenderTextureFormats() { 18 | foreach (var format in Enum.GetValues(typeof(RenderTextureFormat))) CheckRenderTextureFormatSupport((RenderTextureFormat) format); 19 | Debug.Log("Cubemap Array Texture is " + (SystemInfo.supportsCubemapArrayTextures ? "supported" : "not supported")); 20 | Debug.Log("Async GPU Readback is " + (SystemInfo.supportsAsyncGPUReadback ? "supported" : "not supported")); 21 | Debug.Log("Async Compute is " + (SystemInfo.supportsAsyncCompute ? "supported" : "not supported")); 22 | } 23 | 24 | public static void CheckRenderTextureFormatSupport(RenderTextureFormat format) { 25 | Debug.Log(format + " is " + (SystemInfo.SupportsRenderTextureFormat(format) ? "supported" : "not supported")); 26 | } 27 | 28 | [MenuItem("Tools/Check ZBuffer State")] 29 | public static void CheckZBufferState() => Debug.Log("Reversed ZBuffer is " + (SystemInfo.usesReversedZBuffer ? "on" : "off")); 30 | 31 | public static void Compute3DGaussianKernelWeightsFake() { 32 | float sig = .15f; 33 | float3 origin = new float3(0, 0, 0); 34 | float3[] offsets = { 35 | new float3(1, 1, 1), new float3(1, -1, 1), new float3(-1, -1, 1), new float3(-1, 1, 1), 36 | new float3(1, 1, -1), new float3(1, -1, -1), new float3(-1, -1, -1), new float3(-1, 1, -1), 37 | new float3(1, 1, 0), new float3(1, -1, 0), new float3(-1, -1, 0), new float3(-1, 1, 0), 38 | new float3(1, 0, 1), new float3(-1, 0, 1), new float3(1, 0, -1), new float3(-1, 0, -1), 39 | new float3(0, 1, 1), new float3(0, -1, 1), new float3(0, -1, -1), new float3(0, 1, -1) 40 | }; 41 | 42 | float[] weights = new float[offsets.Length]; 43 | float total = 0; 44 | for (int i = 0; i < offsets.Length; i++) { 45 | float g = Compute3DGaussianKernel(sig, offsets[i]); 46 | weights[i] = g; 47 | total += g; 48 | } 49 | 50 | string display = ""; 51 | 52 | for (int i = 0; i < offsets.Length; i++) { 53 | weights[i] /= total; 54 | display += weights[i] + ", "; 55 | if ((i + 1) % 4 == 0) display += "\n"; 56 | } 57 | 58 | Debug.Log(display); 59 | } 60 | 61 | [MenuItem("Tools/Compute 3D Gaussian Kernel Weight")] 62 | public static void Compute3DGaussianKernelWeights() { 63 | float sig = .15f; 64 | float3 origin = new float3(0, 0, 0); 65 | float3[] offsets = { 66 | new float3(1, 0, 0), new float3(-1, 0, 0), new float3(0, 0, 1), new float3(0, 0, -1), new float3(1, 0, 1), new float3(1, 0, -1), new float3(-1, 0, 1), new float3(-1, 0, -1), 67 | new float3(0, 1, 0), new float3(1, 1, 0), new float3(-1, 1, 0), new float3(0, 1, 1), new float3(0, 1, -1), new float3(1, 1, 1), new float3(1, 1, -1), new float3(-1, 1, 1), new float3(-1, 1, -1), 68 | new float3(0, -1, 0), new float3(1, -1, 0), new float3(-1, -1, 0), new float3(0, -1, 1), new float3(0, -1, -1), new float3(1, -1, 1), new float3(1, -1, -1), new float3(-1, -1, 1), new float3(-1, -1, -1) 69 | }; 70 | 71 | float[] weights = new float[offsets.Length]; 72 | float total = 0; 73 | for (int i = 0; i < offsets.Length; i++) { 74 | float g = Compute3DGaussianKernel(sig, offsets[i]); 75 | weights[i] = g; 76 | total += g; 77 | } 78 | 79 | string display = ""; 80 | float sum = 0; 81 | 82 | for (int i = 0; i < offsets.Length; i++) { 83 | weights[i] /= total; 84 | display += weights[i] + ", "; 85 | sum += weights[i]; 86 | if ((i + 1) % 9 == 0) display += "\n"; 87 | } 88 | 89 | Debug.Log(display); 90 | Debug.Log(sum); 91 | } 92 | 93 | public static float Compute3DGaussianKernel(float sig, float3 pos) { 94 | float e = 2.71828182845904523536028747135266249775724709369995f; 95 | float result = 1f / (Mathf.Pow(2f * Mathf.PI, 1.5f) * sig * sig * sig); 96 | result *= Mathf.Pow(e, -(pos.x * pos.x + pos.y * pos.y + pos.z * pos.z) / (2f * sig * sig)); 97 | return result; 98 | } 99 | } -------------------------------------------------------------------------------- /Assets/Editor/ToolUtilities.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67b492485b704bf8ab09237234f975f2 3 | timeCreated: 1562485732 -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4cfc4b4729e5941f38584ef2558d8d33 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Gaussian Blur.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Gaussian Blur 11 | m_Shader: {fileID: 4800000, guid: 4ffb2963dfff241dfa71cda2b424a9b3, type: 3} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Materials/Gaussian Blur.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91224c5cbba514b418a1d6cbae56ea58 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/SRP Unlit.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: SRP Unlit 11 | m_Shader: {fileID: 4800000, guid: 33af3c9594b374bad89d5c91b4c3315a, type: 3} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 1 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Materials/SRP Unlit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7366360b4e844242aabbbf5cf7b74f5 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Standard Opaque.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_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Standard Opaque 11 | m_Shader: {fileID: 4800000, guid: 7e975e5da0e504de4bae5150cc50bf78, type: 3} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 1 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 1, b: 1, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Materials/Standard Opaque.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e916ea6f792174bb0b56adfd4d3592a3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Test.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Test 11 | m_Shader: {fileID: 4800000, guid: 6d5c8889edb074179920871963236df0, type: 3} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _Face: 0 64 | - _GlossMapScale: 1 65 | - _Glossiness: 0.5 66 | - _GlossyReflections: 1 67 | - _Index: 0 68 | - _Metallic: 0 69 | - _Mode: 0 70 | - _OcclusionStrength: 1 71 | - _Parallax: 0.02 72 | - _SmoothnessTextureChannel: 0 73 | - _SpecularHighlights: 1 74 | - _SrcBlend: 1 75 | - _TestInt: 0 76 | - _UVSec: 0 77 | - _ZWrite: 1 78 | m_Colors: 79 | - _Color: {r: 1, g: 1, b: 1, a: 1} 80 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 81 | -------------------------------------------------------------------------------- /Assets/Materials/Test.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6bcc079d8de804e0ebe3c92a0944d219 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37f40024dffcb470fa57bf20a671253d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Plugins/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ad23083079ce24d8fb8aa941494b661e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd08af8cc9201408eab3185ee957c522 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Profiles.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a95b6f8fc5a64801b327ee9de45c71a 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Profiles/SRPAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 0} 13 | m_Name: SRPAsset 14 | m_EditorClassIdentifier: Assembly-CSharp::SRPAsset 15 | params: 16 | enableDynamicBatching: 1 17 | enableInstancing: 1 18 | enableSRPBatching: 1 19 | enableDynamicScaling: 0 20 | enableRenderScaling: 0 21 | renderScale: 1 22 | clusterGridX: 16 23 | clusterGridY: 9 24 | clusterGridZ: 24 25 | alphaTestDepthCutoff: 0.001 26 | clusterCullingComputeShader: {fileID: 0} 27 | generalComputeShader: {fileID: 0} 28 | directionalLightParams: 29 | enabled: 1 30 | maxPerFrame: 2 31 | shadowOn: 1 32 | shadowResolution: 1024 33 | shadowCascades: 4 34 | shadowCascadeSplits: {x: 0.067, y: 0.2, z: 0.467} 35 | shadowDistance: 100 36 | maxShadowCount: 1 37 | pointLightParams: 38 | enabled: 1 39 | maxPerFrame: 200 40 | shadowOn: 1 41 | softShadow: 1 42 | shadowResolution: 1024 43 | maxShadowCount: 10 44 | spotLightParams: 45 | enabled: 1 46 | maxPerFrame: 50 47 | shadowOn: 1 48 | softShadow: 1 49 | shadowResolution: 1024 50 | maxShadowCount: 10 51 | ditherTransparentParams: 52 | blurOn: 1 53 | downSamples: 2 54 | iteration: 1 55 | blurRadius: 0 56 | blurMaterial: {fileID: 0} 57 | testMaterialOn: 0 58 | testMaterial: {fileID: 0} 59 | depthBoundOn: 0 60 | gizmosOn: 1 61 | testInt: 0 62 | -------------------------------------------------------------------------------- /Assets/Profiles/SRPAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66c01ba17d16a40229d89d58bfb7bb3c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ca8063741e854a0b97c5d081260c98b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/Empty.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 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_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_UseShadowmask: 1 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | debug: 122 | m_Flags: 0 123 | m_NavMeshData: {fileID: 0} 124 | --- !u!1 &452438909 125 | GameObject: 126 | m_ObjectHideFlags: 0 127 | m_CorrespondingSourceObject: {fileID: 0} 128 | m_PrefabInstance: {fileID: 0} 129 | m_PrefabAsset: {fileID: 0} 130 | serializedVersion: 6 131 | m_Component: 132 | - component: {fileID: 452438913} 133 | - component: {fileID: 452438912} 134 | - component: {fileID: 452438911} 135 | m_Layer: 0 136 | m_Name: Cube 137 | m_TagString: Untagged 138 | m_Icon: {fileID: 0} 139 | m_NavMeshLayer: 0 140 | m_StaticEditorFlags: 0 141 | m_IsActive: 1 142 | --- !u!23 &452438911 143 | MeshRenderer: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 452438909} 149 | m_Enabled: 1 150 | m_CastShadows: 1 151 | m_ReceiveShadows: 1 152 | m_DynamicOccludee: 1 153 | m_MotionVectors: 1 154 | m_LightProbeUsage: 1 155 | m_ReflectionProbeUsage: 1 156 | m_RayTracingMode: 2 157 | m_RenderingLayerMask: 1 158 | m_RendererPriority: 0 159 | m_Materials: 160 | - {fileID: 2100000, guid: e916ea6f792174bb0b56adfd4d3592a3, type: 2} 161 | m_StaticBatchInfo: 162 | firstSubMesh: 0 163 | subMeshCount: 0 164 | m_StaticBatchRoot: {fileID: 0} 165 | m_ProbeAnchor: {fileID: 0} 166 | m_LightProbeVolumeOverride: {fileID: 0} 167 | m_ScaleInLightmap: 1 168 | m_ReceiveGI: 1 169 | m_PreserveUVs: 0 170 | m_IgnoreNormalsForChartDetection: 0 171 | m_ImportantGI: 0 172 | m_StitchLightmapSeams: 1 173 | m_SelectedEditorRenderState: 3 174 | m_MinimumChartSize: 4 175 | m_AutoUVMaxDistance: 0.5 176 | m_AutoUVMaxAngle: 89 177 | m_LightmapParameters: {fileID: 0} 178 | m_SortingLayerID: 0 179 | m_SortingLayer: 0 180 | m_SortingOrder: 0 181 | --- !u!33 &452438912 182 | MeshFilter: 183 | m_ObjectHideFlags: 0 184 | m_CorrespondingSourceObject: {fileID: 0} 185 | m_PrefabInstance: {fileID: 0} 186 | m_PrefabAsset: {fileID: 0} 187 | m_GameObject: {fileID: 452438909} 188 | m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} 189 | --- !u!4 &452438913 190 | Transform: 191 | m_ObjectHideFlags: 0 192 | m_CorrespondingSourceObject: {fileID: 0} 193 | m_PrefabInstance: {fileID: 0} 194 | m_PrefabAsset: {fileID: 0} 195 | m_GameObject: {fileID: 452438909} 196 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 197 | m_LocalPosition: {x: 0, y: 0, z: 0} 198 | m_LocalScale: {x: 1, y: 1, z: 1} 199 | m_Children: [] 200 | m_Father: {fileID: 0} 201 | m_RootOrder: 2 202 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 203 | --- !u!1 &1076415129 204 | GameObject: 205 | m_ObjectHideFlags: 0 206 | m_CorrespondingSourceObject: {fileID: 0} 207 | m_PrefabInstance: {fileID: 0} 208 | m_PrefabAsset: {fileID: 0} 209 | serializedVersion: 6 210 | m_Component: 211 | - component: {fileID: 1076415131} 212 | - component: {fileID: 1076415130} 213 | m_Layer: 0 214 | m_Name: Directional Light 215 | m_TagString: Untagged 216 | m_Icon: {fileID: 0} 217 | m_NavMeshLayer: 0 218 | m_StaticEditorFlags: 0 219 | m_IsActive: 1 220 | --- !u!108 &1076415130 221 | Light: 222 | m_ObjectHideFlags: 0 223 | m_CorrespondingSourceObject: {fileID: 0} 224 | m_PrefabInstance: {fileID: 0} 225 | m_PrefabAsset: {fileID: 0} 226 | m_GameObject: {fileID: 1076415129} 227 | m_Enabled: 1 228 | serializedVersion: 10 229 | m_Type: 1 230 | m_Shape: 0 231 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 232 | m_Intensity: 1 233 | m_Range: 10 234 | m_SpotAngle: 30 235 | m_InnerSpotAngle: 21.80208 236 | m_CookieSize: 10 237 | m_Shadows: 238 | m_Type: 2 239 | m_Resolution: -1 240 | m_CustomResolution: -1 241 | m_Strength: 1 242 | m_Bias: 0.05 243 | m_NormalBias: 0.4 244 | m_NearPlane: 0.2 245 | m_CullingMatrixOverride: 246 | e00: 1 247 | e01: 0 248 | e02: 0 249 | e03: 0 250 | e10: 0 251 | e11: 1 252 | e12: 0 253 | e13: 0 254 | e20: 0 255 | e21: 0 256 | e22: 1 257 | e23: 0 258 | e30: 0 259 | e31: 0 260 | e32: 0 261 | e33: 1 262 | m_UseCullingMatrixOverride: 0 263 | m_Cookie: {fileID: 0} 264 | m_DrawHalo: 0 265 | m_Flare: {fileID: 0} 266 | m_RenderMode: 0 267 | m_CullingMask: 268 | serializedVersion: 2 269 | m_Bits: 4294967295 270 | m_RenderingLayerMask: 1 271 | m_Lightmapping: 4 272 | m_LightShadowCasterMode: 0 273 | m_AreaSize: {x: 1, y: 1} 274 | m_BounceIntensity: 1 275 | m_ColorTemperature: 6570 276 | m_UseColorTemperature: 0 277 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 278 | m_UseBoundingSphereOverride: 0 279 | m_ShadowRadius: 0 280 | m_ShadowAngle: 0 281 | --- !u!4 &1076415131 282 | Transform: 283 | m_ObjectHideFlags: 0 284 | m_CorrespondingSourceObject: {fileID: 0} 285 | m_PrefabInstance: {fileID: 0} 286 | m_PrefabAsset: {fileID: 0} 287 | m_GameObject: {fileID: 1076415129} 288 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 289 | m_LocalPosition: {x: 0, y: 3, z: 0} 290 | m_LocalScale: {x: 1, y: 1, z: 1} 291 | m_Children: [] 292 | m_Father: {fileID: 0} 293 | m_RootOrder: 1 294 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 295 | --- !u!1 &2095866292 296 | GameObject: 297 | m_ObjectHideFlags: 0 298 | m_CorrespondingSourceObject: {fileID: 0} 299 | m_PrefabInstance: {fileID: 0} 300 | m_PrefabAsset: {fileID: 0} 301 | serializedVersion: 6 302 | m_Component: 303 | - component: {fileID: 2095866295} 304 | - component: {fileID: 2095866294} 305 | - component: {fileID: 2095866293} 306 | m_Layer: 0 307 | m_Name: Main Camera 308 | m_TagString: MainCamera 309 | m_Icon: {fileID: 0} 310 | m_NavMeshLayer: 0 311 | m_StaticEditorFlags: 0 312 | m_IsActive: 1 313 | --- !u!81 &2095866293 314 | AudioListener: 315 | m_ObjectHideFlags: 0 316 | m_CorrespondingSourceObject: {fileID: 0} 317 | m_PrefabInstance: {fileID: 0} 318 | m_PrefabAsset: {fileID: 0} 319 | m_GameObject: {fileID: 2095866292} 320 | m_Enabled: 1 321 | --- !u!20 &2095866294 322 | Camera: 323 | m_ObjectHideFlags: 0 324 | m_CorrespondingSourceObject: {fileID: 0} 325 | m_PrefabInstance: {fileID: 0} 326 | m_PrefabAsset: {fileID: 0} 327 | m_GameObject: {fileID: 2095866292} 328 | m_Enabled: 1 329 | serializedVersion: 2 330 | m_ClearFlags: 1 331 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 332 | m_projectionMatrixMode: 1 333 | m_GateFitMode: 2 334 | m_FOVAxisMode: 0 335 | m_SensorSize: {x: 36, y: 24} 336 | m_LensShift: {x: 0, y: 0} 337 | m_FocalLength: 50 338 | m_NormalizedViewPortRect: 339 | serializedVersion: 2 340 | x: 0 341 | y: 0 342 | width: 1 343 | height: 1 344 | near clip plane: 0.3 345 | far clip plane: 1000 346 | field of view: 60 347 | orthographic: 0 348 | orthographic size: 5 349 | m_Depth: -1 350 | m_CullingMask: 351 | serializedVersion: 2 352 | m_Bits: 4294967295 353 | m_RenderingPath: -1 354 | m_TargetTexture: {fileID: 0} 355 | m_TargetDisplay: 0 356 | m_TargetEye: 3 357 | m_HDR: 1 358 | m_AllowMSAA: 1 359 | m_AllowDynamicResolution: 0 360 | m_ForceIntoRT: 1 361 | m_OcclusionCulling: 1 362 | m_StereoConvergence: 10 363 | m_StereoSeparation: 0.022 364 | --- !u!4 &2095866295 365 | Transform: 366 | m_ObjectHideFlags: 0 367 | m_CorrespondingSourceObject: {fileID: 0} 368 | m_PrefabInstance: {fileID: 0} 369 | m_PrefabAsset: {fileID: 0} 370 | m_GameObject: {fileID: 2095866292} 371 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 372 | m_LocalPosition: {x: 0, y: 1, z: -10} 373 | m_LocalScale: {x: 1, y: 1, z: 1} 374 | m_Children: [] 375 | m_Father: {fileID: 0} 376 | m_RootOrder: 0 377 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 378 | -------------------------------------------------------------------------------- /Assets/Scenes/Empty.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 34f267404395b4578b09a237a4103105 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/PointLightTestScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1dfb36b833a004a8e80bffdae1cd68c9 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a584a7afe549943bbbc8248c78b4e06b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/CameraWanderer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class CameraWanderer : MonoBehaviour { 4 | 5 | public float walkSpeed = 1f; 6 | public float runSpeed = 2f; 7 | public float sensitivity = 1f; 8 | [HideInInspector] 9 | public Vector3 lastPos; 10 | 11 | private void Awake() => lastPos = transform.position; 12 | 13 | private void Update() { 14 | var speed = Input.GetKey(KeyCode.LeftShift) ? runSpeed : walkSpeed; 15 | if (Input.GetKey(KeyCode.W)) transform.Translate(Vector3.forward * speed * Time.deltaTime); 16 | if (Input.GetKey(KeyCode.S)) transform.Translate(Vector3.back * speed * Time.deltaTime); 17 | if (Input.GetKey(KeyCode.A)) transform.Translate(Vector3.left * speed * Time.deltaTime); 18 | if (Input.GetKey(KeyCode.D)) transform.Translate(Vector3.right * speed * Time.deltaTime); 19 | 20 | if (Input.GetKey(KeyCode.Mouse0)) { 21 | var dPos = Input.mousePosition - lastPos; 22 | transform.Rotate(new Vector3(-dPos.y * sensitivity, dPos.x * sensitivity, 0)); 23 | var x = transform.rotation.eulerAngles.x; 24 | var y = transform.rotation.eulerAngles.y; 25 | transform.rotation = Quaternion.Euler(x, y, 0); 26 | } 27 | 28 | lastPos = Input.mousePosition; 29 | } 30 | } -------------------------------------------------------------------------------- /Assets/Scripts/CameraWanderer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ceb8899c9d04846e68f2e95e34590b4a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Runtime.CompilerServices; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | using UnityEngine.Rendering; 6 | 7 | public static class Extensions { 8 | 9 | public static void Resize(ref ComputeBuffer buffer, int newCapacity) { 10 | if (newCapacity <= buffer.count) return; 11 | newCapacity = Mathf.Max(newCapacity, (int) (buffer.count * 1.2f)); 12 | var stride = buffer.stride; 13 | buffer.Dispose(); 14 | buffer = new ComputeBuffer(newCapacity, stride); 15 | } 16 | 17 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 18 | public static Vector4 GetDirectionFromLocalTransform(this Matrix4x4 transform) { 19 | var direction = transform.GetColumn(2); 20 | direction.x = -direction.x; 21 | direction.y = -direction.y; 22 | direction.z = -direction.z; 23 | return direction; 24 | } 25 | 26 | public static Vector3 GetPositionFromLocalTransform(this Matrix4x4 transform) { 27 | var position = transform.GetColumn(3); 28 | return new Vector3(position.x, position.y, position.z); 29 | } 30 | 31 | public static float3 ToFloat3(this Color color) => new float3(color.r, color.g, color.b); 32 | 33 | public static float4 ToFloat4(this Color color) => new float4(color.a, color.r, color.g, color.b); 34 | 35 | public static float3 ToFloat3(this Vector4 v) => new float3(v.x, v.y, v.z); 36 | 37 | public static bool Exists(this Light light) => light != null && light.isActiveAndEnabled; 38 | } -------------------------------------------------------------------------------- /Assets/Scripts/Extensions.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d5514c3690ab452c86e222394810a510 3 | timeCreated: 1564663669 -------------------------------------------------------------------------------- /Assets/Scripts/FramerateCounter.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class FramerateCounter : MonoBehaviour { 4 | 5 | public int frameCount; 6 | public float dt; 7 | public float fps; 8 | public float updateRate; 9 | 10 | private void OnGUI() { 11 | GUI.Label(new Rect(50, 50, 200, 100), fps.ToString()); 12 | } 13 | 14 | private void Update() { 15 | frameCount++; 16 | dt += Time.deltaTime; 17 | var rate = 1f / updateRate; 18 | if (dt > rate) { 19 | fps = frameCount / dt; 20 | frameCount = 0; 21 | dt -= rate; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Assets/Scripts/FramerateCounter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cecffa2436b3e47fba53bebed51c5295 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/GraphicsUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Rendering; 5 | 6 | public static class GraphicsUtils { 7 | 8 | public static Mesh FullScreenTriangle { 9 | get { 10 | if (fullScreenTriangle != null) return fullScreenTriangle; 11 | 12 | fullScreenTriangle = new Mesh { name = "Full Screen Triangle" }; 13 | fullScreenTriangle.SetVertices(new List { new Vector3(-1, -1, 0), new Vector3(-1, 3, 0), new Vector3(3, -1, 0) }); 14 | fullScreenTriangle.SetIndices(new [] { 0, 1, 2 }, MeshTopology.Triangles, 0, false); 15 | fullScreenTriangle.UploadMeshData(false); 16 | 17 | return fullScreenTriangle; 18 | } 19 | } 20 | 21 | public static Material CopyMaterial { 22 | get { 23 | if (copyMaterial != null) return copyMaterial; 24 | 25 | copyMaterial = new Material(Shader.Find("SRP/StandardBlit")) { name = "Copy", hideFlags = HideFlags.HideAndDontSave }; 26 | 27 | return copyMaterial; 28 | } 29 | } 30 | 31 | private static Mesh fullScreenTriangle; 32 | private static Material copyMaterial; 33 | 34 | public static void BlitWithDepth(this CommandBuffer buffer, RenderTargetIdentifier source, RenderTargetIdentifier destination, RenderTargetIdentifier depth) => buffer.BlitWithDepth(source, destination, depth, CopyMaterial); 35 | 36 | public static void BlitWithDepth(this CommandBuffer buffer, RenderTargetIdentifier source, RenderTargetIdentifier destination, RenderTargetIdentifier depth, Material material, int pass = 0) { 37 | buffer.SetGlobalTexture(ShaderManager.MAIN_TEXTURE, source); 38 | buffer.SetRenderTarget(destination, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store, depth, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store); 39 | buffer.DrawMesh(FullScreenTriangle, Matrix4x4.identity, material, 0, pass); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Assets/Scripts/GraphicsUtils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8511da1e8a64a45dab0a70d4a8383324 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/LightManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Text; 4 | using UnityEngine; 5 | using UnityEngine.Experimental.Rendering; 6 | using UnityEngine.SocialPlatforms; 7 | using UnityEngine.UI; 8 | 9 | [ExecuteInEditMode] 10 | public class LightManager : MonoBehaviour { 11 | 12 | public Color color; 13 | public float intensity; 14 | public float range; 15 | public bool draw; 16 | public Light[] lights; 17 | 18 | private void Awake() { 19 | lights = GetComponentsInChildren(); 20 | } 21 | 22 | private void OnTransformChildrenChanged() { 23 | lights = GetComponentsInChildren(); 24 | } 25 | 26 | private void OnValidate() { 27 | foreach (var light in lights) { 28 | light.color = color; 29 | light.intensity = intensity; 30 | light.range = range; 31 | } 32 | } 33 | 34 | private void OnDrawGizmosSelected() { 35 | if (lights == null && !draw) return; 36 | Gizmos.color = color; 37 | foreach (var light in lights) { 38 | Gizmos.DrawWireSphere(light.transform.position, light.range); 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/Scripts/LightManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 617bd3187ed0495eb599d1ca2a96f202 3 | timeCreated: 1559478238 -------------------------------------------------------------------------------- /Assets/Scripts/MaterialManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public static class MaterialManager { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Assets/Scripts/MaterialManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b60b27b795714740ab0f690b19699bc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/OldSRPAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3e2b0c7a63954483899575263c80a34 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/SRPAsset.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using UnityEngine.Experimental.Rendering; 7 | using UnityEngine.Rendering; 8 | using Object = System.Object; 9 | 10 | [CreateAssetMenu(menuName = "Rendering/SRPAsset")] 11 | public sealed class SRPAsset : RenderPipelineAsset { 12 | 13 | public SRPipelineParams @params; 14 | 15 | protected override RenderPipeline CreatePipeline() => new SRPipeline(@params); 16 | } 17 | 18 | [Serializable] 19 | public class SRPipelineParams { 20 | public bool enableDynamicBatching = true; 21 | public bool enableInstancing = true; 22 | public bool enableSRPBatching = true; 23 | //todo implement render scaling 24 | public bool enableDynamicScaling; 25 | public bool enableRenderScaling; 26 | public float renderScale = 1f; 27 | public int clusterGridX = 16; 28 | public int clusterGridY = 9; 29 | public int clusterGridZ = 24; 30 | public float alphaTestDepthCutoff = .001f; 31 | public ComputeShader clusterCullingComputeShader; 32 | public ComputeShader generalComputeShader; 33 | public DirectionalLightParams directionalLightParams; 34 | public PointLightParams pointLightParams; 35 | public SpotLightParams spotLightParams; 36 | public DitherTransparentParams ditherTransparentParams; 37 | public bool testMaterialOn; 38 | public Material testMaterial; 39 | public bool depthBoundOn; 40 | public bool gizmosOn; 41 | public int testInt; 42 | } 43 | 44 | [Serializable] 45 | public class DirectionalLightParams { 46 | public bool enabled = true; 47 | public int maxPerFrame = 2; 48 | public bool shadowOn = true; 49 | public int shadowResolution = 1024; 50 | public int shadowCascades = 4; 51 | public Vector3 shadowCascadeSplits = new Vector3(.067f, .2f, .467f); 52 | public float shadowDistance = 100; 53 | public int maxShadowCount = 1; 54 | 55 | } 56 | 57 | [Serializable] 58 | public class PointLightParams { 59 | public bool enabled = true; 60 | public int maxPerFrame = 200; 61 | public int maxPerCluster = 20; 62 | public bool shadowOn = true; 63 | public bool softShadow = true; 64 | public int shadowResolution = 1024; 65 | public int maxShadowCount = 10; 66 | } 67 | 68 | [Serializable] 69 | public class SpotLightParams { 70 | public bool enabled = true; 71 | public int maxPerFrame = 100; 72 | public int maxPerCluster = 20; 73 | public bool shadowOn = true; 74 | public bool softShadow = true; 75 | public int shadowResolution = 1024; 76 | public int maxShadowCount = 10; 77 | } 78 | 79 | [Serializable] 80 | public class DitherTransparentParams { 81 | public bool blurOn = true; 82 | public int downSamples = 2; 83 | public int iteration = 1; 84 | public float blurRadius; 85 | public Material blurMaterial; 86 | } 87 | 88 | [Serializable] 89 | public struct Cone { 90 | public float4 vertex; // rgb - vertex, a - angle 91 | public float4 direction; // rgb - direction, a - height 92 | public float radius; 93 | 94 | public Cone(float3 vertex, float angle, float height, float3 direction) { 95 | this.vertex = new float4(vertex, angle); 96 | this.direction = new float4(direction, height); 97 | radius = Mathf.Tan(angle) * height; 98 | } 99 | } 100 | 101 | [Serializable] 102 | public struct DirectionalLight { 103 | public float4 direction; 104 | public float4 color; // rgb - final color, a - shadow strength 105 | public uint shadowIndex; 106 | } 107 | 108 | [Serializable] 109 | public struct PointLight { 110 | public float4 sphere; 111 | public float4 color; // rgb - final color, a - shadow strength 112 | public uint shadowIndex; 113 | } 114 | 115 | [Serializable] 116 | public struct SpotLight { 117 | public Cone cone; 118 | public float4 color; // rgb - final color, a - shadow strength 119 | public uint shadowIndex; 120 | } 121 | 122 | public sealed unsafe class SRPipeline : RenderPipeline { 123 | 124 | public static SRPipeline current { 125 | get; 126 | private set; 127 | } 128 | 129 | public static bool usesReversedZBuffer { 130 | get; 131 | private set; 132 | } 133 | 134 | public static readonly RenderTargetIdentifier ColorBufferId = new RenderTargetIdentifier(ShaderManager.COLOR_BUFFER); 135 | public static readonly RenderTargetIdentifier TemporaryTexture1Id = new RenderTargetIdentifier(ShaderManager.TEMPORARY_TEXTURE_1); 136 | public static readonly RenderTargetIdentifier TemporaryTexture2Id = new RenderTargetIdentifier(ShaderManager.TEMPORARY_TEXTURE_2); 137 | public static readonly RenderTargetIdentifier BlitTemporaryTexture1Id = new RenderTargetIdentifier(ShaderManager.BLIT_TEMPORARY_TEXTURE_1); 138 | public static readonly RenderTargetIdentifier DepthId = new RenderTargetIdentifier(ShaderManager.DEPTH_TEXTURE); 139 | public static readonly RenderTargetIdentifier OpaqueDepthId = new RenderTargetIdentifier(ShaderManager.OPAQUE_DEPTH_TEXTURE); 140 | public static readonly RenderTargetIdentifier OpaqueNormalId = new RenderTargetIdentifier(ShaderManager.OPAQUE_NORMAL_TEXTURE); 141 | public static readonly RenderTargetIdentifier SunlightShadowmapId = new RenderTargetIdentifier(ShaderManager.SUNLIGHT_SHADOWMAP); 142 | public static readonly RenderTargetIdentifier SunlightShadowmapArrayId = new RenderTargetIdentifier(ShaderManager.SUNLIGHT_SHADOWMAP_ARRAY); 143 | public static readonly RenderTargetIdentifier PointLightShadowmapId = new RenderTargetIdentifier(ShaderManager.POINT_LIGHT_SHADOWMAP); 144 | public static readonly RenderTargetIdentifier PointLightShadowmapArrayId = new RenderTargetIdentifier(ShaderManager.POINT_LIGHT_SHADOWMAP_ARRAY); 145 | public static readonly RenderTargetIdentifier SpotLightShadowmapArrayId = new RenderTargetIdentifier(ShaderManager.SPOT_LIGHT_SHADOWMAP_ARRAY); 146 | public static readonly RenderTargetIdentifier DepthBoundId = new RenderTargetIdentifier(ShaderManager.DEPTH_BOUND_TEXTURE); 147 | public static readonly RenderTargetIdentifier DepthMaskId = new RenderTargetIdentifier(ShaderManager.DEPTH_MASK_TEXTURE); 148 | public static readonly RenderTargetIdentifier DepthFrustumId = new RenderTargetIdentifier(ShaderManager.DEPTH_FRUSTUM_TEXTURE); 149 | public static readonly RenderTargetIdentifier CulledPointLightId = new RenderTargetIdentifier(ShaderManager.CULLED_POINT_LIGHT_TEXTURE); 150 | public static readonly RenderTargetIdentifier CulledSpotLightId = new RenderTargetIdentifier(ShaderManager.CULLED_SPOT_LIGHT_TEXTURE); 151 | 152 | public SRPipelineParams @params; 153 | 154 | private ScriptableRenderContext _context; 155 | private CommandBuffer _mainBuffer = new CommandBuffer { name = "Main Buffer" }; 156 | private CommandBuffer _computeBuffer = new CommandBuffer { name = "Compute Buffer" }; 157 | private Camera _camera; 158 | private DirectionalLight[] _dirLights; 159 | private PointLight[] _pointLights; 160 | private SpotLight[] _spotLights; 161 | private int[] _shadowDirLights; 162 | private int[] _shadowPointLights; 163 | private int[] _shadowSpotLights; 164 | private ComputeBuffer _dirLightBuffer; 165 | private ComputeBuffer _pointLightBuffer; 166 | private ComputeBuffer _spotLightBuffer; 167 | private ComputeBuffer _pointLightIndexBuffer; 168 | private ComputeBuffer _spotLightIndexBuffer; 169 | private ComputeBuffer _dirLightInverseVPBuffer; 170 | private ComputeBuffer _spotLightInverseVPBuffer; 171 | private int _pixelWidth; 172 | private int _pixelHeight; 173 | 174 | public SRPipeline(SRPipelineParams @params) { 175 | this.@params = @params; 176 | Init(); 177 | } 178 | 179 | private void Init() { 180 | current = this; 181 | 182 | GraphicsSettings.lightsUseLinearIntensity = true; 183 | usesReversedZBuffer = SystemInfo.usesReversedZBuffer; 184 | 185 | foreach (var camera in Camera.allCameras) camera.forceIntoRenderTexture = true; 186 | 187 | _dirLights = new DirectionalLight[@params.directionalLightParams.maxPerFrame]; 188 | _pointLights = new PointLight[@params.pointLightParams.maxPerFrame]; 189 | _spotLights = new SpotLight[@params.spotLightParams.maxPerFrame]; 190 | _shadowDirLights = new int[@params.directionalLightParams.maxShadowCount]; 191 | _shadowPointLights = new int[@params.pointLightParams.maxShadowCount]; 192 | _shadowSpotLights = new int[@params.spotLightParams.maxShadowCount]; 193 | 194 | GenerateComputeBuffers(); 195 | } 196 | 197 | protected override void Render(ScriptableRenderContext context, Camera[] cameras) { 198 | 199 | _context = context; 200 | GraphicsSettings.useScriptableRenderPipelineBatching = @params.enableSRPBatching; 201 | 202 | foreach (var camera in cameras) { 203 | _camera = camera; 204 | RenderCurrentCamera(); 205 | } 206 | } 207 | 208 | private void RenderCurrentCamera() { 209 | 210 | _pixelWidth = _camera.pixelWidth; 211 | _pixelHeight = _camera.pixelHeight; 212 | 213 | var clearFlags = _camera.clearFlags; 214 | 215 | _mainBuffer.ClearRenderTarget((clearFlags & CameraClearFlags.Depth) != 0, (clearFlags & CameraClearFlags.Color) != 0, _camera.backgroundColor); 216 | 217 | _context.SetupCameraProperties(_camera); 218 | 219 | var farClipPlane = _camera.farClipPlane; 220 | var nearClipPlane = _camera.nearClipPlane; 221 | var clipDistance = farClipPlane - nearClipPlane; 222 | 223 | var zBufferParams = new Vector4(clipDistance / nearClipPlane, 1, clipDistance / (farClipPlane * nearClipPlane), 1 / farClipPlane); 224 | 225 | _mainBuffer.SetGlobalFloat(ShaderManager.ALPHA_TEST_DEPTH_CUTOFF, @params.alphaTestDepthCutoff); 226 | _mainBuffer.SetGlobalVector(ShaderManager.Z_BUFFER_PARAMS, zBufferParams); 227 | 228 | ExecuteMainBuffer(); 229 | 230 | #if UNITY_EDITOR 231 | if (_camera.cameraType == CameraType.SceneView) ScriptableRenderContext.EmitWorldGeometryForSceneView(_camera); 232 | #endif 233 | 234 | // todo add gpu culling (cs based AABB/OBB tests) 235 | if (!_camera.TryGetCullingParameters(out var cullingParameters)) return; 236 | var cull = _context.Cull(ref cullingParameters); 237 | 238 | GenerateRTs(); 239 | 240 | var dirLightCount = 0u; 241 | var pointLightCount = 0u; 242 | var spotLightCount = 0u; 243 | var shadowDirLightCount = 0u; 244 | var shadowPointLightCount = 0u; 245 | var shadowSpotLightCount = 0u; 246 | 247 | var dirLightMax = @params.directionalLightParams.enabled ? @params.directionalLightParams.maxPerFrame : 0; 248 | var pointLightMax = @params.pointLightParams.enabled ? @params.pointLightParams.maxPerFrame : 0; 249 | var spotLightMax = @params.spotLightParams.enabled ? @params.spotLightParams.maxPerFrame : 0; 250 | var shadowDirLightMax = @params.directionalLightParams.enabled ? @params.directionalLightParams.maxShadowCount : 0; 251 | var shadowPointLightMax = @params.pointLightParams.enabled ? @params.pointLightParams.maxShadowCount : 0; 252 | var shadowSpotLightMax = @params.spotLightParams.enabled ? @params.spotLightParams.maxShadowCount : 0; 253 | 254 | if (_dirLights.Length < dirLightMax) _dirLights = new DirectionalLight[dirLightMax]; 255 | if (_pointLights.Length < pointLightMax) _pointLights = new PointLight[pointLightMax]; 256 | if (_spotLights.Length < spotLightMax) _spotLights = new SpotLight[spotLightMax]; 257 | if (_shadowDirLights.Length < shadowDirLightMax) _shadowDirLights = new int[shadowDirLightMax]; 258 | if (_shadowPointLights.Length < shadowPointLightMax) _shadowPointLights = new int[shadowPointLightMax]; 259 | if (_shadowSpotLights.Length < shadowSpotLightMax) _shadowSpotLights = new int[shadowSpotLightMax]; 260 | 261 | var visibleLights = cull.visibleLights; 262 | 263 | for (int i = 0; i < visibleLights.Length; i++) { 264 | var visibleLight = visibleLights[i]; 265 | var originalLight = visibleLight.light; 266 | switch (visibleLight.lightType) { 267 | case LightType.Directional: 268 | if (dirLightCount >= dirLightMax) continue; 269 | DirectionalLight dirLight = new DirectionalLight { 270 | direction = new float4(visibleLight.localToWorldMatrix.GetDirectionFromLocalTransform()), 271 | color = new float4(visibleLight.finalColor.ToFloat3(), originalLight.shadowStrength) 272 | }; 273 | 274 | if (originalLight.shadows != LightShadows.None && shadowDirLightCount < shadowDirLightMax) { 275 | _shadowDirLights[shadowDirLightCount] = i; 276 | shadowDirLightCount++; 277 | dirLight.shadowIndex = shadowDirLightCount; 278 | } else dirLight.shadowIndex = 0; 279 | 280 | _dirLights[dirLightCount] = dirLight; 281 | dirLightCount++; 282 | break; 283 | case LightType.Point: 284 | if (pointLightCount >= pointLightMax) continue; 285 | PointLight pointLight = new PointLight { 286 | sphere = new float4(originalLight.transform.position, originalLight.range), 287 | color = new float4(visibleLight.finalColor.ToFloat3(), originalLight.shadowStrength) 288 | }; 289 | 290 | if (originalLight.shadows != LightShadows.None && shadowPointLightCount < shadowPointLightMax) { 291 | _shadowPointLights[shadowPointLightCount] = i; 292 | shadowPointLightCount++; 293 | pointLight.shadowIndex = shadowPointLightCount; 294 | } else pointLight.shadowIndex = 0; 295 | 296 | _pointLights[pointLightCount] = pointLight; 297 | pointLightCount++; 298 | break; 299 | case LightType.Spot: 300 | if (spotLightCount >= spotLightMax) continue; 301 | SpotLight spotLight = new SpotLight { 302 | cone = new Cone(visibleLight.localToWorldMatrix.GetPositionFromLocalTransform(), Mathf.Deg2Rad * visibleLight.spotAngle * .5f, visibleLight.range, visibleLight.localToWorldMatrix.GetDirectionFromLocalTransform().ToFloat3()), 303 | color = new float4(visibleLight.finalColor.ToFloat3(), originalLight.shadowStrength) 304 | }; 305 | 306 | if (originalLight.shadows != LightShadows.None && shadowSpotLightCount < shadowSpotLightMax) { 307 | _shadowSpotLights[shadowSpotLightCount] = i; 308 | shadowSpotLightCount++; 309 | spotLight.shadowIndex = shadowSpotLightCount; 310 | } else spotLight.shadowIndex = 0; 311 | 312 | _spotLights[spotLightCount] = spotLight; 313 | spotLightCount++; 314 | break; 315 | } 316 | } 317 | 318 | // Cluster Cull 319 | var clusterCullFence = ClusterCull(); 320 | 321 | // Depth Prepass 322 | var opaqueSortSettings = new SortingSettings(_camera) { criteria = SortingCriteria.QuantizedFrontToBack | SortingCriteria.OptimizeStateChanges }; 323 | var depthDrawSettings = new DrawingSettings(ShaderTagManager.DEPTH, opaqueSortSettings) { 324 | enableDynamicBatching = @params.enableDynamicBatching, 325 | enableInstancing = @params.enableInstancing 326 | }; 327 | 328 | var filterSettings = FilteringSettings.defaultValue; 329 | filterSettings.layerMask = _camera.cullingMask; 330 | filterSettings.renderQueueRange = ShaderManager.OPAQUE_RENDER_QUEUE_RANGE; 331 | 332 | ResetRenderTarget(ColorBufferId, DepthId, false, true, 1, Color.black); 333 | 334 | ExecuteMainBuffer(); 335 | 336 | _context.DrawRenderers(cull, ref depthDrawSettings, ref filterSettings); 337 | 338 | // Stencil Prepass 339 | var stencilDrawSettings = new DrawingSettings(ShaderTagManager.STENCIL, opaqueSortSettings) { 340 | enableDynamicBatching = @params.enableDynamicBatching, 341 | enableInstancing = @params.enableInstancing 342 | }; 343 | 344 | filterSettings.renderQueueRange = RenderQueueRange.all; 345 | 346 | ResetRenderTarget(ColorBufferId, DepthId, false, false, 1, Color.black); 347 | 348 | ExecuteMainBuffer(); 349 | 350 | _context.DrawRenderers(cull, ref stencilDrawSettings, ref filterSettings); 351 | 352 | // Editor Pass 353 | #if UNITY_EDITOR 354 | if (@params.gizmosOn) _context.DrawGizmos(_camera, GizmoSubset.PostImageEffects); 355 | #endif 356 | 357 | ReleaseRTs(); 358 | 359 | ExecuteMainBuffer(); 360 | 361 | _context.Submit(); 362 | } 363 | 364 | private GraphicsFence ClusterCull() { 365 | _computeBuffer.SetExecutionFlags(CommandBufferExecutionFlags.AsyncCompute); 366 | var fence = _computeBuffer.CreateAsyncGraphicsFence(); 367 | ExecuteComputeBufferAsync(ComputeQueueType.Default); 368 | return fence; 369 | } 370 | 371 | private void DrawShadows() { 372 | 373 | } 374 | 375 | private void ExecuteMainBuffer() { 376 | _context.ExecuteCommandBuffer(_mainBuffer); 377 | _mainBuffer.Clear(); 378 | } 379 | 380 | private void ExecuteComputeBuffer() { 381 | _context.ExecuteCommandBuffer(_computeBuffer); 382 | _computeBuffer.Clear(); 383 | } 384 | 385 | private void ExecuteCommandBuffer(CommandBuffer cmd) { 386 | _context.ExecuteCommandBuffer(cmd); 387 | cmd.Clear(); 388 | } 389 | 390 | private void ExecuteMainBufferAsync(ComputeQueueType queueType) { 391 | _context.ExecuteCommandBufferAsync(_mainBuffer, queueType); 392 | _mainBuffer.Clear(); 393 | } 394 | 395 | private void ExecuteComputeBufferAsync(ComputeQueueType queueType) { 396 | _context.ExecuteCommandBufferAsync(_computeBuffer, queueType); 397 | _computeBuffer.Clear(); 398 | } 399 | 400 | private void ExecuteCommandBufferAsync(CommandBuffer cmd, ComputeQueueType queueType) { 401 | _context.ExecuteCommandBufferAsync(cmd, queueType); 402 | cmd.Clear(); 403 | } 404 | 405 | private void ResetRenderTarget(RenderTargetIdentifier colorBuffer, bool clearDepth, bool clearColor, float depth, Color color) { 406 | _mainBuffer.SetRenderTarget(colorBuffer); 407 | _mainBuffer.ClearRenderTarget(clearDepth, clearColor, color, depth); 408 | } 409 | 410 | private void ResetRenderTarget(RenderTargetIdentifier colorBuffer, RenderTargetIdentifier depthBuffer, bool clearDepth, bool clearColor, float depth, Color color) { 411 | _mainBuffer.SetRenderTarget(colorBuffer, depthBuffer); 412 | _mainBuffer.ClearRenderTarget(clearDepth, clearColor, color, depth); 413 | } 414 | 415 | private void ResetRenderTarget(RenderTargetIdentifier colorBuffer, CubemapFace cubemapFace, int depthSlice, bool clearDepth, bool clearColor, float depth, Color color) { 416 | _mainBuffer.SetRenderTarget(colorBuffer, 0, cubemapFace, depthSlice); 417 | _mainBuffer.ClearRenderTarget(clearDepth, clearColor, color, depth); 418 | } 419 | 420 | private void GenerateComputeBuffers() { 421 | _dirLightBuffer = new ComputeBuffer(@params.directionalLightParams.maxPerFrame, sizeof(DirectionalLight)); 422 | _pointLightBuffer = new ComputeBuffer(@params.pointLightParams.maxPerFrame, sizeof(PointLight)); 423 | _spotLightBuffer = new ComputeBuffer(@params.spotLightParams.maxPerFrame, sizeof(SpotLight)); 424 | 425 | _dirLightInverseVPBuffer = new ComputeBuffer(@params.directionalLightParams.maxShadowCount, sizeof(Matrix4x4)); 426 | _spotLightInverseVPBuffer = new ComputeBuffer(@params.spotLightParams.maxShadowCount, sizeof(Matrix4x4)); 427 | } 428 | 429 | private void DisposeComputeBuffers() { 430 | _dirLightBuffer.Dispose(); 431 | _pointLightBuffer.Dispose(); 432 | _spotLightBuffer.Dispose(); 433 | _dirLightInverseVPBuffer.Dispose(); 434 | _spotLightInverseVPBuffer.Dispose(); 435 | } 436 | 437 | private void GenerateRTs() { 438 | int width = _pixelWidth; 439 | int height = _pixelHeight; 440 | 441 | _mainBuffer.GetTemporaryRT(ShaderManager.COLOR_BUFFER, width, height, 0, FilterMode.Bilinear, RenderTextureFormat.DefaultHDR, RenderTextureReadWrite.Default); 442 | _mainBuffer.GetTemporaryRT(ShaderManager.DEPTH_TEXTURE, width, height, 32, FilterMode.Bilinear, RenderTextureFormat.Depth, RenderTextureReadWrite.Linear); 443 | _mainBuffer.GetTemporaryRT(ShaderManager.OPAQUE_NORMAL_TEXTURE, width, height, 0, FilterMode.Bilinear, GraphicsFormat.R16G16_SFloat); 444 | } 445 | 446 | private void ReleaseRTs() { 447 | _mainBuffer.ReleaseTemporaryRT(ShaderManager.COLOR_BUFFER); 448 | _mainBuffer.ReleaseTemporaryRT(ShaderManager.DEPTH_TEXTURE); 449 | } 450 | 451 | protected override void Dispose(bool disposing) { 452 | base.Dispose(disposing); 453 | if (!disposing) return; 454 | DisposeComputeBuffers(); 455 | } 456 | } 457 | -------------------------------------------------------------------------------- /Assets/Scripts/SRPAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f962a5c57cec41fabcec3442843e7e2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/ShaderManager.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | using UnityEngine; 3 | using UnityEngine.Rendering; 4 | 5 | public class ShaderManager { 6 | 7 | // Properties 8 | public static readonly int COLOR_BUFFER = Shader.PropertyToID("_ColorBuffer"); 9 | public static readonly int TEMPORARY_TEXTURE_1 = Shader.PropertyToID("_TemporaryTexture1"); 10 | public static readonly int TEMPORARY_TEXTURE_2 = Shader.PropertyToID("_TemporaryTexture2"); 11 | public static readonly int BLIT_TEMPORARY_TEXTURE_1 = Shader.PropertyToID("_BlitTemporaryTexture1"); 12 | public static readonly int MAIN_TEXTURE = Shader.PropertyToID("_MainTex"); 13 | public static readonly int DEPTH_TEXTURE = Shader.PropertyToID("_DepthTexture"); 14 | public static readonly int OPAQUE_DEPTH_TEXTURE = Shader.PropertyToID("_OpaqueDepthTexture"); 15 | public static readonly int OPAQUE_NORMAL_TEXTURE = Shader.PropertyToID("_OpaqueNormalTexture"); 16 | public static readonly int DEPTH_MASK_TEXTURE = Shader.PropertyToID("_DepthMaskTexture"); 17 | public static readonly int DEPTH_BOUND_TEXTURE = Shader.PropertyToID("_DepthBoundTexture"); 18 | public static readonly int DEPTH_FRUSTUM_TEXTURE = Shader.PropertyToID("_DepthFrustumTexture"); 19 | public static readonly int CULLED_POINT_LIGHT_TEXTURE = Shader.PropertyToID("_CulledPointLightTexture"); 20 | public static readonly int CULLED_SPOT_LIGHT_TEXTURE = Shader.PropertyToID("_CulledSpotLightTexture"); 21 | public static readonly int TILE_NUMBER = Shader.PropertyToID("_TileNumber"); 22 | public static readonly int CAMERA_FORWARD = Shader.PropertyToID("_CameraForward"); 23 | public static readonly int CAMERA_POSITION = Shader.PropertyToID("_CameraPosition"); 24 | public static readonly int STENCIL_REF = Shader.PropertyToID("_StencilRef"); 25 | public static readonly int Z_BUFFER_PARAMS = Shader.PropertyToID("_ZBufferParams"); 26 | public static readonly int ALPHA_TEST_DEPTH_CUTOFF = Shader.PropertyToID("_AlphaTestDepthCutoff"); 27 | public static readonly int BLUR_RADIUS = Shader.PropertyToID("_BlurRadius"); 28 | public static readonly int SHADOW_BIAS = Shader.PropertyToID("_ShadowBias"); 29 | public static readonly int SHADOW_NORMAL_BIAS = Shader.PropertyToID("_ShadowNormalBias"); 30 | public static readonly int LIGHT_POS = Shader.PropertyToID("_LightPos"); 31 | public static readonly int SUNLIGHT_COLOR = Shader.PropertyToID("_SunlightColor"); 32 | public static readonly int SUNLIGHT_DIRECTION = Shader.PropertyToID("_SunlightDirection"); 33 | public static readonly int SUNLIGHT_SHADOW_DISTANCE = Shader.PropertyToID("_SunlightShadowDistance"); 34 | public static readonly int SUNLIGHT_SHADOW_STRENGTH = Shader.PropertyToID("_SunlightShadowStrength"); 35 | public static readonly int SUNLIGHT_SHADOWMAP = Shader.PropertyToID("_SunlightShadowmap"); 36 | public static readonly int SUNLIGHT_SHADOWMAP_SIZE = Shader.PropertyToID("_SunlightShadowmapSize"); 37 | public static readonly int SUNLIGHT_SHADOWMAP_ARRAY = Shader.PropertyToID("_SunlightShadowmapArray"); 38 | public static readonly int SUNLIGHT_INVERSE_VP = Shader.PropertyToID("sunlight_InverseVP"); 39 | public static readonly int SUNLIGHT_INVERSE_VP_ARRAY = Shader.PropertyToID("sunlight_InverseVPArray"); 40 | public static readonly int SUNLIGHT_SHADOW_SPLIT_BOUND_ARRAY = Shader.PropertyToID("_SunlightShadowSplitBoundArray"); 41 | public static readonly int UNITY_MATRIX_V = Shader.PropertyToID("unity_MatrixV"); 42 | public static readonly int UNITY_INVERSE_P = Shader.PropertyToID("unity_InverseP"); 43 | public static readonly int UNITY_INVERSE_VP = Shader.PropertyToID("unity_InverseVP"); 44 | public static readonly int POINT_LIGHT_COUNT = Shader.PropertyToID("_PointLightCount"); 45 | public static readonly int SPOT_LIGHT_COUNT = Shader.PropertyToID("_SpotLightCount"); 46 | public static readonly int POINT_LIGHT_BUFFER = Shader.PropertyToID("_PointLightBuffer"); 47 | public static readonly int SPOT_LIGHT_BUFFER = Shader.PropertyToID("_SpotLightBuffer"); 48 | public static readonly int POINT_LIGHT_SHADOWMAP_SIZE = Shader.PropertyToID("_PointLightShadowmapSize"); 49 | public static readonly int POINT_LIGHT_SHADOWMAP = Shader.PropertyToID("_PointLightShadowmap"); 50 | public static readonly int POINT_LIGHT_SHADOWMAP_ARRAY = Shader.PropertyToID("_PointLightShadowmapArray"); 51 | public static readonly int SPOT_LIGHT_SHADOWMAP_SIZE = Shader.PropertyToID("_SpotLightShadowmapSize"); 52 | public static readonly int SPOT_LIGHT_SHADOWMAP_ARRAY = Shader.PropertyToID("_SpotLightShadowmapArray"); 53 | public static readonly int SPOT_LIGHT_INVERSE_VP_BUFFER = Shader.PropertyToID("spotLight_InverseVPBuffer"); 54 | 55 | // Keywords 56 | public const string SUNLIGHT_SHADOWS = "_SUNLIGHT_SHADOWS"; 57 | public const string SUNLIGHT_SOFT_SHADOWS = "_SUNLIGHT_SOFT_SHADOWS"; 58 | public const string POINT_LIGHT = "_POINT_LIGHT"; 59 | public const string POINT_LIGHT_SHADOWS = "_POINT_LIGHT_SHADOWS"; 60 | public const string POINT_LIGHT_SOFT_SHADOWS = "_POINT_LIGHT_SOFT_SHADOWS"; 61 | public const string SPOT_LIGHT = "_SPOT_LIGHT"; 62 | public const string SPOT_LIGHT_SHADOWS = "_SPOT_LIGHT_SHADOWS"; 63 | public const string SPOT_LIGHT_SOFT_SHADOWS = "_SPOT_LIGHT_SOFT_SHADOWS"; 64 | 65 | // Custom Render Queues 66 | public const int OPAQUE_RENDER_QUEUE = 2000; 67 | public const int ALPHA_TEST_RENDER_QUEUE = 2450; 68 | public const int DITHER_TRANSPARENT_RENDER_QUEUE = 2700; 69 | public const int TRANSPARENT_QUEUE = 3000; 70 | 71 | // Render Queue Ranges 72 | public static readonly RenderQueueRange OPAQUE_RENDER_QUEUE_RANGE = new RenderQueueRange(OPAQUE_RENDER_QUEUE, ALPHA_TEST_RENDER_QUEUE - 1); 73 | public static readonly RenderQueueRange ALPHA_TEST_QUEUE_RANGE = new RenderQueueRange(ALPHA_TEST_RENDER_QUEUE, TRANSPARENT_QUEUE - 1); 74 | public static readonly RenderQueueRange DITHER_TRANSPARENT_QUEUE_RANGE = new RenderQueueRange(DITHER_TRANSPARENT_RENDER_QUEUE, TRANSPARENT_QUEUE - 1); 75 | public static readonly RenderQueueRange NON_TRANSPARENT_RENDER_QUEUE = new RenderQueueRange(OPAQUE_RENDER_QUEUE, TRANSPARENT_QUEUE - 1); 76 | } -------------------------------------------------------------------------------- /Assets/Scripts/ShaderManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd50eb5200c34129b0419f12234ca672 3 | timeCreated: 1562494024 -------------------------------------------------------------------------------- /Assets/Scripts/ShaderTagManager.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine.Rendering; 2 | 3 | public static class ShaderTagManager { 4 | 5 | public static readonly ShaderTagId NONE = ShaderTagId.none; 6 | public static readonly ShaderTagId SRP_DEFAULT_UNLIT = new ShaderTagId("SRPDefaultUnlit"); 7 | public static readonly ShaderTagId DEPTH = new ShaderTagId("Depth"); 8 | public static readonly ShaderTagId DEPTH_NORMAL = new ShaderTagId("DepthNormal"); 9 | public static readonly ShaderTagId STENCIL = new ShaderTagId("Stencil"); 10 | } -------------------------------------------------------------------------------- /Assets/Scripts/ShaderTagManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 91df544dda5c4486a5df8540902833d1 3 | timeCreated: 1561211137 -------------------------------------------------------------------------------- /Assets/Scripts/TestBehaviour.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [ExecuteInEditMode] 6 | public class TestBehaviour : MonoBehaviour { 7 | 8 | } -------------------------------------------------------------------------------- /Assets/Scripts/TestBehaviour.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0aa66277e98ae429baa1444e90ea2552 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 765c660500a674e7b9f2c13b46c14ba0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuardHei/SRP/57abd23054c2414a0d43d17472144866ee2da09e/Assets/Shaders/.DS_Store -------------------------------------------------------------------------------- /Assets/Shaders/AlphaTestDepthNormal.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/AlphaTestDepthNormal" { 2 | 3 | SubShader { 4 | 5 | Tags { 6 | "RenderType" = "Opaque" 7 | "Queue" = "AlphaTest" 8 | } 9 | 10 | Pass { 11 | 12 | Name "DEPTHNORMAL" 13 | 14 | Tags { 15 | "LightMode" = "DepthNormal" 16 | } 17 | 18 | ZTest Less 19 | ZWrite On 20 | Cull Back 21 | 22 | HLSLPROGRAM 23 | 24 | #pragma target 5.0 25 | 26 | #pragma vertex AlphaTestDepthVertex 27 | #pragma fragment AlphaTestDepthFragment 28 | #pragma multi_compile_instancing 29 | 30 | #include "SRPInclude.hlsl" 31 | 32 | struct AlphaTestDepthVertexInput { 33 | float4 pos : POSITION; 34 | float3 normal : NORMAL; 35 | float2 uv : TEXCOORD0; 36 | UNITY_VERTEX_INPUT_INSTANCE_ID 37 | }; 38 | 39 | struct AlphaTestDepthVertexOutput { 40 | float4 clipPos : POSITION; 41 | float3 normal : TEXCOORD0; 42 | float2 uv : TEXCOORD1; 43 | }; 44 | 45 | CBUFFER_START(UnityPerMaterial) 46 | float4 _AlphaTexture_ST; 47 | CBUFFER_END 48 | 49 | TEXTURE2D(_AlphaTexture); 50 | SAMPLER(sampler_AlphaTexture); 51 | 52 | AlphaTestDepthVertexOutput AlphaTestDepthVertex(AlphaTestDepthVertexInput input) { 53 | AlphaTestDepthVertexOutput output; 54 | UNITY_SETUP_INSTANCE_ID(input); 55 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos)); 56 | output.normal = GetWorldNormal(input.normal); 57 | output.uv = TRANSFORM_TEX(input.uv, _AlphaTexture); 58 | return output; 59 | } 60 | 61 | float4 AlphaTestDepthFragment(AlphaTestDepthVertexOutput input) : SV_TARGET { 62 | float alpha = _AlphaTexture.Sample(sampler_AlphaTexture, input.uv).r; 63 | clip(alpha - _AlphaTestDepthCutoff); 64 | float3 normal = normalize(input.normal); 65 | return float4(normal, 1); 66 | } 67 | 68 | ENDHLSL 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Assets/Shaders/AlphaTestDepthNormal.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cdefcf7a543724e1992a2dd7adca5374 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/CBRCompute.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel CSMain 2 | 3 | [numthreads(8,8,1)] 4 | void CSMain (uint3 id : SV_DispatchThreadID) { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Assets/Shaders/CBRCompute.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b2288e342b93f49e2b874c061ebcb5f8 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 65536 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/ComputeUtils.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef COMPUTE_UTILS 2 | #define COMPUTE_UTILS 3 | 4 | struct Cone { 5 | float3 vertex; 6 | float angle; 7 | float height; 8 | float3 direction; 9 | float radius; 10 | }; 11 | 12 | struct PointLight { 13 | float3 color; 14 | float shadowStrength; 15 | float4 sphere; 16 | uint shadowIndex; 17 | }; 18 | 19 | struct SpotLight { 20 | float3 color; 21 | float shadowStrength; 22 | Cone cone; 23 | // float4x4 matrixVP; 24 | float smallAngle; 25 | float nearClip; 26 | uint shadowIndex; 27 | }; 28 | 29 | CBUFFER_START(UnityPerFrame) 30 | float4 _ZBufferParams; 31 | float4 _WorldSpaceCameraPos; 32 | float4 _ScreenParams; 33 | float4 _ProjectionParams; 34 | float4x4 unity_MatrixV; 35 | float4x4 unity_MatrixVP; 36 | float4x4 unity_InverseP; 37 | float4x4 unity_InverseVP; 38 | CBUFFER_END 39 | 40 | inline float SinOf(float cos) { 41 | return sqrt(1 - cos * cos); 42 | } 43 | 44 | inline float TanOf(float sin, float cos) { 45 | return sin / cos; 46 | } 47 | 48 | inline float CosBetween(float3 directionA, float3 directionB) { 49 | return saturate(dot(directionA, directionB)); 50 | } 51 | 52 | inline float SinBetween(float3 directionA, float3 directionB) { 53 | float cos = CosBetween(directionA, directionB); 54 | return sqrt(1 - cos * cos); 55 | } 56 | 57 | inline float TanBetween(float3 directionA, float3 directionB) { 58 | float cos = CosBetween(directionA, directionB); 59 | float sin = SinOf(cos); 60 | return TanOf(sin, cos); 61 | } 62 | 63 | inline float4 GetPlane(float3 normal, float3 vertex) { 64 | return float4(normal, -dot(normal, vertex)); 65 | } 66 | 67 | inline float4 GetPlane(float3 vertexA, float3 vertexB, float3 vertexC) { 68 | float3 normal = normalize(cross(vertexB - vertexA, vertexC - vertexA)); 69 | return float4(normal, -dot(normal, vertexA)); 70 | } 71 | 72 | inline float4 GetPlane(float4 vertexA, float4 vertexB, float4 vertexC) { 73 | float3 a = vertexA.xyz / vertexA.w; 74 | float3 b = vertexB.xyz / vertexB.w; 75 | float3 c = vertexC.xyz / vertexC.w; 76 | 77 | float3 normal = normalize(cross(b - a, c - a)); 78 | return float4(normal, -dot(normal, a)); 79 | } 80 | 81 | inline float GetDistanceToPlane(float4 plane, float3 vertex) { 82 | return dot(plane.xyz, vertex) + plane.w; 83 | } 84 | 85 | inline float VertexInsidePlane(float3 vertex, float4 plane) { 86 | return (dot(plane.xyz, vertex) + plane.w) < 0; 87 | } 88 | 89 | inline float SphereInsidePlane(float4 sphere, float4 plane) { 90 | return (dot(plane.xyz, sphere.xyz) + plane.w) < sphere.w; 91 | } 92 | 93 | inline float ConeInsidePlane(Cone cone, float4 plane) { 94 | float3 direction = -cone.direction; 95 | float3 m = cross(cross(plane.xyz, direction), direction); 96 | float3 q = cone.vertex + direction * cone.height + normalize(m) * cone.radius; 97 | return VertexInsidePlane(cone.vertex, plane) + VertexInsidePlane(q, plane); 98 | } 99 | 100 | inline float VertexInsideSphere(float3 vertex, float4 sphere) { 101 | float3 distance = vertex - sphere.xyz; 102 | return dot(distance, distance) < sphere.w; 103 | } 104 | 105 | inline float SphereIntersect(float4 sphere, float4 plane) { 106 | return (GetDistanceToPlane(plane, sphere.xyz) < sphere.w); 107 | } 108 | 109 | float SphereIntersect(float4 sphere, float4 planes[6]) { 110 | [unroll] 111 | for (uint i = 0; i < 6; ++i) { 112 | if (GetDistanceToPlane(planes[i], sphere.xyz) > sphere.w) return 0; 113 | } 114 | 115 | return 1; 116 | } 117 | 118 | float BoxIntersect(float3 extent, float3 position, float4 planes[6]) { 119 | float result = 1; 120 | for (uint i = 0; i < 6; ++i) { 121 | float4 plane = planes[i]; 122 | float3 absNormal = abs(plane.xyz); 123 | result *= ((dot(position, plane.xyz) - dot(absNormal, extent)) < -plane.w); 124 | } 125 | 126 | return result; 127 | } 128 | 129 | float BoxIntersect(float3 extent, float3x3 localToWorld, float3 position, float4 planes[6]) { 130 | float result = 1; 131 | for (uint i = 0; i < 6; ++i) { 132 | float4 plane = planes[i]; 133 | float3 absNormal = abs(mul(plane.xyz, localToWorld)); 134 | result *= ((dot(position, plane.xyz) - dot(absNormal, extent)) < -plane.w); 135 | } 136 | 137 | return result; 138 | } 139 | 140 | float ConeIntersect(Cone cone, float4 planes[6]) { 141 | [unroll] 142 | for (uint i = 0; i < 6; ++i) { 143 | if (ConeInsidePlane(cone, planes[i]) < .5) return 0; 144 | } 145 | 146 | return 1; 147 | } 148 | 149 | inline float ConeIntersect(Cone cone, float4 plane) { 150 | return ConeInsidePlane(cone, plane); 151 | } 152 | 153 | inline float ConeSphereIntersect(Cone cone, float4 sphere) { 154 | float3 diff = cone.vertex - sphere.xyz; 155 | float diffDot = dot(diff, diff); 156 | float lenComp = dot(diff, cone.direction); 157 | float dist = cos(cone.angle) * sqrt(diffDot - lenComp * lenComp) - lenComp * sin(cone.angle); 158 | 159 | bool angleCull = dist > sphere.w; 160 | bool frontCull = lenComp > sphere.w + cone.height; 161 | bool backCull = lenComp < -sphere.w; 162 | 163 | return !(angleCull || frontCull || backCull); 164 | } 165 | 166 | float4 UnprojectScreenSpaceToViewSpace(float4 position) { 167 | float4 clipSpace = float4(float2(position.x, 1 - position.y) * 2 - 1, position.z, position.w); 168 | float4 viewSpace = mul(clipSpace, unity_InverseP); 169 | viewSpace /= viewSpace.w; 170 | return viewSpace; 171 | } 172 | 173 | #endif // COMPUTE_UTILS -------------------------------------------------------------------------------- /Assets/Shaders/ComputeUtils.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a258ac002903648bdbe7df9fe01ec921 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/DebugCubemapArray.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/DebugCubemapArray" { 2 | 3 | Properties { 4 | _Index("Index", Int) = 0 5 | _Face("Face", Int) = 0 6 | _MainTex ("Main Texture", 2D) = "" { } 7 | } 8 | 9 | SubShader { 10 | 11 | Tags { 12 | "RenderType"="Opaque" 13 | } 14 | 15 | Pass { 16 | 17 | ZTest Always 18 | ZWrite Off 19 | Cull Off 20 | 21 | HLSLPROGRAM 22 | #pragma target 5.0 23 | 24 | #pragma vertex Vertex 25 | #pragma fragment Fragment 26 | 27 | #include "SRPInclude.hlsl" 28 | #include "ComputeUtils.hlsl" 29 | 30 | ImageVertexOutput Vertex(ImageVertexInput input) { 31 | ImageVertexOutput output; 32 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos.xyz)); 33 | output.uv = input.uv; 34 | return output; 35 | } 36 | 37 | int _Index; 38 | 39 | float4 Fragment(ImageVertexOutput input, float4 screenPos : SV_POSITION) : SV_TARGET { 40 | float3 dir = float3(screenPos.zw, 1); 41 | return float4(1, 0, 0, 1); 42 | // return _PointLightShadowmapArray.Sample(sampler_PointLightShadowmapArray, float4(dir, _Index)); 43 | } 44 | 45 | ENDHLSL 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Assets/Shaders/DebugCubemapArray.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f3b063bbb210416b864c61edc6102fd 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/DitherTransparentDepthNormal.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/DitherTransparentDepthNormal" { 2 | 3 | SubShader { 4 | 5 | Tags { 6 | "RenderType" = "Opaque" 7 | "Queue" = "AlphaTest" 8 | } 9 | 10 | Pass { 11 | 12 | Name "DEPTHNORMAL" 13 | 14 | Tags { 15 | "LightMode" = "DepthNormal" 16 | } 17 | 18 | ZTest Less 19 | ZWrite On 20 | Cull Back 21 | 22 | HLSLPROGRAM 23 | 24 | #pragma target 5.0 25 | 26 | #pragma vertex AlphaTestDepthVertex 27 | #pragma fragment AlphaTestDepthFragment 28 | #pragma multi_compile_instancing 29 | 30 | #include "SRPInclude.hlsl" 31 | 32 | struct AlphaTestDepthVertexInput { 33 | float4 pos : POSITION; 34 | float3 normal : NORMAL; 35 | float2 uv : TEXCOORD0; 36 | UNITY_VERTEX_INPUT_INSTANCE_ID 37 | }; 38 | 39 | struct AlphaTestDepthVertexOutput { 40 | float4 clipPos : SV_POSITION; 41 | float3 normal : TEXCOORD0; 42 | float2 uv : TEXCOORD1; 43 | }; 44 | 45 | CBUFFER_START(UnityPerMaterial) 46 | float4 _Color; 47 | float4 _AlphaTexture_ST; 48 | CBUFFER_END 49 | 50 | TEXTURE2D(_AlphaTexture); 51 | SAMPLER(sampler_AlphaTexture); 52 | 53 | AlphaTestDepthVertexOutput AlphaTestDepthVertex(AlphaTestDepthVertexInput input) { 54 | AlphaTestDepthVertexOutput output; 55 | UNITY_SETUP_INSTANCE_ID(input); 56 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos)); 57 | output.normal = GetWorldNormal(input.normal); 58 | output.uv = TRANSFORM_TEX(input.uv, _AlphaTexture); 59 | return output; 60 | } 61 | 62 | float4 AlphaTestDepthFragment(AlphaTestDepthVertexOutput input, float4 screenPos : SV_POSITION) : SV_TARGET { 63 | float alpha = _Color.a * _AlphaTexture.Sample(sampler_AlphaTexture, input.uv).r; 64 | DitherClip64((uint2) screenPos.xy, alpha); 65 | float3 normal = normalize(input.normal); 66 | return float4(normal, 1); 67 | } 68 | 69 | ENDHLSL 70 | } 71 | 72 | Pass { 73 | 74 | Name "SHADOWCASTER" 75 | 76 | Tags { 77 | "LightMode" = "ShadowCaster" 78 | } 79 | 80 | HLSLPROGRAM 81 | 82 | #pragma target 3.5 83 | 84 | #pragma vertex DitherTransparentShadowCasterVertex 85 | #pragma fragment DitherTransparentShadowCasterFragment 86 | 87 | #pragma multi_compile_instancing 88 | #pragma instancing_options assumeuniformscaling 89 | 90 | #include "SRPInclude.hlsl" 91 | 92 | struct DitherTransparentShadowCasterVertexInput { 93 | float4 pos : POSITION; 94 | float3 normal : NORMAL; 95 | float2 uv : TEXCOORD0; 96 | UNITY_VERTEX_INPUT_INSTANCE_ID 97 | }; 98 | 99 | struct DitherTransparentShadowCasterVertexOutput { 100 | float4 clipPos : SV_POSITION; 101 | float4 worldPos : TEXCOORD0; 102 | float2 uv : TEXCOORD1; 103 | }; 104 | 105 | CBUFFER_START(UnityPerMaterial) 106 | float4 _Color; 107 | float4 _AlphaTexture_ST; 108 | CBUFFER_END 109 | 110 | TEXTURE2D(_AlphaTexture); 111 | SAMPLER(sampler_AlphaTexture); 112 | 113 | DitherTransparentShadowCasterVertexOutput DitherTransparentShadowCasterVertex(DitherTransparentShadowCasterVertexInput input) { 114 | DitherTransparentShadowCasterVertexOutput output; 115 | UNITY_SETUP_INSTANCE_ID(input); 116 | float3 worldNormal = GetWorldNormal(input.normal); 117 | float4 worldPos = GetWorldPosition(input.pos.xyz); 118 | output.clipPos = ClipSpaceShadowBias(GetClipPosition(ShadowNormalBias(worldPos, worldNormal))); 119 | output.worldPos = worldPos; 120 | output.uv = TRANSFORM_TEX(input.uv, _AlphaTexture); 121 | return output; 122 | } 123 | 124 | float4 DitherTransparentShadowCasterFragment(DitherTransparentShadowCasterVertexOutput input, float4 screenPos : SV_POSITION) : SV_TARGET { 125 | float alpha = _Color.a * _AlphaTexture.Sample(sampler_AlphaTexture, input.uv).r; 126 | DitherClip64((uint2) screenPos.xy, alpha); 127 | return distance(input.worldPos.xyz, _LightPos.xyz) / _LightPos.w; 128 | } 129 | 130 | ENDHLSL 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /Assets/Shaders/DitherTransparentDepthNormal.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 68bc33c571adf4c3a962a5faa2fc1bca 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/DitherTransparentLitColor.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/DitherTransparentLitColor" { 2 | 3 | Properties { 4 | _Color("Color", Color) = (0, 0, 0, 1) 5 | _AlphaTexture("Alpha", 2D) = "white" { } 6 | } 7 | 8 | SubShader { 9 | 10 | UsePass "SRP/DitherTransparentDepthNormal/DEPTHNORMAL" 11 | 12 | UsePass "SRP/DitherTransparentStencil/STENCIL" 13 | 14 | UsePass "SRP/DitherTransparentDepthNormal/SHADOWCASTER" 15 | 16 | Pass { 17 | 18 | Tags { 19 | "RenderType" = "Opaque" 20 | } 21 | 22 | ZTest Equal 23 | ZWrite Off 24 | Cull Back 25 | 26 | HLSLPROGRAM 27 | #pragma target 5.0 28 | 29 | #pragma vertex Vertex 30 | #pragma fragment Fragment 31 | #pragma multi_compile_instancing 32 | 33 | #pragma multi_compile __ _SUNLIGHT_SHADOWS 34 | #pragma multi_compile __ _SUNLIGHT_SOFT_SHADOWS 35 | #pragma multi_compile __ _POINT_LIGHT_SHADOWS 36 | #pragma multi_compile __ _POINT_LIGHT_SOFT_SHADOWS 37 | #pragma multi_compile __ _SPOT_LIGHT_SHADOWS 38 | #pragma multi_compile __ _SPOT_LIGHT_SOFT_SHADOWS 39 | 40 | #include "SRPInclude.hlsl" 41 | 42 | struct VertexOutput { 43 | float4 clipPos : SV_POSITION; 44 | float4 worldPos : TEXCOORD0; 45 | float3 normal : TEXCOORD1; 46 | float3 viewDir : TEXCOORD2; 47 | UNITY_VERTEX_INPUT_INSTANCE_ID 48 | }; 49 | 50 | UNITY_INSTANCING_BUFFER_START(UnityPerMaterial) 51 | UNITY_DEFINE_INSTANCED_PROP(float3, _Color) 52 | UNITY_INSTANCING_BUFFER_END(UnityPerMaterial) 53 | 54 | VertexOutput Vertex(SimpleVertexInput input) { 55 | VertexOutput output; 56 | UNITY_SETUP_INSTANCE_ID(input); 57 | UNITY_TRANSFER_INSTANCE_ID(input, output); 58 | output.worldPos = GetWorldPosition(input.pos.xyz); 59 | output.clipPos = GetClipPosition(output.worldPos); 60 | output.normal = GetWorldNormal(input.normal); 61 | output.viewDir = normalize(WorldSpaceViewDirection(output.worldPos)); 62 | return output; 63 | } 64 | 65 | float4 Fragment(VertexOutput input, float4 screenPos : SV_POSITION) : SV_TARGET { 66 | UNITY_SETUP_INSTANCE_ID(input); 67 | 68 | uint2 screenIndex = screenPos.xy; 69 | 70 | float3 color = UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _Color).rgb; 71 | float3 normal = normalize(input.normal); 72 | 73 | uint2 lightTextureIndex = screenIndex / 16; 74 | uint3 lightCountIndex = uint3(lightTextureIndex, 0); 75 | uint3 lightIndex = lightCountIndex; 76 | uint pointLightCount = _CulledPointLightTexture[lightCountIndex]; 77 | uint spotLightCount = _CulledSpotLightTexture[lightCountIndex]; 78 | float3 litColor = DefaultDirectionalLit(input.worldPos, normal); 79 | 80 | [loop] 81 | for (uint i = 0; i < pointLightCount; ++i) { 82 | lightIndex.z += 1; 83 | litColor += DefaultPointLit(input.worldPos, normal, uint3(lightTextureIndex, i + 1)); 84 | } 85 | 86 | lightIndex = lightCountIndex; 87 | 88 | [loop] 89 | for (i = 0; i < spotLightCount; ++i) { 90 | lightIndex.z += 1; 91 | litColor += DefaultSpotLit(input.worldPos, normal, lightIndex); 92 | } 93 | 94 | return float4(litColor * color, 1); 95 | } 96 | 97 | ENDHLSL 98 | } 99 | } 100 | } -------------------------------------------------------------------------------- /Assets/Shaders/DitherTransparentLitColor.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42b6b04051183429d9a7f8aacccb09a5 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/DitherTransparentStencil.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/DitherTransparentStencil" { 2 | 3 | SubShader { 4 | 5 | Tags { 6 | "RenderType" = "Opaque" 7 | } 8 | 9 | Stencil { 10 | Ref 1 11 | Comp Always 12 | Pass Replace 13 | } 14 | 15 | Pass { 16 | 17 | Name "STENCIL" 18 | 19 | Tags { 20 | "LightMode" = "Stencil" 21 | } 22 | 23 | ZTest LEqual 24 | ZWrite Off 25 | Cull Back 26 | 27 | HLSLPROGRAM 28 | 29 | #pragma target 5.0 30 | 31 | #pragma vertex UnlitVertex 32 | #pragma fragment NoneFragment 33 | #pragma multi_compile_instancing 34 | 35 | #include "SRPInclude.hlsl" 36 | 37 | ENDHLSL 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Assets/Shaders/DitherTransparentStencil.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1eb7784e2d71547c288417a15b2675ac 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/GaussianBlur.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/GaussianBlur" { 2 | 3 | Properties { 4 | _MainTex ("Main Texture", 2D) = "" { } 5 | } 6 | 7 | SubShader { 8 | 9 | Tags { 10 | "RenderType"="Opaque" 11 | } 12 | 13 | Pass { 14 | 15 | ZTest Always 16 | ZWrite Off 17 | Cull Off 18 | 19 | HLSLPROGRAM 20 | #pragma target 3.5 21 | 22 | #pragma vertex Vertex 23 | #pragma fragment Fragment 24 | 25 | #include "SRPInclude.hlsl" 26 | 27 | struct VertexOutput { 28 | float4 clipPos : SV_POSITION; 29 | float2 uv : TEXCOORD0; 30 | float4 uv01 : TEXCOORD1; 31 | float4 uv23 : TEXCOORD2; 32 | float4 uv45 : TEXCOORD3; 33 | }; 34 | 35 | float _BlurRadius; 36 | 37 | VertexOutput Vertex(ImageVertexInput input) { 38 | VertexOutput output; 39 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos.xyz)); 40 | output.uv = input.uv; 41 | float4 offsets = float4(_BlurRadius, 0, 0, 0) * _MainTex_TexelSize.xyxy; 42 | offsets = offsets.xyxy * float4(1, 1, -1, -1); 43 | output.uv01 = input.uv.xyxy + offsets.xyxy; 44 | output.uv23 = input.uv.xyxy + offsets.xyxy * 2.0; 45 | output.uv45 = input.uv.xyxy + offsets.xyxy * 3.0; 46 | return output; 47 | } 48 | 49 | float4 Fragment(VertexOutput input) : SV_TARGET { 50 | // return float4(1, 0, 1, 1); 51 | float4 color = float4(0, 0, 0, 0); 52 | color += 0.4 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv); 53 | color += 0.15 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv01.xy); 54 | color += 0.15 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv01.zw); 55 | color += 0.1 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv23.xy); 56 | color += 0.1 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv23.zw); 57 | color += 0.05 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv45.xy); 58 | color += 0.05 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv45.zw); 59 | return color; 60 | } 61 | 62 | ENDHLSL 63 | } 64 | 65 | Pass { 66 | 67 | ZTest Always 68 | ZWrite Off 69 | Cull Off 70 | 71 | HLSLPROGRAM 72 | #pragma target 3.5 73 | 74 | #pragma vertex Vertex 75 | #pragma fragment Fragment 76 | 77 | #include "SRPInclude.hlsl" 78 | 79 | struct VertexOutput { 80 | float4 clipPos : SV_POSITION; 81 | float2 uv : TEXCOORD0; 82 | float4 uv01 : TEXCOORD1; 83 | float4 uv23 : TEXCOORD2; 84 | float4 uv45 : TEXCOORD3; 85 | }; 86 | 87 | float _BlurRadius; 88 | 89 | VertexOutput Vertex(ImageVertexInput input) { 90 | VertexOutput output; 91 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos.xyz)); 92 | output.uv = input.uv; 93 | float4 offsets = float4(0, _BlurRadius, 0, 0) * _MainTex_TexelSize.xyxy; 94 | offsets = offsets.xyxy * float4(1, 1, -1, -1); 95 | output.uv01 = input.uv.xyxy + offsets.xyxy; 96 | output.uv23 = input.uv.xyxy + offsets.xyxy * 2.0; 97 | output.uv45 = input.uv.xyxy + offsets.xyxy * 3.0; 98 | return output; 99 | } 100 | 101 | float4 Fragment(VertexOutput input) : SV_TARGET { 102 | float4 color = float4(0, 0, 0, 0); 103 | color += 0.4 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv); 104 | color += 0.15 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv01.xy); 105 | color += 0.15 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv01.zw); 106 | color += 0.1 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv23.xy); 107 | color += 0.1 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv23.zw); 108 | color += 0.05 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv45.xy); 109 | color += 0.05 * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv45.zw); 110 | return color; 111 | } 112 | 113 | ENDHLSL 114 | } 115 | 116 | Pass { 117 | 118 | ZTest Always 119 | ZWrite Off 120 | Cull Off 121 | 122 | Stencil { 123 | Ref 1 124 | Comp Equal 125 | ReadMask 1 126 | } 127 | 128 | HLSLPROGRAM 129 | #pragma target 5.0 130 | 131 | #pragma vertex Vertex 132 | #pragma fragment Fragment 133 | 134 | #include "SRPInclude.hlsl" 135 | 136 | ImageVertexOutput Vertex(ImageVertexInput input) { 137 | ImageVertexOutput output; 138 | output.clipPos = float4(input.pos.xy, 0, 1); 139 | output.uv = TransformTriangleVertexToUV(input.pos); 140 | 141 | #if UNITY_UV_STARTS_AT_TOP 142 | output.uv = output.uv * float2(1.0, -1.0) + float2(0.0, 1.0); 143 | #endif 144 | 145 | output.uv = output.uv * _MainTex_ST.xy + _MainTex_ST.zw; 146 | 147 | return output; 148 | } 149 | 150 | float4 Fragment(ImageVertexOutput input) : SV_TARGET { 151 | float2 uv = input.uv; 152 | return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv); 153 | } 154 | 155 | ENDHLSL 156 | } 157 | } 158 | } -------------------------------------------------------------------------------- /Assets/Shaders/GaussianBlur.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ffb2963dfff241dfa71cda2b424a9b3 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/GeneralCompute.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel CopyDepth 2 | 3 | #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" 4 | 5 | #include "ComputeUtils.hlsl" 6 | 7 | RWTexture2D _OpaqueDepthTexture; 8 | Texture2D _DepthTexture; 9 | 10 | [numthreads(8,8,1)] 11 | void CopyDepth(uint3 id : SV_DispatchThreadID) { 12 | _OpaqueDepthTexture[id.xy] = _DepthTexture[id.xy]; 13 | } 14 | -------------------------------------------------------------------------------- /Assets/Shaders/GeneralCompute.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41a3c78fcbfdb40f1aa1a053a7e60b22 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 65536 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/OpaqueDepth.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/OpaqueDepth" { 2 | 3 | SubShader { 4 | 5 | Tags { 6 | "RenderType" = "Opaque" 7 | } 8 | 9 | Pass { 10 | 11 | Name "DEPTH" 12 | 13 | Tags { 14 | "LightMode" = "Depth" 15 | } 16 | 17 | ZTest LEqual 18 | ZWrite On 19 | Cull Back 20 | 21 | HLSLPROGRAM 22 | 23 | #pragma target 5.0 24 | 25 | #pragma vertex OpaqueDepthVertex 26 | #pragma fragment OpaqueDepthFragment 27 | #pragma multi_compile_instancing 28 | 29 | #include "SRPInclude.hlsl" 30 | 31 | BasicVertexOutput OpaqueDepthVertex(BasicVertexInput input) { 32 | BasicVertexOutput output; 33 | UNITY_SETUP_INSTANCE_ID(input); 34 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos)); 35 | return output; 36 | } 37 | 38 | float4 OpaqueDepthFragment(BasicVertexOutput input) : SV_TARGET { 39 | return 0; 40 | } 41 | 42 | ENDHLSL 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Assets/Shaders/OpaqueDepth.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5cc2951a12c4b40598ed5a65c8d7fd32 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/OpaqueDepthNormal.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/OpaqueDepthNormal" { 2 | 3 | SubShader { 4 | 5 | Tags { 6 | "RenderType" = "Opaque" 7 | } 8 | 9 | Pass { 10 | 11 | Name "DEPTHNORMAL" 12 | 13 | Tags { 14 | "LightMode" = "DepthNormal" 15 | } 16 | 17 | ZTest Less 18 | ZWrite On 19 | Cull Back 20 | 21 | HLSLPROGRAM 22 | 23 | #pragma target 5.0 24 | 25 | #pragma vertex OpaqueDepthVertex 26 | #pragma fragment OpaqueDepthFragment 27 | #pragma multi_compile_instancing 28 | 29 | #include "SRPInclude.hlsl" 30 | 31 | SimpleVertexOutput OpaqueDepthVertex(SimpleVertexInput input) { 32 | SimpleVertexOutput output; 33 | UNITY_SETUP_INSTANCE_ID(input); 34 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos)); 35 | output.normal = GetWorldNormal(input.normal); 36 | return output; 37 | } 38 | 39 | float4 OpaqueDepthFragment(SimpleVertexOutput input) : SV_TARGET { 40 | float3 normal = normalize(input.normal); 41 | return float4(normal, 1); 42 | } 43 | 44 | ENDHLSL 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Assets/Shaders/OpaqueDepthNormal.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ecf56a3f3137746da85b6b22dc92cd76 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/OpaqueLitColor.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/OpaqueLitColor" { 2 | 3 | Properties { 4 | _Color("Color", Color) = (0, 0, 0, 1) 5 | } 6 | 7 | SubShader { 8 | 9 | UsePass "SRP/OpaqueDepth/DEPTH" 10 | /* 11 | Pass { 12 | 13 | Tags { 14 | "RenderType" = "Opaque" 15 | } 16 | 17 | ZTest Equal 18 | ZWrite Off 19 | Cull Back 20 | 21 | HLSLPROGRAM 22 | #pragma target 5.0 23 | 24 | #pragma vertex Vertex 25 | #pragma fragment Fragment 26 | #pragma multi_compile_instancing 27 | 28 | #pragma multi_compile __ _SUNLIGHT_SHADOWS 29 | #pragma multi_compile __ _SUNLIGHT_SOFT_SHADOWS 30 | #pragma multi_compile __ _POINT_LIGHT_SHADOWS 31 | #pragma multi_compile __ _POINT_LIGHT_SOFT_SHADOWS 32 | #pragma multi_compile __ _SPOT_LIGHT_SHADOWS 33 | #pragma multi_compile __ _SPOT_LIGHT_SOFT_SHADOWS 34 | #include "SRPInclude.hlsl" 35 | 36 | struct VertexOutput { 37 | float4 clipPos : SV_POSITION; 38 | float4 worldPos : TEXCOORD0; 39 | float3 normal : TEXCOORD1; 40 | float3 viewDir : TEXCOORD2; 41 | UNITY_VERTEX_INPUT_INSTANCE_ID 42 | }; 43 | 44 | UNITY_INSTANCING_BUFFER_START(UnityPerMaterial) 45 | UNITY_DEFINE_INSTANCED_PROP(float3, _Color) 46 | UNITY_INSTANCING_BUFFER_END(UnityPerMaterial) 47 | 48 | VertexOutput Vertex(SimpleVertexInput input) { 49 | VertexOutput output; 50 | UNITY_SETUP_INSTANCE_ID(input); 51 | UNITY_TRANSFER_INSTANCE_ID(input, output); 52 | output.worldPos = GetWorldPosition(input.pos.xyz); 53 | output.clipPos = GetClipPosition(output.worldPos); 54 | output.normal = GetWorldNormal(input.normal); 55 | output.viewDir = normalize(WorldSpaceViewDirection(output.worldPos)); 56 | return output; 57 | } 58 | 59 | float4 Fragment(VertexOutput input, float4 screenPos : SV_POSITION) : SV_TARGET { 60 | UNITY_SETUP_INSTANCE_ID(input); 61 | 62 | uint2 screenIndex = screenPos.xy; 63 | 64 | float3 color = UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _Color).rgb; 65 | float3 normal = normalize(input.normal); 66 | 67 | uint2 lightTextureIndex = screenIndex / 16; 68 | uint3 lightCountIndex = uint3(lightTextureIndex, 0); 69 | uint3 lightIndex = lightCountIndex; 70 | uint pointLightCount = _CulledPointLightTexture[lightCountIndex]; 71 | uint spotLightCount = _CulledSpotLightTexture[lightCountIndex]; 72 | float3 litColor = DefaultDirectionalLit(input.worldPos, normal); 73 | 74 | [loop] 75 | for (uint i = 0; i < pointLightCount; ++i) { 76 | lightIndex.z += 1; 77 | litColor += DefaultPointLit(input.worldPos, normal, uint3(lightTextureIndex, i + 1)); 78 | } 79 | 80 | lightIndex = lightCountIndex; 81 | 82 | [loop] 83 | for (i = 0; i < spotLightCount; ++i) { 84 | lightIndex.z += 1; 85 | litColor += DefaultSpotLit(input.worldPos, normal, lightIndex); 86 | } 87 | 88 | return float4(litColor * color, 1); 89 | } 90 | 91 | ENDHLSL 92 | } 93 | */ 94 | } 95 | } -------------------------------------------------------------------------------- /Assets/Shaders/OpaqueLitColor.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e975e5da0e504de4bae5150cc50bf78 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/SRPInclude.hlsl: -------------------------------------------------------------------------------- 1 | #ifndef SRP_INCLUDE 2 | #define SRP_INCLUDE 3 | 4 | #define UNITY_MATRIX_M unity_ObjectToWorld 5 | 6 | #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" 7 | #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl" 8 | #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Shadow/ShadowSamplingTent.hlsl" 9 | 10 | #include "ComputeUtils.hlsl" 11 | 12 | static const float DITHER_THRESHOLDS_64[64] = { 13 | 1, 33, 9, 41, 3, 35, 11, 43, 14 | 49, 17, 57, 25, 51, 19, 59, 27, 15 | 13, 45, 5, 37, 15, 47, 7, 39, 16 | 61, 29, 53, 21, 63, 31, 55, 23, 17 | 4, 36, 12, 44, 2, 34, 10, 42, 18 | 52, 20, 60, 28, 50, 18, 58, 26, 19 | 16, 48, 8, 40, 14, 48, 6, 38, 20 | 64, 32, 56, 24, 62, 30, 54, 22 21 | }; 22 | 23 | static const float4 POINT_LIGHT_PCF_OFFSET_6[6] = { 24 | float4(1, 0, 0, 0.1666667), float4(-1, 0, 0, 0.1666667), float4(0, 1, 0, 0.1666667), float4(0, -1, 0, 0.1666667), float4(0, 0, 1, 0.1666667), float4(0, 0, -1, 0.1666667) 25 | }; 26 | 27 | static const float4 POINT_LIGHT_PCF_OFFSET_20[20] = { 28 | float4(1, 1, 1, 1.861362E-11), float4(1, -1, 1, 1.861362E-11), float4(-1, -1, 1, 1.861362E-11), float4(-1, 1, 1, 1.861362E-11), 29 | float4(1, 1, -1, 1.861362E-11), float4(1, -1, -1, 1.861362E-11), float4(-1, -1, -1, 1.861362E-11), float4(-1, 1, -1, 1.861362E-11), 30 | float4(1, 1, 0, 0.08333334), float4(1, -1, 0, 0.08333334), float4(-1, -1, 0, 0.08333334), float4(-1, 1, 0, 0.08333334), 31 | float4(1, 0, 1, 0.08333334), float4(-1, 0, 1, 0.08333334), float4(1, 0, -1, 0.08333334), float4(-1, 0, -1, 0.08333334), 32 | float4(0, 1, 1, 0.08333334), float4(0, -1, 1, 0.08333334), float4(0, -1, -1, 0.08333334), float4(0, 1, -1, 0.08333334) 33 | }; 34 | 35 | StructuredBuffer _PointLightBuffer; 36 | StructuredBuffer _SpotLightBuffer; 37 | 38 | StructuredBuffer pointLight_InverseVPBuffer; 39 | StructuredBuffer spotLight_InverseVPBuffer; 40 | 41 | Texture3D _CulledPointLightTexture; 42 | Texture3D _CulledSpotLightTexture; 43 | 44 | TEXTURE2D(_MainTex); 45 | SAMPLER(sampler_MainTex); 46 | 47 | TEXTURE2D(_OpaqueNormalTexture); 48 | SAMPLER(sampler_OpaqueNormalTexture); 49 | 50 | TEXTURE2D(_OpaqueDepthTexture); 51 | SAMPLER(sampler_OpaqueDepthTexture); 52 | 53 | TEXTURE2D_SHADOW(_SunlightShadowmap); 54 | SAMPLER_CMP(sampler_SunlightShadowmap); 55 | 56 | TEXTURE2D_ARRAY_SHADOW(_SunlightShadowmapArray); 57 | SAMPLER_CMP(sampler_SunlightShadowmapArray); 58 | 59 | TEXTURECUBE_SHADOW(_PointLightShadowmap); 60 | SAMPLER(sampler_PointLightShadowmap); 61 | 62 | TEXTURECUBE_ARRAY_SHADOW(_PointLightShadowmapArray); 63 | SAMPLER(sampler_PointLightShadowmapArray); 64 | 65 | TEXTURE2D_ARRAY_SHADOW(_SpotLightShadowmapArray); 66 | SAMPLER_CMP(sampler_SpotLightShadowmapArray); 67 | 68 | CBUFFER_START(UnityPerFrame) 69 | float4 _OpaqueDepthTexture_ST; 70 | float4 _OpaqueNormalTexture_ST; 71 | float _AlphaTestDepthCutoff; 72 | CBUFFER_END 73 | 74 | CBUFFER_START(UnityPerDraw) 75 | float4x4 unity_ObjectToWorld; 76 | float4x4 unity_WorldToObject; 77 | float4 unity_LODFade; 78 | real4 unity_WorldTransformParams; 79 | CBUFFER_END 80 | 81 | CBUFFER_START(UnityPerMaterial) 82 | float4 _MainTex_ST; 83 | float4 _MainTex_TexelSize; 84 | CBUFFER_END 85 | 86 | CBUFFER_START(Shadow) 87 | float _ShadowBias; 88 | float _ShadowNormalBias; 89 | float _PointLightShadowmap_ST; 90 | float _SpotLightShadowmap_ST; 91 | float4 _PointLightShadowmapSize; 92 | float4 _SpotLightShadowmapSize; 93 | float4 _LightPos; 94 | CBUFFER_END 95 | 96 | CBUFFER_START(Sunlight) 97 | float4x4 sunlight_InverseVP; 98 | float4x4 sunlight_InverseVPArray[4]; 99 | float4 _SunlightShadowSplitBoundArray[4]; 100 | float4 _SunlightShadowmap_ST; 101 | float4 _SunlightShadowmapSize; 102 | float3 _SunlightColor; 103 | float3 _SunlightDirection; 104 | float _SunlightShadowDistance; 105 | float _SunlightShadowStrength; 106 | CBUFFER_END 107 | 108 | ////////////////////////////////////////// 109 | // Built-in Vertex Input/Output Structs // 110 | ////////////////////////////////////////// 111 | 112 | struct BasicVertexInput { 113 | float4 pos : POSITION; 114 | UNITY_VERTEX_INPUT_INSTANCE_ID 115 | }; 116 | 117 | struct SimpleVertexInput { 118 | float4 pos : POSITION; 119 | float3 normal : NORMAL; 120 | UNITY_VERTEX_INPUT_INSTANCE_ID 121 | }; 122 | 123 | struct ImageVertexInput { 124 | float4 pos : POSITION; 125 | float2 uv : TEXCOORD0; 126 | }; 127 | 128 | struct BasicVertexOutput { 129 | float4 clipPos : SV_POSITION; 130 | }; 131 | 132 | struct SimpleVertexOutput { 133 | float4 clipPos : SV_POSITION; 134 | float3 normal : TEXCOORD0; 135 | }; 136 | 137 | struct ImageVertexOutput { 138 | float4 clipPos : SV_POSITION; 139 | float2 uv : TEXCOORD0; 140 | }; 141 | 142 | struct ShadowVertexOutput { 143 | float4 clipPos : SV_POSITION; 144 | float3 worldPos : TEXCOORD0; 145 | }; 146 | 147 | /////////////////////////////// 148 | // Built-in Helper Functions // 149 | /////////////////////////////// 150 | 151 | inline float4 GetWorldPosition(float3 pos) { 152 | return mul(UNITY_MATRIX_M, float4(pos, 1.0)); 153 | } 154 | 155 | inline float4 GetClipPosition(float4 worldPos) { 156 | return mul(unity_MatrixVP, worldPos); 157 | } 158 | 159 | inline float3 GetWorldNormal(float3 normal) { 160 | return mul((float3x3) UNITY_MATRIX_M, normal); 161 | } 162 | 163 | inline float4 ComputeScreenPosition(float4 clipPos) { 164 | float4 output = clipPos * .5; 165 | output.xy = float2(output.x, output.y * _ProjectionParams.x) + output.w; 166 | output.zw = clipPos.zw; 167 | return output; 168 | } 169 | 170 | inline float3 WorldSpaceViewDirection(float4 localPos) { 171 | return _WorldSpaceCameraPos.xyz - mul(UNITY_MATRIX_M, localPos).xyz; 172 | } 173 | 174 | inline float3 WorldSpaceViewDirection(float3 worldPos) { 175 | return _WorldSpaceCameraPos.xyz - worldPos; 176 | } 177 | 178 | inline float IsDithered64(uint2 screenIndex, float alpha) { 179 | uint index = (screenIndex.x % 8) * 8 + screenIndex.y % 8; 180 | return alpha - DITHER_THRESHOLDS_64[index] / 65.0; 181 | } 182 | 183 | inline void DitherClip64(uint2 screenIndex, float alpha) { 184 | clip(IsDithered64(screenIndex, alpha)); 185 | } 186 | 187 | inline float2 TransformTriangleVertexToUV(float4 vertex) { 188 | float2 uv = (vertex.xy + 1.0) * .5; 189 | return uv; 190 | } 191 | 192 | //////////////////////// 193 | // Lighting Functions // 194 | //////////////////////// 195 | 196 | inline float SlopeScaleShadowBias(float3 worldNormal, float biasStrength, float maxBias) { 197 | // return clamp(biasStrength * dot(mul(unity_MatrixVP, float4(worldNormal, 1)), mul(unity_MatrixVP, float4(_SunlightDirection, 1))), 0, maxBias); 198 | return clamp(biasStrength * TanBetween(worldNormal, _SunlightDirection), 0, maxBias); 199 | } 200 | 201 | inline float LegacySlopeScaleShadowBias(float3 worldNormal, float constantBias, float maxBias) { 202 | return constantBias + clamp(TanBetween(worldNormal, _SunlightDirection), 0, maxBias); 203 | } 204 | 205 | inline float4 ShadowNormalBias(float4 worldPos, float3 worldNormal) { 206 | float shadowCos = CosBetween(worldNormal, _SunlightDirection); 207 | float shadowSin = SinOf(shadowCos); 208 | float normalBias = _ShadowNormalBias * shadowSin; 209 | worldPos -= float4(worldNormal * normalBias, 0); 210 | return worldPos; 211 | } 212 | 213 | inline float4 ClipSpaceShadowBias(float4 clipPos) { 214 | #if UNITY_REVERSED_Z 215 | clipPos.z -= saturate(_ShadowBias / clipPos.w); 216 | clipPos.z = min(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE); 217 | #else 218 | clipPos.z += saturate(_ShadowBias / clipPos.w); 219 | clipPos.z = max(clipPos.z, clipPos.w * UNITY_NEAR_CLIP_VALUE) 220 | #endif 221 | return clipPos; 222 | } 223 | 224 | inline float CascadedDirectionalHardShadow(float3 shadowPos, float cascadeIndex) { 225 | return SAMPLE_TEXTURE2D_ARRAY_SHADOW(_SunlightShadowmapArray, sampler_SunlightShadowmapArray, shadowPos, cascadeIndex); 226 | } 227 | 228 | float CascadedDirectionalSoftShadow(float3 shadowPos, float cascadeIndex) { 229 | real tentWeights[9]; 230 | real2 tentUVs[9]; 231 | SampleShadow_ComputeSamples_Tent_5x5(_SunlightShadowmapSize, shadowPos.xy, tentWeights, tentUVs); 232 | float attenuation = 0; 233 | [unroll] 234 | for (uint i = 0; i < 9; i++) attenuation += tentWeights[i] * CascadedDirectionalHardShadow(float3(tentUVs[i].xy, shadowPos.z), cascadeIndex); 235 | return attenuation; 236 | } 237 | 238 | inline float DefaultDirectionalShadow(float3 worldPos) { 239 | float4 shadowPos = mul(sunlight_InverseVP, float4(worldPos, 1)); 240 | shadowPos.xyz /= shadowPos.w; 241 | return lerp(1, SAMPLE_TEXTURE2D_SHADOW(_SunlightShadowmap, sampler_SunlightShadowmap, shadowPos.xyz), _SunlightShadowStrength); 242 | } 243 | 244 | float DefaultCascadedDirectionalShadow(float3 worldPos) { 245 | #if !defined(_SUNLIGHT_SHADOWS) 246 | return 1; 247 | #else 248 | float3 diff = worldPos - _WorldSpaceCameraPos.xyz; 249 | if (dot(diff, diff) > _SunlightShadowDistance * _SunlightShadowDistance) return 1; 250 | float4 cascadeFlags = float4(VertexInsideSphere(worldPos, _SunlightShadowSplitBoundArray[0]), VertexInsideSphere(worldPos, _SunlightShadowSplitBoundArray[1]), VertexInsideSphere(worldPos, _SunlightShadowSplitBoundArray[2]), VertexInsideSphere(worldPos, _SunlightShadowSplitBoundArray[3])); 251 | cascadeFlags.yzw = saturate(cascadeFlags.yzw - cascadeFlags.xyz); 252 | float cascadeIndex = 4 - dot(cascadeFlags, float4(4, 3, 2, 1)); 253 | float4 shadowPos = mul(sunlight_InverseVPArray[cascadeIndex], float4(worldPos, 1)); 254 | shadowPos.xyz /= shadowPos.w; 255 | #if !defined(_SUNLIGHT_SOFT_SHADOWS) 256 | float shadowAttenuation = CascadedDirectionalHardShadow(shadowPos, cascadeIndex); 257 | #else 258 | float shadowAttenuation = CascadedDirectionalSoftShadow(shadowPos, cascadeIndex); 259 | #endif 260 | return lerp(1, shadowAttenuation, _SunlightShadowStrength); 261 | #endif 262 | } 263 | 264 | inline float PointHardShadow(float4 shadowPos, float index) { 265 | float shadow = _PointLightShadowmapArray.Sample(sampler_PointLightShadowmapArray, float4(shadowPos.xyz, index)); 266 | float depth = shadowPos.w; 267 | return depth < shadow; 268 | } 269 | 270 | float PointSoftShadow(float4 shadowPos, float index, float viewDist) { 271 | //todo gonna replace this naive PCF method (terrible shadow bands & performance) 272 | float diskRadius = (1.0 - viewDist * _ZBufferParams.w) * 0.002; 273 | float attenuation = 0; 274 | [unroll] 275 | for (uint i = 0; i < 20; i++) attenuation += PointHardShadow(float4(shadowPos.xyz + POINT_LIGHT_PCF_OFFSET_20[i].xyz * diskRadius, shadowPos.w), index); 276 | attenuation /= 20.0; 277 | /* low sample count but much more terrible shadow bands 278 | [unroll] 279 | for (uint i = 0; i < 6; i++) attenuation += PointHardShadow(float4(shadowPos.xyz + POINT_LIGHT_PCF_OFFSET_6[i].xyz * diskRadius, shadowPos.w), index) * POINT_LIGHT_PCF_OFFSET_6[i].w; 280 | */ 281 | return attenuation; 282 | } 283 | 284 | float DefaultPointShadow(float viewDist, float3 lightDir, float depth, uint3 lightIndex) { 285 | #if !defined(_POINT_LIGHT_SHADOWS) 286 | return 1; 287 | #else 288 | PointLight light = _PointLightBuffer[_CulledPointLightTexture[lightIndex]]; 289 | uint shadowIndex = light.shadowIndex; 290 | if (shadowIndex == 0) return 1; 291 | shadowIndex--; 292 | float4 shadowPos = float4(lightDir, depth); 293 | #if !defined(_POINT_LIGHT_SOFT_SHADOWS) 294 | float shadowAttenuation = PointHardShadow(shadowPos, shadowIndex); 295 | #else 296 | float shadowAttenuation = PointSoftShadow(shadowPos, shadowIndex, viewDist); 297 | #endif 298 | return lerp(1, shadowAttenuation, light.shadowStrength); 299 | #endif 300 | } 301 | 302 | inline float SpotHardShadow(float3 shadowPos, uint index) { 303 | return SAMPLE_TEXTURE2D_ARRAY_SHADOW(_SpotLightShadowmapArray, sampler_SpotLightShadowmapArray, shadowPos, index); 304 | } 305 | 306 | float SpotSoftShadow(float3 shadowPos, uint index) { 307 | real tentWeights[9]; 308 | real2 tentUVs[9]; 309 | SampleShadow_ComputeSamples_Tent_5x5(_SpotLightShadowmapSize, shadowPos.xy, tentWeights, tentUVs); 310 | float attenuation = 0; 311 | [unroll] 312 | for (uint i = 0; i < 9; i++) attenuation += tentWeights[i] * SpotHardShadow(float3(tentUVs[i].xy, shadowPos.z), index); 313 | return attenuation; 314 | } 315 | 316 | float DefaultSpotShadow(float3 worldPos, uint3 lightIndex) { 317 | #if !defined(_SPOT_LIGHT_SHADOWS) 318 | return 1; 319 | #else 320 | SpotLight light = _SpotLightBuffer[_CulledSpotLightTexture[lightIndex]]; 321 | uint shadowIndex = light.shadowIndex; 322 | if (shadowIndex == 0) return 1; 323 | shadowIndex--; 324 | float4 shadowPos = mul(spotLight_InverseVPBuffer[shadowIndex], float4(worldPos, 1)); 325 | shadowPos.xyz /= shadowPos.w; 326 | #if !defined(_SPOT_LIGHT_SOFT_SHADOWS) 327 | float shadowAttenuation = SpotHardShadow(shadowPos, shadowIndex); 328 | #else 329 | float shadowAttenuation = SpotSoftShadow(shadowPos, shadowIndex); 330 | #endif 331 | return lerp(1, shadowAttenuation, light.shadowStrength); 332 | #endif 333 | } 334 | 335 | inline float3 DefaultDirectionalLit(float3 worldPos, float3 worldNormal) { 336 | float diffuse = saturate(dot(worldNormal, _SunlightDirection)); 337 | float shadow = DefaultCascadedDirectionalShadow(worldPos); 338 | return diffuse * _SunlightColor * shadow; 339 | } 340 | 341 | inline float3 DefaultPointLit(float3 worldPos, float3 worldNormal, uint3 lightIndex) { 342 | PointLight light = _PointLightBuffer[_CulledPointLightTexture[lightIndex]]; 343 | float3 lightDir = light.sphere.xyz - worldPos; 344 | float lightDist = length(lightDir); 345 | lightDir /= lightDist; 346 | float distanceSqr = lightDist * lightDist; 347 | float rangeFade = distanceSqr * 1.0 / max(light.sphere.w * light.sphere.w, .00001); 348 | rangeFade = saturate(1.0 - rangeFade * rangeFade); 349 | rangeFade *= rangeFade; 350 | float diffuse = saturate(dot(worldNormal, lightDir)); 351 | diffuse *= rangeFade / distanceSqr; 352 | float radius = light.sphere.w; 353 | float shadow = DefaultPointShadow(distance(worldPos, _WorldSpaceCameraPos), -lightDir, lightDist / radius, lightIndex); 354 | return diffuse * light.color * shadow; 355 | } 356 | 357 | inline float3 DefaultSpotLit(float3 worldPos, float3 worldNormal, uint3 lightIndex) { 358 | SpotLight light = _SpotLightBuffer[_CulledSpotLightTexture[lightIndex]]; 359 | float3 lightDir = light.cone.vertex - worldPos; 360 | float lightDist = length(lightDir); 361 | lightDir /= lightDist; 362 | float distanceSqr = lightDist * lightDist; 363 | float rangeFade = distanceSqr * 1.0 / max(light.cone.height * light.cone.height, .00001); 364 | rangeFade = saturate(1.0 - rangeFade * rangeFade); 365 | rangeFade *= rangeFade; 366 | float cosAngle = cos(light.cone.angle); 367 | float angleRangeInv = 1.0 / max(cos(light.smallAngle) - cosAngle, .00001); 368 | float spotFade = dot(light.cone.direction, lightDir); 369 | spotFade = saturate((spotFade - cosAngle) * angleRangeInv); 370 | float diffuse = saturate(dot(worldNormal, lightDir)); 371 | diffuse *= rangeFade * spotFade / distanceSqr; 372 | float shadow = DefaultSpotShadow(worldPos, lightIndex); 373 | return diffuse * light.color * shadow; 374 | } 375 | 376 | ////////////////////////////////////// 377 | // Built-in Vertex/Fragment Shaders // 378 | ////////////////////////////////////// 379 | 380 | BasicVertexOutput UnlitVertex(BasicVertexInput input) { 381 | UNITY_SETUP_INSTANCE_ID(input); 382 | BasicVertexOutput output; 383 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos.xyz)); 384 | return output; 385 | } 386 | 387 | ImageVertexOutput ImageVertex(ImageVertexInput input) { 388 | ImageVertexOutput output; 389 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos.xyz)); 390 | // output.uv = TRANSFORM_TEX(input.uv, _MainTex); 391 | output.uv = input.uv; 392 | return output; 393 | } 394 | 395 | float4 UnlitFragment(BasicVertexOutput input) : SV_TARGET { 396 | return 1; 397 | } 398 | 399 | float4 NoneFragment(BasicVertexOutput input) : SV_TARGET { 400 | return 0; 401 | } 402 | 403 | ShadowVertexOutput ShadowCasterVertex(SimpleVertexInput input) { 404 | UNITY_SETUP_INSTANCE_ID(input); 405 | ShadowVertexOutput output; 406 | float3 worldNormal = GetWorldNormal(input.normal); 407 | float4 worldPos = GetWorldPosition(input.pos.xyz); 408 | output.worldPos = worldPos; 409 | output.clipPos = ClipSpaceShadowBias(GetClipPosition(ShadowNormalBias(worldPos, worldNormal))); 410 | return output; 411 | } 412 | 413 | float4 ShadowCasterFragment(ShadowVertexOutput input) : SV_TARGET { 414 | return distance(input.worldPos.xyz, _LightPos.xyz) / _LightPos.w; 415 | } 416 | 417 | #endif // SRP_INCLUDE -------------------------------------------------------------------------------- /Assets/Shaders/SRPInclude.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6aae78ff3c6764f8d802211dc58c4900 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/StandardBlit.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/StandardBlit" { 2 | 3 | Properties { 4 | _MainTex ("Main Texture", 2D) = "" { } 5 | } 6 | 7 | SubShader { 8 | 9 | Tags { 10 | "RenderType"="Opaque" 11 | } 12 | 13 | Pass { 14 | 15 | Name "COPY" 16 | 17 | ZTest Always 18 | ZWrite Off 19 | Cull Off 20 | 21 | HLSLPROGRAM 22 | #pragma target 5.0 23 | 24 | #pragma vertex Vertex 25 | #pragma fragment Fragment 26 | 27 | #include "SRPInclude.hlsl" 28 | 29 | ImageVertexOutput Vertex(ImageVertexInput input) { 30 | ImageVertexOutput output; 31 | // output.clipPos = float4(input.pos.xy, 0, 1); 32 | // output.uv = TransformTriangleVertexToUV(input.pos) 33 | output.clipPos = float4(input.pos.xy * 2.0 - 1.0, 0, 1); 34 | output.uv = input.uv; 35 | 36 | #if UNITY_UV_STARTS_AT_TOP 37 | output.uv = output.uv * float2(1.0, -1.0) + float2(0.0, 1.0); 38 | #endif 39 | 40 | output.uv = output.uv * _MainTex_ST.xy + _MainTex_ST.zw; 41 | 42 | return output; 43 | } 44 | 45 | float4 Fragment(ImageVertexOutput input) : SV_TARGET { 46 | return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv); 47 | } 48 | 49 | ENDHLSL 50 | } 51 | 52 | Pass { 53 | 54 | Name "VERTICALFLIP" 55 | 56 | ZTest Always 57 | ZWrite Off 58 | Cull Off 59 | 60 | HLSLPROGRAM 61 | #pragma target 3.5 62 | 63 | #pragma vertex Vertex 64 | #pragma fragment Fragment 65 | 66 | #include "SRPInclude.hlsl" 67 | 68 | ImageVertexOutput Vertex(ImageVertexInput input) { 69 | ImageVertexOutput output; 70 | output.clipPos = float4(input.pos.xy, 0, 1); 71 | output.uv = (input.pos.xy + 1) * 0.5; 72 | output.uv.y = 1 - output.uv.y; 73 | 74 | #if UNITY_UV_STARTS_AT_TOP 75 | output.uv = output.uv * float2(1, -1) + float2(0, 1); 76 | #endif 77 | 78 | return output; 79 | } 80 | 81 | float4 Fragment(ImageVertexOutput input) : SV_TARGET { 82 | return SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, input.uv); 83 | } 84 | 85 | ENDHLSL 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /Assets/Shaders/StandardBlit.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 796a924f9ac34460eac7027e673b66b5 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/TBRCompute.compute: -------------------------------------------------------------------------------- 1 | #pragma kernel GenerateDepthBound 2 | #pragma kernel GenerateDepthMask 3 | #pragma kernel GenerateDepthFrustum 4 | #pragma kernel CullPointLight 5 | #pragma kernel CullSpotLight 6 | #pragma kernel CullDecal 7 | 8 | #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" 9 | 10 | #include "ComputeUtils.hlsl" 11 | 12 | #define MAXPOINTLIGHTPERTILE 16 13 | #define MAXSPOTLIGHTPERTILE 4 14 | #define MAXDECALPERTILE 4 15 | 16 | Texture2D _DepthTexture; 17 | Texture2D _OpaqueDepthTexture; 18 | 19 | RWTexture2D _DepthMaskTexture; 20 | RWTexture2D _DepthBoundTexture; 21 | RWTexture3D _DepthFrustumTexture; 22 | RWTexture3D _CulledPointLightTexture; 23 | RWTexture3D _CulledSpotLightTexture; 24 | 25 | StructuredBuffer _PointLightBuffer; 26 | StructuredBuffer _SpotLightBuffer; 27 | 28 | uint _PointLightCount; 29 | uint _SpotLightCount; 30 | float2 _TileNumber; 31 | float3 _CameraForward; 32 | float3 _CameraPosition; 33 | 34 | [numthreads(16,9,1)] 35 | void GenerateDepthBound(uint2 id : SV_DISPATCHTHREADID) { 36 | const uint tileResolution = 16; 37 | uint baseX = id.x * tileResolution; 38 | uint baseY = id.y * tileResolution; 39 | 40 | float min = 1; 41 | float max = 0; 42 | 43 | for (uint i = 0; i < tileResolution; ++i) { 44 | for (uint j = 0; j < tileResolution; ++j) { 45 | uint2 index = uint2(baseX + i, baseY + j); 46 | float depth = _DepthTexture[index]; 47 | float opaqueDepth = _OpaqueDepthTexture[index]; 48 | #if UNITY_REVERSED_Z 49 | if (opaqueDepth < min) min = opaqueDepth; 50 | #else 51 | if (opaqueDepth > max) max = opaqueDepth; 52 | #endif 53 | if (depth > max) max = depth; 54 | if (depth < min) min = depth; 55 | } 56 | } 57 | 58 | _DepthBoundTexture[id.xy] = float4(LinearEyeDepth(min, _ZBufferParams), LinearEyeDepth(max, _ZBufferParams), UnprojectScreenSpaceToViewSpace(float4(0, 0, min, 1)).z, UnprojectScreenSpaceToViewSpace(float4(0, 0, max, 1)).z); 59 | } 60 | 61 | [numthreads(16, 9, 1)] 62 | void GenerateDepthMask(uint2 id : SV_DISPATCHTHREADID) { 63 | const uint tileResolution = 16; 64 | uint baseX = id.x * tileResolution; 65 | uint baseY = id.y * tileResolution; 66 | 67 | uint depthMask = 0; 68 | float2 minMax = _DepthBoundTexture[id.xy].xy; 69 | float invDepthRange = 32.0f / (minMax.y - minMax.x); 70 | 71 | for (uint i = 0; i < tileResolution; ++i) { 72 | for (uint j = 0; j < tileResolution; ++j) { 73 | uint2 index = uint2(baseX + i, baseY + j); 74 | /* 75 | float depth = UnprojectScreenSpaceToViewSpace(float4(0, 0, _DepthTexture[index], 1)).z; 76 | float opaqueDepth = UnprojectScreenSpaceToViewSpace(float4(0, 0, _OpaqueDepthTexture[index], 1)).z; 77 | */ 78 | float depth = LinearEyeDepth(_DepthTexture[index], _ZBufferParams); 79 | float opaqueDepth = LinearEyeDepth(_OpaqueDepthTexture[index], _ZBufferParams); 80 | uint bitMask = max(0, min(32, floor((depth - minMax.x) * invDepthRange))); 81 | depthMask |= 1 << bitMask; 82 | bitMask = max(0, min(32, floor((opaqueDepth - minMax.x) * invDepthRange))); 83 | depthMask |= 1 << bitMask; 84 | } 85 | } 86 | 87 | _DepthMaskTexture[id.xy] = depthMask; 88 | } 89 | 90 | [numthreads(16, 9, 1)] 91 | void GenerateDepthFrustum(uint2 id : SV_DISPATCHTHREADID) { 92 | const float nearZ = 1; 93 | float2 eyeDepthBound; 94 | float4 cornerUV; 95 | cornerUV.xy = id / _TileNumber; 96 | cornerUV.zw = cornerUV.xy + 1.0 / _TileNumber; 97 | cornerUV.xy = cornerUV.xy * 2 - 1; 98 | cornerUV.zw = cornerUV.zw * 2 - 1; 99 | 100 | #if UNITY_REVERSED_Z 101 | const float flagA = 1; 102 | const float flagB = -1; 103 | eyeDepthBound = _DepthBoundTexture[id].yx; 104 | #else 105 | const float flagA = -1; 106 | const float flagB = 1; 107 | eyeDepthBound = _DepthBoundTexture[id].xy; 108 | #endif 109 | 110 | // float2 eyeDepthBound = float2(LinearEyeDepth(minMax.x, _ZBufferParams), LinearEyeDepth(minMax.y, _ZBufferParams)); 111 | 112 | _DepthFrustumTexture[uint3(id, 0)] = GetPlane(mul(unity_InverseVP, float4(flagA, cornerUV.w, nearZ, 1)), mul(unity_InverseVP, float4(flagB, cornerUV.w, nearZ, 1)), mul(unity_InverseVP, float4(0, cornerUV.w, .5, 1))); 113 | _DepthFrustumTexture[uint3(id, 1)] = GetPlane(mul(unity_InverseVP, float4(flagB, cornerUV.y, nearZ, 1)), mul(unity_InverseVP, float4(flagA, cornerUV.y, nearZ, 1)), mul(unity_InverseVP, float4(0, cornerUV.y, .5, 1))); 114 | _DepthFrustumTexture[uint3(id, 2)] = GetPlane(mul(unity_InverseVP, float4(cornerUV.x, flagA, nearZ, 1)), mul(unity_InverseVP, float4(cornerUV.x, flagB, nearZ, 1)), mul(unity_InverseVP, float4(cornerUV.x, 0, .5, 1))); 115 | _DepthFrustumTexture[uint3(id, 3)] = GetPlane(mul(unity_InverseVP, float4(cornerUV.z, flagB, nearZ, 1)), mul(unity_InverseVP, float4(cornerUV.z, flagA, nearZ, 1)), mul(unity_InverseVP, float4(cornerUV.z, 0, .5, 1))); 116 | _DepthFrustumTexture[uint3(id, 4)] = GetPlane(-_CameraForward, _CameraPosition + _CameraForward * eyeDepthBound.x); 117 | _DepthFrustumTexture[uint3(id, 5)] = GetPlane(_CameraForward, _CameraPosition + _CameraForward * eyeDepthBound.y); 118 | } 119 | 120 | [numthreads(16, 9, 1)] 121 | void CullPointLight(uint2 id : SV_DISPATCHTHREADID) { 122 | float4 planes[6]; 123 | 124 | planes[0] = _DepthFrustumTexture[uint3(id, 0)]; 125 | planes[1] = _DepthFrustumTexture[uint3(id, 1)]; 126 | planes[2] = _DepthFrustumTexture[uint3(id, 2)]; 127 | planes[3] = _DepthFrustumTexture[uint3(id, 3)]; 128 | planes[4] = _DepthFrustumTexture[uint3(id, 4)]; 129 | planes[5] = _DepthFrustumTexture[uint3(id, 5)]; 130 | 131 | uint lightCount = 0; 132 | uint3 lightCountIndex = uint3(id, 0); 133 | 134 | float2 minMax = _DepthBoundTexture[id.xy].xy; 135 | float invDepthRange = 32.0f / (minMax.y - minMax.x); 136 | uint tileDepthMask = _DepthMaskTexture[id.xy]; 137 | 138 | for (uint i = 0; lightCount < MAXPOINTLIGHTPERTILE && i < _PointLightCount; ++i) { 139 | PointLight light = _PointLightBuffer[i]; 140 | if (SphereIntersect(light.sphere, planes) > .5) { 141 | uint3 index = uint3(id, lightCount + 1); 142 | /* 143 | float lightPosDepth = LinearEyeDepth(light.sphere.xyz, unity_MatrixV); 144 | float minDepth = lightPosDepth - light.sphere.r; 145 | float maxDepth = lightPosDepth + light.sphere.r; 146 | uint depthMask = 0xFFFFFFF; 147 | uint depthMaskStart = max(0, min(32, floor((minDepth - minMax.x) * invDepthRange))); 148 | uint depthMaskEnd = max(0, min(32, floor((maxDepth - minMax.x) * invDepthRange))); 149 | depthMask >>= 31 - (depthMaskEnd - depthMaskStart); 150 | depthMask <<= depthMaskStart; 151 | 152 | if (tileDepthMask & depthMask) { 153 | _CulledPointLightTexture[index] = i; 154 | lightCount++; 155 | } 156 | */ 157 | _CulledPointLightTexture[index] = i; 158 | lightCount++; 159 | } 160 | } 161 | 162 | _CulledPointLightTexture[lightCountIndex] = lightCount; 163 | } 164 | 165 | [numthreads(16, 9, 1)] 166 | void CullSpotLight(uint2 id : SV_DISPATCHTHREADID) { 167 | float4 planes[6]; 168 | 169 | planes[0] = _DepthFrustumTexture[uint3(id, 0)]; 170 | planes[1] = _DepthFrustumTexture[uint3(id, 1)]; 171 | planes[2] = _DepthFrustumTexture[uint3(id, 2)]; 172 | planes[3] = _DepthFrustumTexture[uint3(id, 3)]; 173 | planes[4] = _DepthFrustumTexture[uint3(id, 4)]; 174 | planes[5] = _DepthFrustumTexture[uint3(id, 5)]; 175 | 176 | uint lightCount = 0; 177 | uint3 lightCountIndex = uint3(id, 0); 178 | 179 | for (uint i = 0; lightCount < MAXSPOTLIGHTPERTILE && i < _SpotLightCount; ++i) { 180 | SpotLight light = _SpotLightBuffer[i]; 181 | if (ConeIntersect(light.cone, planes) > .5) { 182 | uint3 index = uint3(id, lightCount + 1); 183 | _CulledSpotLightTexture[index] = i; 184 | lightCount++; 185 | } 186 | 187 | } 188 | 189 | _CulledSpotLightTexture[lightCountIndex] = lightCount; 190 | } 191 | 192 | [numthreads(16, 9, 1)] 193 | void CullDecal(uint2 id : SV_DISPATCHTHREADID) { 194 | float4 planes[6]; 195 | 196 | planes[0] = _DepthFrustumTexture[uint3(id, 0)]; 197 | planes[1] = _DepthFrustumTexture[uint3(id, 1)]; 198 | planes[2] = _DepthFrustumTexture[uint3(id, 2)]; 199 | planes[3] = _DepthFrustumTexture[uint3(id, 3)]; 200 | planes[4] = _DepthFrustumTexture[uint3(id, 4)]; 201 | planes[5] = _DepthFrustumTexture[uint3(id, 5)]; 202 | 203 | uint decalCount = 0; 204 | uint3 decalCountIndex = uint3(id, 0); 205 | } -------------------------------------------------------------------------------- /Assets/Shaders/TBRCompute.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cfe11d383a0604dd0ac41c8200327321 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 65540 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/Test.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/Test" { 2 | 3 | Properties { 4 | _TestInt ("Test Int", Int) = -1 5 | } 6 | 7 | SubShader { 8 | 9 | Tags { 10 | "RenderType"="Opaque" 11 | } 12 | 13 | Pass { 14 | 15 | ZTest Always 16 | ZWrite Off 17 | Cull Off 18 | 19 | HLSLPROGRAM 20 | #pragma target 5.0 21 | 22 | #pragma vertex Vertex 23 | #pragma fragment Fragment 24 | 25 | #include "SRPInclude.hlsl" 26 | 27 | float _TestInt; 28 | 29 | ImageVertexOutput Vertex(ImageVertexInput input) { 30 | ImageVertexOutput output; 31 | output.clipPos = GetClipPosition(GetWorldPosition(input.pos.xyz)); 32 | output.uv = input.uv; 33 | return output; 34 | } 35 | 36 | float4 Fragment(ImageVertexOutput input) : SV_TARGET { 37 | /* 38 | if (_TestInt >= 0 && _TestInt <= 5) { 39 | float3 dir = float3(0, 0, 0); 40 | float a1 = (input.uv.x - .5) * 2; 41 | float a2 = (input.uv.y - .5) * 2; 42 | // return float4(input.uv, 0, 1); 43 | switch (_TestInt) { 44 | case 0: dir = float3(1, a1, a2); break; 45 | case 1: dir = float3(-1, a1, a2); break; 46 | case 2: dir = float3(a1, 1, a2); break; 47 | case 3: dir = float3(a1, -1, a2); break; 48 | case 4: dir = float3(a1, a2, 1); break; 49 | case 5: dir = float3(a1, a2, -1); break; 50 | } 51 | 52 | dir = normalize(dir); 53 | return SAMPLE_TEXTURECUBE(_PointLightShadowmap, sampler_PointLightShadowmap, dir) > 0; 54 | } 55 | */ 56 | float4 c = SAMPLE_TEXTURE2D(_OpaqueDepthTexture, sampler_OpaqueDepthTexture, input.uv); 57 | // return c; 58 | float t = c.r + c.g + c.b; 59 | float a = 1 - c.r; 60 | return float4(a, a , a, 1); 61 | /* 62 | uint2 lightTextureIndex = uint2(_ScreenParams.x * input.uv.x / 16.0, _ScreenParams.y * input.uv.y / 16.0); 63 | uint lightCount = _CulledPointLightTexture[uint3(lightTextureIndex, 0)]; 64 | // lightCount += _CulledSpotLightTexture[uint3(lightTextureIndex, 0)]; 65 | // lightCount = min(lightCount, 1); 66 | 67 | float4 color = float4(0, 0, 0, 1); 68 | 69 | [loop] 70 | for (uint i = 0; i < lightCount; ++i) { 71 | PointLight light = _PointLightBuffer[_CulledPointLightTexture[uint3(lightTextureIndex, i + 1)]]; 72 | color.rgb = light.color; 73 | } 74 | 75 | // color = float4(lightTextureIndex.x / 160.0, lightTextureIndex.y / 90.0, 0, 1); 76 | 77 | // return float4(input.uv, 0, 1); 78 | 79 | switch (lightCount) { 80 | case 1: color.r = 1; break; 81 | case 2: color.g = 1; break; 82 | case 3: color.b = 1; break; 83 | case 4: color.rg = float2(.5, .5); break; 84 | case 5: color.rb = float2(.5, .5); break; 85 | case 6: color.gb = float2(.5, .5); break; 86 | case 7: color.rgb = float3(.5, .5, .5); break; 87 | case 8: color.rg = float2(1, 1); break; 88 | case 9: color.rb = float2(1, 1); break; 89 | case 10: color.gb = float2(1, 1); break; 90 | } 91 | 92 | if (lightCount == 1) color.r = 1; 93 | else if (lightCount == 2) color.g = 1; 94 | else if (lightCount == 3) color.b = 1; 95 | else if (lightCount == 4) color.rg = float2(.5, .5); 96 | 97 | return color; 98 | */ 99 | } 100 | 101 | ENDHLSL 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /Assets/Shaders/Test.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6d5c8889edb074179920871963236df0 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/TransparentDepth.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/TransparentDepth" { 2 | 3 | SubShader { 4 | 5 | Tags { 6 | "Queue" = "Transparent" 7 | "RenderType" = "Transparent" 8 | } 9 | 10 | Pass { 11 | 12 | Name "DEPTH" 13 | 14 | Tags { 15 | "LightMode" = "Depth" 16 | } 17 | 18 | ZTest Less 19 | ZWrite On 20 | Cull Back 21 | 22 | HLSLPROGRAM 23 | 24 | #pragma target 5.0 25 | 26 | #pragma vertex UnlitVertex 27 | #pragma fragment Fragment 28 | #pragma multi_compile_instancing 29 | 30 | #include "SRPInclude.hlsl" 31 | 32 | float4 Fragment(BasicVertexOutput input) : SV_TARGET { 33 | return float4(1, 0, 0, 1); 34 | } 35 | 36 | ENDHLSL 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Assets/Shaders/TransparentDepth.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b315fad4db3964753a0755d064b3dbc6 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/TransparentLitColor.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/TransparentLitColor" { 2 | 3 | Properties { 4 | _Color("Color", Color) = (0, 0, 0, 1) 5 | } 6 | 7 | SubShader { 8 | 9 | Tags { 10 | "Queue" = "Transparent" 11 | "RenderType" = "Transparent" 12 | } 13 | 14 | UsePass "SRP/TransparentDepth/DEPTH" 15 | 16 | Pass { 17 | 18 | ZTest Equal 19 | ZWrite Off 20 | Cull Back 21 | Blend SrcAlpha OneMinusSrcAlpha 22 | 23 | HLSLPROGRAM 24 | #pragma target 5.0 25 | 26 | #pragma vertex Vertex 27 | #pragma fragment Fragment 28 | #pragma multi_compile_instancing 29 | 30 | #pragma multi_compile __ _SUNLIGHT_SHADOWS 31 | #pragma multi_compile __ _SUNLIGHT_SOFT_SHADOWS 32 | #pragma multi_compile __ _POINT_LIGHT_SHADOWS 33 | #pragma multi_compile __ _POINT_LIGHT_SOFT_SHADOWS 34 | #pragma multi_compile __ _SPOT_LIGHT_SHADOWS 35 | #pragma multi_compile __ _SPOT_LIGHT_SOFT_SHADOWS 36 | #include "SRPInclude.hlsl" 37 | 38 | struct VertexOutput { 39 | float4 clipPos : SV_POSITION; 40 | float4 worldPos : TEXCOORD0; 41 | float3 normal : TEXCOORD1; 42 | float3 viewDir : TEXCOORD2; 43 | UNITY_VERTEX_INPUT_INSTANCE_ID 44 | }; 45 | 46 | UNITY_INSTANCING_BUFFER_START(UnityPerMaterial) 47 | UNITY_DEFINE_INSTANCED_PROP(float4, _Color) 48 | UNITY_INSTANCING_BUFFER_END(UnityPerMaterial) 49 | 50 | VertexOutput Vertex(SimpleVertexInput input) { 51 | VertexOutput output; 52 | UNITY_SETUP_INSTANCE_ID(input); 53 | UNITY_TRANSFER_INSTANCE_ID(input, output); 54 | output.worldPos = GetWorldPosition(input.pos.xyz); 55 | output.clipPos = GetClipPosition(output.worldPos); 56 | output.normal = GetWorldNormal(input.normal); 57 | output.viewDir = normalize(WorldSpaceViewDirection(output.worldPos)); 58 | return output; 59 | } 60 | 61 | float4 Fragment(VertexOutput input, float4 screenPos : SV_POSITION) : SV_TARGET { 62 | UNITY_SETUP_INSTANCE_ID(input); 63 | 64 | uint2 screenIndex = screenPos.xy; 65 | 66 | float4 c = UNITY_ACCESS_INSTANCED_PROP(UnityPerMaterial, _Color); 67 | float3 color = c.rgb; 68 | float alpha = c.a; 69 | float3 normal = normalize(input.normal); 70 | 71 | uint2 lightTextureIndex = screenIndex / 16; 72 | uint3 lightCountIndex = uint3(lightTextureIndex, 0); 73 | uint3 lightIndex = lightCountIndex; 74 | uint pointLightCount = _CulledPointLightTexture[lightCountIndex]; 75 | uint spotLightCount = _CulledSpotLightTexture[lightCountIndex]; 76 | float3 litColor = DefaultDirectionalLit(input.worldPos, normal); 77 | 78 | [loop] 79 | for (uint i = 0; i < pointLightCount; ++i) { 80 | lightIndex.z += 1; 81 | litColor += DefaultPointLit(input.worldPos, normal, uint3(lightTextureIndex, i + 1)); 82 | } 83 | 84 | lightIndex = lightCountIndex; 85 | 86 | [loop] 87 | for (i = 0; i < spotLightCount; ++i) { 88 | lightIndex.z += 1; 89 | litColor += DefaultSpotLit(input.worldPos, normal, lightIndex); 90 | } 91 | 92 | return float4(litColor * color, alpha); 93 | } 94 | 95 | ENDHLSL 96 | } 97 | /* 98 | Pass { 99 | 100 | Tags { 101 | "LightMode"="ShadowCaster" 102 | } 103 | 104 | HLSLPROGRAM 105 | 106 | #pragma target 3.5 107 | 108 | #pragma vertex ShadowCasterVertex 109 | #pragma fragment ShadowCasterFragment 110 | 111 | #pragma multi_compile_instancing 112 | #pragma instancing_options assumeuniformscaling 113 | 114 | #include "SRPInclude.hlsl" 115 | 116 | ENDHLSL 117 | } 118 | */ 119 | } 120 | } -------------------------------------------------------------------------------- /Assets/Shaders/TransparentLitColor.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 553b8a941a6554afeb89e48490163626 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/Unlit.shader: -------------------------------------------------------------------------------- 1 | Shader "SRP/Unlit" { 2 | 3 | SubShader { 4 | 5 | Pass { 6 | HLSLPROGRAM 7 | 8 | #pragma target 5.0 9 | 10 | #pragma multi_compile_instancing 11 | 12 | #pragma vertex UnlitVertex 13 | #pragma fragment UnlitFragment 14 | 15 | #include "SRPInclude.hlsl" 16 | 17 | ENDHLSL 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Assets/Shaders/Unlit.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33af3c9594b374bad89d5c91b4c3315a 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8351f33e2e7584b1f8f2c0d85b8ccfda 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Textures/Alpha Texture 0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuardHei/SRP/57abd23054c2414a0d43d17472144866ee2da09e/Assets/Textures/Alpha Texture 0.png -------------------------------------------------------------------------------- /Assets/Textures/Alpha Texture 0.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2eece513519d44ea0807ca41dbe6f35a 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | spriteSheet: 74 | serializedVersion: 2 75 | sprites: [] 76 | outline: [] 77 | physicsShape: [] 78 | bones: [] 79 | spriteID: 80 | internalID: 0 81 | vertices: [] 82 | indices: 83 | edges: [] 84 | weights: [] 85 | secondaryTextures: [] 86 | spritePackingTag: 87 | pSDRemoveMatte: 0 88 | pSDShowRemoveMatteOption: 0 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/Textures/Alpha Texture 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuardHei/SRP/57abd23054c2414a0d43d17472144866ee2da09e/Assets/Textures/Alpha Texture 1.png -------------------------------------------------------------------------------- /Assets/Textures/Alpha Texture 1.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 179f1a57edecd4562ab71fa0772b5010 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | spriteSheet: 74 | serializedVersion: 2 75 | sprites: [] 76 | outline: [] 77 | physicsShape: [] 78 | bones: [] 79 | spriteID: 80 | internalID: 0 81 | vertices: [] 82 | indices: 83 | edges: [] 84 | weights: [] 85 | secondaryTextures: [] 86 | spritePackingTag: 87 | pSDRemoveMatte: 0 88 | pSDShowRemoveMatteOption: 0 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/Textures/Alpha Texture 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuardHei/SRP/57abd23054c2414a0d43d17472144866ee2da09e/Assets/Textures/Alpha Texture 2.png -------------------------------------------------------------------------------- /Assets/Textures/Alpha Texture 2.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97999fbf288f5467b9e05d0af9c51e45 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | spriteSheet: 74 | serializedVersion: 2 75 | sprites: [] 76 | outline: [] 77 | physicsShape: [] 78 | bones: [] 79 | spriteID: 80 | internalID: 0 81 | vertices: [] 82 | indices: 83 | edges: [] 84 | weights: [] 85 | secondaryTextures: [] 86 | spritePackingTag: 87 | pSDRemoveMatte: 0 88 | pSDShowRemoveMatteOption: 0 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /Assets/Textures/Test Texture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GuardHei/SRP/57abd23054c2414a0d43d17472144866ee2da09e/Assets/Textures/Test Texture.png -------------------------------------------------------------------------------- /Assets/Textures/Test Texture.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37f4fa1b18e2b42029840c46560256a3 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 10 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 3 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 2048 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 1 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | forceMaximumCompressionQuality_BC6H_BC7: 0 73 | spriteSheet: 74 | serializedVersion: 2 75 | sprites: [] 76 | outline: [] 77 | physicsShape: [] 78 | bones: [] 79 | spriteID: 80 | internalID: 0 81 | vertices: [] 82 | indices: 83 | edges: [] 84 | weights: [] 85 | secondaryTextures: [] 86 | spritePackingTag: 87 | pSDRemoveMatte: 0 88 | pSDShowRemoveMatteOption: 0 89 | userData: 90 | assetBundleName: 91 | assetBundleVariant: 92 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 GuardHei 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.analytics": "3.3.5", 4 | "com.unity.burst": "1.2.3", 5 | "com.unity.cinemachine": "2.5.0", 6 | "com.unity.collab-proxy": "2.0.0-preview.17", 7 | "com.unity.collections": "0.5.2-preview.8", 8 | "com.unity.ide.rider": "1.2.1", 9 | "com.unity.ide.visualstudio": "2.0.0", 10 | "com.unity.ide.vscode": "1.1.4", 11 | "com.unity.purchasing": "2.0.6", 12 | "com.unity.quicksearch": "1.5.1", 13 | "com.unity.render-pipelines.core": "7.2.1", 14 | "com.unity.textmeshpro": "3.0.0-preview.1", 15 | "com.unity.timeline": "1.2.12", 16 | "com.unity.ugui": "1.0.0", 17 | "com.unity.modules.ai": "1.0.0", 18 | "com.unity.modules.androidjni": "1.0.0", 19 | "com.unity.modules.animation": "1.0.0", 20 | "com.unity.modules.assetbundle": "1.0.0", 21 | "com.unity.modules.audio": "1.0.0", 22 | "com.unity.modules.cloth": "1.0.0", 23 | "com.unity.modules.director": "1.0.0", 24 | "com.unity.modules.imageconversion": "1.0.0", 25 | "com.unity.modules.imgui": "1.0.0", 26 | "com.unity.modules.jsonserialize": "1.0.0", 27 | "com.unity.modules.particlesystem": "1.0.0", 28 | "com.unity.modules.physics": "1.0.0", 29 | "com.unity.modules.physics2d": "1.0.0", 30 | "com.unity.modules.screencapture": "1.0.0", 31 | "com.unity.modules.terrain": "1.0.0", 32 | "com.unity.modules.terrainphysics": "1.0.0", 33 | "com.unity.modules.tilemap": "1.0.0", 34 | "com.unity.modules.ui": "1.0.0", 35 | "com.unity.modules.uielements": "1.0.0", 36 | "com.unity.modules.umbra": "1.0.0", 37 | "com.unity.modules.unityanalytics": "1.0.0", 38 | "com.unity.modules.unitywebrequest": "1.0.0", 39 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 40 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 41 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 42 | "com.unity.modules.unitywebrequestwww": "1.0.0", 43 | "com.unity.modules.vehicles": "1.0.0", 44 | "com.unity.modules.video": "1.0.0", 45 | "com.unity.modules.vr": "1.0.0", 46 | "com.unity.modules.wind": "1.0.0", 47 | "com.unity.modules.xr": "1.0.0" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /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 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/BurstAotSettings_StandaloneOSX.json: -------------------------------------------------------------------------------- 1 | { 2 | "MonoBehaviour": { 3 | "m_Enabled": true, 4 | "m_EditorHideFlags": 0, 5 | "m_Name": "", 6 | "m_EditorClassIdentifier": "Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", 7 | "DisableOptimisations": false, 8 | "DisableSafetyChecks": true, 9 | "DisableBurstCompilation": false 10 | } 11 | } -------------------------------------------------------------------------------- /ProjectSettings/BurstAotSettings_StandaloneWindows.json: -------------------------------------------------------------------------------- 1 | { 2 | "MonoBehaviour": { 3 | "m_Enabled": true, 4 | "m_EditorHideFlags": 0, 5 | "m_Name": "", 6 | "m_EditorClassIdentifier": "Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", 7 | "DisableOptimisations": false, 8 | "DisableSafetyChecks": true, 9 | "DisableBurstCompilation": false 10 | } 11 | } -------------------------------------------------------------------------------- /ProjectSettings/BurstAotSettings_WebGL.json: -------------------------------------------------------------------------------- 1 | { 2 | "MonoBehaviour": { 3 | "m_Enabled": true, 4 | "m_EditorHideFlags": 0, 5 | "m_Name": "", 6 | "m_EditorClassIdentifier": "Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", 7 | "DisableOptimisations": false, 8 | "DisableSafetyChecks": true, 9 | "DisableBurstCompilation": false 10 | } 11 | } -------------------------------------------------------------------------------- /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: 11 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_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 0 9 | path: Assets/Scenes/SampleScene.unity 10 | guid: 9fc0d4010bbf28b4594072e72b8655ab 11 | - enabled: 1 12 | path: Assets/Scenes/PointLightTestScene.unity 13 | guid: 1dfb36b833a004a8e80bffdae1cd68c9 14 | m_configObjects: {} 15 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /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: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 41 | - {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0} 42 | m_PreloadedShaders: [] 43 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 44 | type: 0} 45 | m_CustomRenderPipeline: {fileID: 11400000, guid: 66c01ba17d16a40229d89d58bfb7bb3c, 46 | type: 2} 47 | m_TransparencySortMode: 0 48 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 49 | m_DefaultRenderingPath: 1 50 | m_DefaultMobileRenderingPath: 1 51 | m_TierSettings: [] 52 | m_LightmapStripping: 0 53 | m_FogStripping: 0 54 | m_InstancingStripping: 0 55 | m_LightmapKeepPlain: 1 56 | m_LightmapKeepDirCombined: 1 57 | m_LightmapKeepDynamicPlain: 1 58 | m_LightmapKeepDynamicDirCombined: 1 59 | m_LightmapKeepShadowMask: 1 60 | m_LightmapKeepSubtractive: 1 61 | m_FogKeepLinear: 1 62 | m_FogKeepExp: 1 63 | m_FogKeepExp2: 1 64 | m_AlbedoSwatchInfos: [] 65 | m_LightsUseLinearIntensity: 1 66 | m_LightsUseColorTemperature: 0 67 | m_LogWhenShaderIsCompiled: 0 68 | m_AllowEnlightenSupportForUpgradedProject: 1 69 | -------------------------------------------------------------------------------- /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 | - serializedVersion: 3 297 | m_Name: Enable Debug Button 1 298 | descriptiveName: 299 | descriptiveNegativeName: 300 | negativeButton: 301 | positiveButton: left ctrl 302 | altNegativeButton: 303 | altPositiveButton: joystick button 8 304 | gravity: 0 305 | dead: 0 306 | sensitivity: 0 307 | snap: 0 308 | invert: 0 309 | type: 0 310 | axis: 0 311 | joyNum: 0 312 | - serializedVersion: 3 313 | m_Name: Enable Debug Button 2 314 | descriptiveName: 315 | descriptiveNegativeName: 316 | negativeButton: 317 | positiveButton: backspace 318 | altNegativeButton: 319 | altPositiveButton: joystick button 9 320 | gravity: 0 321 | dead: 0 322 | sensitivity: 0 323 | snap: 0 324 | invert: 0 325 | type: 0 326 | axis: 0 327 | joyNum: 0 328 | - serializedVersion: 3 329 | m_Name: Debug Reset 330 | descriptiveName: 331 | descriptiveNegativeName: 332 | negativeButton: 333 | positiveButton: left alt 334 | altNegativeButton: 335 | altPositiveButton: joystick button 1 336 | gravity: 0 337 | dead: 0 338 | sensitivity: 0 339 | snap: 0 340 | invert: 0 341 | type: 0 342 | axis: 0 343 | joyNum: 0 344 | - serializedVersion: 3 345 | m_Name: Debug Next 346 | descriptiveName: 347 | descriptiveNegativeName: 348 | negativeButton: 349 | positiveButton: page down 350 | altNegativeButton: 351 | altPositiveButton: joystick button 5 352 | gravity: 0 353 | dead: 0 354 | sensitivity: 0 355 | snap: 0 356 | invert: 0 357 | type: 0 358 | axis: 0 359 | joyNum: 0 360 | - serializedVersion: 3 361 | m_Name: Debug Previous 362 | descriptiveName: 363 | descriptiveNegativeName: 364 | negativeButton: 365 | positiveButton: page up 366 | altNegativeButton: 367 | altPositiveButton: joystick button 4 368 | gravity: 0 369 | dead: 0 370 | sensitivity: 0 371 | snap: 0 372 | invert: 0 373 | type: 0 374 | axis: 0 375 | joyNum: 0 376 | - serializedVersion: 3 377 | m_Name: Debug Validate 378 | descriptiveName: 379 | descriptiveNegativeName: 380 | negativeButton: 381 | positiveButton: return 382 | altNegativeButton: 383 | altPositiveButton: joystick button 0 384 | gravity: 0 385 | dead: 0 386 | sensitivity: 0 387 | snap: 0 388 | invert: 0 389 | type: 0 390 | axis: 0 391 | joyNum: 0 392 | - serializedVersion: 3 393 | m_Name: Debug Persistent 394 | descriptiveName: 395 | descriptiveNegativeName: 396 | negativeButton: 397 | positiveButton: right shift 398 | altNegativeButton: 399 | altPositiveButton: joystick button 2 400 | gravity: 0 401 | dead: 0 402 | sensitivity: 0 403 | snap: 0 404 | invert: 0 405 | type: 0 406 | axis: 0 407 | joyNum: 0 408 | - serializedVersion: 3 409 | m_Name: Debug Multiplier 410 | descriptiveName: 411 | descriptiveNegativeName: 412 | negativeButton: 413 | positiveButton: left shift 414 | altNegativeButton: 415 | altPositiveButton: joystick button 3 416 | gravity: 0 417 | dead: 0 418 | sensitivity: 0 419 | snap: 0 420 | invert: 0 421 | type: 0 422 | axis: 0 423 | joyNum: 0 424 | - serializedVersion: 3 425 | m_Name: Debug Horizontal 426 | descriptiveName: 427 | descriptiveNegativeName: 428 | negativeButton: left 429 | positiveButton: right 430 | altNegativeButton: 431 | altPositiveButton: 432 | gravity: 1000 433 | dead: 0.001 434 | sensitivity: 1000 435 | snap: 0 436 | invert: 0 437 | type: 0 438 | axis: 0 439 | joyNum: 0 440 | - serializedVersion: 3 441 | m_Name: Debug Vertical 442 | descriptiveName: 443 | descriptiveNegativeName: 444 | negativeButton: down 445 | positiveButton: up 446 | altNegativeButton: 447 | altPositiveButton: 448 | gravity: 1000 449 | dead: 0.001 450 | sensitivity: 1000 451 | snap: 0 452 | invert: 0 453 | type: 0 454 | axis: 0 455 | joyNum: 0 456 | - serializedVersion: 3 457 | m_Name: Debug Vertical 458 | descriptiveName: 459 | descriptiveNegativeName: 460 | negativeButton: down 461 | positiveButton: up 462 | altNegativeButton: 463 | altPositiveButton: 464 | gravity: 1000 465 | dead: 0.001 466 | sensitivity: 1000 467 | snap: 0 468 | invert: 0 469 | type: 2 470 | axis: 6 471 | joyNum: 0 472 | - serializedVersion: 3 473 | m_Name: Debug Horizontal 474 | descriptiveName: 475 | descriptiveNegativeName: 476 | negativeButton: left 477 | positiveButton: right 478 | altNegativeButton: 479 | altPositiveButton: 480 | gravity: 1000 481 | dead: 0.001 482 | sensitivity: 1000 483 | snap: 0 484 | invert: 0 485 | type: 2 486 | axis: 5 487 | joyNum: 0 488 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 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 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /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: 4 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_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /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: 20 7 | productGUID: fb16bd36855f649238495ea6b1d61223 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: SRP 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 1 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosUseCustomAppBackgroundBehavior: 0 56 | iosAllowHTTPDownload: 1 57 | allowedAutorotateToPortrait: 1 58 | allowedAutorotateToPortraitUpsideDown: 1 59 | allowedAutorotateToLandscapeRight: 1 60 | allowedAutorotateToLandscapeLeft: 1 61 | useOSAutorotation: 1 62 | use32BitDisplayBuffer: 1 63 | preserveFramebufferAlpha: 0 64 | disableDepthAndStencilBuffers: 0 65 | androidStartInFullscreen: 1 66 | androidRenderOutsideSafeArea: 1 67 | androidUseSwappy: 0 68 | androidBlitType: 1 69 | defaultIsNativeResolution: 1 70 | macRetinaSupport: 1 71 | runInBackground: 1 72 | captureSingleScreen: 0 73 | muteOtherAudioSources: 0 74 | Prepare IOS For Recording: 0 75 | Force IOS Speakers When Recording: 0 76 | deferSystemGesturesMode: 0 77 | hideHomeButton: 0 78 | submitAnalytics: 1 79 | usePlayerLog: 1 80 | bakeCollisionMeshes: 0 81 | forceSingleInstance: 1 82 | useFlipModelSwapchain: 1 83 | resizableWindow: 0 84 | useMacAppStoreValidation: 0 85 | macAppStoreCategory: public.app-category.games 86 | gpuSkinning: 1 87 | xboxPIXTextureCapture: 0 88 | xboxEnableAvatar: 0 89 | xboxEnableKinect: 0 90 | xboxEnableKinectAutoTracking: 0 91 | xboxEnableFitness: 0 92 | visibleInBackground: 1 93 | allowFullscreenSwitch: 1 94 | fullscreenMode: 1 95 | xboxSpeechDB: 0 96 | xboxEnableHeadOrientation: 0 97 | xboxEnableGuest: 0 98 | xboxEnablePIXSampling: 0 99 | metalFramebufferOnly: 0 100 | xboxOneResolution: 0 101 | xboxOneSResolution: 0 102 | xboxOneXResolution: 3 103 | xboxOneMonoLoggingLevel: 0 104 | xboxOneLoggingLevel: 1 105 | xboxOneDisableEsram: 0 106 | xboxOnePresentImmediateThreshold: 0 107 | switchQueueCommandMemory: 0 108 | switchQueueControlMemory: 16384 109 | switchQueueComputeMemory: 262144 110 | switchNVNShaderPoolsGranularity: 33554432 111 | switchNVNDefaultPoolsGranularity: 16777216 112 | switchNVNOtherPoolsGranularity: 16777216 113 | vulkanNumSwapchainBuffers: 3 114 | vulkanEnableSetSRGBWrite: 0 115 | m_SupportedAspectRatios: 116 | 4:3: 0 117 | 5:4: 0 118 | 16:10: 1 119 | 16:9: 0 120 | Others: 0 121 | bundleVersion: 0.1 122 | preloadedAssets: [] 123 | metroInputSource: 0 124 | wsaTransparentSwapchain: 0 125 | m_HolographicPauseOnTrackingLoss: 1 126 | xboxOneDisableKinectGpuReservation: 0 127 | xboxOneEnable7thCore: 0 128 | vrSettings: 129 | cardboard: 130 | depthFormat: 0 131 | enableTransitionView: 0 132 | daydream: 133 | depthFormat: 0 134 | useSustainedPerformanceMode: 0 135 | enableVideoLayer: 0 136 | useProtectedVideoMemory: 0 137 | minimumSupportedHeadTracking: 0 138 | maximumSupportedHeadTracking: 1 139 | hololens: 140 | depthFormat: 1 141 | depthBufferSharingEnabled: 0 142 | lumin: 143 | depthFormat: 0 144 | frameTiming: 2 145 | enableGLCache: 0 146 | glCacheMaxBlobSize: 524288 147 | glCacheMaxFileSize: 8388608 148 | oculus: 149 | sharedDepthBuffer: 1 150 | dashSupport: 1 151 | lowOverheadMode: 0 152 | protectedContext: 0 153 | v2Signing: 0 154 | enable360StereoCapture: 0 155 | isWsaHolographicRemotingEnabled: 0 156 | enableFrameTimingStats: 0 157 | useHDRDisplay: 0 158 | D3DHDRBitDepth: 0 159 | m_ColorGamuts: 00000000 160 | targetPixelDensity: 30 161 | resolutionScalingMode: 0 162 | androidSupportedAspectRatio: 1 163 | androidMaxAspectRatio: 2.1 164 | applicationIdentifier: {} 165 | buildNumber: {} 166 | AndroidBundleVersionCode: 1 167 | AndroidMinSdkVersion: 19 168 | AndroidTargetSdkVersion: 0 169 | AndroidPreferredInstallLocation: 1 170 | aotOptions: 171 | stripEngineCode: 1 172 | iPhoneStrippingLevel: 0 173 | iPhoneScriptCallOptimization: 0 174 | ForceInternetPermission: 0 175 | ForceSDCardPermission: 0 176 | CreateWallpaper: 0 177 | APKExpansionFiles: 0 178 | keepLoadedShadersAlive: 0 179 | StripUnusedMeshComponents: 1 180 | VertexChannelCompressionMask: 4054 181 | iPhoneSdkVersion: 988 182 | iOSTargetOSVersionString: 10.0 183 | tvOSSdkVersion: 0 184 | tvOSRequireExtendedGameController: 0 185 | tvOSTargetOSVersionString: 10.0 186 | uIPrerenderedIcon: 0 187 | uIRequiresPersistentWiFi: 0 188 | uIRequiresFullScreen: 1 189 | uIStatusBarHidden: 1 190 | uIExitOnSuspend: 0 191 | uIStatusBarStyle: 0 192 | iPhoneSplashScreen: {fileID: 0} 193 | iPhoneHighResSplashScreen: {fileID: 0} 194 | iPhoneTallHighResSplashScreen: {fileID: 0} 195 | iPhone47inSplashScreen: {fileID: 0} 196 | iPhone55inPortraitSplashScreen: {fileID: 0} 197 | iPhone55inLandscapeSplashScreen: {fileID: 0} 198 | iPhone58inPortraitSplashScreen: {fileID: 0} 199 | iPhone58inLandscapeSplashScreen: {fileID: 0} 200 | iPadPortraitSplashScreen: {fileID: 0} 201 | iPadHighResPortraitSplashScreen: {fileID: 0} 202 | iPadLandscapeSplashScreen: {fileID: 0} 203 | iPadHighResLandscapeSplashScreen: {fileID: 0} 204 | iPhone65inPortraitSplashScreen: {fileID: 0} 205 | iPhone65inLandscapeSplashScreen: {fileID: 0} 206 | iPhone61inPortraitSplashScreen: {fileID: 0} 207 | iPhone61inLandscapeSplashScreen: {fileID: 0} 208 | appleTVSplashScreen: {fileID: 0} 209 | appleTVSplashScreen2x: {fileID: 0} 210 | tvOSSmallIconLayers: [] 211 | tvOSSmallIconLayers2x: [] 212 | tvOSLargeIconLayers: [] 213 | tvOSLargeIconLayers2x: [] 214 | tvOSTopShelfImageLayers: [] 215 | tvOSTopShelfImageLayers2x: [] 216 | tvOSTopShelfImageWideLayers: [] 217 | tvOSTopShelfImageWideLayers2x: [] 218 | iOSLaunchScreenType: 0 219 | iOSLaunchScreenPortrait: {fileID: 0} 220 | iOSLaunchScreenLandscape: {fileID: 0} 221 | iOSLaunchScreenBackgroundColor: 222 | serializedVersion: 2 223 | rgba: 0 224 | iOSLaunchScreenFillPct: 100 225 | iOSLaunchScreenSize: 100 226 | iOSLaunchScreenCustomXibPath: 227 | iOSLaunchScreeniPadType: 0 228 | iOSLaunchScreeniPadImage: {fileID: 0} 229 | iOSLaunchScreeniPadBackgroundColor: 230 | serializedVersion: 2 231 | rgba: 0 232 | iOSLaunchScreeniPadFillPct: 100 233 | iOSLaunchScreeniPadSize: 100 234 | iOSLaunchScreeniPadCustomXibPath: 235 | iOSUseLaunchScreenStoryboard: 0 236 | iOSLaunchScreenCustomStoryboardPath: 237 | iOSDeviceRequirements: [] 238 | iOSURLSchemes: [] 239 | iOSBackgroundModes: 0 240 | iOSMetalForceHardShadows: 0 241 | metalEditorSupport: 1 242 | metalAPIValidation: 1 243 | iOSRenderExtraFrameOnPause: 0 244 | appleDeveloperTeamID: 245 | iOSManualSigningProvisioningProfileID: 246 | tvOSManualSigningProvisioningProfileID: 247 | iOSManualSigningProvisioningProfileType: 0 248 | tvOSManualSigningProvisioningProfileType: 0 249 | appleEnableAutomaticSigning: 0 250 | iOSRequireARKit: 0 251 | iOSAutomaticallyDetectAndAddCapabilities: 1 252 | appleEnableProMotion: 0 253 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 254 | templatePackageId: com.unity.template.3d@1.0.11 255 | templateDefaultScene: Assets/Scenes/SampleScene.unity 256 | AndroidTargetArchitectures: 1 257 | AndroidSplashScreenScale: 0 258 | androidSplashScreen: {fileID: 0} 259 | AndroidKeystoreName: '{inproject}: ' 260 | AndroidKeyaliasName: 261 | AndroidBuildApkPerCpuArchitecture: 0 262 | AndroidTVCompatibility: 0 263 | AndroidIsGame: 1 264 | AndroidEnableTango: 0 265 | androidEnableBanner: 1 266 | androidUseLowAccuracyLocation: 0 267 | androidUseCustomKeystore: 0 268 | m_AndroidBanners: 269 | - width: 320 270 | height: 180 271 | banner: {fileID: 0} 272 | androidGamepadSupportLevel: 0 273 | AndroidValidateAppBundleSize: 1 274 | AndroidAppBundleSizeToValidate: 100 275 | m_BuildTargetIcons: [] 276 | m_BuildTargetPlatformIcons: [] 277 | m_BuildTargetBatching: 278 | - m_BuildTarget: Standalone 279 | m_StaticBatching: 1 280 | m_DynamicBatching: 1 281 | - m_BuildTarget: tvOS 282 | m_StaticBatching: 1 283 | m_DynamicBatching: 0 284 | - m_BuildTarget: Android 285 | m_StaticBatching: 1 286 | m_DynamicBatching: 0 287 | - m_BuildTarget: iPhone 288 | m_StaticBatching: 1 289 | m_DynamicBatching: 0 290 | - m_BuildTarget: WebGL 291 | m_StaticBatching: 0 292 | m_DynamicBatching: 0 293 | m_BuildTargetGraphicsJobs: 294 | - m_BuildTarget: MacStandaloneSupport 295 | m_GraphicsJobs: 1 296 | - m_BuildTarget: Switch 297 | m_GraphicsJobs: 1 298 | - m_BuildTarget: MetroSupport 299 | m_GraphicsJobs: 1 300 | - m_BuildTarget: AppleTVSupport 301 | m_GraphicsJobs: 0 302 | - m_BuildTarget: BJMSupport 303 | m_GraphicsJobs: 1 304 | - m_BuildTarget: LinuxStandaloneSupport 305 | m_GraphicsJobs: 1 306 | - m_BuildTarget: PS4Player 307 | m_GraphicsJobs: 1 308 | - m_BuildTarget: iOSSupport 309 | m_GraphicsJobs: 0 310 | - m_BuildTarget: WindowsStandaloneSupport 311 | m_GraphicsJobs: 1 312 | - m_BuildTarget: XboxOnePlayer 313 | m_GraphicsJobs: 1 314 | - m_BuildTarget: LuminSupport 315 | m_GraphicsJobs: 0 316 | - m_BuildTarget: AndroidPlayer 317 | m_GraphicsJobs: 0 318 | - m_BuildTarget: WebGLSupport 319 | m_GraphicsJobs: 0 320 | m_BuildTargetGraphicsJobMode: 321 | - m_BuildTarget: PS4Player 322 | m_GraphicsJobMode: 0 323 | - m_BuildTarget: XboxOnePlayer 324 | m_GraphicsJobMode: 0 325 | m_BuildTargetGraphicsAPIs: 326 | - m_BuildTarget: AndroidPlayer 327 | m_APIs: 150000000b000000 328 | m_Automatic: 0 329 | - m_BuildTarget: iOSSupport 330 | m_APIs: 10000000 331 | m_Automatic: 1 332 | - m_BuildTarget: AppleTVSupport 333 | m_APIs: 10000000 334 | m_Automatic: 0 335 | - m_BuildTarget: WebGLSupport 336 | m_APIs: 0b000000 337 | m_Automatic: 1 338 | - m_BuildTarget: MacStandaloneSupport 339 | m_APIs: 10000000 340 | m_Automatic: 0 341 | - m_BuildTarget: WindowsStandaloneSupport 342 | m_APIs: 0200000012000000 343 | m_Automatic: 0 344 | - m_BuildTarget: LinuxStandaloneSupport 345 | m_APIs: 1500000011000000 346 | m_Automatic: 0 347 | m_BuildTargetVRSettings: 348 | - m_BuildTarget: Standalone 349 | m_Enabled: 0 350 | m_Devices: 351 | - Oculus 352 | - OpenVR 353 | openGLRequireES31: 0 354 | openGLRequireES31AEP: 0 355 | openGLRequireES32: 0 356 | m_TemplateCustomTags: {} 357 | mobileMTRendering: 358 | Android: 1 359 | iPhone: 1 360 | tvOS: 1 361 | m_BuildTargetGroupLightmapEncodingQuality: [] 362 | m_BuildTargetGroupLightmapSettings: [] 363 | playModeTestRunnerEnabled: 0 364 | runPlayModeTestAsEditModeTest: 0 365 | actionOnDotNetUnhandledException: 1 366 | enableInternalProfiler: 0 367 | logObjCUncaughtExceptions: 1 368 | enableCrashReportAPI: 0 369 | cameraUsageDescription: 370 | locationUsageDescription: 371 | microphoneUsageDescription: 372 | switchNetLibKey: 373 | switchSocketMemoryPoolSize: 6144 374 | switchSocketAllocatorPoolSize: 128 375 | switchSocketConcurrencyLimit: 14 376 | switchScreenResolutionBehavior: 2 377 | switchUseCPUProfiler: 0 378 | switchApplicationID: 0x01004b9000490000 379 | switchNSODependencies: 380 | switchTitleNames_0: 381 | switchTitleNames_1: 382 | switchTitleNames_2: 383 | switchTitleNames_3: 384 | switchTitleNames_4: 385 | switchTitleNames_5: 386 | switchTitleNames_6: 387 | switchTitleNames_7: 388 | switchTitleNames_8: 389 | switchTitleNames_9: 390 | switchTitleNames_10: 391 | switchTitleNames_11: 392 | switchTitleNames_12: 393 | switchTitleNames_13: 394 | switchTitleNames_14: 395 | switchPublisherNames_0: 396 | switchPublisherNames_1: 397 | switchPublisherNames_2: 398 | switchPublisherNames_3: 399 | switchPublisherNames_4: 400 | switchPublisherNames_5: 401 | switchPublisherNames_6: 402 | switchPublisherNames_7: 403 | switchPublisherNames_8: 404 | switchPublisherNames_9: 405 | switchPublisherNames_10: 406 | switchPublisherNames_11: 407 | switchPublisherNames_12: 408 | switchPublisherNames_13: 409 | switchPublisherNames_14: 410 | switchIcons_0: {fileID: 0} 411 | switchIcons_1: {fileID: 0} 412 | switchIcons_2: {fileID: 0} 413 | switchIcons_3: {fileID: 0} 414 | switchIcons_4: {fileID: 0} 415 | switchIcons_5: {fileID: 0} 416 | switchIcons_6: {fileID: 0} 417 | switchIcons_7: {fileID: 0} 418 | switchIcons_8: {fileID: 0} 419 | switchIcons_9: {fileID: 0} 420 | switchIcons_10: {fileID: 0} 421 | switchIcons_11: {fileID: 0} 422 | switchIcons_12: {fileID: 0} 423 | switchIcons_13: {fileID: 0} 424 | switchIcons_14: {fileID: 0} 425 | switchSmallIcons_0: {fileID: 0} 426 | switchSmallIcons_1: {fileID: 0} 427 | switchSmallIcons_2: {fileID: 0} 428 | switchSmallIcons_3: {fileID: 0} 429 | switchSmallIcons_4: {fileID: 0} 430 | switchSmallIcons_5: {fileID: 0} 431 | switchSmallIcons_6: {fileID: 0} 432 | switchSmallIcons_7: {fileID: 0} 433 | switchSmallIcons_8: {fileID: 0} 434 | switchSmallIcons_9: {fileID: 0} 435 | switchSmallIcons_10: {fileID: 0} 436 | switchSmallIcons_11: {fileID: 0} 437 | switchSmallIcons_12: {fileID: 0} 438 | switchSmallIcons_13: {fileID: 0} 439 | switchSmallIcons_14: {fileID: 0} 440 | switchManualHTML: 441 | switchAccessibleURLs: 442 | switchLegalInformation: 443 | switchMainThreadStackSize: 1048576 444 | switchPresenceGroupId: 445 | switchLogoHandling: 0 446 | switchReleaseVersion: 0 447 | switchDisplayVersion: 1.0.0 448 | switchStartupUserAccount: 0 449 | switchTouchScreenUsage: 0 450 | switchSupportedLanguagesMask: 0 451 | switchLogoType: 0 452 | switchApplicationErrorCodeCategory: 453 | switchUserAccountSaveDataSize: 0 454 | switchUserAccountSaveDataJournalSize: 0 455 | switchApplicationAttribute: 0 456 | switchCardSpecSize: -1 457 | switchCardSpecClock: -1 458 | switchRatingsMask: 0 459 | switchRatingsInt_0: 0 460 | switchRatingsInt_1: 0 461 | switchRatingsInt_2: 0 462 | switchRatingsInt_3: 0 463 | switchRatingsInt_4: 0 464 | switchRatingsInt_5: 0 465 | switchRatingsInt_6: 0 466 | switchRatingsInt_7: 0 467 | switchRatingsInt_8: 0 468 | switchRatingsInt_9: 0 469 | switchRatingsInt_10: 0 470 | switchRatingsInt_11: 0 471 | switchRatingsInt_12: 0 472 | switchLocalCommunicationIds_0: 473 | switchLocalCommunicationIds_1: 474 | switchLocalCommunicationIds_2: 475 | switchLocalCommunicationIds_3: 476 | switchLocalCommunicationIds_4: 477 | switchLocalCommunicationIds_5: 478 | switchLocalCommunicationIds_6: 479 | switchLocalCommunicationIds_7: 480 | switchParentalControl: 0 481 | switchAllowsScreenshot: 1 482 | switchAllowsVideoCapturing: 1 483 | switchAllowsRuntimeAddOnContentInstall: 0 484 | switchDataLossConfirmation: 0 485 | switchUserAccountLockEnabled: 0 486 | switchSystemResourceMemory: 16777216 487 | switchSupportedNpadStyles: 3 488 | switchNativeFsCacheSize: 32 489 | switchIsHoldTypeHorizontal: 0 490 | switchSupportedNpadCount: 8 491 | switchSocketConfigEnabled: 0 492 | switchTcpInitialSendBufferSize: 32 493 | switchTcpInitialReceiveBufferSize: 64 494 | switchTcpAutoSendBufferSizeMax: 256 495 | switchTcpAutoReceiveBufferSizeMax: 256 496 | switchUdpSendBufferSize: 9 497 | switchUdpReceiveBufferSize: 42 498 | switchSocketBufferEfficiency: 4 499 | switchSocketInitializeEnabled: 1 500 | switchNetworkInterfaceManagerInitializeEnabled: 1 501 | switchPlayerConnectionEnabled: 1 502 | ps4NPAgeRating: 12 503 | ps4NPTitleSecret: 504 | ps4NPTrophyPackPath: 505 | ps4ParentalLevel: 11 506 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 507 | ps4Category: 0 508 | ps4MasterVersion: 01.00 509 | ps4AppVersion: 01.00 510 | ps4AppType: 0 511 | ps4ParamSfxPath: 512 | ps4VideoOutPixelFormat: 0 513 | ps4VideoOutInitialWidth: 1920 514 | ps4VideoOutBaseModeInitialWidth: 1920 515 | ps4VideoOutReprojectionRate: 60 516 | ps4PronunciationXMLPath: 517 | ps4PronunciationSIGPath: 518 | ps4BackgroundImagePath: 519 | ps4StartupImagePath: 520 | ps4StartupImagesFolder: 521 | ps4IconImagesFolder: 522 | ps4SaveDataImagePath: 523 | ps4SdkOverride: 524 | ps4BGMPath: 525 | ps4ShareFilePath: 526 | ps4ShareOverlayImagePath: 527 | ps4PrivacyGuardImagePath: 528 | ps4NPtitleDatPath: 529 | ps4RemotePlayKeyAssignment: -1 530 | ps4RemotePlayKeyMappingDir: 531 | ps4PlayTogetherPlayerCount: 0 532 | ps4EnterButtonAssignment: 1 533 | ps4ApplicationParam1: 0 534 | ps4ApplicationParam2: 0 535 | ps4ApplicationParam3: 0 536 | ps4ApplicationParam4: 0 537 | ps4DownloadDataSize: 0 538 | ps4GarlicHeapSize: 2048 539 | ps4ProGarlicHeapSize: 2560 540 | playerPrefsMaxSize: 32768 541 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 542 | ps4pnSessions: 1 543 | ps4pnPresence: 1 544 | ps4pnFriends: 1 545 | ps4pnGameCustomData: 1 546 | playerPrefsSupport: 0 547 | enableApplicationExit: 0 548 | resetTempFolder: 1 549 | restrictedAudioUsageRights: 0 550 | ps4UseResolutionFallback: 0 551 | ps4ReprojectionSupport: 0 552 | ps4UseAudio3dBackend: 0 553 | ps4SocialScreenEnabled: 0 554 | ps4ScriptOptimizationLevel: 0 555 | ps4Audio3dVirtualSpeakerCount: 14 556 | ps4attribCpuUsage: 0 557 | ps4PatchPkgPath: 558 | ps4PatchLatestPkgPath: 559 | ps4PatchChangeinfoPath: 560 | ps4PatchDayOne: 0 561 | ps4attribUserManagement: 0 562 | ps4attribMoveSupport: 0 563 | ps4attrib3DSupport: 0 564 | ps4attribShareSupport: 0 565 | ps4attribExclusiveVR: 0 566 | ps4disableAutoHideSplash: 0 567 | ps4videoRecordingFeaturesUsed: 0 568 | ps4contentSearchFeaturesUsed: 0 569 | ps4attribEyeToEyeDistanceSettingVR: 0 570 | ps4IncludedModules: [] 571 | ps4attribVROutputEnabled: 0 572 | monoEnv: 573 | splashScreenBackgroundSourceLandscape: {fileID: 0} 574 | splashScreenBackgroundSourcePortrait: {fileID: 0} 575 | blurSplashScreenBackground: 1 576 | spritePackerPolicy: 577 | webGLMemorySize: 16 578 | webGLExceptionSupport: 1 579 | webGLNameFilesAsHashes: 0 580 | webGLDataCaching: 1 581 | webGLDebugSymbols: 0 582 | webGLEmscriptenArgs: 583 | webGLModulesDirectory: 584 | webGLTemplate: APPLICATION:Default 585 | webGLAnalyzeBuildSize: 0 586 | webGLUseEmbeddedResources: 0 587 | webGLCompressionFormat: 1 588 | webGLLinkerTarget: 1 589 | webGLThreadsSupport: 0 590 | webGLWasmStreaming: 0 591 | scriptingDefineSymbols: 592 | 1: UNITY_POST_PROCESSING_STACK_V2 593 | 7: UNITY_POST_PROCESSING_STACK_V2 594 | 13: UNITY_POST_PROCESSING_STACK_V2 595 | 19: UNITY_POST_PROCESSING_STACK_V2 596 | 21: UNITY_POST_PROCESSING_STACK_V2 597 | 25: UNITY_POST_PROCESSING_STACK_V2 598 | 26: UNITY_POST_PROCESSING_STACK_V2 599 | 27: UNITY_POST_PROCESSING_STACK_V2 600 | 28: UNITY_POST_PROCESSING_STACK_V2 601 | 29: UNITY_POST_PROCESSING_STACK_V2 602 | platformArchitecture: {} 603 | scriptingBackend: 604 | Standalone: 0 605 | il2cppCompilerConfiguration: {} 606 | managedStrippingLevel: {} 607 | incrementalIl2cppBuild: {} 608 | allowUnsafeCode: 1 609 | additionalIl2CppArgs: 610 | scriptingRuntimeVersion: 1 611 | gcIncremental: 1 612 | gcWBarrierValidation: 0 613 | apiCompatibilityLevelPerPlatform: 614 | Standalone: 3 615 | m_RenderingPath: 1 616 | m_MobileRenderingPath: 1 617 | metroPackageName: Template_3D 618 | metroPackageVersion: 619 | metroCertificatePath: 620 | metroCertificatePassword: 621 | metroCertificateSubject: 622 | metroCertificateIssuer: 623 | metroCertificateNotAfter: 0000000000000000 624 | metroApplicationDescription: Template_3D 625 | wsaImages: {} 626 | metroTileShortName: 627 | metroTileShowName: 0 628 | metroMediumTileShowName: 0 629 | metroLargeTileShowName: 0 630 | metroWideTileShowName: 0 631 | metroSupportStreamingInstall: 0 632 | metroLastRequiredScene: 0 633 | metroDefaultTileSize: 1 634 | metroTileForegroundText: 2 635 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 636 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 637 | a: 1} 638 | metroSplashScreenUseBackgroundColor: 0 639 | platformCapabilities: {} 640 | metroTargetDeviceFamilies: {} 641 | metroFTAName: 642 | metroFTAFileTypes: [] 643 | metroProtocolName: 644 | XboxOneProductId: 645 | XboxOneUpdateKey: 646 | XboxOneSandboxId: 647 | XboxOneContentId: 648 | XboxOneTitleId: 649 | XboxOneSCId: 650 | XboxOneGameOsOverridePath: 651 | XboxOnePackagingOverridePath: 652 | XboxOneAppManifestOverridePath: 653 | XboxOneVersion: 1.0.0.0 654 | XboxOnePackageEncryption: 0 655 | XboxOnePackageUpdateGranularity: 2 656 | XboxOneDescription: 657 | XboxOneLanguage: 658 | - enus 659 | XboxOneCapability: [] 660 | XboxOneGameRating: {} 661 | XboxOneIsContentPackage: 0 662 | XboxOneEnableGPUVariability: 0 663 | XboxOneSockets: {} 664 | XboxOneSplashScreen: {fileID: 0} 665 | XboxOneAllowedProductIds: [] 666 | XboxOnePersistentLocalStorageSize: 0 667 | XboxOneXTitleMemory: 8 668 | XboxOneOverrideIdentityName: 669 | vrEditorSettings: 670 | daydream: 671 | daydreamIconForeground: {fileID: 0} 672 | daydreamIconBackground: {fileID: 0} 673 | cloudServicesEnabled: 674 | UNet: 1 675 | luminIcon: 676 | m_Name: 677 | m_ModelFolderPath: 678 | m_PortalFolderPath: 679 | luminCert: 680 | m_CertPath: 681 | m_SignPackage: 1 682 | luminIsChannelApp: 0 683 | luminVersion: 684 | m_VersionCode: 1 685 | m_VersionName: 686 | apiCompatibilityLevel: 6 687 | cloudProjectId: 688 | framebufferDepthMemorylessMode: 0 689 | projectName: 690 | organizationId: 691 | cloudEnabled: 0 692 | enableNativePlatformBackendsForNewInputSystem: 0 693 | disableOldInputManagerSupport: 0 694 | legacyClampBlendShapeWeights: 1 695 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.3.3f1 2 | m_EditorVersionWithRevision: 2019.3.3f1 (7ceaae5f7503) 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: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | skinWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | customRenderPipeline: {fileID: 0} 44 | excludedTargetPlatforms: [] 45 | - serializedVersion: 2 46 | name: Low 47 | pixelLightCount: 0 48 | shadows: 0 49 | shadowResolution: 0 50 | shadowProjection: 1 51 | shadowCascades: 1 52 | shadowDistance: 20 53 | shadowNearPlaneOffset: 3 54 | shadowCascade2Split: 0.33333334 55 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 56 | shadowmaskMode: 0 57 | skinWeights: 2 58 | textureQuality: 0 59 | anisotropicTextures: 0 60 | antiAliasing: 0 61 | softParticles: 0 62 | softVegetation: 0 63 | realtimeReflectionProbes: 0 64 | billboardsFaceCameraPosition: 0 65 | vSyncCount: 0 66 | lodBias: 0.4 67 | maximumLODLevel: 0 68 | streamingMipmapsActive: 0 69 | streamingMipmapsAddAllCameras: 1 70 | streamingMipmapsMemoryBudget: 512 71 | streamingMipmapsRenderersPerFrame: 512 72 | streamingMipmapsMaxLevelReduction: 2 73 | streamingMipmapsMaxFileIORequests: 1024 74 | particleRaycastBudget: 16 75 | asyncUploadTimeSlice: 2 76 | asyncUploadBufferSize: 16 77 | asyncUploadPersistentBuffer: 1 78 | resolutionScalingFixedDPIFactor: 1 79 | customRenderPipeline: {fileID: 0} 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: Medium 83 | pixelLightCount: 1 84 | shadows: 1 85 | shadowResolution: 0 86 | shadowProjection: 1 87 | shadowCascades: 1 88 | shadowDistance: 20 89 | shadowNearPlaneOffset: 3 90 | shadowCascade2Split: 0.33333334 91 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 92 | shadowmaskMode: 0 93 | skinWeights: 2 94 | textureQuality: 0 95 | anisotropicTextures: 1 96 | antiAliasing: 0 97 | softParticles: 0 98 | softVegetation: 0 99 | realtimeReflectionProbes: 0 100 | billboardsFaceCameraPosition: 0 101 | vSyncCount: 1 102 | lodBias: 0.7 103 | maximumLODLevel: 0 104 | streamingMipmapsActive: 0 105 | streamingMipmapsAddAllCameras: 1 106 | streamingMipmapsMemoryBudget: 512 107 | streamingMipmapsRenderersPerFrame: 512 108 | streamingMipmapsMaxLevelReduction: 2 109 | streamingMipmapsMaxFileIORequests: 1024 110 | particleRaycastBudget: 64 111 | asyncUploadTimeSlice: 2 112 | asyncUploadBufferSize: 16 113 | asyncUploadPersistentBuffer: 1 114 | resolutionScalingFixedDPIFactor: 1 115 | customRenderPipeline: {fileID: 0} 116 | excludedTargetPlatforms: [] 117 | - serializedVersion: 2 118 | name: High 119 | pixelLightCount: 2 120 | shadows: 2 121 | shadowResolution: 1 122 | shadowProjection: 1 123 | shadowCascades: 2 124 | shadowDistance: 40 125 | shadowNearPlaneOffset: 3 126 | shadowCascade2Split: 0.33333334 127 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 128 | shadowmaskMode: 1 129 | skinWeights: 2 130 | textureQuality: 0 131 | anisotropicTextures: 1 132 | antiAliasing: 0 133 | softParticles: 0 134 | softVegetation: 1 135 | realtimeReflectionProbes: 1 136 | billboardsFaceCameraPosition: 1 137 | vSyncCount: 1 138 | lodBias: 1 139 | maximumLODLevel: 0 140 | streamingMipmapsActive: 0 141 | streamingMipmapsAddAllCameras: 1 142 | streamingMipmapsMemoryBudget: 512 143 | streamingMipmapsRenderersPerFrame: 512 144 | streamingMipmapsMaxLevelReduction: 2 145 | streamingMipmapsMaxFileIORequests: 1024 146 | particleRaycastBudget: 256 147 | asyncUploadTimeSlice: 2 148 | asyncUploadBufferSize: 16 149 | asyncUploadPersistentBuffer: 1 150 | resolutionScalingFixedDPIFactor: 1 151 | customRenderPipeline: {fileID: 0} 152 | excludedTargetPlatforms: [] 153 | - serializedVersion: 2 154 | name: Very High 155 | pixelLightCount: 3 156 | shadows: 2 157 | shadowResolution: 2 158 | shadowProjection: 1 159 | shadowCascades: 2 160 | shadowDistance: 70 161 | shadowNearPlaneOffset: 3 162 | shadowCascade2Split: 0.33333334 163 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 164 | shadowmaskMode: 1 165 | skinWeights: 4 166 | textureQuality: 0 167 | anisotropicTextures: 2 168 | antiAliasing: 2 169 | softParticles: 1 170 | softVegetation: 1 171 | realtimeReflectionProbes: 1 172 | billboardsFaceCameraPosition: 1 173 | vSyncCount: 1 174 | lodBias: 1.5 175 | maximumLODLevel: 0 176 | streamingMipmapsActive: 0 177 | streamingMipmapsAddAllCameras: 1 178 | streamingMipmapsMemoryBudget: 512 179 | streamingMipmapsRenderersPerFrame: 512 180 | streamingMipmapsMaxLevelReduction: 2 181 | streamingMipmapsMaxFileIORequests: 1024 182 | particleRaycastBudget: 1024 183 | asyncUploadTimeSlice: 2 184 | asyncUploadBufferSize: 16 185 | asyncUploadPersistentBuffer: 1 186 | resolutionScalingFixedDPIFactor: 1 187 | customRenderPipeline: {fileID: 0} 188 | excludedTargetPlatforms: [] 189 | - serializedVersion: 2 190 | name: Ultra 191 | pixelLightCount: 4 192 | shadows: 2 193 | shadowResolution: 2 194 | shadowProjection: 1 195 | shadowCascades: 4 196 | shadowDistance: 150 197 | shadowNearPlaneOffset: 3 198 | shadowCascade2Split: 0.33333334 199 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 200 | shadowmaskMode: 1 201 | skinWeights: 4 202 | textureQuality: 0 203 | anisotropicTextures: 2 204 | antiAliasing: 2 205 | softParticles: 1 206 | softVegetation: 1 207 | realtimeReflectionProbes: 1 208 | billboardsFaceCameraPosition: 1 209 | vSyncCount: 0 210 | lodBias: 2 211 | maximumLODLevel: 0 212 | streamingMipmapsActive: 0 213 | streamingMipmapsAddAllCameras: 1 214 | streamingMipmapsMemoryBudget: 512 215 | streamingMipmapsRenderersPerFrame: 512 216 | streamingMipmapsMaxLevelReduction: 2 217 | streamingMipmapsMaxFileIORequests: 1024 218 | particleRaycastBudget: 4096 219 | asyncUploadTimeSlice: 2 220 | asyncUploadBufferSize: 16 221 | asyncUploadPersistentBuffer: 1 222 | resolutionScalingFixedDPIFactor: 1 223 | customRenderPipeline: {fileID: 0} 224 | excludedTargetPlatforms: [] 225 | m_PerPlatformDefaultQuality: 226 | Android: 2 227 | Lumin: 5 228 | Nintendo 3DS: 5 229 | Nintendo Switch: 5 230 | PS4: 5 231 | PSP2: 2 232 | Standalone: 5 233 | WebGL: 3 234 | Windows Store Apps: 5 235 | XboxOne: 5 236 | iPhone: 2 237 | tvOS: 2 238 | -------------------------------------------------------------------------------- /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 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /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 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SRP 2 | 3 | ## Description 4 | A customized forward+ render pipeline for Unity 5 | 6 | ## Planned Features 7 | 1. Supports forward+ render path (Implemented) 8 | 2. Supports tile-based light culling with transparent objects (Implemented - Both dither transparent & transparent) 9 | 3. Supports realtime directional light / spot light / point light shadows (Implemented - Both hard shadows & soft shadows) 10 | 4. Supports cascaded shadowmap for directional light (Implemented) 11 | 5. Supports volumetric lighting 12 | 6. Supports Mie-scattering skylight 13 | 7. Supoorts screen space decals 14 | 8. Supports global illumination 15 | 9. Supports stochastic screen space reflection 16 | 10. Supports MSAA / FXAA / SMAA / TAA 17 | 18 | ## Possible Features 19 | 1. Supports GPU culling 20 | 2. Supports nonphotorealistic render pipeline 21 | 3. Supports in-pipeline GPU grass 22 | 4. Supports in-pipeline post-processing stack 23 | 5. Supports groundtruth ambient occulsion 24 | 25 | ## Graphic API 26 | 1. DX11+ on Windows 27 | 2. Metal on Mac 28 | 3. OpenGL 4.5+ on Linux 29 | 30 | PS: Graphic APIs that support Compute Shaders. 31 | 32 | ## Docs 33 | Not ready yet 34 | 35 | ## Previews 36 | ![Still Under Development.png](https://i.loli.net/2019/10/08/IryF3zL2GwCnMxd.png) 37 | 38 | Parameters 39 | + 2k resolution 40 | + 59 point lights 41 | + 22 spot lights, 2 of them have soft shadows, 1k resolution 42 | + 1 directional light with soft shadow, 4 cascades, 2k resolution 43 | + 586 fps 44 | 45 | Configs 46 | + MacBook Pro (15-inch, 2017) 47 | + macOS Mojave 10.14.4 48 | + 3.1 GHz Intel Core i7 49 | + 16 GB 2133 MHz LPDDR3 50 | + Radeon Pro 560 4 GB -------------------------------------------------------------------------------- /SRP.sln.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | vcSharedLogLevel: 9 | value: 0d5e400f0650 10 | flags: 0 11 | m_VCAutomaticAdd: 1 12 | m_VCDebugCom: 0 13 | m_VCDebugCmd: 0 14 | m_VCDebugOut: 0 15 | m_SemanticMergeMode: 2 16 | m_VCShowFailedCheckout: 1 17 | m_VCOverwriteFailedCheckoutAssets: 1 18 | m_VCAllowAsyncUpdate: 0 19 | m_AssetPipelineMode: 0 20 | m_CacheServerMode: 0 21 | m_CacheServers: [] 22 | --------------------------------------------------------------------------------