├── .gitignore ├── Assets ├── Scenes.meta ├── Scenes │ ├── TestScene.unity │ └── TestScene.unity.meta ├── Script.meta ├── Script │ ├── AddShader.shader │ ├── AddShader.shader.meta │ ├── BRDFs.cginc │ ├── BRDFs.cginc.meta │ ├── BTDFs.cginc │ ├── BTDFs.cginc.meta │ ├── Common.cginc │ ├── Common.cginc.meta │ ├── PathTracingMaster.cs │ ├── PathTracingMaster.cs.meta │ ├── PathTracingShader.compute │ └── PathTracingShader.compute.meta ├── texture.meta └── texture │ ├── cape_hill_4k.hdr │ ├── cape_hill_4k.hdr.meta │ ├── kiara_9_dusk_4k.hdr │ └── kiara_9_dusk_4k.hdr.meta ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset └── VFXManager.asset ├── README.md └── Screenshot ├── Derivation ├── BRDF │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.png │ └── 4.png └── BTDF │ ├── 1.jpg │ ├── 2.jpg │ ├── 3.png │ └── 4.jpg ├── MonteCarlo.png ├── Pbr.png ├── RenderingEquation.png ├── blend.jpg ├── btdf.png └── cook-torrance.png /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | Assets/AssetStoreTools* 7 | Assets/Develop* 8 | 9 | # Visual Studio cache directory 10 | .vs/ 11 | 12 | # Autogenerated VS/MD/Consulo solution and project files 13 | ExportedObj/ 14 | .consulo/ 15 | *.csproj 16 | *.unityproj 17 | *.sln 18 | *.suo 19 | *.tmp 20 | *.user 21 | *.userprefs 22 | *.pidb 23 | *.booproj 24 | *.svd 25 | *.pdb 26 | 27 | # Unity3D generated meta files 28 | *.pidb.meta 29 | *.pdb.meta 30 | 31 | # Unity3D Generated File On Crash Reports 32 | sysinfo.txt 33 | 34 | # Builds 35 | *.apk 36 | *.unitypackage 37 | Logs 38 | Packages 39 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ef494fdf49b78f348b5c7e3f6ea42a31 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/TestScene.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: 170076734} 41 | m_IndirectSpecularColor: {r: 0.18028554, g: 0.22571614, b: 0.30692446, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 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: 10 58 | m_Resolution: 2 59 | m_BakeResolution: 10 60 | m_AtlasSize: 512 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 1 69 | m_FinalGather: 0 70 | m_FinalGatherFiltering: 1 71 | m_FinalGatherRayCount: 256 72 | m_ReflectionCompression: 2 73 | m_MixedBakeMode: 2 74 | m_BakeBackend: 1 75 | m_PVRSampling: 1 76 | m_PVRDirectSampleCount: 32 77 | m_PVRSampleCount: 256 78 | m_PVRBounces: 2 79 | m_PVRFilterTypeDirect: 0 80 | m_PVRFilterTypeIndirect: 0 81 | m_PVRFilterTypeAO: 0 82 | m_PVRFilteringMode: 1 83 | m_PVRCulling: 1 84 | m_PVRFilteringGaussRadiusDirect: 1 85 | m_PVRFilteringGaussRadiusIndirect: 5 86 | m_PVRFilteringGaussRadiusAO: 2 87 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 88 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 89 | m_PVRFilteringAtrousPositionSigmaAO: 1 90 | m_ShowResolutionOverlay: 1 91 | m_LightingDataAsset: {fileID: 0} 92 | m_UseShadowmask: 1 93 | --- !u!196 &4 94 | NavMeshSettings: 95 | serializedVersion: 2 96 | m_ObjectHideFlags: 0 97 | m_BuildSettings: 98 | serializedVersion: 2 99 | agentTypeID: 0 100 | agentRadius: 0.5 101 | agentHeight: 2 102 | agentSlope: 45 103 | agentClimb: 0.4 104 | ledgeDropHeight: 0 105 | maxJumpAcrossDistance: 0 106 | minRegionArea: 2 107 | manualCellSize: 0 108 | cellSize: 0.16666667 109 | manualTileSize: 0 110 | tileSize: 256 111 | accuratePlacement: 0 112 | debug: 113 | m_Flags: 0 114 | m_NavMeshData: {fileID: 0} 115 | --- !u!1 &170076733 116 | GameObject: 117 | m_ObjectHideFlags: 0 118 | m_CorrespondingSourceObject: {fileID: 0} 119 | m_PrefabInstance: {fileID: 0} 120 | m_PrefabAsset: {fileID: 0} 121 | serializedVersion: 6 122 | m_Component: 123 | - component: {fileID: 170076735} 124 | - component: {fileID: 170076734} 125 | m_Layer: 0 126 | m_Name: Directional Light 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!108 &170076734 133 | Light: 134 | m_ObjectHideFlags: 0 135 | m_CorrespondingSourceObject: {fileID: 0} 136 | m_PrefabInstance: {fileID: 0} 137 | m_PrefabAsset: {fileID: 0} 138 | m_GameObject: {fileID: 170076733} 139 | m_Enabled: 1 140 | serializedVersion: 8 141 | m_Type: 1 142 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 143 | m_Intensity: 1 144 | m_Range: 10 145 | m_SpotAngle: 30 146 | m_CookieSize: 10 147 | m_Shadows: 148 | m_Type: 2 149 | m_Resolution: -1 150 | m_CustomResolution: -1 151 | m_Strength: 1 152 | m_Bias: 0.05 153 | m_NormalBias: 0.4 154 | m_NearPlane: 0.2 155 | m_Cookie: {fileID: 0} 156 | m_DrawHalo: 0 157 | m_Flare: {fileID: 0} 158 | m_RenderMode: 0 159 | m_CullingMask: 160 | serializedVersion: 2 161 | m_Bits: 4294967295 162 | m_Lightmapping: 1 163 | m_LightShadowCasterMode: 0 164 | m_AreaSize: {x: 1, y: 1} 165 | m_BounceIntensity: 1 166 | m_ColorTemperature: 6570 167 | m_UseColorTemperature: 0 168 | m_ShadowRadius: 0 169 | m_ShadowAngle: 0 170 | --- !u!4 &170076735 171 | Transform: 172 | m_ObjectHideFlags: 0 173 | m_CorrespondingSourceObject: {fileID: 0} 174 | m_PrefabInstance: {fileID: 0} 175 | m_PrefabAsset: {fileID: 0} 176 | m_GameObject: {fileID: 170076733} 177 | m_LocalRotation: {x: 0.29883623, y: -0.64085644, z: 0.29883623, w: 0.64085644} 178 | m_LocalPosition: {x: 0, y: 3, z: 0} 179 | m_LocalScale: {x: 1, y: 1, z: 1} 180 | m_Children: [] 181 | m_Father: {fileID: 0} 182 | m_RootOrder: 0 183 | m_LocalEulerAnglesHint: {x: 50, y: -90, z: 0} 184 | --- !u!1 &534669902 185 | GameObject: 186 | m_ObjectHideFlags: 0 187 | m_CorrespondingSourceObject: {fileID: 0} 188 | m_PrefabInstance: {fileID: 0} 189 | m_PrefabAsset: {fileID: 0} 190 | serializedVersion: 6 191 | m_Component: 192 | - component: {fileID: 534669905} 193 | - component: {fileID: 534669904} 194 | - component: {fileID: 534669903} 195 | - component: {fileID: 534669906} 196 | m_Layer: 0 197 | m_Name: Main Camera 198 | m_TagString: MainCamera 199 | m_Icon: {fileID: 0} 200 | m_NavMeshLayer: 0 201 | m_StaticEditorFlags: 0 202 | m_IsActive: 1 203 | --- !u!81 &534669903 204 | AudioListener: 205 | m_ObjectHideFlags: 0 206 | m_CorrespondingSourceObject: {fileID: 0} 207 | m_PrefabInstance: {fileID: 0} 208 | m_PrefabAsset: {fileID: 0} 209 | m_GameObject: {fileID: 534669902} 210 | m_Enabled: 1 211 | --- !u!20 &534669904 212 | Camera: 213 | m_ObjectHideFlags: 0 214 | m_CorrespondingSourceObject: {fileID: 0} 215 | m_PrefabInstance: {fileID: 0} 216 | m_PrefabAsset: {fileID: 0} 217 | m_GameObject: {fileID: 534669902} 218 | m_Enabled: 1 219 | serializedVersion: 2 220 | m_ClearFlags: 1 221 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 222 | m_projectionMatrixMode: 1 223 | m_SensorSize: {x: 36, y: 24} 224 | m_LensShift: {x: 0, y: 0} 225 | m_GateFitMode: 2 226 | m_FocalLength: 50 227 | m_NormalizedViewPortRect: 228 | serializedVersion: 2 229 | x: 0 230 | y: 0 231 | width: 1 232 | height: 1 233 | near clip plane: 0.3 234 | far clip plane: 1000 235 | field of view: 45 236 | orthographic: 0 237 | orthographic size: 5 238 | m_Depth: -1 239 | m_CullingMask: 240 | serializedVersion: 2 241 | m_Bits: 4294967295 242 | m_RenderingPath: -1 243 | m_TargetTexture: {fileID: 0} 244 | m_TargetDisplay: 0 245 | m_TargetEye: 3 246 | m_HDR: 1 247 | m_AllowMSAA: 1 248 | m_AllowDynamicResolution: 0 249 | m_ForceIntoRT: 0 250 | m_OcclusionCulling: 1 251 | m_StereoConvergence: 10 252 | m_StereoSeparation: 0.022 253 | --- !u!4 &534669905 254 | Transform: 255 | m_ObjectHideFlags: 0 256 | m_CorrespondingSourceObject: {fileID: 0} 257 | m_PrefabInstance: {fileID: 0} 258 | m_PrefabAsset: {fileID: 0} 259 | m_GameObject: {fileID: 534669902} 260 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 261 | m_LocalPosition: {x: 0, y: 0, z: -265} 262 | m_LocalScale: {x: 1, y: 1, z: 1} 263 | m_Children: [] 264 | m_Father: {fileID: 2113928122} 265 | m_RootOrder: 0 266 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 267 | --- !u!114 &534669906 268 | MonoBehaviour: 269 | m_ObjectHideFlags: 0 270 | m_CorrespondingSourceObject: {fileID: 0} 271 | m_PrefabInstance: {fileID: 0} 272 | m_PrefabAsset: {fileID: 0} 273 | m_GameObject: {fileID: 534669902} 274 | m_Enabled: 1 275 | m_EditorHideFlags: 0 276 | m_Script: {fileID: 11500000, guid: 1173c6c6ad93db64488b55882bcabfc1, type: 3} 277 | m_Name: 278 | m_EditorClassIdentifier: 279 | SphereRadius: {x: 10, y: 10} 280 | SpheresMax: 20 281 | SpherePlacementRadius: 100 282 | SphereSeed: 122383271 283 | RayTracingShader: {fileID: 7200000, guid: fbcf628b29c45324898b8c011ace2f32, type: 3} 284 | SkyboxTexture: {fileID: 2800000, guid: f0ec7dd2ef05b9f42b818fc5c42fc84f, type: 3} 285 | DirectionalLight: {fileID: 170076734} 286 | --- !u!1 &2113928121 287 | GameObject: 288 | m_ObjectHideFlags: 0 289 | m_CorrespondingSourceObject: {fileID: 0} 290 | m_PrefabInstance: {fileID: 0} 291 | m_PrefabAsset: {fileID: 0} 292 | serializedVersion: 6 293 | m_Component: 294 | - component: {fileID: 2113928122} 295 | m_Layer: 0 296 | m_Name: GameObject 297 | m_TagString: Untagged 298 | m_Icon: {fileID: 0} 299 | m_NavMeshLayer: 0 300 | m_StaticEditorFlags: 0 301 | m_IsActive: 1 302 | --- !u!4 &2113928122 303 | Transform: 304 | m_ObjectHideFlags: 0 305 | m_CorrespondingSourceObject: {fileID: 0} 306 | m_PrefabInstance: {fileID: 0} 307 | m_PrefabAsset: {fileID: 0} 308 | m_GameObject: {fileID: 2113928121} 309 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 310 | m_LocalPosition: {x: 0, y: 0, z: 0} 311 | m_LocalScale: {x: 1, y: 1, z: 1} 312 | m_Children: 313 | - {fileID: 534669905} 314 | m_Father: {fileID: 0} 315 | m_RootOrder: 1 316 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 317 | -------------------------------------------------------------------------------- /Assets/Scenes/TestScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f663611d4bf67c488e28f07d8e7e8a9 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Script.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14cddb949124b964191a16e8dccd5e3f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Script/AddShader.shader: -------------------------------------------------------------------------------- 1 | Shader "Hidden/AddShader" 2 | { 3 | Properties 4 | { 5 | _MainTex("Texture", 2D) = "white" {} 6 | } 7 | SubShader 8 | { 9 | // No culling or depth 10 | Cull Off ZWrite Off ZTest Always 11 | Blend SrcAlpha OneMinusSrcAlpha 12 | 13 | Pass 14 | { 15 | CGPROGRAM 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | 19 | #include "UnityCG.cginc" 20 | 21 | struct appdata 22 | { 23 | float4 vertex : POSITION; 24 | float2 uv : TEXCOORD0; 25 | }; 26 | 27 | struct v2f 28 | { 29 | float2 uv : TEXCOORD0; 30 | float4 vertex : SV_POSITION; 31 | }; 32 | 33 | v2f vert(appdata v) 34 | { 35 | v2f o; 36 | o.vertex = UnityObjectToClipPos(v.vertex); 37 | o.uv = v.uv; 38 | return o; 39 | } 40 | 41 | sampler2D _MainTex; 42 | float _Sample; 43 | 44 | float4 frag(v2f i) : SV_Target 45 | { 46 | return float4(tex2D(_MainTex, i.uv).rgb, 1.0f / (_Sample + 1.0f)); 47 | } 48 | ENDCG 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Assets/Script/AddShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b478cba5df8e6348a46569ae4396814 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Script/BRDFs.cginc: -------------------------------------------------------------------------------- 1 | #ifndef BRDF_INCLUDE 2 | #define BRDF_INCLUDE 3 | #include "Common.cginc" 4 | 5 | float3 SpecularBRDF(float D, float G, float3 F, float3 V, float3 L, float3 N) 6 | { 7 | float NdotL = abs(dot(N, L)); 8 | float NdotV = abs(dot(N, V)); 9 | 10 | //specualr 11 | //Microfacet specular = D * G * F / (4 * NoL * NoV) 12 | float3 nominator = D * G * F; 13 | float denominator = 4.0 * NdotV * NdotL + 0.001; 14 | float3 specularBrdf = nominator / denominator; 15 | 16 | return specularBrdf; 17 | } 18 | 19 | float3 DiffuseBRDF(float3 albedo) 20 | { 21 | return albedo / PI; 22 | } 23 | 24 | 25 | 26 | #endif -------------------------------------------------------------------------------- /Assets/Script/BRDFs.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: eb5cbe4c8b5d94b4082e4572e8f6b7e9 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Script/BTDFs.cginc: -------------------------------------------------------------------------------- 1 | #ifndef BTDF_INCLUDE 2 | #define BTDF_INCLUDE 3 | 4 | float3 RefractionBTDF(float D, float G, float3 F, float3 V, float3 L, float3 N, float3 H, float etaIn, float etaOut) 5 | { //Not reciprocal! be careful about direction! 6 | 7 | float NdotL = abs(dot(N, L)); 8 | float NdotV = abs(dot(N, V)); 9 | 10 | float VdotH = abs(dot(V, H)); 11 | float LdotH = abs(dot(L, H)); 12 | 13 | 14 | float term1 = VdotH * LdotH / (NdotV * NdotL); 15 | float3 term2 = etaOut * etaOut * (1 - F) * G * D; 16 | //term1 = 1; 17 | //term2 = 1; 18 | float term3 = (etaIn * VdotH + etaOut * LdotH) * (etaIn * VdotH + etaOut * LdotH) + 0.001f; 19 | //term3 = 1; 20 | float3 refractionBrdf = term1 * term2 / term3; 21 | 22 | return refractionBrdf; 23 | } 24 | 25 | 26 | #endif -------------------------------------------------------------------------------- /Assets/Script/BTDFs.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4983fc1f0d1562b418b5f2ea15d77d9b 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Script/Common.cginc: -------------------------------------------------------------------------------- 1 | #ifndef COMMON_INCLUDE 2 | #define COMMON_INCLUDE 3 | 4 | 5 | static const float PI = 3.14159265f; 6 | float2 _Pixel; 7 | float _Seed; 8 | 9 | float rand() 10 | { 11 | float result = frac(sin(_Seed / 100.0f * dot(_Pixel, float2(12.9898f, 78.233f))) * 43758.5453f); 12 | _Seed += 1.0f; 13 | return result; 14 | } 15 | 16 | //return the roation matrix 17 | float3x3 GetTransformMatrix(float3 normal) 18 | { 19 | // Choose a helper vector for the cross product 20 | float3 helper = float3(1, 0, 0); 21 | if (abs(normal.x) > 0.99f) 22 | helper = float3(0, 0, 1); 23 | 24 | // Generate vectors 25 | float3 tangent = normalize(cross(normal, helper)); 26 | float3 binormal = normalize(cross(normal, tangent)); 27 | return float3x3(tangent, binormal, normal); 28 | } 29 | 30 | float3 SampleHemisphere(float3 normal, float alpha) 31 | { 32 | // Sample the hemisphere, where alpha determines the kind of the sampling 33 | float cosTheta = pow(rand(), 1.0f / (alpha + 1.0f)); 34 | float sinTheta = sqrt(1.0f - cosTheta * cosTheta); 35 | float phi = 2 * PI * rand(); 36 | float3 tangentSpaceDir = float3(cos(phi) * sinTheta, sin(phi) * sinTheta, cosTheta); 37 | 38 | // Transform direction to be centered around whatever noraml we need 39 | return mul(tangentSpaceDir, GetTransformMatrix(normal)); 40 | } 41 | 42 | //SampleHemisphere alpha = 1 43 | float CosinSamplingPDF(float NdotL) 44 | { 45 | return NdotL / PI; 46 | } 47 | 48 | float3 FresnelSchlick(float cosTheta, float3 F0) 49 | { 50 | return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0); 51 | } 52 | 53 | float DistributionGGX(float3 N, float3 H, float roughness) 54 | { 55 | float a = roughness * roughness; 56 | float a2 = a * a; 57 | float NdotH = max(dot(N, H), 0.0); 58 | float NdotH2 = NdotH * NdotH; 59 | 60 | float nom = a2; 61 | float denom = (NdotH2 * (a2 - 1.0) + 1.0); 62 | denom = PI * denom * denom; 63 | 64 | return nom / denom; 65 | } 66 | 67 | float GeometrySchlickGGX(float NdotV, float roughness) 68 | { 69 | float r = (roughness + 1.0); 70 | float k = (r * r) / 8.0; 71 | 72 | float nom = NdotV; 73 | float denom = NdotV * (1.0 - k) + k; 74 | 75 | return nom / denom; 76 | } 77 | float GeometrySmith(float3 N, float3 V, float3 L, float roughness) 78 | { 79 | float NdotV = abs(dot(N, V)); 80 | float NdotL = abs(dot(N, L)); 81 | float ggx2 = GeometrySchlickGGX(NdotV, roughness); 82 | float ggx1 = GeometrySchlickGGX(NdotL, roughness); 83 | 84 | return ggx1 * ggx2; 85 | } 86 | 87 | float3 ImportanceSampleGGX(float2 Xi, float3 N, float3 V, float roughness) 88 | { 89 | float a = roughness * roughness; 90 | 91 | float phi = 2.0 * PI * Xi.x; 92 | float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (a * a - 1.0) * Xi.y)); 93 | float sinTheta = sqrt(1.0 - cosTheta * cosTheta); 94 | 95 | // from spherical coordinates to cartesian coordinates 96 | float3 H; 97 | H.x = cos(phi) * sinTheta; 98 | H.y = sin(phi) * sinTheta; 99 | H.z = cosTheta; 100 | 101 | // from tangent-space vector to world-space sample vector 102 | float3 up = abs(N.z) < 0.999 ? float3(0.0, 0.0, 1.0) : float3(1.0, 0.0, 0.0); 103 | float3 tangent = normalize(cross(up, N)); 104 | float3 bitangent = cross(N, tangent); 105 | 106 | float3 halfVec = tangent * H.x + bitangent * H.y + N * H.z; 107 | halfVec = normalize(halfVec); 108 | 109 | return halfVec; 110 | 111 | } 112 | 113 | float ImportanceSampleGGX_PDF(float NDF, float NdotH, float VdotH) 114 | { 115 | //ImportanceSampleGGX pdf 116 | //pdf = D * NoH / (4 * VoH) 117 | return NDF * NdotH / (4 * VdotH); 118 | 119 | } 120 | 121 | //calculate fresnel 122 | float Calculatefresnel(const float3 I, const float3 N, const float3 ior) 123 | { 124 | float kr; 125 | float cosi = clamp(-1, 1, dot(I, N)); 126 | float etai = 1, etat = ior; 127 | if (cosi > 0) 128 | { 129 | //std::swap(etai, etat); 130 | float temp = etai; 131 | etai = etat; 132 | etat = temp; 133 | } 134 | // Compute sini using Snell's law 135 | float sint = etai / etat * sqrt(max(0.f, 1 - cosi * cosi)); 136 | // Total internal reflection 137 | if (sint >= 1) 138 | { 139 | kr = 1; 140 | } 141 | else 142 | { 143 | float cost = sqrt(max(0.f, 1 - sint * sint)); 144 | cosi = abs(cosi); 145 | float Rs = ((etat * cosi) - (etai * cost)) / ((etat * cosi) + (etai * cost)); 146 | float Rp = ((etai * cosi) - (etat * cost)) / ((etai * cosi) + (etat * cost)); 147 | kr = (Rs * Rs + Rp * Rp) / 2; 148 | } 149 | return kr; 150 | // As a consequence of the conservation of energy, transmittance is given by: 151 | // kt = 1 - kr; 152 | } 153 | 154 | 155 | #endif -------------------------------------------------------------------------------- /Assets/Script/Common.cginc.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: af786e7d21dee6d4e918d8de3fab71c0 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Script/PathTracingMaster.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | 5 | public class PathTracingMaster : MonoBehaviour 6 | { 7 | 8 | struct Sphere 9 | { 10 | public Vector3 position; 11 | public float radius; 12 | public Vector3 albedo; 13 | public float metallic; 14 | public float roughness; 15 | public float specular; 16 | public float specTrans; 17 | public Vector3 transColor; 18 | public Vector3 emission; 19 | }; 20 | private RenderTexture _converged; 21 | public Vector2 SphereRadius = new Vector2(3.0f, 8.0f); 22 | public uint SpheresMax = 100; 23 | public float SpherePlacementRadius = 100.0f; 24 | private ComputeBuffer _sphereBuffer; 25 | 26 | public int SphereSeed; 27 | public ComputeShader RayTracingShader; 28 | 29 | private RenderTexture _target; 30 | 31 | private Camera _camera; 32 | public Texture SkyboxTexture; 33 | 34 | private uint _currentSample = 0; 35 | private Material _addMaterial; 36 | 37 | public Light DirectionalLight; 38 | 39 | 40 | private void OnEnable() 41 | { 42 | _currentSample = 0; 43 | SetUpScene(); 44 | } 45 | private void OnDisable() 46 | { 47 | if (_sphereBuffer != null) 48 | _sphereBuffer.Release(); 49 | } 50 | 51 | private void SetUpScene() 52 | { 53 | //Random.InitState(SphereSeed); 54 | 55 | Color color = Color.white; 56 | List spheres = new List(); 57 | for (int i = 0; i < 55; i++) 58 | { 59 | Sphere sphere = new Sphere(); 60 | 61 | sphere.radius = 10; 62 | float intervalX = 3 * sphere.radius; 63 | float intervalZ = 4 * sphere.radius; 64 | float startX = -4.5f * intervalX; 65 | float startZ = 2 * intervalZ; 66 | 67 | int row = i / 11; 68 | int col = i % 11; 69 | sphere.position = new Vector3(startX + col * intervalX, startZ - row * intervalZ, 0); 70 | 71 | 72 | 73 | 74 | sphere.emission = new Vector3(0, 0, 0); 75 | 76 | 77 | switch (row) 78 | { 79 | case 0://metallic row 80 | sphere.albedo = new Vector3(1, 0.71f, 0); 81 | sphere.metallic = col * 0.1f; 82 | sphere.transColor = sphere.albedo; 83 | sphere.roughness = 0.1f; 84 | sphere.specular = 0.5f; 85 | sphere.specTrans = 0.0f; 86 | break; 87 | case 1: 88 | //specular row 89 | sphere.albedo = new Vector3(1, 0, 0); 90 | sphere.metallic = 0; 91 | sphere.transColor = sphere.albedo; 92 | sphere.roughness = 0.1f; 93 | sphere.specular = col * 0.1f; 94 | sphere.specTrans = 0.0f; 95 | 96 | break; 97 | case 2: 98 | //roughness row 99 | sphere.albedo = new Vector3(0, 0.8f, 0.2f); 100 | sphere.metallic = 0; 101 | sphere.transColor = sphere.albedo; 102 | sphere.roughness = col* 0.1f; 103 | sphere.specular = 0.5f; 104 | sphere.specTrans = 0.0f; 105 | break; 106 | case 3: 107 | //specTrans row 108 | sphere.albedo = new Vector3(0.5f, 0.2f, 1); 109 | sphere.metallic = 0; 110 | sphere.transColor = sphere.albedo; 111 | sphere.roughness = 0.1f; 112 | sphere.specular = 0.5f; 113 | sphere.specTrans = col * 0.1f; 114 | break; 115 | case 4: 116 | //roughness with specTrans = 1 117 | sphere.albedo = new Vector3(0.03f, 0.03f, 0.03f); 118 | sphere.metallic = 0; 119 | sphere.transColor = new Vector3(1, 1, 1); 120 | sphere.roughness = col * 0.1f; 121 | sphere.specular = 0.5f; 122 | sphere.specTrans = 1f; 123 | break; 124 | } 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | spheres.Add(sphere); 134 | } 135 | 136 | if (_sphereBuffer != null) 137 | _sphereBuffer.Release(); 138 | if (spheres.Count > 0) 139 | { 140 | _sphereBuffer = new ComputeBuffer(spheres.Count, 68); 141 | _sphereBuffer.SetData(spheres); 142 | } 143 | } 144 | 145 | private void Awake() 146 | { 147 | _camera = GetComponent(); 148 | } 149 | private void SetShaderParameters() 150 | { 151 | RayTracingShader.SetVector("_PixelOffset", new Vector2(Random.value, Random.value)); 152 | RayTracingShader.SetTexture(0, "_SkyboxTexture", SkyboxTexture); 153 | RayTracingShader.SetMatrix("_CameraToWorld", _camera.cameraToWorldMatrix); 154 | RayTracingShader.SetMatrix("_CameraInverseProjection", _camera.projectionMatrix.inverse); 155 | Vector3 l = DirectionalLight.transform.forward; 156 | RayTracingShader.SetVector("_DirectionalLight", new Vector4(l.x, l.y, l.z, DirectionalLight.intensity)); 157 | RayTracingShader.SetBuffer(0, "_Spheres", _sphereBuffer); 158 | RayTracingShader.SetFloat("_Seed", Random.value); 159 | } 160 | 161 | private void OnRenderImage(RenderTexture source, RenderTexture destination) 162 | { 163 | SetShaderParameters(); 164 | Render(destination); 165 | } 166 | 167 | private void Render(RenderTexture destination) 168 | { 169 | 170 | InitRenderTexture(); 171 | RayTracingShader.SetTexture(0, "Result", _target); 172 | int threadGroupsX = Mathf.CeilToInt(Screen.width / 8.0f); 173 | int threadGroupsY = Mathf.CeilToInt(Screen.height / 8.0f); 174 | RayTracingShader.Dispatch(0, threadGroupsX, threadGroupsY, 1); 175 | 176 | 177 | if (_addMaterial == null) 178 | _addMaterial = new Material(Shader.Find("Hidden/AddShader")); 179 | _addMaterial.SetFloat("_Sample", _currentSample); 180 | Graphics.Blit(_target, _converged, _addMaterial); 181 | Graphics.Blit(_converged, destination); 182 | _currentSample++; 183 | } 184 | 185 | private void InitRenderTexture() 186 | { 187 | if (_target == null || _target.width != Screen.width || _target.height != Screen.height) 188 | { 189 | if (_target != null) 190 | { 191 | _target.Release(); 192 | } 193 | _target = new RenderTexture(Screen.width, Screen.height, 0, 194 | RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear); 195 | _target.enableRandomWrite = true; 196 | _target.Create(); 197 | } 198 | 199 | if (_converged == null || _converged.width != Screen.width || _converged.height != Screen.height) 200 | { 201 | 202 | if (_converged != null) 203 | { 204 | _converged.Release(); 205 | } 206 | 207 | _converged = new RenderTexture(Screen.width, Screen.height, 0, 208 | RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear); 209 | _converged.enableRandomWrite = true; 210 | _converged.Create(); 211 | } 212 | } 213 | 214 | private void Update() 215 | { 216 | if (transform.hasChanged) 217 | { 218 | _currentSample = 0; 219 | transform.hasChanged = false; 220 | } 221 | 222 | if (DirectionalLight.transform.hasChanged) 223 | { 224 | _currentSample = 0; 225 | DirectionalLight.transform.hasChanged = false; 226 | } 227 | } 228 | } 229 | 230 | -------------------------------------------------------------------------------- /Assets/Script/PathTracingMaster.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1173c6c6ad93db64488b55882bcabfc1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Script/PathTracingShader.compute: -------------------------------------------------------------------------------- 1 | #include "Common.cginc" 2 | #include "BRDFs.cginc" 3 | #include "BTDFs.cginc" 4 | #pragma kernel CSMain 5 | 6 | struct Sphere 7 | { 8 | float3 position; 9 | float radius; 10 | float3 albedo; 11 | float metallic; 12 | float roughness; 13 | float specular; 14 | float specTrans; 15 | float3 transColor; 16 | float3 emission; 17 | }; 18 | 19 | struct Ray 20 | { 21 | float3 origin; 22 | float3 direction; 23 | float3 energy; 24 | }; 25 | 26 | struct RayHit 27 | { 28 | float3 position; 29 | float distance; 30 | float3 normal; 31 | float3 albedo; 32 | float metallic; 33 | float roughness; 34 | float specular; 35 | float specTrans; 36 | float3 transColor; 37 | float3 emission; 38 | }; 39 | 40 | RWTexture2D Result; 41 | float4x4 _CameraToWorld; 42 | float4x4 _CameraInverseProjection; 43 | // 44 | Texture2D _SkyboxTexture; 45 | SamplerState sampler_SkyboxTexture; 46 | 47 | float2 _PixelOffset; 48 | float4 _DirectionalLight; 49 | 50 | StructuredBuffer _Spheres; 51 | 52 | Ray CreateRay(float3 origin, float3 direction) 53 | { 54 | Ray ray; 55 | ray.origin = origin; 56 | ray.direction = direction; 57 | ray.energy = float3(1.0f, 1.0f, 1.0f); 58 | return ray; 59 | } 60 | 61 | Ray CreateCameraRay(float2 uv) 62 | { 63 | // Transform the camera origin to world space 64 | float3 origin = mul(_CameraToWorld, float4(0.0f, 0.0f, 0.0f, 1.0f)).xyz; 65 | //transform float4(uv, 0.0f, 1.0f) to camera space on near plane 66 | float3 direction = mul(_CameraInverseProjection, float4(uv, 0.0f, 1.0f)).xyz; 67 | direction = direction - float3(0, 0, 0); 68 | 69 | direction = mul(_CameraToWorld, float4(direction, 0.0f)).xyz; 70 | direction = normalize(direction); 71 | return CreateRay(origin, direction); 72 | } 73 | 74 | 75 | 76 | RayHit CreateRayHit() 77 | { 78 | RayHit hit; 79 | hit.position = float3(0.0f, 0.0f, 0.0f); 80 | hit.distance = 1.#INF; 81 | hit.normal = float3(0.0f, 0.0f, 0.0f); 82 | hit.albedo = float3(0.0f, 0.0f, 0.0f); 83 | hit.metallic = 0; 84 | hit.roughness = 0; 85 | hit.specular = 0; 86 | hit.specTrans = 0; 87 | hit.transColor = float3(0.0f, 0.0f, 0.0f); 88 | hit.emission = float3(0, 0, 0); 89 | return hit; 90 | } 91 | 92 | void IntersectGroundPlane(Ray ray, inout RayHit bestHit) 93 | { 94 | // Calculate distance along the ray where the ground plane is intersected 95 | float t = -ray.origin.y / ray.direction.y; 96 | if (t > 0 && t < bestHit.distance) 97 | { 98 | bestHit.distance = t; 99 | bestHit.position = ray.origin + t * ray.direction; 100 | bestHit.normal = float3(0.0f, 1.0f, 0.0f); 101 | bestHit.albedo = 0.5f; 102 | bestHit.metallic = 0.0f; 103 | bestHit.roughness = 0.0f; 104 | bestHit.specular = 0.5f; 105 | bestHit.specTrans = 1; 106 | bestHit.transColor = float3(1, 0, 0); 107 | bestHit.emission = float3(0, 0, 0); 108 | 109 | } 110 | } 111 | 112 | void IntersectSphere(Ray ray, inout RayHit bestHit, Sphere sphere) 113 | { 114 | // Calculate distance along the ray where the sphere is intersected 115 | //https://en.wikipedia.org/wiki/Line%E2%80%93sphere_intersection 116 | float3 d = ray.origin - sphere.position; 117 | float p1 = -dot(ray.direction, d); 118 | float p2sqr = p1 * p1 - dot(d, d) + sphere.radius * sphere.radius; 119 | if (p2sqr < 0) 120 | return; 121 | float p2 = sqrt(p2sqr); 122 | float t = p1 - p2 > 0 ? p1 - p2 : p1 + p2; 123 | if (t > 0 && t < bestHit.distance) 124 | { 125 | bestHit.distance = t; 126 | bestHit.position = ray.origin + t * ray.direction; 127 | bestHit.normal = normalize(bestHit.position - sphere.position); 128 | bestHit.albedo = sphere.albedo; 129 | bestHit.metallic = sphere.metallic; 130 | bestHit.roughness = sphere.roughness; 131 | bestHit.specular = sphere.specular; 132 | bestHit.specTrans = sphere.specTrans; 133 | bestHit.transColor = sphere.transColor; 134 | bestHit.emission = sphere.emission; 135 | } 136 | } 137 | 138 | 139 | RayHit Trace(Ray ray) 140 | { 141 | RayHit bestHit = CreateRayHit(); 142 | //IntersectGroundPlane(ray, bestHit); 143 | 144 | 145 | 146 | // Trace spheres 147 | uint numSpheres, stride; 148 | _Spheres.GetDimensions(numSpheres, stride); 149 | for (uint i = 0; i < numSpheres; i++) 150 | IntersectSphere(ray, bestHit, _Spheres[i]); 151 | 152 | return bestHit; 153 | } 154 | 155 | 156 | 157 | float3 Shade(inout Ray ray, RayHit hit) 158 | { 159 | if (hit.distance < 1.#INF) 160 | { 161 | 162 | float roulette = rand(); 163 | float blender = rand();//used to blend BSDF and BRDF 164 | 165 | if (blender < 1 - hit.specTrans) 166 | { 167 | float3 reflectionDir; 168 | 169 | float diffuseRatio = 0.5 * (1.0 - hit.metallic); 170 | float specularRoatio = 1 - diffuseRatio; 171 | float3 V = normalize(-ray.direction); 172 | 173 | if (roulette < diffuseRatio) 174 | { //sample diffuse 175 | 176 | //cosin sample 177 | reflectionDir = SampleHemisphere(hit.normal, 1.0f); 178 | } 179 | else 180 | { //sample specular 181 | 182 | 183 | //hemisphere sampling 184 | //reflectionDir = SampleHemisphere(hit.normal, 0.0f); 185 | 186 | //ImportanceSampleGGX 187 | float3 halfVec = ImportanceSampleGGX(float2(rand(), rand()), hit.normal, V, hit.roughness); 188 | //isosceles 189 | reflectionDir = 2.0 * dot(V, halfVec) * halfVec - V; 190 | reflectionDir = normalize(reflectionDir); 191 | } 192 | 193 | 194 | 195 | float3 L = normalize(reflectionDir); 196 | float3 H = normalize(V + L); 197 | 198 | float NdotL = abs(dot(hit.normal, L)); 199 | float NdotH = abs(dot(hit.normal, H)); 200 | float VdotH = abs(dot(V, H)); 201 | 202 | float NdotV = abs(dot(hit.normal, V)); 203 | 204 | float3 F0 = float3(0.08, 0.08, 0.08); 205 | F0 = lerp(F0 * hit.specular, hit.albedo, hit.metallic); 206 | 207 | float NDF = DistributionGGX(hit.normal, H, hit.roughness); 208 | float G = GeometrySmith(hit.normal, V, L, hit.roughness); 209 | float3 F = FresnelSchlick(max(dot(H, V), 0.0), F0); 210 | 211 | float3 kS = F; 212 | float3 kD = 1.0 - kS; 213 | kD *= 1.0 - hit.metallic; 214 | 215 | float3 specularBrdf = SpecularBRDF(NDF, G, F, V, L, hit.normal); 216 | 217 | //hemisphere sampling pdf 218 | //pdf = 1 / (2 * PI) 219 | //float speccualrPdf = 1 / (2 * PI); 220 | 221 | //ImportanceSampleGGX pdf 222 | //pdf = D * NoH / (4 * VoH) 223 | float speccualrPdf = ImportanceSampleGGX_PDF(NDF, NdotH, VdotH); 224 | 225 | 226 | 227 | //diffuse 228 | //Lambert diffuse = diffuse / PI 229 | float3 diffuseBrdf = DiffuseBRDF(hit.albedo); 230 | //cosin sample pdf = N dot L / PI 231 | float diffusePdf = CosinSamplingPDF(NdotL); 232 | 233 | float3 totalBrdf = (diffuseBrdf * kD + specularBrdf) * NdotL; 234 | float totalPdf = diffuseRatio * diffusePdf + specularRoatio * speccualrPdf; 235 | 236 | ray.origin = hit.position + hit.normal * 0.001f; 237 | ray.direction = reflectionDir; 238 | if (totalPdf > 0.0) 239 | { 240 | ray.energy *= totalBrdf / totalPdf; 241 | } 242 | } 243 | else 244 | { 245 | bool fromOutside = dot(ray.direction, hit.normal) < 0; 246 | float3 N = fromOutside ? hit.normal : -hit.normal; 247 | float3 bias = N * 0.001f; 248 | 249 | float etai = 1; 250 | float etat = 1.55; 251 | 252 | float3 V = normalize(-ray.direction); 253 | float3 H = ImportanceSampleGGX(float2(rand(), rand()), N, V, hit.roughness); 254 | 255 | 256 | float3 F0 = float3(0.08, 0.08, 0.08); 257 | F0 = F0 * hit.specular; 258 | float3 F = FresnelSchlick(max(dot(H, V), 0.0), F0); 259 | 260 | 261 | float kr = Calculatefresnel(ray.direction, hit.normal, 1.55); 262 | 263 | float specularRoatio = kr; 264 | float refractionRatio = 1 - kr; 265 | 266 | float3 L; 267 | 268 | if (roulette <= specularRoatio) 269 | { 270 | ray.origin = hit.position + bias; 271 | L = reflect(ray.direction, H); 272 | ray.direction = L; 273 | } 274 | else 275 | { 276 | float eta = fromOutside ? etai / etat : etat / etai; 277 | L = normalize(refract(ray.direction, H, eta)); 278 | ray.origin = hit.position - bias; 279 | ray.direction = L; 280 | //L = N; 281 | if (!fromOutside) 282 | { 283 | //since the BTDF is not reciprocal, we need to invert the direction of our vectors. 284 | float3 temp = L; 285 | L = V; 286 | V = temp; 287 | 288 | N = -N; 289 | H = -H; 290 | } 291 | } 292 | 293 | float NdotL = abs(dot(N, L)); 294 | float NdotV = abs(dot(N, V)); 295 | 296 | float NdotH = abs(dot(N, H)); 297 | float VdotH = abs(dot(V, H)); 298 | float LdotH = abs(dot(L, H)); 299 | 300 | 301 | float NDF = DistributionGGX(N, H, hit.roughness); 302 | float G = GeometrySmith(N, V, L, hit.roughness); 303 | 304 | //specualr 305 | 306 | float3 specularBrdf = SpecularBRDF(NDF, G, F, V, L, N); 307 | 308 | //ImportanceSampleGGX pdf 309 | //pdf = D * NoH / (4 * VoH) 310 | float speccualrPdf = ImportanceSampleGGX_PDF(NDF, NdotH, VdotH); 311 | 312 | //refraction 313 | float etaOut = etat; 314 | float etaIn = etai; 315 | 316 | float3 refractionBtdf = RefractionBTDF(NDF, G, F, V, L, N, H, etaIn, etaOut); 317 | float refractionPdf = ImportanceSampleGGX_PDF(NDF, NdotH, VdotH); 318 | 319 | //BSDF = BRDF + BTDF 320 | float3 totalBrdf = (specularBrdf + refractionBtdf * hit.transColor) * NdotL; 321 | float totalPdf = specularRoatio * speccualrPdf + refractionRatio * refractionPdf; 322 | if (totalPdf > 0.0) 323 | { 324 | ray.energy *= totalBrdf / totalPdf; 325 | } 326 | } 327 | 328 | 329 | return hit.emission; 330 | } 331 | else 332 | { 333 | // Erase the ray's energy - the sky doesn't reflect anything 334 | ray.energy = 0.0f; 335 | 336 | // Sample the skybox and write it 337 | float theta = acos(ray.direction.y) / -PI; 338 | float phi = atan2(ray.direction.x, -ray.direction.z) / -PI * 0.5f; 339 | return _SkyboxTexture.SampleLevel(sampler_SkyboxTexture, float2(phi, theta), 0).xyz; 340 | } 341 | } 342 | 343 | 344 | 345 | [numthreads(8, 8, 1)] 346 | void CSMain(uint3 id : SV_DispatchThreadID) 347 | { 348 | // Get the dimensions of the RenderTexture 349 | uint width, height; 350 | Result.GetDimensions(width, height); 351 | // Transform pixel to [-1,1] range 352 | float2 uv = float2((id.xy + _PixelOffset) / float2(width, height) * 2.0f - 1.0f); 353 | // Get a ray for the UVs 354 | Ray ray = CreateCameraRay(uv); 355 | 356 | _Pixel = id.xy; 357 | // Trace and shade 358 | float3 result = float3(0, 0, 0); 359 | for (int i = 0; i < 8; i++) 360 | { //tracing 8 bounces 361 | RayHit hit = Trace(ray); 362 | result += ray.energy * Shade(ray, hit); 363 | 364 | if (!any(ray.energy)) 365 | break; 366 | } 367 | 368 | Result[id.xy] = float4(result, 1); 369 | 370 | } -------------------------------------------------------------------------------- /Assets/Script/PathTracingShader.compute.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fbcf628b29c45324898b8c011ace2f32 3 | ComputeShaderImporter: 4 | externalObjects: {} 5 | currentAPIMask: 4 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/texture.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c9a37f5e2948d274ca76b6200beb3145 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/texture/cape_hill_4k.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Assets/texture/cape_hill_4k.hdr -------------------------------------------------------------------------------- /Assets/texture/cape_hill_4k.hdr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1211a89a812ca4044b21662c1c0ed34f 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 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: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 4096 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 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 4096 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Assets/texture/kiara_9_dusk_4k.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Assets/texture/kiara_9_dusk_4k.hdr -------------------------------------------------------------------------------- /Assets/texture/kiara_9_dusk_4k.hdr.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f0ec7dd2ef05b9f42b818fc5c42fc84f 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 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: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 4096 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 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 4096 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 1 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /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: 7 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: 1 23 | m_ClothInterCollisionSettingsToggle: 0 24 | m_ContactPairsMode: 0 25 | m_BroadphaseType: 0 26 | m_WorldBounds: 27 | m_Center: {x: 0, y: 0, z: 0} 28 | m_Extent: {x: 250, y: 250, z: 250} 29 | m_WorldSubdivisions: 8 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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: 7 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /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: 12 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 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | 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/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 3 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_AutoSyncTransforms: 1 46 | m_AlwaysShowColliders: 0 47 | m_ShowColliderSleep: 1 48 | m_ShowColliderContacts: 0 49 | m_ShowColliderAABB: 0 50 | m_ContactArrowScale: 0.2 51 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 52 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 53 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 54 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 55 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 56 | -------------------------------------------------------------------------------- /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: 15 7 | productGUID: 817c538d5398e3b45a7a85eb0aa46ff1 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: gpu-ray-tracing-in-unity 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 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidStartInFullscreen: 1 67 | androidRenderOutsideSafeArea: 0 68 | androidBlitType: 0 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: 0 82 | resizableWindow: 0 83 | useMacAppStoreValidation: 0 84 | macAppStoreCategory: public.app-category.games 85 | gpuSkinning: 0 86 | graphicsJobs: 0 87 | xboxPIXTextureCapture: 0 88 | xboxEnableAvatar: 0 89 | xboxEnableKinect: 0 90 | xboxEnableKinectAutoTracking: 0 91 | xboxEnableFitness: 0 92 | visibleInBackground: 1 93 | allowFullscreenSwitch: 1 94 | graphicsJobMode: 0 95 | fullscreenMode: 1 96 | xboxSpeechDB: 0 97 | xboxEnableHeadOrientation: 0 98 | xboxEnableGuest: 0 99 | xboxEnablePIXSampling: 0 100 | metalFramebufferOnly: 0 101 | xboxOneResolution: 0 102 | xboxOneSResolution: 0 103 | xboxOneXResolution: 3 104 | xboxOneMonoLoggingLevel: 0 105 | xboxOneLoggingLevel: 1 106 | xboxOneDisableEsram: 0 107 | xboxOnePresentImmediateThreshold: 0 108 | switchQueueCommandMemory: 0 109 | vulkanEnableSetSRGBWrite: 0 110 | m_SupportedAspectRatios: 111 | 4:3: 1 112 | 5:4: 1 113 | 16:10: 1 114 | 16:9: 1 115 | Others: 1 116 | bundleVersion: 1.0 117 | preloadedAssets: [] 118 | metroInputSource: 0 119 | wsaTransparentSwapchain: 0 120 | m_HolographicPauseOnTrackingLoss: 1 121 | xboxOneDisableKinectGpuReservation: 0 122 | xboxOneEnable7thCore: 0 123 | isWsaHolographicRemotingEnabled: 0 124 | vrSettings: 125 | cardboard: 126 | depthFormat: 0 127 | enableTransitionView: 0 128 | daydream: 129 | depthFormat: 0 130 | useSustainedPerformanceMode: 0 131 | enableVideoLayer: 0 132 | useProtectedVideoMemory: 0 133 | minimumSupportedHeadTracking: 0 134 | maximumSupportedHeadTracking: 1 135 | hololens: 136 | depthFormat: 1 137 | depthBufferSharingEnabled: 0 138 | oculus: 139 | sharedDepthBuffer: 0 140 | dashSupport: 0 141 | enable360StereoCapture: 0 142 | protectGraphicsMemory: 0 143 | enableFrameTimingStats: 0 144 | useHDRDisplay: 0 145 | m_ColorGamuts: 00000000 146 | targetPixelDensity: 30 147 | resolutionScalingMode: 0 148 | androidSupportedAspectRatio: 1 149 | androidMaxAspectRatio: 2.1 150 | applicationIdentifier: {} 151 | buildNumber: {} 152 | AndroidBundleVersionCode: 1 153 | AndroidMinSdkVersion: 16 154 | AndroidTargetSdkVersion: 0 155 | AndroidPreferredInstallLocation: 1 156 | aotOptions: 157 | stripEngineCode: 1 158 | iPhoneStrippingLevel: 0 159 | iPhoneScriptCallOptimization: 0 160 | ForceInternetPermission: 0 161 | ForceSDCardPermission: 0 162 | CreateWallpaper: 0 163 | APKExpansionFiles: 0 164 | keepLoadedShadersAlive: 0 165 | StripUnusedMeshComponents: 0 166 | VertexChannelCompressionMask: 4054 167 | iPhoneSdkVersion: 988 168 | iOSTargetOSVersionString: 9.0 169 | tvOSSdkVersion: 0 170 | tvOSRequireExtendedGameController: 0 171 | tvOSTargetOSVersionString: 9.0 172 | uIPrerenderedIcon: 0 173 | uIRequiresPersistentWiFi: 0 174 | uIRequiresFullScreen: 1 175 | uIStatusBarHidden: 1 176 | uIExitOnSuspend: 0 177 | uIStatusBarStyle: 0 178 | iPhoneSplashScreen: {fileID: 0} 179 | iPhoneHighResSplashScreen: {fileID: 0} 180 | iPhoneTallHighResSplashScreen: {fileID: 0} 181 | iPhone47inSplashScreen: {fileID: 0} 182 | iPhone55inPortraitSplashScreen: {fileID: 0} 183 | iPhone55inLandscapeSplashScreen: {fileID: 0} 184 | iPhone58inPortraitSplashScreen: {fileID: 0} 185 | iPhone58inLandscapeSplashScreen: {fileID: 0} 186 | iPadPortraitSplashScreen: {fileID: 0} 187 | iPadHighResPortraitSplashScreen: {fileID: 0} 188 | iPadLandscapeSplashScreen: {fileID: 0} 189 | iPadHighResLandscapeSplashScreen: {fileID: 0} 190 | appleTVSplashScreen: {fileID: 0} 191 | appleTVSplashScreen2x: {fileID: 0} 192 | tvOSSmallIconLayers: [] 193 | tvOSSmallIconLayers2x: [] 194 | tvOSLargeIconLayers: [] 195 | tvOSLargeIconLayers2x: [] 196 | tvOSTopShelfImageLayers: [] 197 | tvOSTopShelfImageLayers2x: [] 198 | tvOSTopShelfImageWideLayers: [] 199 | tvOSTopShelfImageWideLayers2x: [] 200 | iOSLaunchScreenType: 0 201 | iOSLaunchScreenPortrait: {fileID: 0} 202 | iOSLaunchScreenLandscape: {fileID: 0} 203 | iOSLaunchScreenBackgroundColor: 204 | serializedVersion: 2 205 | rgba: 0 206 | iOSLaunchScreenFillPct: 100 207 | iOSLaunchScreenSize: 100 208 | iOSLaunchScreenCustomXibPath: 209 | iOSLaunchScreeniPadType: 0 210 | iOSLaunchScreeniPadImage: {fileID: 0} 211 | iOSLaunchScreeniPadBackgroundColor: 212 | serializedVersion: 2 213 | rgba: 0 214 | iOSLaunchScreeniPadFillPct: 100 215 | iOSLaunchScreeniPadSize: 100 216 | iOSLaunchScreeniPadCustomXibPath: 217 | iOSUseLaunchScreenStoryboard: 0 218 | iOSLaunchScreenCustomStoryboardPath: 219 | iOSDeviceRequirements: [] 220 | iOSURLSchemes: [] 221 | iOSBackgroundModes: 0 222 | iOSMetalForceHardShadows: 0 223 | metalEditorSupport: 1 224 | metalAPIValidation: 1 225 | iOSRenderExtraFrameOnPause: 0 226 | appleDeveloperTeamID: 227 | iOSManualSigningProvisioningProfileID: 228 | tvOSManualSigningProvisioningProfileID: 229 | iOSManualSigningProvisioningProfileType: 0 230 | tvOSManualSigningProvisioningProfileType: 0 231 | appleEnableAutomaticSigning: 0 232 | iOSRequireARKit: 0 233 | appleEnableProMotion: 0 234 | clonedFromGUID: 00000000000000000000000000000000 235 | templatePackageId: 236 | templateDefaultScene: 237 | AndroidTargetArchitectures: 1 238 | AndroidSplashScreenScale: 0 239 | androidSplashScreen: {fileID: 0} 240 | AndroidKeystoreName: 241 | AndroidKeyaliasName: 242 | AndroidBuildApkPerCpuArchitecture: 0 243 | AndroidTVCompatibility: 1 244 | AndroidIsGame: 1 245 | AndroidEnableTango: 0 246 | androidEnableBanner: 1 247 | androidUseLowAccuracyLocation: 0 248 | m_AndroidBanners: 249 | - width: 320 250 | height: 180 251 | banner: {fileID: 0} 252 | androidGamepadSupportLevel: 0 253 | resolutionDialogBanner: {fileID: 0} 254 | m_BuildTargetIcons: [] 255 | m_BuildTargetPlatformIcons: [] 256 | m_BuildTargetBatching: [] 257 | m_BuildTargetGraphicsAPIs: [] 258 | m_BuildTargetVRSettings: [] 259 | m_BuildTargetEnableVuforiaSettings: [] 260 | openGLRequireES31: 0 261 | openGLRequireES31AEP: 0 262 | m_TemplateCustomTags: {} 263 | mobileMTRendering: 264 | Android: 1 265 | iPhone: 1 266 | tvOS: 1 267 | m_BuildTargetGroupLightmapEncodingQuality: [] 268 | m_BuildTargetGroupLightmapSettings: [] 269 | playModeTestRunnerEnabled: 0 270 | runPlayModeTestAsEditModeTest: 0 271 | actionOnDotNetUnhandledException: 1 272 | enableInternalProfiler: 0 273 | logObjCUncaughtExceptions: 1 274 | enableCrashReportAPI: 0 275 | cameraUsageDescription: 276 | locationUsageDescription: 277 | microphoneUsageDescription: 278 | switchNetLibKey: 279 | switchSocketMemoryPoolSize: 6144 280 | switchSocketAllocatorPoolSize: 128 281 | switchSocketConcurrencyLimit: 14 282 | switchScreenResolutionBehavior: 2 283 | switchUseCPUProfiler: 0 284 | switchApplicationID: 0x01004b9000490000 285 | switchNSODependencies: 286 | switchTitleNames_0: 287 | switchTitleNames_1: 288 | switchTitleNames_2: 289 | switchTitleNames_3: 290 | switchTitleNames_4: 291 | switchTitleNames_5: 292 | switchTitleNames_6: 293 | switchTitleNames_7: 294 | switchTitleNames_8: 295 | switchTitleNames_9: 296 | switchTitleNames_10: 297 | switchTitleNames_11: 298 | switchTitleNames_12: 299 | switchTitleNames_13: 300 | switchTitleNames_14: 301 | switchPublisherNames_0: 302 | switchPublisherNames_1: 303 | switchPublisherNames_2: 304 | switchPublisherNames_3: 305 | switchPublisherNames_4: 306 | switchPublisherNames_5: 307 | switchPublisherNames_6: 308 | switchPublisherNames_7: 309 | switchPublisherNames_8: 310 | switchPublisherNames_9: 311 | switchPublisherNames_10: 312 | switchPublisherNames_11: 313 | switchPublisherNames_12: 314 | switchPublisherNames_13: 315 | switchPublisherNames_14: 316 | switchIcons_0: {fileID: 0} 317 | switchIcons_1: {fileID: 0} 318 | switchIcons_2: {fileID: 0} 319 | switchIcons_3: {fileID: 0} 320 | switchIcons_4: {fileID: 0} 321 | switchIcons_5: {fileID: 0} 322 | switchIcons_6: {fileID: 0} 323 | switchIcons_7: {fileID: 0} 324 | switchIcons_8: {fileID: 0} 325 | switchIcons_9: {fileID: 0} 326 | switchIcons_10: {fileID: 0} 327 | switchIcons_11: {fileID: 0} 328 | switchIcons_12: {fileID: 0} 329 | switchIcons_13: {fileID: 0} 330 | switchIcons_14: {fileID: 0} 331 | switchSmallIcons_0: {fileID: 0} 332 | switchSmallIcons_1: {fileID: 0} 333 | switchSmallIcons_2: {fileID: 0} 334 | switchSmallIcons_3: {fileID: 0} 335 | switchSmallIcons_4: {fileID: 0} 336 | switchSmallIcons_5: {fileID: 0} 337 | switchSmallIcons_6: {fileID: 0} 338 | switchSmallIcons_7: {fileID: 0} 339 | switchSmallIcons_8: {fileID: 0} 340 | switchSmallIcons_9: {fileID: 0} 341 | switchSmallIcons_10: {fileID: 0} 342 | switchSmallIcons_11: {fileID: 0} 343 | switchSmallIcons_12: {fileID: 0} 344 | switchSmallIcons_13: {fileID: 0} 345 | switchSmallIcons_14: {fileID: 0} 346 | switchManualHTML: 347 | switchAccessibleURLs: 348 | switchLegalInformation: 349 | switchMainThreadStackSize: 1048576 350 | switchPresenceGroupId: 351 | switchLogoHandling: 0 352 | switchReleaseVersion: 0 353 | switchDisplayVersion: 1.0.0 354 | switchStartupUserAccount: 0 355 | switchTouchScreenUsage: 0 356 | switchSupportedLanguagesMask: 0 357 | switchLogoType: 0 358 | switchApplicationErrorCodeCategory: 359 | switchUserAccountSaveDataSize: 0 360 | switchUserAccountSaveDataJournalSize: 0 361 | switchApplicationAttribute: 0 362 | switchCardSpecSize: -1 363 | switchCardSpecClock: -1 364 | switchRatingsMask: 0 365 | switchRatingsInt_0: 0 366 | switchRatingsInt_1: 0 367 | switchRatingsInt_2: 0 368 | switchRatingsInt_3: 0 369 | switchRatingsInt_4: 0 370 | switchRatingsInt_5: 0 371 | switchRatingsInt_6: 0 372 | switchRatingsInt_7: 0 373 | switchRatingsInt_8: 0 374 | switchRatingsInt_9: 0 375 | switchRatingsInt_10: 0 376 | switchRatingsInt_11: 0 377 | switchLocalCommunicationIds_0: 378 | switchLocalCommunicationIds_1: 379 | switchLocalCommunicationIds_2: 380 | switchLocalCommunicationIds_3: 381 | switchLocalCommunicationIds_4: 382 | switchLocalCommunicationIds_5: 383 | switchLocalCommunicationIds_6: 384 | switchLocalCommunicationIds_7: 385 | switchParentalControl: 0 386 | switchAllowsScreenshot: 1 387 | switchAllowsVideoCapturing: 1 388 | switchAllowsRuntimeAddOnContentInstall: 0 389 | switchDataLossConfirmation: 0 390 | switchUserAccountLockEnabled: 0 391 | switchSupportedNpadStyles: 3 392 | switchNativeFsCacheSize: 32 393 | switchIsHoldTypeHorizontal: 0 394 | switchSupportedNpadCount: 8 395 | switchSocketConfigEnabled: 0 396 | switchTcpInitialSendBufferSize: 32 397 | switchTcpInitialReceiveBufferSize: 64 398 | switchTcpAutoSendBufferSizeMax: 256 399 | switchTcpAutoReceiveBufferSizeMax: 256 400 | switchUdpSendBufferSize: 9 401 | switchUdpReceiveBufferSize: 42 402 | switchSocketBufferEfficiency: 4 403 | switchSocketInitializeEnabled: 1 404 | switchNetworkInterfaceManagerInitializeEnabled: 1 405 | switchPlayerConnectionEnabled: 1 406 | ps4NPAgeRating: 12 407 | ps4NPTitleSecret: 408 | ps4NPTrophyPackPath: 409 | ps4ParentalLevel: 11 410 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 411 | ps4Category: 0 412 | ps4MasterVersion: 01.00 413 | ps4AppVersion: 01.00 414 | ps4AppType: 0 415 | ps4ParamSfxPath: 416 | ps4VideoOutPixelFormat: 0 417 | ps4VideoOutInitialWidth: 1920 418 | ps4VideoOutBaseModeInitialWidth: 1920 419 | ps4VideoOutReprojectionRate: 60 420 | ps4PronunciationXMLPath: 421 | ps4PronunciationSIGPath: 422 | ps4BackgroundImagePath: 423 | ps4StartupImagePath: 424 | ps4StartupImagesFolder: 425 | ps4IconImagesFolder: 426 | ps4SaveDataImagePath: 427 | ps4SdkOverride: 428 | ps4BGMPath: 429 | ps4ShareFilePath: 430 | ps4ShareOverlayImagePath: 431 | ps4PrivacyGuardImagePath: 432 | ps4NPtitleDatPath: 433 | ps4RemotePlayKeyAssignment: -1 434 | ps4RemotePlayKeyMappingDir: 435 | ps4PlayTogetherPlayerCount: 0 436 | ps4EnterButtonAssignment: 1 437 | ps4ApplicationParam1: 0 438 | ps4ApplicationParam2: 0 439 | ps4ApplicationParam3: 0 440 | ps4ApplicationParam4: 0 441 | ps4DownloadDataSize: 0 442 | ps4GarlicHeapSize: 2048 443 | ps4ProGarlicHeapSize: 2560 444 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 445 | ps4pnSessions: 1 446 | ps4pnPresence: 1 447 | ps4pnFriends: 1 448 | ps4pnGameCustomData: 1 449 | playerPrefsSupport: 0 450 | enableApplicationExit: 0 451 | resetTempFolder: 1 452 | restrictedAudioUsageRights: 0 453 | ps4UseResolutionFallback: 0 454 | ps4ReprojectionSupport: 0 455 | ps4UseAudio3dBackend: 0 456 | ps4SocialScreenEnabled: 0 457 | ps4ScriptOptimizationLevel: 2 458 | ps4Audio3dVirtualSpeakerCount: 14 459 | ps4attribCpuUsage: 0 460 | ps4PatchPkgPath: 461 | ps4PatchLatestPkgPath: 462 | ps4PatchChangeinfoPath: 463 | ps4PatchDayOne: 0 464 | ps4attribUserManagement: 0 465 | ps4attribMoveSupport: 0 466 | ps4attrib3DSupport: 0 467 | ps4attribShareSupport: 0 468 | ps4attribExclusiveVR: 0 469 | ps4disableAutoHideSplash: 0 470 | ps4videoRecordingFeaturesUsed: 0 471 | ps4contentSearchFeaturesUsed: 0 472 | ps4attribEyeToEyeDistanceSettingVR: 0 473 | ps4IncludedModules: [] 474 | monoEnv: 475 | splashScreenBackgroundSourceLandscape: {fileID: 0} 476 | splashScreenBackgroundSourcePortrait: {fileID: 0} 477 | spritePackerPolicy: 478 | webGLMemorySize: 256 479 | webGLExceptionSupport: 1 480 | webGLNameFilesAsHashes: 0 481 | webGLDataCaching: 0 482 | webGLDebugSymbols: 0 483 | webGLEmscriptenArgs: 484 | webGLModulesDirectory: 485 | webGLTemplate: APPLICATION:Default 486 | webGLAnalyzeBuildSize: 0 487 | webGLUseEmbeddedResources: 0 488 | webGLCompressionFormat: 1 489 | webGLLinkerTarget: 0 490 | webGLThreadsSupport: 0 491 | scriptingDefineSymbols: {} 492 | platformArchitecture: {} 493 | scriptingBackend: {} 494 | il2cppCompilerConfiguration: {} 495 | managedStrippingLevel: {} 496 | incrementalIl2cppBuild: {} 497 | allowUnsafeCode: 0 498 | additionalIl2CppArgs: 499 | scriptingRuntimeVersion: 1 500 | apiCompatibilityLevelPerPlatform: {} 501 | m_RenderingPath: 1 502 | m_MobileRenderingPath: 1 503 | metroPackageName: gpu-ray-tracing-in-unity 504 | metroPackageVersion: 505 | metroCertificatePath: 506 | metroCertificatePassword: 507 | metroCertificateSubject: 508 | metroCertificateIssuer: 509 | metroCertificateNotAfter: 0000000000000000 510 | metroApplicationDescription: gpu-ray-tracing-in-unity 511 | wsaImages: {} 512 | metroTileShortName: 513 | metroTileShowName: 0 514 | metroMediumTileShowName: 0 515 | metroLargeTileShowName: 0 516 | metroWideTileShowName: 0 517 | metroSupportStreamingInstall: 0 518 | metroLastRequiredScene: 0 519 | metroDefaultTileSize: 1 520 | metroTileForegroundText: 2 521 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 522 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 523 | a: 1} 524 | metroSplashScreenUseBackgroundColor: 0 525 | platformCapabilities: {} 526 | metroTargetDeviceFamilies: {} 527 | metroFTAName: 528 | metroFTAFileTypes: [] 529 | metroProtocolName: 530 | metroCompilationOverrides: 1 531 | XboxOneProductId: 532 | XboxOneUpdateKey: 533 | XboxOneSandboxId: 534 | XboxOneContentId: 535 | XboxOneTitleId: 536 | XboxOneSCId: 537 | XboxOneGameOsOverridePath: 538 | XboxOnePackagingOverridePath: 539 | XboxOneAppManifestOverridePath: 540 | XboxOneVersion: 1.0.0.0 541 | XboxOnePackageEncryption: 0 542 | XboxOnePackageUpdateGranularity: 2 543 | XboxOneDescription: 544 | XboxOneLanguage: 545 | - enus 546 | XboxOneCapability: [] 547 | XboxOneGameRating: {} 548 | XboxOneIsContentPackage: 0 549 | XboxOneEnableGPUVariability: 0 550 | XboxOneSockets: {} 551 | XboxOneSplashScreen: {fileID: 0} 552 | XboxOneAllowedProductIds: [] 553 | XboxOnePersistentLocalStorageSize: 0 554 | XboxOneXTitleMemory: 8 555 | xboxOneScriptCompiler: 0 556 | XboxOneOverrideIdentityName: 557 | vrEditorSettings: 558 | daydream: 559 | daydreamIconForeground: {fileID: 0} 560 | daydreamIconBackground: {fileID: 0} 561 | cloudServicesEnabled: {} 562 | luminIcon: 563 | m_Name: 564 | m_ModelFolderPath: 565 | m_PortalFolderPath: 566 | luminCert: 567 | m_CertPath: 568 | m_PrivateKeyPath: 569 | luminIsChannelApp: 0 570 | luminVersion: 571 | m_VersionCode: 1 572 | m_VersionName: 573 | facebookSdkVersion: 7.9.4 574 | facebookAppId: 575 | facebookCookies: 1 576 | facebookLogging: 1 577 | facebookStatus: 1 578 | facebookXfbml: 0 579 | facebookFrictionlessRequests: 1 580 | apiCompatibilityLevel: 6 581 | cloudProjectId: 582 | framebufferDepthMemorylessMode: 0 583 | projectName: 584 | organizationId: 585 | cloudEnabled: 0 586 | enableNativePlatformBackendsForNewInputSystem: 0 587 | disableOldInputManagerSupport: 0 588 | legacyClampBlendShapeWeights: 1 589 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.3.7f1 2 | -------------------------------------------------------------------------------- /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 | blendWeights: 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 | particleRaycastBudget: 4 33 | asyncUploadTimeSlice: 2 34 | asyncUploadBufferSize: 4 35 | resolutionScalingFixedDPIFactor: 1 36 | excludedTargetPlatforms: [] 37 | - serializedVersion: 2 38 | name: Low 39 | pixelLightCount: 0 40 | shadows: 0 41 | shadowResolution: 0 42 | shadowProjection: 1 43 | shadowCascades: 1 44 | shadowDistance: 20 45 | shadowNearPlaneOffset: 3 46 | shadowCascade2Split: 0.33333334 47 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 48 | shadowmaskMode: 0 49 | blendWeights: 2 50 | textureQuality: 0 51 | anisotropicTextures: 0 52 | antiAliasing: 0 53 | softParticles: 0 54 | softVegetation: 0 55 | realtimeReflectionProbes: 0 56 | billboardsFaceCameraPosition: 0 57 | vSyncCount: 0 58 | lodBias: 0.4 59 | maximumLODLevel: 0 60 | particleRaycastBudget: 16 61 | asyncUploadTimeSlice: 2 62 | asyncUploadBufferSize: 4 63 | resolutionScalingFixedDPIFactor: 1 64 | excludedTargetPlatforms: [] 65 | - serializedVersion: 2 66 | name: Medium 67 | pixelLightCount: 1 68 | shadows: 1 69 | shadowResolution: 0 70 | shadowProjection: 1 71 | shadowCascades: 1 72 | shadowDistance: 20 73 | shadowNearPlaneOffset: 3 74 | shadowCascade2Split: 0.33333334 75 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 76 | shadowmaskMode: 0 77 | blendWeights: 2 78 | textureQuality: 0 79 | anisotropicTextures: 1 80 | antiAliasing: 0 81 | softParticles: 0 82 | softVegetation: 0 83 | realtimeReflectionProbes: 0 84 | billboardsFaceCameraPosition: 0 85 | vSyncCount: 1 86 | lodBias: 0.7 87 | maximumLODLevel: 0 88 | particleRaycastBudget: 64 89 | asyncUploadTimeSlice: 2 90 | asyncUploadBufferSize: 4 91 | resolutionScalingFixedDPIFactor: 1 92 | excludedTargetPlatforms: [] 93 | - serializedVersion: 2 94 | name: High 95 | pixelLightCount: 2 96 | shadows: 2 97 | shadowResolution: 1 98 | shadowProjection: 1 99 | shadowCascades: 2 100 | shadowDistance: 40 101 | shadowNearPlaneOffset: 3 102 | shadowCascade2Split: 0.33333334 103 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 104 | shadowmaskMode: 1 105 | blendWeights: 2 106 | textureQuality: 0 107 | anisotropicTextures: 1 108 | antiAliasing: 0 109 | softParticles: 0 110 | softVegetation: 1 111 | realtimeReflectionProbes: 1 112 | billboardsFaceCameraPosition: 1 113 | vSyncCount: 1 114 | lodBias: 1 115 | maximumLODLevel: 0 116 | particleRaycastBudget: 256 117 | asyncUploadTimeSlice: 2 118 | asyncUploadBufferSize: 4 119 | resolutionScalingFixedDPIFactor: 1 120 | excludedTargetPlatforms: [] 121 | - serializedVersion: 2 122 | name: Very High 123 | pixelLightCount: 3 124 | shadows: 2 125 | shadowResolution: 2 126 | shadowProjection: 1 127 | shadowCascades: 2 128 | shadowDistance: 70 129 | shadowNearPlaneOffset: 3 130 | shadowCascade2Split: 0.33333334 131 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 132 | shadowmaskMode: 1 133 | blendWeights: 4 134 | textureQuality: 0 135 | anisotropicTextures: 2 136 | antiAliasing: 2 137 | softParticles: 1 138 | softVegetation: 1 139 | realtimeReflectionProbes: 1 140 | billboardsFaceCameraPosition: 1 141 | vSyncCount: 1 142 | lodBias: 1.5 143 | maximumLODLevel: 0 144 | particleRaycastBudget: 1024 145 | asyncUploadTimeSlice: 2 146 | asyncUploadBufferSize: 4 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Ultra 151 | pixelLightCount: 4 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 4 156 | shadowDistance: 150 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 2 171 | maximumLODLevel: 0 172 | particleRaycastBudget: 4096 173 | asyncUploadTimeSlice: 2 174 | asyncUploadBufferSize: 4 175 | resolutionScalingFixedDPIFactor: 1 176 | excludedTargetPlatforms: [] 177 | m_PerPlatformDefaultQuality: 178 | Android: 2 179 | Nintendo 3DS: 5 180 | Nintendo Switch: 5 181 | PS4: 5 182 | PSP2: 2 183 | Standalone: 5 184 | Tizen: 2 185 | WebGL: 3 186 | Windows Store Apps: 5 187 | XboxOne: 5 188 | iPhone: 2 189 | tvOS: 2 190 | -------------------------------------------------------------------------------- /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 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | m_TestInitMode: 0 11 | CrashReportingSettings: 12 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 13 | m_NativeEventUrl: https://perf-events.cloud.unity3d.com/symbolicate 14 | m_Enabled: 0 15 | m_CaptureEditorExceptions: 1 16 | UnityPurchasingSettings: 17 | m_Enabled: 0 18 | m_TestMode: 0 19 | UnityAnalyticsSettings: 20 | m_Enabled: 0 21 | m_InitializeOnStartup: 1 22 | m_TestMode: 0 23 | m_TestEventUrl: 24 | m_TestConfigUrl: 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: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/ProjectSettings/VFXManager.asset -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Physically based rendering Path Tracer in Unity3D using compute shader 2 | 3 | Unity 2018.3.7f1 (win10 64-bit) 4 | 5 | ![DemoScreenShot](Screenshot/Pbr.png) 6 | ## Material parameters: 7 | 1. albedo 8 | 2. specular (control the specular high light) 9 | 3. metallic 10 | 4. roughness 11 | 5. specTrans (control transparency of the material. This parameter is to blend metallic BRDF with dielectricc BSDF and it is taken from Disney's BSDF) 12 | ![DemoScreenShot](Screenshot/blend.jpg) 13 | form [Extending the Disney BRDF to a BSDF with Integrated Subsurface Scattering](https://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_slides.pdf) 14 | 15 | ## Features: 16 | 1. Path-Traced Physically based rendering based on Monte Carlo integration 17 | 2. PBR BRDF and PBR BTDF 18 | 3. Physically based parameters 19 | 4. Hemisphere Sampling, importance sampling GGX 20 | 21 | 22 | ## Principle: 23 | 24 | ### Rendering Equation 25 | ![DemoScreenShot](Screenshot/RenderingEquation.png) 26 | ### Monte Carlo Integration 27 | ![DemoScreenShot](Screenshot/MonteCarlo.png) 28 | ### Pbr BRDF 29 | This demo used cook-torrance BRDF. The choice of D,G,F term refers to the PBR implementation in UE4. 30 | ![DemoScreenShot](Screenshot/cook-torrance.png) 31 | [Formula Derivation](Screenshot/Derivation/BRDF) 32 | 33 | ### Pbr BSDF = BRDF + BTDF 34 | The BSDF/BTDF used in this demo is from Walter's paper [Microfacet Models for Refraction through Rough Surfaces](http://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf) 35 | ![DemoScreenShot](Screenshot/btdf.png) 36 | **Notice!** This BTDF is not reciprocal, be careful about the direction! 37 | [Formula Derivation](Screenshot/Derivation/BTDF) 38 | 39 | 40 | 41 | 42 | ## Reference: 43 | [GPU Path Tracing in Unity – Part 2](http://three-eyed-games.com/2018/05/12/gpu-path-tracing-in-unity-part-2/) 44 | [Rendering Equation](http://www.cse.chalmers.se/edu/year/2011/course/TDA361/2007/rend_eq.pdf) 45 | [Monte Carlo Methods in Practice](https://www.scratchapixel.com/lessons/mathematics-physics-for-computer-graphics/monte-carlo-methods-in-practice/monte-carlo-methods) 46 | [蒙特·卡罗(Monte Carlo)积分详解](https://www.qiujiawei.com/monte-carlo/) 47 | [Reflection, Refraction (Transmission) and Fresnel](https://www.scratchapixel.com/lessons/3d-basic-rendering/introduction-to-shading/reflection-refraction-fresnel) 48 | [Webgl中采用PBR的实时光线追踪](https://zhuanlan.zhihu.com/p/58692781) 49 | [Learnopengl](https://learnopengl.com/PBR/Theory) 50 | [Real Shading in Unreal Engine 4](https://de45xmedrsdbp.cloudfront.net/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf) 51 | [基于物理着色(一)](https://zhuanlan.zhihu.com/p/20091064) 52 | [Microfacet Models for Refraction through Rough Surfaces](http://www.cs.cornell.edu/~srm/publications/EGSR07-btdf.pdf) 53 | [Microfacet models for refection and refraction](http://www.cs.cornell.edu/courses/cs5625/2016sp/slides/04ufacet.pdf) 54 | [Extending the Disney BRDF to a BSDF with Integrated Subsurface Scattering](https://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_notes.pdf) [Extending the Disney BRDF to a BSDF with Integrated Subsurface Scattering](https://blog.selfshadow.com/publications/s2015-shading-course/burley/s2015_pbs_disney_bsdf_slides.pdf) 55 | [Disney Principled BRDF实现笔记](https://zhuanlan.zhihu.com/p/57771965) 56 | [Cook-Torrance BRDF](https://www.youtube.com/watch?list=PLslgisHe5tBPckSYyKoU3jEA4bqiFmNBJ&v=k9Nz2z1jTFQ&feature=emb_logo) 57 | [Microfacet Models](http://www.pbr-book.org/3ed-2018/Reflection_Models/Microfacet_Models.html) 58 | [Surface Reflection: Physical and Geometrical Perspectives ](https://www.ri.cmu.edu/pub_files/pub3/nayar_s_k_1989_1/nayar_s_k_1989_1.pdf) 59 | [Advanced Global Illumination] 60 | [How Is The NDF Really Defined?](http://www.reedbeta.com/blog/hows-the-ndf-really-defined/) 61 | [ENERGY CONSERVATION IN GAMES](http://www.rorydriscoll.com/2009/01/25/energy-conservation-in-games/) 62 | [Adopting a physically based shading model](https://seblagarde.wordpress.com/2011/08/17/hello-world/) 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /Screenshot/Derivation/BRDF/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BRDF/1.jpg -------------------------------------------------------------------------------- /Screenshot/Derivation/BRDF/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BRDF/2.jpg -------------------------------------------------------------------------------- /Screenshot/Derivation/BRDF/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BRDF/3.png -------------------------------------------------------------------------------- /Screenshot/Derivation/BRDF/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BRDF/4.png -------------------------------------------------------------------------------- /Screenshot/Derivation/BTDF/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BTDF/1.jpg -------------------------------------------------------------------------------- /Screenshot/Derivation/BTDF/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BTDF/2.jpg -------------------------------------------------------------------------------- /Screenshot/Derivation/BTDF/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BTDF/3.png -------------------------------------------------------------------------------- /Screenshot/Derivation/BTDF/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Derivation/BTDF/4.jpg -------------------------------------------------------------------------------- /Screenshot/MonteCarlo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/MonteCarlo.png -------------------------------------------------------------------------------- /Screenshot/Pbr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/Pbr.png -------------------------------------------------------------------------------- /Screenshot/RenderingEquation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/RenderingEquation.png -------------------------------------------------------------------------------- /Screenshot/blend.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/blend.jpg -------------------------------------------------------------------------------- /Screenshot/btdf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/btdf.png -------------------------------------------------------------------------------- /Screenshot/cook-torrance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aceyan/Unity3D_PBR_Path_Tracer/d034daeb10c8c7e6035b0f121813ebb7b316a57c/Screenshot/cook-torrance.png --------------------------------------------------------------------------------