├── ProjectSettings ├── boot.config ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── PresetManager.asset ├── EditorBuildSettings.asset ├── XRSettings.asset ├── VersionControlSettings.asset ├── Packages │ └── com.unity.testtools.codecoverage │ │ └── Settings.json ├── TimeManager.asset ├── VFXManager.asset ├── URPProjectSettings.asset ├── AudioManager.asset ├── ShaderGraphSettings.asset ├── TagManager.asset ├── UnityConnectSettings.asset ├── PackageManagerSettings.asset ├── DynamicsManager.asset ├── MemorySettings.asset ├── EditorSettings.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── GraphicsSettings.asset ├── SceneTemplateSettings.json ├── QualitySettings.asset ├── InputManager.asset └── ProjectSettings.asset ├── Documentation ├── hard_shadows.jpg ├── soft_shadows.jpg ├── poisson_rotated.jpg ├── poisson_default_16.jpg ├── poisson_default_4.jpg └── poisson_stratified.jpg ├── Assets ├── Shaders │ ├── LitPoissonSampling.shader.meta │ └── LitPoissonSampling.shader ├── Scripts │ ├── PoissonSamplingRendererPass.cs.meta │ ├── RotatedPoissonSamplingTextureGenerator.cs.meta │ ├── PoissonSamplingShadows.cs.meta │ ├── PoissonSamplingShadows.cs │ ├── RotatedPoissonSamplingTextureGenerator.cs │ └── PoissonSamplingRendererPass.cs ├── Scenes │ ├── SampleScene │ │ ├── LightingData.asset │ │ ├── ReflectionProbe-0.exr │ │ ├── LightingData.asset.meta │ │ └── ReflectionProbe-0.exr.meta │ ├── SampleScene.unity.meta │ ├── SampleScene.meta │ └── SampleScene.unity ├── Scenes.meta ├── Scripts.meta ├── Shaders.meta ├── URP.meta ├── Materials.meta ├── Textures.meta ├── Materials │ ├── Cube.mat.meta │ ├── Floor.mat.meta │ ├── Sphere.mat.meta │ ├── Cube.mat │ ├── Floor.mat │ └── Sphere.mat ├── Textures │ └── RotatedPoissonSamplingTexture.asset.meta └── URP │ ├── New Universal Render Pipeline Asset.asset.meta │ ├── UniversalRenderPipelineGlobalSettings.asset.meta │ ├── New Universal Render Pipeline Asset_Renderer.asset.meta │ ├── UniversalRenderPipelineGlobalSettings.asset │ ├── New Universal Render Pipeline Asset.asset │ └── New Universal Render Pipeline Asset_Renderer.asset ├── .gitattributes ├── Packages ├── manifest.json └── packages-lock.json ├── README.md ├── .editorconfig └── .gitignore /ProjectSettings/boot.config: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Documentation/hard_shadows.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Documentation/hard_shadows.jpg -------------------------------------------------------------------------------- /Documentation/soft_shadows.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Documentation/soft_shadows.jpg -------------------------------------------------------------------------------- /Documentation/poisson_rotated.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Documentation/poisson_rotated.jpg -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2021.3.0f1 2 | m_EditorVersionWithRevision: 2021.3.0f1 (6eacc8284459) 3 | -------------------------------------------------------------------------------- /Documentation/poisson_default_16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Documentation/poisson_default_16.jpg -------------------------------------------------------------------------------- /Documentation/poisson_default_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Documentation/poisson_default_4.jpg -------------------------------------------------------------------------------- /Documentation/poisson_stratified.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Documentation/poisson_stratified.jpg -------------------------------------------------------------------------------- /Assets/Shaders/LitPoissonSampling.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c21b2e6e61fc47519f6719a351a2fc98 3 | timeCreated: 1660986800 -------------------------------------------------------------------------------- /Assets/Scripts/PoissonSamplingRendererPass.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c46ee000436a480c8a989c4d1900b1ca 3 | timeCreated: 1660990098 -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene/LightingData.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Assets/Scenes/SampleScene/LightingData.asset -------------------------------------------------------------------------------- /Assets/Scripts/RotatedPoissonSamplingTextureGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0936ef5400094c6ebcd3f2ad4b7c67d6 3 | timeCreated: 1661000019 -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.unity binary merge=unityyamlmerge 2 | *.prefab binary merge=unityyamlmerge 3 | *.asset binary merge=unityyamlmerge 4 | *.unitypackage binary -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene/ReflectionProbe-0.exr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Delt06/unity-pcf-poisson/HEAD/Assets/Scenes/SampleScene/ReflectionProbe-0.exr -------------------------------------------------------------------------------- /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/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ea315d0fd7389c41b19996891e99ae3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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: abe948885e3ae244facd936c52d67fc9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7e95321e08c7f114993f2d9a360f22fb 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/URP.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5bf927bf5f169f4597681633dc60406 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6db80102853e36748ab11d78323809de 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b5869f41f2e5fb4b9160f0d3c4fa4e5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 29589c1ab7a45c546a95325e05de6d48 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 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 | } -------------------------------------------------------------------------------- /Assets/Materials/Cube.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7c5ba3a2ff79d624f931e7695f70a03f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Floor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b95236c730724d2408616d033fc06d37 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Sphere.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f6601ece73857934cb81273ae8354b69 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene/LightingData.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 838b2cc23aea2d641a5606683c6e17af 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 112000000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Textures/RotatedPoissonSamplingTexture.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dd541e86e3a38954aa3d83830653848e 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11700000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/URP/New Universal Render Pipeline Asset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 20bca0a53c4df3143a84a4f9aa5806ad 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "m_Name": "Settings", 3 | "m_Path": "ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json", 4 | "m_Dictionary": { 5 | "m_DictionaryValues": [] 6 | } 7 | } -------------------------------------------------------------------------------- /Assets/URP/UniversalRenderPipelineGlobalSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5e6a1001e4d10b746a847890b1f534e9 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/URP/New Universal Render Pipeline Asset_Renderer.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 98d006b34e4e4f94981cf68fef75ff7a 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /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_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /Assets/Scripts/PoissonSamplingShadows.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5b9f53d8d8547988986db4a147e4e9e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: 7 | - RotationSamplingTexture: {fileID: 11700000, guid: dd541e86e3a38954aa3d83830653848e, type: 2} 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /ProjectSettings/URPProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 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: 11500000, guid: 247994e1f5a72c2419c26a37e9334c01, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_LastMaterialVersion: 5 16 | -------------------------------------------------------------------------------- /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/ShaderGraphSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 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: 11500000, guid: de02f9e1d18f588468e474319d09a723, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | customInterpolatorErrorThreshold: 32 16 | customInterpolatorWarningThreshold: 16 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/Materials/Cube.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Cube 11 | m_Shader: {fileID: 4800000, guid: c21b2e6e61fc47519f6719a351a2fc98, type: 3} 12 | m_ValidKeywords: [] 13 | m_InvalidKeywords: [] 14 | m_LightmapFlags: 4 15 | m_EnableInstancingVariants: 0 16 | m_DoubleSidedGI: 0 17 | m_CustomRenderQueue: -1 18 | stringTagMap: {} 19 | disabledShaderPasses: [] 20 | m_SavedProperties: 21 | serializedVersion: 3 22 | m_TexEnvs: [] 23 | m_Ints: [] 24 | m_Floats: 25 | - _PoissonSpread: 1287 26 | - _PoissonStratified: 0 27 | m_Colors: 28 | - _BaseColor: {r: 0.8679245, g: 0.24973297, b: 0.41495472, a: 1} 29 | m_BuildTextureStacks: [] 30 | -------------------------------------------------------------------------------- /Assets/Materials/Floor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Floor 11 | m_Shader: {fileID: 4800000, guid: c21b2e6e61fc47519f6719a351a2fc98, type: 3} 12 | m_ValidKeywords: [] 13 | m_InvalidKeywords: [] 14 | m_LightmapFlags: 4 15 | m_EnableInstancingVariants: 0 16 | m_DoubleSidedGI: 0 17 | m_CustomRenderQueue: -1 18 | stringTagMap: {} 19 | disabledShaderPasses: [] 20 | m_SavedProperties: 21 | serializedVersion: 3 22 | m_TexEnvs: [] 23 | m_Ints: [] 24 | m_Floats: 25 | - _PoissonSpread: 1287 26 | - _PoissonStratified: 0 27 | m_Colors: 28 | - _BaseColor: {r: 0.29125133, g: 0.7264151, b: 0.37141308, a: 1} 29 | m_BuildTextureStacks: [] 30 | -------------------------------------------------------------------------------- /Assets/Materials/Sphere.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Sphere 11 | m_Shader: {fileID: 4800000, guid: c21b2e6e61fc47519f6719a351a2fc98, type: 3} 12 | m_ValidKeywords: [] 13 | m_InvalidKeywords: [] 14 | m_LightmapFlags: 4 15 | m_EnableInstancingVariants: 0 16 | m_DoubleSidedGI: 0 17 | m_CustomRenderQueue: -1 18 | stringTagMap: {} 19 | disabledShaderPasses: [] 20 | m_SavedProperties: 21 | serializedVersion: 3 22 | m_TexEnvs: [] 23 | m_Ints: [] 24 | m_Floats: 25 | - _PoissonSpread: 1287 26 | - _PoissonStratified: 0 27 | m_Colors: 28 | - _BaseColor: {r: 0.26352793, g: 0.72115564, b: 0.8867924, a: 1} 29 | m_BuildTextureStacks: [] 30 | -------------------------------------------------------------------------------- /Assets/URP/UniversalRenderPipelineGlobalSettings.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: 11500000, guid: 2ec995e51a6e251468d2a3fd8a686257, type: 3} 13 | m_Name: UniversalRenderPipelineGlobalSettings 14 | m_EditorClassIdentifier: 15 | k_AssetVersion: 2 16 | lightLayerName0: Light Layer default 17 | lightLayerName1: Light Layer 1 18 | lightLayerName2: Light Layer 2 19 | lightLayerName3: Light Layer 3 20 | lightLayerName4: Light Layer 4 21 | lightLayerName5: Light Layer 5 22 | lightLayerName6: Light Layer 6 23 | lightLayerName7: Light Layer 7 24 | m_StripDebugVariants: 1 25 | m_StripUnusedPostProcessingVariants: 0 26 | m_StripUnusedVariants: 1 27 | supportRuntimeDebugDisplay: 0 28 | -------------------------------------------------------------------------------- /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_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | UnityAdsSettings: 27 | m_Enabled: 0 28 | m_InitializeOnStartup: 1 29 | m_TestMode: 0 30 | m_IosGameId: 31 | m_AndroidGameId: 32 | m_GameIds: {} 33 | m_GameId: 34 | PerformanceReportingSettings: 35 | m_Enabled: 0 36 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 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: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.com 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_UserSelectedRegistryName: 29 | m_UserAddingNewScopedRegistry: 0 30 | m_RegistryInfoDraft: 31 | m_Modified: 0 32 | m_ErrorMessage: 33 | m_UserModificationsInstanceId: -830 34 | m_OriginalInstanceId: -832 35 | m_LoadAssets: 0 36 | -------------------------------------------------------------------------------- /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/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /Assets/Scripts/PoissonSamplingShadows.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering.Universal; 3 | 4 | public class PoissonSamplingShadows : ScriptableRendererFeature 5 | { 6 | public enum PoissonSamplesCount 7 | { 8 | _4, 9 | _16, 10 | } 11 | 12 | public enum PoissonSamplingMode 13 | { 14 | Disabled, 15 | PoissonSampling, 16 | PoissonSamplingStratified, 17 | PoissonSamplingRotated, 18 | } 19 | 20 | public PoissonSamplingMode Mode = PoissonSamplingMode.PoissonSampling; 21 | [Min(0.1f)] 22 | public float Spread = 700f; 23 | [HideInInspector] 24 | public Texture3D RotationSamplingTexture; 25 | 26 | public PoissonSamplesCount SamplesCount = PoissonSamplesCount._16; 27 | 28 | private PoissonSamplingRendererPass _pass; 29 | 30 | private void OnDestroy() 31 | { 32 | _pass.Dispose(); 33 | } 34 | 35 | public override void Create() 36 | { 37 | _pass = new PoissonSamplingRendererPass 38 | { 39 | Mode = Mode, 40 | Spread = Spread, 41 | SamplesCount = SamplesCount, 42 | RotationSamplingTexture = RotationSamplingTexture, 43 | }; 44 | } 45 | 46 | public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) 47 | { 48 | renderer.EnqueuePass(_pass); 49 | } 50 | } -------------------------------------------------------------------------------- /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: 11 7 | m_SerializationMode: 2 8 | m_LineEndingsForNewScripts: 0 9 | m_DefaultBehaviorMode: 0 10 | m_PrefabRegularEnvironment: {fileID: 0} 11 | m_PrefabUIEnvironment: {fileID: 0} 12 | m_SpritePackerMode: 0 13 | m_SpritePackerPaddingPower: 1 14 | m_Bc7TextureCompressor: 0 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_EnableTextureStreamingInEditMode: 1 22 | m_EnableTextureStreamingInPlayMode: 1 23 | m_AsyncShaderCompilation: 1 24 | m_CachingShaderPreprocessor: 1 25 | m_PrefabModeAllowAutoSave: 1 26 | m_EnterPlayModeOptionsEnabled: 1 27 | m_EnterPlayModeOptions: 1 28 | m_GameObjectNamingDigits: 1 29 | m_GameObjectNamingScheme: 0 30 | m_AssetNamingUsesSpace: 1 31 | m_UseLegacyProbeSampleCount: 0 32 | m_SerializeInlineMappingsOnOneLine: 1 33 | m_DisableCookiesInLightmapper: 0 34 | m_AssetPipelineMode: 1 35 | m_RefreshImportMode: 0 36 | m_CacheServerMode: 0 37 | m_CacheServerEndpoint: 38 | m_CacheServerNamespacePrefix: default 39 | m_CacheServerEnableDownload: 1 40 | m_CacheServerEnableUpload: 1 41 | m_CacheServerEnableAuth: 0 42 | m_CacheServerEnableTls: 0 43 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/Scripts/RotatedPoissonSamplingTextureGenerator.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using Unity.Mathematics; 3 | using UnityEditor; 4 | using UnityEngine; 5 | using Random = UnityEngine.Random; 6 | 7 | public class RotatedPoissonSamplingTextureGenerator : EditorWindow 8 | { 9 | [SerializeField] [Min(1)] 10 | private int _size = 32; 11 | 12 | private void OnGUI() 13 | { 14 | _size = EditorGUILayout.IntField("Size", _size); 15 | 16 | if (GUILayout.Button("Generate")) 17 | Generate(); 18 | } 19 | 20 | [MenuItem("Window/Rendering/Rotated Poisson Sampling Texture Generator")] 21 | public static void Open() 22 | { 23 | var window = CreateWindow(); 24 | window.titleContent = new GUIContent("Rotated Poisson Sampling Texture Generator"); 25 | window.Show(); 26 | } 27 | 28 | private void Generate() 29 | { 30 | var texture = new Texture3D(_size, _size, _size, TextureFormat.RG16, false); 31 | var pixels = texture.GetPixels(); 32 | for (var i = 0; i < pixels.Length; i++) 33 | { 34 | var rotation = Random.value * Mathf.PI * 2; 35 | math.sincos(rotation, out var sin, out var cos); 36 | ref var pixel = ref pixels[i]; 37 | 38 | static float Remap(float value) => (value + 1) * 0.5f; 39 | pixel.r = Remap(cos); 40 | pixel.g = Remap(sin); 41 | } 42 | 43 | texture.SetPixels(pixels); 44 | texture.Apply(false, true); 45 | 46 | var path = EditorUtility.SaveFilePanelInProject( 47 | "Save texture", 48 | "RotatedPoissonSamplingTexture", 49 | "asset", 50 | "Save texture" 51 | ); 52 | 53 | if (path.Length == 0) return; 54 | 55 | AssetDatabase.CreateAsset(texture, path); 56 | AssetDatabase.SaveAssets(); 57 | } 58 | } 59 | 60 | #endif -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.15.15", 4 | "com.unity.feature.development": "1.0.1", 5 | "com.unity.ide.rider": "3.0.13", 6 | "com.unity.ide.visualstudio": "2.0.14", 7 | "com.unity.ide.vscode": "1.2.5", 8 | "com.unity.render-pipelines.universal": "12.1.6", 9 | "com.unity.test-framework": "1.1.31", 10 | "com.unity.textmeshpro": "3.0.6", 11 | "com.unity.timeline": "1.6.4", 12 | "com.unity.ugui": "1.0.0", 13 | "com.unity.visualscripting": "1.7.6", 14 | "com.unity.modules.ai": "1.0.0", 15 | "com.unity.modules.androidjni": "1.0.0", 16 | "com.unity.modules.animation": "1.0.0", 17 | "com.unity.modules.assetbundle": "1.0.0", 18 | "com.unity.modules.audio": "1.0.0", 19 | "com.unity.modules.cloth": "1.0.0", 20 | "com.unity.modules.director": "1.0.0", 21 | "com.unity.modules.imageconversion": "1.0.0", 22 | "com.unity.modules.imgui": "1.0.0", 23 | "com.unity.modules.jsonserialize": "1.0.0", 24 | "com.unity.modules.particlesystem": "1.0.0", 25 | "com.unity.modules.physics": "1.0.0", 26 | "com.unity.modules.physics2d": "1.0.0", 27 | "com.unity.modules.screencapture": "1.0.0", 28 | "com.unity.modules.terrain": "1.0.0", 29 | "com.unity.modules.terrainphysics": "1.0.0", 30 | "com.unity.modules.tilemap": "1.0.0", 31 | "com.unity.modules.ui": "1.0.0", 32 | "com.unity.modules.uielements": "1.0.0", 33 | "com.unity.modules.umbra": "1.0.0", 34 | "com.unity.modules.unityanalytics": "1.0.0", 35 | "com.unity.modules.unitywebrequest": "1.0.0", 36 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 37 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 38 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 39 | "com.unity.modules.unitywebrequestwww": "1.0.0", 40 | "com.unity.modules.vehicles": "1.0.0", 41 | "com.unity.modules.video": "1.0.0", 42 | "com.unity.modules.vr": "1.0.0", 43 | "com.unity.modules.wind": "1.0.0", 44 | "com.unity.modules.xr": "1.0.0" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Custom Unity PCF (Poisson Sampling) 2 | 3 | PCF (Percentage Closer Filtering) via Poisson sampling for Unity and Universal Render Pipeline. 4 | 5 | Used to prevent aliasing, which is one of the problems of shadow mapping. 6 | 7 | > Built with Unity 2021.3.0f1 and URP v12.1.6. 8 | 9 | ![Preview](Documentation/poisson_default_16.jpg) 10 | 11 | ## Implementation 12 | 13 | The project contains: 14 | - A render feature to configure the poisson sampling parameters: 15 | - Spread 16 | - Mode 17 | - Disabled 18 | - Poisson Sampling 19 | - Poisson Sampling (Stratified) 20 | - Poisson Sampling (Rotated) 21 | - Samples Count (4 or 16) 22 | - Lit Shader, which uses Poisson sampling to access shadow maps. Supports the following features: 23 | - Lambertian lighting 24 | - Shadow receiving/casting 25 | - Ambient lighting 26 | - Editor utility to generate 3D Texture to sample rotations in the shader. 27 | - It can be accessed in `Window/Rendering/Rotated Poisson Sampling Texture Generator`. 28 | - The render feature uses the bundled 32x32x32 texture by default. 29 | 30 | ## Examples 31 | 32 | Shadow resolution is set to 4096 in all examples. 33 | 34 | Hard shadows (built-in) 35 | 36 | ![Hard Shadows](Documentation/hard_shadows.jpg) 37 | 38 | Soft shadows (built-in) 39 | 40 | ![Soft Shadows](Documentation/soft_shadows.jpg) 41 | 42 | Poisson Sampling 43 | - Spread: 1200 44 | - Samples 16 45 | 46 | ![Poisson (Default, 16)](Documentation/poisson_default_16.jpg) 47 | 48 | Poisson Sampling 49 | - Spread: 1500 50 | - Samples 4 51 | 52 | ![Poisson (Default, 4)](Documentation/poisson_default_4.jpg) 53 | 54 | Poisson Sampling (Stratified) 55 | - Spread: 2000 56 | - Samples: 16 57 | 58 | ![Poisson (Stratified)](Documentation/poisson_stratified.jpg) 59 | 60 | Poisson Sampling (Rotated) 61 | - Spread: 1000 62 | - Samples: 16 63 | 64 | ![Poisson (Rotated)](Documentation/poisson_rotated.jpg) 65 | 66 | ## References 67 | 68 | - http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-16-shadow-mapping/#aliasing 69 | - https://dev.theomader.com/shadow-quality-2/ 70 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/URP/New Universal Render Pipeline Asset.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: 11500000, guid: bf2edee5c58d82540a51f03df9d42094, type: 3} 13 | m_Name: New Universal Render Pipeline Asset 14 | m_EditorClassIdentifier: 15 | k_AssetVersion: 9 16 | k_AssetPreviousVersion: 9 17 | m_RendererType: 1 18 | m_RendererData: {fileID: 0} 19 | m_RendererDataList: 20 | - {fileID: 11400000, guid: 98d006b34e4e4f94981cf68fef75ff7a, type: 2} 21 | m_DefaultRendererIndex: 0 22 | m_RequireDepthTexture: 0 23 | m_RequireOpaqueTexture: 0 24 | m_OpaqueDownsampling: 1 25 | m_SupportsTerrainHoles: 0 26 | m_StoreActionsOptimization: 0 27 | m_SupportsHDR: 0 28 | m_MSAA: 1 29 | m_RenderScale: 1 30 | m_UpscalingFilter: 0 31 | m_FsrOverrideSharpness: 0 32 | m_FsrSharpness: 0.92 33 | m_MainLightRenderingMode: 1 34 | m_MainLightShadowsSupported: 1 35 | m_MainLightShadowmapResolution: 4096 36 | m_AdditionalLightsRenderingMode: 1 37 | m_AdditionalLightsPerObjectLimit: 4 38 | m_AdditionalLightShadowsSupported: 0 39 | m_AdditionalLightsShadowmapResolution: 2048 40 | m_AdditionalLightsShadowResolutionTierLow: 256 41 | m_AdditionalLightsShadowResolutionTierMedium: 512 42 | m_AdditionalLightsShadowResolutionTierHigh: 1024 43 | m_ReflectionProbeBlending: 0 44 | m_ReflectionProbeBoxProjection: 0 45 | m_ShadowDistance: 25 46 | m_ShadowCascadeCount: 1 47 | m_Cascade2Split: 0.25 48 | m_Cascade3Split: {x: 0.1, y: 0.3} 49 | m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} 50 | m_CascadeBorder: 0.2 51 | m_ShadowDepthBias: 5.74 52 | m_ShadowNormalBias: 1 53 | m_SoftShadowsSupported: 0 54 | m_ConservativeEnclosingSphere: 1 55 | m_NumIterationsEnclosingSphere: 64 56 | m_AdditionalLightsCookieResolution: 2048 57 | m_AdditionalLightsCookieFormat: 3 58 | m_UseSRPBatcher: 1 59 | m_SupportsDynamicBatching: 0 60 | m_MixedLightingSupported: 1 61 | m_SupportsLightLayers: 0 62 | m_DebugLevel: 0 63 | m_UseAdaptivePerformance: 1 64 | m_ColorGradingMode: 0 65 | m_ColorGradingLutSize: 32 66 | m_UseFastSRGBLinearConversion: 0 67 | m_ShadowType: 1 68 | m_LocalShadowsSupported: 0 69 | m_LocalShadowsAtlasResolution: 256 70 | m_MaxPixelLights: 0 71 | m_ShadowAtlasResolution: 256 72 | m_ShaderVariantLogLevel: 0 73 | m_VolumeFrameworkUpdateMode: 0 74 | m_ShadowCascades: 0 75 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene/ReflectionProbe-0.exr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9b8ad7186d2f2f4db05b6682ba68ab8 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 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 | vTOnly: 0 27 | ignoreMasterTextureLimit: 0 28 | grayScaleToAlpha: 0 29 | generateCubemap: 6 30 | cubemapConvolution: 1 31 | seamlessCubemap: 1 32 | textureFormat: 1 33 | maxTextureSize: 2048 34 | textureSettings: 35 | serializedVersion: 2 36 | filterMode: 2 37 | aniso: 0 38 | mipBias: 0 39 | wrapU: 1 40 | wrapV: 1 41 | wrapW: 1 42 | nPOTScale: 1 43 | lightmap: 0 44 | compressionQuality: 50 45 | spriteMode: 0 46 | spriteExtrude: 1 47 | spriteMeshType: 1 48 | alignment: 0 49 | spritePivot: {x: 0.5, y: 0.5} 50 | spritePixelsToUnits: 100 51 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 52 | spriteGenerateFallbackPhysicsShape: 1 53 | alphaUsage: 1 54 | alphaIsTransparency: 0 55 | spriteTessellationDetail: -1 56 | textureType: 0 57 | textureShape: 2 58 | singleChannelComponent: 0 59 | flipbookRows: 1 60 | flipbookColumns: 1 61 | maxTextureSizeSet: 0 62 | compressionQualitySet: 0 63 | textureFormatSet: 0 64 | ignorePngGamma: 0 65 | applyGammaDecoding: 0 66 | platformSettings: 67 | - serializedVersion: 3 68 | buildTarget: DefaultTexturePlatform 69 | maxTextureSize: 2048 70 | resizeAlgorithm: 0 71 | textureFormat: -1 72 | textureCompression: 1 73 | compressionQuality: 100 74 | crunchedCompression: 0 75 | allowsAlphaSplitting: 0 76 | overridden: 0 77 | androidETC2FallbackOverride: 0 78 | forceMaximumCompressionQuality_BC6H_BC7: 0 79 | spriteSheet: 80 | serializedVersion: 2 81 | sprites: [] 82 | outline: [] 83 | physicsShape: [] 84 | bones: [] 85 | spriteID: 86 | internalID: 0 87 | vertices: [] 88 | indices: 89 | edges: [] 90 | weights: [] 91 | secondaryTextures: [] 92 | nameFileIdTable: {} 93 | spritePackingTag: 94 | pSDRemoveMatte: 0 95 | pSDShowRemoveMatteOption: 0 96 | userData: 97 | assetBundleName: 98 | assetBundleVariant: 99 | -------------------------------------------------------------------------------- /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: 14 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_VideoShadersIncludeMode: 2 32 | m_AlwaysIncludedShaders: 33 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_PreloadShadersBatchTimeLimit: -1 41 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 42 | m_CustomRenderPipeline: {fileID: 11400000, guid: 20bca0a53c4df3143a84a4f9aa5806ad, type: 2} 43 | m_TransparencySortMode: 0 44 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 45 | m_DefaultRenderingPath: 1 46 | m_DefaultMobileRenderingPath: 1 47 | m_TierSettings: [] 48 | m_LightmapStripping: 0 49 | m_FogStripping: 0 50 | m_InstancingStripping: 0 51 | m_LightmapKeepPlain: 1 52 | m_LightmapKeepDirCombined: 1 53 | m_LightmapKeepDynamicPlain: 1 54 | m_LightmapKeepDynamicDirCombined: 1 55 | m_LightmapKeepShadowMask: 1 56 | m_LightmapKeepSubtractive: 1 57 | m_FogKeepLinear: 1 58 | m_FogKeepExp: 1 59 | m_FogKeepExp2: 1 60 | m_AlbedoSwatchInfos: [] 61 | m_LightsUseLinearIntensity: 1 62 | m_LightsUseColorTemperature: 1 63 | m_DefaultRenderingLayerMask: 1 64 | m_LogWhenShaderIsCompiled: 0 65 | m_SRPDefaultSettings: 66 | UnityEngine.Rendering.Universal.UniversalRenderPipeline: {fileID: 11400000, guid: 5e6a1001e4d10b746a847890b1f534e9, type: 2} 67 | -------------------------------------------------------------------------------- /Assets/URP/New Universal Render Pipeline Asset_Renderer.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: 11500000, guid: de640fe3d0db1804a85f9fc8f5cadab6, type: 3} 13 | m_Name: New Universal Render Pipeline Asset_Renderer 14 | m_EditorClassIdentifier: 15 | debugShaders: 16 | debugReplacementPS: {fileID: 4800000, guid: cf852408f2e174538bcd9b7fda1c5ae7, type: 3} 17 | m_RendererFeatures: 18 | - {fileID: 2867228581203603178} 19 | m_RendererFeatureMap: eaee7c103471ca27 20 | m_UseNativeRenderPass: 0 21 | postProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} 22 | xrSystemData: {fileID: 11400000, guid: 60e1133243b97e347b653163a8c01b64, type: 2} 23 | shaders: 24 | blitPS: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} 25 | copyDepthPS: {fileID: 4800000, guid: d6dae50ee9e1bfa4db75f19f99355220, type: 3} 26 | screenSpaceShadowPS: {fileID: 0} 27 | samplingPS: {fileID: 4800000, guid: 04c410c9937594faa893a11dceb85f7e, type: 3} 28 | stencilDeferredPS: {fileID: 4800000, guid: e9155b26e1bc55942a41e518703fe304, type: 3} 29 | fallbackErrorPS: {fileID: 4800000, guid: e6e9a19c3678ded42a3bc431ebef7dbd, type: 3} 30 | materialErrorPS: {fileID: 4800000, guid: 5fd9a8feb75a4b5894c241777f519d4e, type: 3} 31 | coreBlitPS: {fileID: 4800000, guid: 93446b5c5339d4f00b85c159e1159b7c, type: 3} 32 | coreBlitColorAndDepthPS: {fileID: 4800000, guid: d104b2fc1ca6445babb8e90b0758136b, type: 3} 33 | cameraMotionVector: {fileID: 4800000, guid: c56b7e0d4c7cb484e959caeeedae9bbf, type: 3} 34 | objectMotionVector: {fileID: 4800000, guid: 7b3ede40266cd49a395def176e1bc486, type: 3} 35 | m_AssetVersion: 1 36 | m_OpaqueLayerMask: 37 | serializedVersion: 2 38 | m_Bits: 4294967295 39 | m_TransparentLayerMask: 40 | serializedVersion: 2 41 | m_Bits: 4294967295 42 | m_DefaultStencilState: 43 | overrideStencilState: 0 44 | stencilReference: 0 45 | stencilCompareFunction: 8 46 | passOperation: 2 47 | failOperation: 0 48 | zFailOperation: 0 49 | m_ShadowTransparentReceive: 1 50 | m_RenderingMode: 0 51 | m_DepthPrimingMode: 0 52 | m_AccurateGbufferNormals: 0 53 | m_ClusteredRendering: 0 54 | m_TileSize: 32 55 | m_IntermediateTextureMode: 1 56 | --- !u!114 &2867228581203603178 57 | MonoBehaviour: 58 | m_ObjectHideFlags: 0 59 | m_CorrespondingSourceObject: {fileID: 0} 60 | m_PrefabInstance: {fileID: 0} 61 | m_PrefabAsset: {fileID: 0} 62 | m_GameObject: {fileID: 0} 63 | m_Enabled: 1 64 | m_EditorHideFlags: 0 65 | m_Script: {fileID: 11500000, guid: b5b9f53d8d8547988986db4a147e4e9e, type: 3} 66 | m_Name: PoissonSamplingShadows 67 | m_EditorClassIdentifier: 68 | m_Active: 1 69 | Spread: 1000 70 | Mode: 3 71 | RotationSamplingTexture: {fileID: 11700000, guid: dd541e86e3a38954aa3d83830653848e, type: 2} 72 | SamplesCount: 1 73 | -------------------------------------------------------------------------------- /Assets/Scripts/PoissonSamplingRendererPass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using UnityEngine.Rendering; 4 | using UnityEngine.Rendering.Universal; 5 | 6 | public class PoissonSamplingRendererPass : ScriptableRenderPass, IDisposable 7 | { 8 | private const string PoissonShadowsKeyword = "_POISSON_SHADOWS"; 9 | private const string PoissonShadowsStratifiedKeyword = "_POISSON_SHADOWS_STRATIFIED"; 10 | private const string PoissonShadowsRotatedKeyword = "_POISSON_SHADOWS_ROTATED"; 11 | 12 | private const string PoissonShadowsDisk4Keyword = "_POISSON_SHADOWS_DISK_4"; 13 | private const string PoissonShadowsDisk16Keyword = "_POISSON_SHADOWS_DISK_16"; 14 | 15 | 16 | private static readonly int PoissonShadowsSpreadInvId = Shader.PropertyToID("_PoissonShadowsSpreadInv"); 17 | private static readonly int PoissonShadowsRotationTextureId = Shader.PropertyToID("_PoissonShadowsRotationTexture"); 18 | 19 | public PoissonSamplingRendererPass() => renderPassEvent = RenderPassEvent.BeforeRendering; 20 | 21 | public PoissonSamplingShadows.PoissonSamplingMode Mode { get; set; } 22 | 23 | public float Spread { get; set; } 24 | 25 | public PoissonSamplingShadows.PoissonSamplesCount SamplesCount { get; set; } 26 | 27 | public Texture3D RotationSamplingTexture { get; set; } 28 | 29 | 30 | public void Dispose() 31 | { 32 | Shader.DisableKeyword(PoissonShadowsKeyword); 33 | Shader.DisableKeyword(PoissonShadowsStratifiedKeyword); 34 | Shader.DisableKeyword(PoissonShadowsRotatedKeyword); 35 | 36 | Shader.DisableKeyword(PoissonShadowsDisk4Keyword); 37 | Shader.DisableKeyword(PoissonShadowsDisk16Keyword); 38 | 39 | Shader.SetGlobalTexture(PoissonShadowsRotationTextureId, null); 40 | } 41 | 42 | public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) 43 | { 44 | var cmd = CommandBufferPool.Get(); 45 | 46 | switch (Mode) 47 | { 48 | case PoissonSamplingShadows.PoissonSamplingMode.Disabled: 49 | cmd.DisableShaderKeyword(PoissonShadowsKeyword); 50 | cmd.DisableShaderKeyword(PoissonShadowsStratifiedKeyword); 51 | cmd.DisableShaderKeyword(PoissonShadowsRotatedKeyword); 52 | break; 53 | case PoissonSamplingShadows.PoissonSamplingMode.PoissonSampling: 54 | cmd.EnableShaderKeyword(PoissonShadowsKeyword); 55 | cmd.DisableShaderKeyword(PoissonShadowsStratifiedKeyword); 56 | cmd.DisableShaderKeyword(PoissonShadowsRotatedKeyword); 57 | break; 58 | case PoissonSamplingShadows.PoissonSamplingMode.PoissonSamplingStratified: 59 | cmd.DisableShaderKeyword(PoissonShadowsKeyword); 60 | cmd.EnableShaderKeyword(PoissonShadowsStratifiedKeyword); 61 | cmd.DisableShaderKeyword(PoissonShadowsRotatedKeyword); 62 | break; 63 | case PoissonSamplingShadows.PoissonSamplingMode.PoissonSamplingRotated: 64 | cmd.DisableShaderKeyword(PoissonShadowsKeyword); 65 | cmd.DisableShaderKeyword(PoissonShadowsStratifiedKeyword); 66 | cmd.EnableShaderKeyword(PoissonShadowsRotatedKeyword); 67 | break; 68 | default: 69 | throw new ArgumentOutOfRangeException(); 70 | } 71 | 72 | if (Mode != PoissonSamplingShadows.PoissonSamplingMode.Disabled) 73 | { 74 | switch (SamplesCount) 75 | { 76 | case PoissonSamplingShadows.PoissonSamplesCount._4: 77 | cmd.EnableShaderKeyword(PoissonShadowsDisk4Keyword); 78 | cmd.DisableShaderKeyword(PoissonShadowsDisk16Keyword); 79 | break; 80 | case PoissonSamplingShadows.PoissonSamplesCount._16: 81 | cmd.DisableShaderKeyword(PoissonShadowsDisk4Keyword); 82 | cmd.EnableShaderKeyword(PoissonShadowsDisk16Keyword); 83 | break; 84 | default: 85 | throw new ArgumentOutOfRangeException(); 86 | } 87 | } 88 | else 89 | { 90 | cmd.DisableShaderKeyword(PoissonShadowsDisk4Keyword); 91 | cmd.DisableShaderKeyword(PoissonShadowsDisk16Keyword); 92 | } 93 | 94 | cmd.SetGlobalTexture(PoissonShadowsRotationTextureId, 95 | Mode == PoissonSamplingShadows.PoissonSamplingMode.PoissonSamplingRotated 96 | ? RotationSamplingTexture 97 | : Texture2D.blackTexture 98 | ); 99 | 100 | 101 | cmd.SetGlobalFloat(PoissonShadowsSpreadInvId, 1f / Spread); 102 | 103 | context.ExecuteCommandBuffer(cmd); 104 | CommandBufferPool.Release(cmd); 105 | } 106 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | end_of_line=lf 3 | trim_trailing_whitespace=false 4 | insert_final_newline=false 5 | indent_style=space 6 | indent_size=4 7 | 8 | # Spacing 9 | csharp_space_after_cast = true 10 | csharp_space_after_colon_in_inheritance_clause = true 11 | csharp_space_after_comma = true 12 | csharp_space_after_dot = false 13 | csharp_space_after_keywords_in_control_flow_statements = true 14 | csharp_space_after_semicolon_in_for_statement = true 15 | csharp_space_around_binary_operators = before_and_after 16 | csharp_space_around_declaration_statements = false 17 | csharp_space_before_colon_in_inheritance_clause = true 18 | csharp_space_before_comma = false 19 | csharp_space_before_dot = false 20 | csharp_space_before_open_square_brackets = false 21 | csharp_space_before_semicolon_in_for_statement = false 22 | csharp_space_between_empty_square_brackets = false 23 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 24 | csharp_space_between_method_call_name_and_opening_parenthesis = false 25 | csharp_space_between_method_call_parameter_list_parentheses = false 26 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 27 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 28 | csharp_space_between_method_declaration_parameter_list_parentheses = false 29 | csharp_space_between_parentheses = false 30 | csharp_space_between_square_brackets = false 31 | 32 | # Microsoft .NET properties 33 | csharp_new_line_before_members_in_object_initializers=false 34 | csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion 35 | csharp_style_var_elsewhere=true:suggestion 36 | csharp_style_var_for_built_in_types=true:suggestion 37 | csharp_style_var_when_type_is_apparent=true:suggestion 38 | dotnet_naming_rule.types_and_namespaces_rule.severity=warning 39 | dotnet_naming_rule.types_and_namespaces_rule.style=upper_camel_case_underscore_tolerant_style 40 | dotnet_naming_rule.types_and_namespaces_rule.symbols=types_and_namespaces_symbols 41 | dotnet_naming_style.upper_camel_case_underscore_tolerant_style.capitalization=pascal_case 42 | dotnet_naming_style.upper_camel_case_underscore_tolerant_style.word_separator=_ 43 | dotnet_naming_symbols.types_and_namespaces_symbols.applicable_accessibilities=* 44 | dotnet_naming_symbols.types_and_namespaces_symbols.applicable_kinds=namespace,class,struct,enum,delegate 45 | dotnet_style_parentheses_in_arithmetic_binary_operators=never_if_unnecessary:none 46 | dotnet_style_parentheses_in_other_binary_operators=never_if_unnecessary:none 47 | dotnet_style_parentheses_in_relational_binary_operators=never_if_unnecessary:none 48 | dotnet_style_predefined_type_for_locals_parameters_members=true:suggestion 49 | dotnet_style_predefined_type_for_member_access=true:suggestion 50 | dotnet_style_qualification_for_event=false:suggestion 51 | dotnet_style_qualification_for_field=false:suggestion 52 | dotnet_style_qualification_for_method=false:suggestion 53 | dotnet_style_qualification_for_property=false:suggestion 54 | dotnet_style_require_accessibility_modifiers=for_non_interface_members:suggestion 55 | 56 | # ReSharper properties 57 | resharper_apply_auto_detected_rules=false 58 | resharper_autodetect_indent_settings=true 59 | resharper_braces_for_for=required 60 | resharper_braces_for_foreach=required 61 | resharper_braces_for_while=required 62 | resharper_constructor_or_destructor_body=expression_body 63 | resharper_csharp_empty_block_style=together_same_line 64 | resharper_csharp_indent_style=tab 65 | resharper_csharp_wrap_before_invocation_rpar=true 66 | resharper_force_attribute_style=separate 67 | resharper_indent_nested_fixed_stmt=true 68 | resharper_indent_nested_foreach_stmt=true 69 | resharper_indent_nested_for_stmt=true 70 | resharper_indent_nested_lock_stmt=true 71 | resharper_indent_nested_usings_stmt=true 72 | resharper_indent_nested_while_stmt=true 73 | resharper_indent_preprocessor_directives=normal 74 | resharper_local_function_body=expression_body 75 | resharper_method_or_operator_body=expression_body 76 | resharper_trailing_comma_in_multiline_lists=true 77 | resharper_use_indent_from_vs=false 78 | resharper_use_roslyn_logic_for_evident_types=true 79 | 80 | # ReSharper inspection severities 81 | resharper_arrange_redundant_parentheses_highlighting=hint 82 | resharper_arrange_this_qualifier_highlighting=hint 83 | resharper_arrange_type_member_modifiers_highlighting=hint 84 | resharper_arrange_type_modifiers_highlighting=hint 85 | resharper_bad_child_statement_indent_highlighting=none 86 | resharper_bad_control_braces_indent_highlighting=warning 87 | resharper_built_in_type_reference_style_for_member_access_highlighting=hint 88 | resharper_built_in_type_reference_style_highlighting=hint 89 | resharper_enforce_do_while_statement_braces_highlighting=warning 90 | resharper_enforce_fixed_statement_braces_highlighting=warning 91 | resharper_enforce_foreach_statement_braces_highlighting=warning 92 | resharper_enforce_for_statement_braces_highlighting=warn 93 | resharper_enforce_if_statement_braces_highlighting=warning 94 | resharper_enforce_lock_statement_braces_highlighting=warning 95 | resharper_enforce_using_statement_braces_highlighting=warning 96 | resharper_enforce_while_statement_braces_highlighting=warning 97 | resharper_function_recursive_on_all_paths_highlighting=error 98 | resharper_redundant_base_qualifier_highlighting=warning 99 | resharper_suggest_var_or_type_built_in_types_highlighting=hint 100 | resharper_suggest_var_or_type_elsewhere_highlighting=hint 101 | resharper_suggest_var_or_type_simple_types_highlighting=hint 102 | resharper_web_config_module_not_resolved_highlighting=warning 103 | resharper_web_config_type_not_resolved_highlighting=warning 104 | resharper_web_config_wrong_module_highlighting=warning 105 | 106 | [*.cs] 107 | indent_style=space 108 | indent_size=4 109 | -------------------------------------------------------------------------------- /ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "ignore": false, 8 | "defaultInstantiationMode": 0, 9 | "supportsModification": true 10 | }, 11 | { 12 | "userAdded": false, 13 | "type": "UnityEditor.Animations.AnimatorController", 14 | "ignore": false, 15 | "defaultInstantiationMode": 0, 16 | "supportsModification": true 17 | }, 18 | { 19 | "userAdded": false, 20 | "type": "UnityEngine.AnimatorOverrideController", 21 | "ignore": false, 22 | "defaultInstantiationMode": 0, 23 | "supportsModification": true 24 | }, 25 | { 26 | "userAdded": false, 27 | "type": "UnityEditor.Audio.AudioMixerController", 28 | "ignore": false, 29 | "defaultInstantiationMode": 0, 30 | "supportsModification": true 31 | }, 32 | { 33 | "userAdded": false, 34 | "type": "UnityEngine.ComputeShader", 35 | "ignore": true, 36 | "defaultInstantiationMode": 1, 37 | "supportsModification": true 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEngine.Cubemap", 42 | "ignore": false, 43 | "defaultInstantiationMode": 0, 44 | "supportsModification": true 45 | }, 46 | { 47 | "userAdded": false, 48 | "type": "UnityEngine.GameObject", 49 | "ignore": false, 50 | "defaultInstantiationMode": 0, 51 | "supportsModification": true 52 | }, 53 | { 54 | "userAdded": false, 55 | "type": "UnityEditor.LightingDataAsset", 56 | "ignore": false, 57 | "defaultInstantiationMode": 0, 58 | "supportsModification": false 59 | }, 60 | { 61 | "userAdded": false, 62 | "type": "UnityEngine.LightingSettings", 63 | "ignore": false, 64 | "defaultInstantiationMode": 0, 65 | "supportsModification": true 66 | }, 67 | { 68 | "userAdded": false, 69 | "type": "UnityEngine.Material", 70 | "ignore": false, 71 | "defaultInstantiationMode": 0, 72 | "supportsModification": true 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEditor.MonoScript", 77 | "ignore": true, 78 | "defaultInstantiationMode": 1, 79 | "supportsModification": true 80 | }, 81 | { 82 | "userAdded": false, 83 | "type": "UnityEngine.PhysicMaterial", 84 | "ignore": false, 85 | "defaultInstantiationMode": 0, 86 | "supportsModification": true 87 | }, 88 | { 89 | "userAdded": false, 90 | "type": "UnityEngine.PhysicsMaterial2D", 91 | "ignore": false, 92 | "defaultInstantiationMode": 0, 93 | "supportsModification": true 94 | }, 95 | { 96 | "userAdded": false, 97 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 98 | "ignore": false, 99 | "defaultInstantiationMode": 0, 100 | "supportsModification": true 101 | }, 102 | { 103 | "userAdded": false, 104 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 105 | "ignore": false, 106 | "defaultInstantiationMode": 0, 107 | "supportsModification": true 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Rendering.VolumeProfile", 112 | "ignore": false, 113 | "defaultInstantiationMode": 0, 114 | "supportsModification": true 115 | }, 116 | { 117 | "userAdded": false, 118 | "type": "UnityEditor.SceneAsset", 119 | "ignore": false, 120 | "defaultInstantiationMode": 0, 121 | "supportsModification": false 122 | }, 123 | { 124 | "userAdded": false, 125 | "type": "UnityEngine.Shader", 126 | "ignore": true, 127 | "defaultInstantiationMode": 1, 128 | "supportsModification": true 129 | }, 130 | { 131 | "userAdded": false, 132 | "type": "UnityEngine.ShaderVariantCollection", 133 | "ignore": true, 134 | "defaultInstantiationMode": 1, 135 | "supportsModification": true 136 | }, 137 | { 138 | "userAdded": false, 139 | "type": "UnityEngine.Texture", 140 | "ignore": false, 141 | "defaultInstantiationMode": 0, 142 | "supportsModification": true 143 | }, 144 | { 145 | "userAdded": false, 146 | "type": "UnityEngine.Texture2D", 147 | "ignore": false, 148 | "defaultInstantiationMode": 0, 149 | "supportsModification": true 150 | }, 151 | { 152 | "userAdded": false, 153 | "type": "UnityEngine.Timeline.TimelineAsset", 154 | "ignore": false, 155 | "defaultInstantiationMode": 0, 156 | "supportsModification": true 157 | } 158 | ], 159 | "defaultDependencyTypeInfo": { 160 | "userAdded": false, 161 | "type": "", 162 | "ignore": false, 163 | "defaultInstantiationMode": 1, 164 | "supportsModification": true 165 | }, 166 | "newSceneOverride": 0 167 | } -------------------------------------------------------------------------------- /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: 0 205 | softParticles: 1 206 | softVegetation: 1 207 | realtimeReflectionProbes: 1 208 | billboardsFaceCameraPosition: 1 209 | vSyncCount: 1 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 | Stadia: 5 233 | Standalone: 5 234 | WebGL: 3 235 | Windows Store Apps: 5 236 | XboxOne: 5 237 | iPhone: 2 238 | tvOS: 2 239 | -------------------------------------------------------------------------------- /Assets/Shaders/LitPoissonSampling.shader: -------------------------------------------------------------------------------- 1 | Shader "Custom/Lit Poisson Sampling" 2 | { 3 | Properties 4 | { 5 | [MainColor] 6 | _BaseColor ("Albedo", Color) = (1.0, 1.0, 1.0, 1.0) 7 | } 8 | SubShader 9 | { 10 | Tags { "RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline" } 11 | LOD 300 12 | 13 | Pass 14 | { 15 | Name "ForwardLitPoissonSampling" 16 | Tags{"LightMode" = "UniversalForward"} 17 | 18 | HLSLPROGRAM 19 | #pragma vertex vert 20 | #pragma fragment frag 21 | 22 | #pragma multi_compile _ _MAIN_LIGHT_SHADOWS _MAIN_LIGHT_SHADOWS_CASCADE 23 | #pragma multi_compile _ _SHADOWS_SOFT 24 | #pragma multi_compile _ _POISSON_SHADOWS _POISSON_SHADOWS_STRATIFIED _POISSON_SHADOWS_ROTATED 25 | #pragma multi_compile _ _POISSON_SHADOWS_DISK_4 _POISSON_SHADOWS_DISK_16 26 | 27 | #pragma shader_feature_local POISSON_SAMPLING_STRATIFIED 28 | 29 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 30 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" 31 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Shadows.hlsl" 32 | 33 | #if defined(_POISSON_SHADOWS) || defined(_POISSON_SHADOWS_STRATIFIED) || defined(_POISSON_SHADOWS_ROTATED) 34 | #define _POISSON_SHADOWS_ANY 35 | #endif 36 | 37 | struct appdata 38 | { 39 | float4 position_os : POSITION; 40 | 41 | half2 uv : TEXCOORD0; 42 | half3 normal_os : NORMAL; 43 | }; 44 | 45 | struct v2f 46 | { 47 | float4 position_cs : SV_POSITION; 48 | 49 | half2 uv : TEXCOORD0; 50 | half3 normal_ws : NORMAL; 51 | float3 position_ws : POSITION_WS; 52 | }; 53 | 54 | float _PoissonShadowsSpreadInv; 55 | TEXTURE3D(_PoissonShadowsRotationTexture); 56 | SAMPLER(sampler_PoissonShadowsRotationTexture); 57 | 58 | CBUFFER_START(UnityPerMaterial) 59 | half4 _BaseColor; 60 | CBUFFER_END 61 | 62 | v2f vert (const appdata v) 63 | { 64 | v2f o; 65 | const float3 position_ws = TransformObjectToWorld(v.position_os.xyz); 66 | o.position_cs = TransformWorldToHClip(position_ws); 67 | o.uv = v.uv; 68 | o.normal_ws = TransformObjectToWorldNormal(v.normal_os); 69 | o.position_ws = position_ws; 70 | return o; 71 | } 72 | 73 | #ifdef _POISSON_SHADOWS_DISK_4 74 | 75 | #define POISSON_DISK_SIZE 4 76 | 77 | static const float2 poisson_disk[] = { 78 | float2( -0.94201624, -0.39906216 ), 79 | float2( 0.94558609, -0.76890725 ), 80 | float2( -0.094184101, -0.92938870 ), 81 | float2( 0.34495938, 0.29387760 ) 82 | }; 83 | #elif defined(_POISSON_SHADOWS_DISK_16) 84 | 85 | #define POISSON_DISK_SIZE 16 86 | 87 | static const float2 poisson_disk[] = { 88 | float2( -0.94201624, -0.39906216 ), 89 | float2( 0.94558609, -0.76890725 ), 90 | float2( -0.094184101, -0.92938870 ), 91 | float2( 0.34495938, 0.29387760 ), 92 | float2( -0.91588581, 0.45771432 ), 93 | float2( -0.81544232, -0.87912464 ), 94 | float2( -0.38277543, 0.27676845 ), 95 | float2( 0.97484398, 0.75648379 ), 96 | float2( 0.44323325, -0.97511554 ), 97 | float2( 0.53742981, -0.47373420 ), 98 | float2( -0.26496911, -0.41893023 ), 99 | float2( 0.79197514, 0.19090188 ), 100 | float2( -0.24188840, 0.99706507 ), 101 | float2( -0.81409955, 0.91437590 ), 102 | float2( 0.19984126, 0.78641367 ), 103 | float2( 0.14383161, -0.14100790 ) 104 | }; 105 | 106 | #else 107 | 108 | #define POISSON_DISK_SIZE 0 109 | 110 | static const float2 poisson_disk[1]; 111 | 112 | #endif 113 | 114 | float random_value(const float4 seed4) 115 | { 116 | const float dot_product = dot(seed4, float4(12.9898,78.233,45.164,94.673)); 117 | return frac(sin(dot_product) * 43758.5453); 118 | } 119 | 120 | real sample_shadowmap_poisson(TEXTURE2D_SHADOW_PARAM(shadow_map, sampler_shadow_map), float4 shadow_coord, half4 shadow_params, float3 position_ws, const bool is_perspective_projection = true) 121 | { 122 | // Compiler will optimize this branch away as long as isPerspectiveProjection is known at compile time 123 | if (is_perspective_projection) 124 | shadow_coord.xyz /= shadow_coord.w; 125 | 126 | real attenuation = 0; 127 | 128 | #ifdef _POISSON_SHADOWS_ROTATED 129 | float2 rotation = SAMPLE_TEXTURE3D(_PoissonShadowsRotationTexture, sampler_PoissonShadowsRotationTexture, position_ws.xyz * 100).xy; 130 | rotation = rotation * 2 - 1; 131 | #endif 132 | 133 | UNITY_UNROLL 134 | for (int i=0;i