├── Images ├── 9_Final1.png ├── 9_Final2.png ├── 0_SetupDX12.png ├── 6_Diffuse1.png ├── 2_Background1.png ├── 3_AddASphere1.png ├── 0_ImportPackage.png ├── 1_OutputImage1.png ├── 1_OutputImage2.png ├── 4_NormalAsColor1.png ├── 5_Antialiasing1.png ├── 5_Antialiasing2.png ├── 7_Dielectrics1.png └── 8_FocusCamera1.png ├── Assets ├── Models │ ├── Sphere.FBX │ └── Sphere.FBX.meta ├── Scripts │ ├── Tutorials │ │ ├── AntialiasingTutorial.cs.meta │ │ ├── AntialiasingTutorialAsset.cs.meta │ │ ├── RayTracingTutorialAsset.cs │ │ ├── CameraTutorialAsset.cs │ │ ├── CameraTutorial.cs.meta │ │ ├── BackgroundTutorial.cs.meta │ │ ├── CameraTutorialAsset.cs.meta │ │ ├── CreateSphereTutorial.cs.meta │ │ ├── OutputColorTutorial.cs.meta │ │ ├── RayTracingTutorial.cs.meta │ │ ├── TutorialController.cs.meta │ │ ├── BackgroundTutorialAsset.cs.meta │ │ ├── CreateSphereTutorialAsset.cs.meta │ │ ├── OutputColorTutorialAsset.cs.meta │ │ ├── RayTracingTutorialAsset.cs.meta │ │ ├── BackgroundTutorialAsset.cs │ │ ├── OutputColorTutorialAsset.cs │ │ ├── AntialiasingTutorialAsset.cs │ │ ├── CreateSphereTutorialAsset.cs │ │ ├── TutorialController.cs │ │ ├── BackgroundTutorial.cs │ │ ├── OutputColorTutorial.cs │ │ ├── CreateSphereTutorial.cs │ │ ├── AntialiasingTutorial.cs │ │ ├── RayTracingTutorial.cs │ │ └── CameraTutorial.cs │ ├── Editor.meta │ ├── Tutorials.meta │ ├── Utilities.meta │ ├── FocusCamera.cs.meta │ ├── SceneManager.cs.meta │ ├── Editor │ │ ├── BuildFinalScene.cs.meta │ │ └── BuildFinalScene.cs │ ├── RayTracingRenderPipeline.cs.meta │ ├── Utilities │ │ ├── MersenneTwister.cs.meta │ │ └── MersenneTwister.cs │ ├── RayTracingRenderPipelineAsset.cs.meta │ ├── RayTracingRenderPipelineAsset.cs │ ├── SceneManager.cs │ ├── FocusCamera.cs │ └── RayTracingRenderPipeline.cs ├── Prefabs │ ├── Sphere.prefab.meta │ └── Sphere.prefab ├── Scenes │ ├── FinalScene.unity.meta │ ├── CameraTutorialScene.unity.meta │ ├── DiffuseTutorialScene.unity.meta │ ├── AntialiasingTutorialScene.unity.meta │ ├── BackgroundTutorialScene.unity.meta │ ├── CreateSphereTutorialScene.unity.meta │ ├── DielectricsTutorialScene.unity.meta │ ├── OutputColorTutorialScene.unity.meta │ ├── SurfaceNormalTutorialScene.unity.meta │ ├── BackgroundTutorialScene.unity │ ├── OutputColorTutorialScene.unity │ └── FinalScene.unity ├── Shaders │ ├── PRNG.hlsl.meta │ ├── Common.hlsl.meta │ ├── CameraTutorial.raytrace.meta │ ├── AntialiasingTutorial.raytrace.meta │ ├── BackgroundTutorial.raytrace.meta │ ├── CreateSphereTutorial.raytrace.meta │ ├── OutputColorTutorial.raytrace.meta │ ├── Metal.shader.meta │ ├── Unlit.shader.meta │ ├── Dielectrics.shader.meta │ ├── Diffuse.shader.meta │ ├── DielectricsInv.shader.meta │ ├── NormalAsColor.shader.meta │ ├── OutputColorTutorial.raytrace │ ├── BackgroundTutorial.raytrace │ ├── CreateSphereTutorial.raytrace │ ├── Unlit.shader │ ├── PRNG.hlsl │ ├── Common.hlsl │ ├── AntialiasingTutorial.raytrace │ ├── CameraTutorial.raytrace │ ├── NormalAsColor.shader │ ├── Diffuse.shader │ ├── Metal.shader │ ├── Dielectrics.shader │ └── DielectricsInv.shader ├── Models.meta ├── Prefabs.meta ├── Scenes.meta ├── Scripts.meta ├── Shaders.meta ├── Materials.meta ├── Settings.meta ├── Materials │ ├── Red.mat.meta │ ├── Diffuse.mat.meta │ ├── Metal_1.mat.meta │ ├── Metal_3.mat.meta │ ├── Dielectric_1.mat.meta │ ├── Dielectric_2.mat.meta │ ├── Diffuse_1.mat.meta │ ├── Diffuse_2.mat.meta │ ├── NormalAsColor.mat.meta │ ├── RandomMetal.mat.meta │ ├── RandomDielectric.mat.meta │ ├── RandomLambertian.mat.meta │ ├── Red.mat │ ├── Diffuse.mat │ ├── Diffuse_2.mat │ ├── Diffuse_1.mat │ ├── NormalAsColor.mat │ ├── RandomLambertian.mat │ ├── Metal_1.mat │ ├── Metal_3.mat │ ├── RandomMetal.mat │ ├── Dielectric_1.mat │ ├── Dielectric_2.mat │ └── RandomDielectric.mat └── Settings │ ├── CameraTutorialAsset.asset.meta │ ├── AntialiasingTutorialAsset.asset.meta │ ├── BackgroundTutorialAsset.asset.meta │ ├── CreateSphereTutorialAsset.asset.meta │ ├── OutputColorTutorialAsset.asset.meta │ ├── CameraTutorialRenderPipelineAsset.asset.meta │ ├── AntialiasingTutorialRenderPipelineAsset.asset.meta │ ├── BackgroundTutorialRenderPipelineAsset.asset.meta │ ├── CreateSphereTutorialRenderPipelineAsset.asset.meta │ ├── OutputColorTutorialRenderPipelineAsset.asset.meta │ ├── CameraTutorialAsset.asset │ ├── BackgroundTutorialAsset.asset │ ├── AntialiasingTutorialAsset.asset │ ├── CreateSphereTutorialAsset.asset │ ├── OutputColorTutorialAsset.asset │ ├── CameraTutorialRenderPipelineAsset.asset │ ├── BackgroundTutorialRenderPipelineAsset.asset │ ├── OutputColorTutorialRenderPipelineAsset.asset │ ├── AntialiasingTutorialRenderPipelineAsset.asset │ └── CreateSphereTutorialRenderPipelineAsset.asset ├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── PresetManager.asset ├── EditorBuildSettings.asset ├── XRSettings.asset ├── VersionControlSettings.asset ├── TimeManager.asset ├── VFXManager.asset ├── AudioManager.asset ├── TagManager.asset ├── PackageManagerSettings.asset ├── EditorSettings.asset ├── UnityConnectSettings.asset ├── DynamicsManager.asset ├── MemorySettings.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── GraphicsSettings.asset └── QualitySettings.asset ├── .gitignore ├── Packages └── manifest.json └── .gitattributes /Images/9_Final1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/9_Final1.png -------------------------------------------------------------------------------- /Images/9_Final2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/9_Final2.png -------------------------------------------------------------------------------- /Images/0_SetupDX12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/0_SetupDX12.png -------------------------------------------------------------------------------- /Images/6_Diffuse1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/6_Diffuse1.png -------------------------------------------------------------------------------- /Assets/Models/Sphere.FBX: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Assets/Models/Sphere.FBX -------------------------------------------------------------------------------- /Images/2_Background1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/2_Background1.png -------------------------------------------------------------------------------- /Images/3_AddASphere1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/3_AddASphere1.png -------------------------------------------------------------------------------- /Images/0_ImportPackage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/0_ImportPackage.png -------------------------------------------------------------------------------- /Images/1_OutputImage1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/1_OutputImage1.png -------------------------------------------------------------------------------- /Images/1_OutputImage2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/1_OutputImage2.png -------------------------------------------------------------------------------- /Images/4_NormalAsColor1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/4_NormalAsColor1.png -------------------------------------------------------------------------------- /Images/5_Antialiasing1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/5_Antialiasing1.png -------------------------------------------------------------------------------- /Images/5_Antialiasing2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/5_Antialiasing2.png -------------------------------------------------------------------------------- /Images/7_Dielectrics1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/7_Dielectrics1.png -------------------------------------------------------------------------------- /Images/8_FocusCamera1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sieluna/RTSRP/HEAD/Images/8_FocusCamera1.png -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2022.3.62f1 2 | m_EditorVersionWithRevision: 2022.3.62f1 (4af31df58517) 3 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/AntialiasingTutorial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4b47fe23b8ad478fa3b41e3bf4d0a386 3 | timeCreated: 1726045059 -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/AntialiasingTutorialAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c3c42a05f22c429287b57d246ce66d67 3 | timeCreated: 1726045059 -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /Assets/Prefabs/Sphere.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1055d362c9899694d8a2a23073d4b1b5 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/FinalScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 39c2cd702c5cb3543accef57d6014729 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Shaders/PRNG.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5491077d9cc93984e9ab854ff27d59e4 3 | ShaderIncludeImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Models.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a1a9e7ff9086f444b92209d9f62c20c7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 643abb809800b69448e68db9023542b0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35c130a17da37204ca4ccc87566af359 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7a498f08817c61942b926b907ac7194b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b86a9cade37e547478ef55d8e9638ea8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/Common.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8c82b95356e9f545afb897ae8bb9a6d 3 | ShaderIncludeImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 909e3859b5ee0c348929e669c1b71ec2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/CameraTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d483c3f2215f08a48bfdc9605b41895b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/DiffuseTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3ca95cf1df1a4e547b8e72e9d59d809a 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Settings.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97750c48f6d91a04db2337b6228948b2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/AntialiasingTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a961a51d345c1794187d0e04b17982a7 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/BackgroundTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aebf4ffd012e8794cac5cc399bd3d159 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/CreateSphereTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f81f97830fa2744e9351938bc2674ff 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/DielectricsTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 537df33ebb9c1f2468a7cc088602625e 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes/OutputColorTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a39cea4c300510498cae481ea0fdcd8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scripts/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 97134e94d8064ced90e8ac6be2a6a475 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5fcd7e5117a842c3939dffb1cfd086ac 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scripts/Utilities.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 658611ff6fb84eac81313abf376870de 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /Assets/Scenes/SurfaceNormalTutorialScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c956d90cc2eeda4da4559da892a3f6c 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Shaders/CameraTutorial.raytrace.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 66ded485275d45c45901ceeac5105991 3 | RayTracingShaderImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /Assets/Materials/Red.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f0daec622685254fae7a8a0c78c5cfb 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/AntialiasingTutorial.raytrace.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 80e8c36f9c61431fa0c7962d25ac050a 3 | RayTracingShaderImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Shaders/BackgroundTutorial.raytrace.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c78c4c34f83f71645ab965767702fd0b 3 | RayTracingShaderImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Shaders/CreateSphereTutorial.raytrace.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 058286ab16aa7cd408ca35ca34bb3d2b 3 | RayTracingShaderImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Shaders/OutputColorTutorial.raytrace.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4a311ad11bc4ac43830e6acf9dad2f3 3 | RayTracingShaderImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Materials/Diffuse.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6edc4b03338938244a094bc210bd4cc8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Metal_1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f5093f6a7959b664eafe5975500bc28d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Metal_3.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 95bfd4e5e2902ae4f8a03136c5ac1ef5 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Dielectric_1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c4a593ffd2563c144af2f81c952cdce6 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Dielectric_2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6077f6bc08fe9b439e1353c39e71cff 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Diffuse_1.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6462482812aa7f4439a7c2ce3836405e 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/Diffuse_2.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d59a60fed3998f44be25a19b1e63d5b 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/NormalAsColor.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64dc47bd86f4d2e4f996614d81a8af69 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/RandomMetal.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 313fb290e5c0e3343a5b2608f344c8c4 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/RandomDielectric.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7705b79ee482d204f8b85c3526b1d50f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Materials/RandomLambertian.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a695cca994f3fe245b7c8afda70ce445 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/CameraTutorialAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 18407dabfa4f2ba418ce5e05bee6c265 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /Assets/Settings/AntialiasingTutorialAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ce18e9e59632b424ba25994014ced4af 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/BackgroundTutorialAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0a8753c53d3d32e4bbaad78bd57fb854 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/CreateSphereTutorialAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 40097d6f302379d4e9078c0265fc83c8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/OutputColorTutorialAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebea31b602bf9a24d9902c86e52f5c51 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/CameraTutorialRenderPipelineAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b5af963700af58248baac5c9a1073337 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/Metal.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b6f12a2a27ee89d4cbcad79383888a72 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/Unlit.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6b8deee82a5ebb418040d5c5cc17a8a 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Assets/Settings/AntialiasingTutorialRenderPipelineAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9200f12b540f972459c8bb3668bd2453 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/BackgroundTutorialRenderPipelineAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 78b24dd2cfd4ae24caca8228a8aea74c 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/CreateSphereTutorialRenderPipelineAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: dc463cad6d641cd458ebac88ef03cfa3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Settings/OutputColorTutorialRenderPipelineAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8319959ec71070c4fa4aa54986d4551d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Shaders/Dielectrics.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7e5bb62a1c13e841b5ce0f720ac9126 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/Diffuse.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0820419a37b6409a8dc4c49cf5bebf17 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/DielectricsInv.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ca38bbf6cd15a90419102e5d4a0f3de4 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Shaders/NormalAsColor.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38fb1e4053ce44bfa144270b8a39d9cf 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/RayTracingTutorialAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Experimental.Rendering; 3 | 4 | public abstract class RayTracingTutorialAsset : ScriptableObject 5 | { 6 | public RayTracingShader Shader; 7 | 8 | public abstract RayTracingTutorial CreateTutorial(); 9 | } -------------------------------------------------------------------------------- /Assets/Scripts/FocusCamera.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a98622bd0a834508974890cb65a9e4f3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/SceneManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5a6b39f571604bf44bd007ed629d6838 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CameraTutorialAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [CreateAssetMenu(fileName = "CameraTutorialAsset", menuName = "Rendering/CameraTutorialAsset")] 4 | public class CameraTutorialAsset : RayTracingTutorialAsset 5 | { 6 | public override RayTracingTutorial CreateTutorial() => new CameraTutorial(this); 7 | } -------------------------------------------------------------------------------- /Assets/Scripts/Editor/BuildFinalScene.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bcce08730764409eb2ff3b40557b8c77 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RayTracingRenderPipeline.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ecb237095e344c7bbfc6896d324ced1 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CameraTutorial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 751a0349388ee87469e792d8edce7888 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Utilities/MersenneTwister.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aeed62e44c3b4200997cfe4b0aa23bcb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/RayTracingRenderPipelineAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4ad849d2f2484497b25b79034ab1c15b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/BackgroundTutorial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e64a9b557904354c8fd5300aba4ac59 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CameraTutorialAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ca6deea5a1e00440a1719e93a49a350 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CreateSphereTutorial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 43c6f05d508cc804993066d0785904bd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/OutputColorTutorial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19c3227d11d347be84933e4682015488 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/RayTracingTutorial.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5706f4e417c245ecb8ca73e13c69f68d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/TutorialController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b66b24dadf6e2154bb091a678aad4162 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/BackgroundTutorialAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8e3289f0554382a4eb8b9dd80b41531d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CreateSphereTutorialAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8d49372cb9a766342b6d0fd91c777b2a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/OutputColorTutorialAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 170e405de00149b78a59dc477c4a562c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/RayTracingTutorialAsset.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 851136ff587d43f198aa096803efcde8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/BackgroundTutorialAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [CreateAssetMenu(fileName = "BackgroundTutorialAsset", menuName = "Rendering/BackgroundTutorialAsset")] 4 | public class BackgroundTutorialAsset : RayTracingTutorialAsset 5 | { 6 | public override RayTracingTutorial CreateTutorial() => new BackgroundTutorial(this); 7 | } 8 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/OutputColorTutorialAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [CreateAssetMenu(fileName = "OutputColorTutorialAsset", menuName = "Rendering/OutputColorTutorialAsset")] 4 | public class OutputColorTutorialAsset : RayTracingTutorialAsset 5 | { 6 | public override RayTracingTutorial CreateTutorial() => new OutputColorTutorial(this); 7 | } -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/AntialiasingTutorialAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [CreateAssetMenu(fileName = "AntialiasingTutorialAsset", menuName = "Rendering/AntialiasingTutorialAsset")] 4 | public class AntialiasingTutorialAsset : RayTracingTutorialAsset 5 | { 6 | public override RayTracingTutorial CreateTutorial() => new AntialiasingTutorial(this); 7 | } -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CreateSphereTutorialAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [CreateAssetMenu(fileName = "CreateSphereTutorialAsset", menuName = "Rendering/CreateSphereTutorialAsset")] 4 | public class CreateSphereTutorialAsset : RayTracingTutorialAsset 5 | { 6 | public override RayTracingTutorial CreateTutorial() => new CreateSphereTutorial(this); 7 | } -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | -------------------------------------------------------------------------------- /Assets/Shaders/OutputColorTutorial.raytrace: -------------------------------------------------------------------------------- 1 | #pragma max_recursion_depth 1 2 | 3 | RWTexture2D _OutputTarget; 4 | 5 | [shader("raygeneration")] 6 | void OutputColorRayGenShader() 7 | { 8 | uint2 dispatchIdx = DispatchRaysIndex().xy; 9 | uint2 dispatchDim = DispatchRaysDimensions().xy; 10 | 11 | _OutputTarget[dispatchIdx] = float4((float)dispatchIdx.x / dispatchDim.x, (float)dispatchIdx.y / dispatchDim.y, 0.2f, 1.0f); 12 | } -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/TutorialController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | public class TutorialController : MonoBehaviour 5 | { 6 | public RenderPipelineAsset renderPipelineAsset; 7 | 8 | public void Start() 9 | { 10 | GraphicsSettings.renderPipelineAsset = renderPipelineAsset; 11 | } 12 | 13 | public void OnDestroy() 14 | { 15 | GraphicsSettings.renderPipelineAsset = null; 16 | } 17 | } -------------------------------------------------------------------------------- /Assets/Scripts/RayTracingRenderPipelineAsset.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | [CreateAssetMenu(fileName = "RayTracingRenderPipelineAsset", menuName = "Rendering/RayTracingRenderPipelineAsset", order = -1)] 5 | public class RayTracingRenderPipelineAsset : RenderPipelineAsset 6 | { 7 | public RayTracingTutorialAsset TutorialAsset; 8 | 9 | protected override RenderPipeline CreatePipeline() => new RayTracingRenderPipeline(this); 10 | } -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /Assets/Settings/CameraTutorialAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 9ca6deea5a1e00440a1719e93a49a350, type: 3} 13 | m_Name: CameraTutorialAsset 14 | m_EditorClassIdentifier: 15 | Shader: {fileID: 4807578003741378534, guid: 66ded485275d45c45901ceeac5105991, type: 3} 16 | -------------------------------------------------------------------------------- /Assets/Settings/BackgroundTutorialAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8e3289f0554382a4eb8b9dd80b41531d, type: 3} 13 | m_Name: BackgroundTutorialAsset 14 | m_EditorClassIdentifier: 15 | Shader: {fileID: 4807578003741378534, guid: 9a392e846b2abbb409c93cae8934162d, type: 3} 16 | -------------------------------------------------------------------------------- /Assets/Settings/AntialiasingTutorialAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: c3c42a05f22c429287b57d246ce66d67, type: 3} 13 | m_Name: AntialiasingTutorialAsset 14 | m_EditorClassIdentifier: 15 | Shader: {fileID: 4807578003741378534, guid: 80e8c36f9c61431fa0c7962d25ac050a, type: 3} 16 | -------------------------------------------------------------------------------- /Assets/Settings/CreateSphereTutorialAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 8d49372cb9a766342b6d0fd91c777b2a, type: 3} 13 | m_Name: CreateSphereTutorialAsset 14 | m_EditorClassIdentifier: 15 | Shader: {fileID: 4807578003741378534, guid: 058286ab16aa7cd408ca35ca34bb3d2b, type: 3} 16 | -------------------------------------------------------------------------------- /Assets/Settings/OutputColorTutorialAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 170e405de00149b78a59dc477c4a562c, type: 3} 13 | m_Name: OutputColorTutorialAsset 14 | m_EditorClassIdentifier: 15 | Shader: {fileID: 4807578003741378534, guid: e4a311ad11bc4ac43830e6acf9dad2f3, type: 3} 16 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /Assets/Settings/CameraTutorialRenderPipelineAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4ad849d2f2484497b25b79034ab1c15b, type: 3} 13 | m_Name: CameraTutorialRenderPipelineAsset 14 | m_EditorClassIdentifier: 15 | TutorialAsset: {fileID: 11400000, guid: 18407dabfa4f2ba418ce5e05bee6c265, type: 2} 16 | -------------------------------------------------------------------------------- /Assets/Settings/BackgroundTutorialRenderPipelineAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4ad849d2f2484497b25b79034ab1c15b, type: 3} 13 | m_Name: BackgroundTutorialRenderPipelineAsset 14 | m_EditorClassIdentifier: 15 | TutorialAsset: {fileID: 11400000, guid: 0a8753c53d3d32e4bbaad78bd57fb854, type: 2} 16 | -------------------------------------------------------------------------------- /Assets/Settings/OutputColorTutorialRenderPipelineAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4ad849d2f2484497b25b79034ab1c15b, type: 3} 13 | m_Name: OutputColorTutorialRenderPipelineAsset 14 | m_EditorClassIdentifier: 15 | TutorialAsset: {fileID: 11400000, guid: ebea31b602bf9a24d9902c86e52f5c51, type: 2} 16 | -------------------------------------------------------------------------------- /Assets/Settings/AntialiasingTutorialRenderPipelineAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4ad849d2f2484497b25b79034ab1c15b, type: 3} 13 | m_Name: AntialiasingTutorialRenderPipelineAsset 14 | m_EditorClassIdentifier: 15 | TutorialAsset: {fileID: 11400000, guid: ce18e9e59632b424ba25994014ced4af, type: 2} 16 | -------------------------------------------------------------------------------- /Assets/Settings/CreateSphereTutorialRenderPipelineAsset.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 4ad849d2f2484497b25b79034ab1c15b, type: 3} 13 | m_Name: CreateSphereTutorialRenderPipelineAsset 14 | m_EditorClassIdentifier: 15 | TutorialAsset: {fileID: 11400000, guid: 40097d6f302379d4e9078c0265fc83c8, type: 2} 16 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.com 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_UserSelectedRegistryName: 29 | m_UserAddingNewScopedRegistry: 0 30 | m_RegistryInfoDraft: 31 | m_Modified: 0 32 | m_ErrorMessage: 33 | m_UserModificationsInstanceId: -830 34 | m_OriginalInstanceId: -832 35 | m_LoadAssets: 0 36 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 0 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 0 30 | m_SerializeInlineMappingsOnOneLine: 1 31 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_DashboardUrl: https://dashboard.unity3d.com 13 | m_TestInitMode: 0 14 | CrashReportingSettings: 15 | m_EventUrl: https://perf-events.cloud.unity3d.com 16 | m_Enabled: 0 17 | m_LogBufferSize: 10 18 | m_CaptureEditorExceptions: 1 19 | UnityPurchasingSettings: 20 | m_Enabled: 0 21 | m_TestMode: 0 22 | UnityAnalyticsSettings: 23 | m_Enabled: 0 24 | m_TestMode: 0 25 | m_InitializeOnStartup: 1 26 | m_PackageRequiringCoreStatsPresent: 0 27 | UnityAdsSettings: 28 | m_Enabled: 0 29 | m_InitializeOnStartup: 1 30 | m_TestMode: 0 31 | m_IosGameId: 32 | m_AndroidGameId: 33 | m_GameIds: {} 34 | m_GameId: 35 | PerformanceReportingSettings: 36 | m_Enabled: 0 37 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/BackgroundTutorial.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | public class BackgroundTutorial : RayTracingTutorial 5 | { 6 | public BackgroundTutorial(RayTracingTutorialAsset asset) : base(asset) { } 7 | 8 | public override void Render(ScriptableRenderContext context, Camera camera) 9 | { 10 | base.Render(context, camera); 11 | var outputTarget = RequireOutputTarget(camera); 12 | 13 | var cmd = CommandBufferPool.Get(nameof(BackgroundTutorial)); 14 | try 15 | { 16 | using (new ProfilingScope(cmd, new ProfilingSampler("RayTracing"))) 17 | { 18 | cmd.SetRayTracingTextureParam(m_Shader, s_OutputTarget, outputTarget); 19 | cmd.DispatchRays(m_Shader, "BackgroundRayGenShader", (uint) outputTarget.rt.width, (uint) outputTarget.rt.height, 1, camera); 20 | } 21 | 22 | context.ExecuteCommandBuffer(cmd); 23 | 24 | using (new ProfilingScope(cmd, new ProfilingSampler("FinalBlit"))) 25 | { 26 | cmd.Blit(outputTarget, BuiltinRenderTextureType.CameraTarget, Vector2.one, Vector2.zero); 27 | } 28 | 29 | context.ExecuteCommandBuffer(cmd); 30 | } 31 | finally 32 | { 33 | CommandBufferPool.Release(cmd); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/OutputColorTutorial.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | public class OutputColorTutorial : RayTracingTutorial 5 | { 6 | public OutputColorTutorial(RayTracingTutorialAsset asset) : base(asset) { } 7 | 8 | public override void Render(ScriptableRenderContext context, Camera camera) 9 | { 10 | base.Render(context, camera); 11 | var outputTarget = RequireOutputTarget(camera); 12 | 13 | var cmd = CommandBufferPool.Get(nameof(OutputColorTutorial)); 14 | try 15 | { 16 | using (new ProfilingScope(cmd, new ProfilingSampler("RayTracing"))) 17 | { 18 | cmd.SetRayTracingTextureParam(m_Shader, s_OutputTarget, outputTarget); 19 | cmd.DispatchRays(m_Shader, "OutputColorRayGenShader", (uint) outputTarget.rt.width, (uint) outputTarget.rt.height, 1, camera); 20 | } 21 | 22 | context.ExecuteCommandBuffer(cmd); 23 | 24 | using (new ProfilingScope(cmd, new ProfilingSampler("FinalBlit"))) 25 | { 26 | cmd.Blit(outputTarget, BuiltinRenderTextureType.CameraTarget, Vector2.one, Vector2.zero); 27 | } 28 | 29 | context.ExecuteCommandBuffer(cmd); 30 | } 31 | finally 32 | { 33 | CommandBufferPool.Release(cmd); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Assets/Shaders/BackgroundTutorial.raytrace: -------------------------------------------------------------------------------- 1 | #pragma max_recursion_depth 1 2 | 3 | #define CBUFFER_START(name) cbuffer name { 4 | #define CBUFFER_END }; 5 | 6 | CBUFFER_START(CameraBuffer) 7 | float4x4 _InvCameraViewProj; 8 | float3 _WorldSpaceCameraPos; 9 | float _CameraFarDistance; 10 | CBUFFER_END 11 | 12 | RWTexture2D _OutputTarget; 13 | 14 | inline void GenerateCameraRay(out float3 origin, out float3 direction) 15 | { 16 | float2 xy = DispatchRaysIndex().xy + 0.5f; // center in the middle of the pixel. 17 | float2 screenPos = xy / DispatchRaysDimensions().xy * 2.0f - 1.0f; 18 | 19 | // Un project the pixel coordinate into a ray. 20 | float4 world = mul(_InvCameraViewProj, float4(screenPos, 0, 1)); 21 | 22 | world.xyz /= world.w; 23 | origin = _WorldSpaceCameraPos.xyz; 24 | direction = normalize(world.xyz - origin); 25 | } 26 | 27 | inline float3 Color(float3 origin, float3 direction) 28 | { 29 | float t = 0.5f * (direction.y + 1.0f); 30 | return (1.0f - t) * float3(1.0f, 1.0f, 1.0f) + t * float3(0.5f, 0.7f, 1.0f); 31 | } 32 | 33 | [shader("raygeneration")] 34 | void BackgroundRayGenShader() 35 | { 36 | const uint2 dispatchIdx = DispatchRaysIndex().xy; 37 | 38 | float3 origin; 39 | float3 direction; 40 | GenerateCameraRay(origin, direction); 41 | 42 | _OutputTarget[dispatchIdx] = float4(Color(origin, direction), 1.0f); 43 | } -------------------------------------------------------------------------------- /Assets/Scripts/SceneManager.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Experimental.Rendering; 3 | 4 | public class SceneManager : MonoBehaviour 5 | { 6 | private const int k_MaxNumSubMeshes = 32; 7 | 8 | private static SceneManager s_Instance; 9 | 10 | public Renderer[] renderers; 11 | 12 | private readonly RayTracingSubMeshFlags[] m_SubMeshFlagArray = new RayTracingSubMeshFlags[k_MaxNumSubMeshes]; 13 | 14 | public bool IsDirty { get; set; } = true; 15 | 16 | public static SceneManager Instance 17 | { 18 | get 19 | { 20 | if (s_Instance is not null) return s_Instance; 21 | 22 | s_Instance = FindObjectOfType(); 23 | s_Instance.Init(); 24 | 25 | return s_Instance; 26 | } 27 | } 28 | 29 | public void Awake() 30 | { 31 | if (Application.isPlaying) 32 | DontDestroyOnLoad(this); 33 | 34 | IsDirty = true; 35 | } 36 | 37 | public void FillAccelerationStructure(ref RayTracingAccelerationStructure accelerationStructure) 38 | { 39 | foreach (var targetRenderer in renderers) 40 | if (targetRenderer) 41 | accelerationStructure.AddInstance(targetRenderer, m_SubMeshFlagArray); 42 | } 43 | 44 | private void Init() 45 | { 46 | for (var i = 0; i < k_MaxNumSubMeshes; ++i) 47 | { 48 | m_SubMeshFlagArray[i] = RayTracingSubMeshFlags.Enabled; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Recordings can get excessive in size 18 | /[Rr]ecordings/ 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | # /[Aa]ssets/AssetStoreTools* 22 | 23 | # Autogenerated Jetbrains Rider plugin 24 | /[Aa]ssets/Plugins/Editor/JetBrains* 25 | 26 | # Visual Studio cache directory 27 | .vs/ 28 | 29 | # Rider cache directory 30 | .idea/ 31 | 32 | # Gradle cache directory 33 | .gradle/ 34 | 35 | # Autogenerated VS/MD/Consulo solution and project files 36 | ExportedObj/ 37 | .consulo/ 38 | *.csproj 39 | *.unityproj 40 | *.sln 41 | *.suo 42 | *.tmp 43 | *.user 44 | *.userprefs 45 | *.pidb 46 | *.booproj 47 | *.svd 48 | *.pdb 49 | *.mdb 50 | *.opendb 51 | *.VC.db 52 | 53 | # Unity3D generated meta files 54 | *.pidb.meta 55 | *.pdb.meta 56 | *.mdb.meta 57 | 58 | # Unity3D generated file on crash reports 59 | sysinfo.txt 60 | 61 | # Builds 62 | *.apk 63 | *.aab 64 | *.unitypackage 65 | *.app 66 | 67 | # Crashlytics generated file 68 | crashlytics-build.properties 69 | 70 | # Packed Addressables 71 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 72 | 73 | # Temporary auto-generated Android Assets 74 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 75 | /[Aa]ssets/[Ss]treamingAssets/aa/* -------------------------------------------------------------------------------- /Assets/Shaders/CreateSphereTutorial.raytrace: -------------------------------------------------------------------------------- 1 | #pragma max_recursion_depth 1 2 | 3 | #include "./Common.hlsl" 4 | 5 | RWTexture2D _OutputTarget; 6 | 7 | inline float3 BackgroundColor(float3 origin, float3 direction) 8 | { 9 | float t = 0.5f * (direction.y + 1.0f); 10 | return (1.0f - t) * float3(1.0f, 1.0f, 1.0f) + t * float3(0.5f, 0.7f, 1.0f); 11 | } 12 | 13 | [shader("raygeneration")] 14 | void CreateSphereRayGenShader() 15 | { 16 | const uint2 dispatchIdx = DispatchRaysIndex().xy; 17 | 18 | float3 origin; 19 | float3 direction; 20 | GenerateCameraRay(origin, direction); 21 | 22 | RayDesc rayDescriptor; 23 | rayDescriptor.Origin = origin; 24 | rayDescriptor.Direction = direction; 25 | rayDescriptor.TMin = 1e-5f; 26 | rayDescriptor.TMax = _CameraFarDistance; 27 | 28 | RayIntersection rayIntersection; 29 | rayIntersection.remainingDepth = 1; 30 | rayIntersection.color = float4(0.0f, 0.0f, 0.0f, 0.0f); 31 | 32 | TraceRay(_AccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xFF, 0, 1, 0, rayDescriptor, rayIntersection); 33 | 34 | _OutputTarget[dispatchIdx] = rayIntersection.color; 35 | } 36 | 37 | [shader("miss")] 38 | void MissShader(inout RayIntersection rayIntersection : SV_RayPayload) 39 | { 40 | float3 origin = WorldRayOrigin(); 41 | float3 direction = WorldRayDirection(); 42 | rayIntersection.color = float4(BackgroundColor(origin, direction), 1.0f); 43 | } 44 | 45 | [shader("anyhit")] 46 | void AnyHitShader(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) 47 | { 48 | AcceptHitAndEndSearch(); 49 | } 50 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CreateSphereTutorial.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | public class CreateSphereTutorial : RayTracingTutorial 5 | { 6 | public CreateSphereTutorial(RayTracingTutorialAsset asset) : base(asset) { } 7 | 8 | public override void Render(ScriptableRenderContext context, Camera camera) 9 | { 10 | base.Render(context, camera); 11 | var outputTarget = RequireOutputTarget(camera); 12 | 13 | var accelerationStructure = m_Pipeline.RequestAccelerationStructure(); 14 | 15 | var cmd = CommandBufferPool.Get(nameof(CreateSphereTutorial)); 16 | try 17 | { 18 | using (new ProfilingScope(cmd, new ProfilingSampler("RayTracing"))) 19 | { 20 | cmd.SetRayTracingShaderPass(m_Shader, "RayTracing"); 21 | cmd.SetRayTracingAccelerationStructure(m_Shader, RayTracingRenderPipeline.s_AccelerationStructure, accelerationStructure); 22 | cmd.SetRayTracingTextureParam(m_Shader, s_OutputTarget, outputTarget); 23 | cmd.DispatchRays(m_Shader, "CreateSphereRayGenShader", (uint) outputTarget.rt.width, (uint) outputTarget.rt.height, 1, camera); 24 | } 25 | 26 | context.ExecuteCommandBuffer(cmd); 27 | 28 | using (new ProfilingScope(cmd, new ProfilingSampler("FinalBlit"))) 29 | { 30 | cmd.Blit(outputTarget, BuiltinRenderTextureType.CameraTarget, Vector2.one, Vector2.zero); 31 | } 32 | 33 | context.ExecuteCommandBuffer(cmd); 34 | } 35 | finally 36 | { 37 | CommandBufferPool.Release(cmd); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.feature.development": "1.0.1", 4 | "com.unity.render-pipelines.core": "14.0.12", 5 | "com.unity.ugui": "1.0.0", 6 | "com.unity.modules.ai": "1.0.0", 7 | "com.unity.modules.androidjni": "1.0.0", 8 | "com.unity.modules.animation": "1.0.0", 9 | "com.unity.modules.assetbundle": "1.0.0", 10 | "com.unity.modules.audio": "1.0.0", 11 | "com.unity.modules.cloth": "1.0.0", 12 | "com.unity.modules.director": "1.0.0", 13 | "com.unity.modules.imageconversion": "1.0.0", 14 | "com.unity.modules.imgui": "1.0.0", 15 | "com.unity.modules.jsonserialize": "1.0.0", 16 | "com.unity.modules.particlesystem": "1.0.0", 17 | "com.unity.modules.physics": "1.0.0", 18 | "com.unity.modules.physics2d": "1.0.0", 19 | "com.unity.modules.screencapture": "1.0.0", 20 | "com.unity.modules.terrain": "1.0.0", 21 | "com.unity.modules.terrainphysics": "1.0.0", 22 | "com.unity.modules.tilemap": "1.0.0", 23 | "com.unity.modules.ui": "1.0.0", 24 | "com.unity.modules.uielements": "1.0.0", 25 | "com.unity.modules.umbra": "1.0.0", 26 | "com.unity.modules.unityanalytics": "1.0.0", 27 | "com.unity.modules.unitywebrequest": "1.0.0", 28 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 29 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 30 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 31 | "com.unity.modules.unitywebrequestwww": "1.0.0", 32 | "com.unity.modules.vehicles": "1.0.0", 33 | "com.unity.modules.video": "1.0.0", 34 | "com.unity.modules.vr": "1.0.0", 35 | "com.unity.modules.wind": "1.0.0", 36 | "com.unity.modules.xr": "1.0.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /Assets/Scripts/FocusCamera.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | [RequireComponent(typeof(Camera))] 5 | [ExecuteAlways] 6 | public class FocusCamera : MonoBehaviour 7 | { 8 | public float FocusDistance = 10.0f; 9 | public float Aperture = 1.0f; 10 | 11 | [NonSerialized] public Vector3 LeftBottomCorner; 12 | [NonSerialized] public Vector3 RightTopCorner; 13 | [NonSerialized] public Vector2 Size; 14 | 15 | private Camera m_Camera; 16 | 17 | public void Update() 18 | { 19 | m_Camera ??= GetComponent(); 20 | 21 | var theta = m_Camera.fieldOfView * Mathf.Deg2Rad; 22 | var halfHeight = Mathf.Tan(theta * 0.5f); 23 | var halfWidth = m_Camera.aspect * halfHeight; 24 | LeftBottomCorner = transform.position + transform.forward * FocusDistance - 25 | transform.right * FocusDistance * halfWidth - 26 | transform.up * FocusDistance * halfHeight; 27 | Size = new Vector2(FocusDistance * halfWidth * 2.0f, FocusDistance * halfHeight * 2.0f); 28 | RightTopCorner = LeftBottomCorner + transform.right * Size.x + transform.up * Size.y; 29 | } 30 | 31 | public void OnDrawGizmosSelected() 32 | { 33 | Gizmos.color = Color.red; 34 | var pt1 = LeftBottomCorner; 35 | var pt2 = pt1 + transform.right * Size.x; 36 | var pt3 = RightTopCorner; 37 | var pt4 = pt1 + transform.up * Size.y; 38 | Gizmos.DrawLine(pt1, pt2); 39 | Gizmos.DrawLine(pt2, pt3); 40 | Gizmos.DrawLine(pt3, pt4); 41 | Gizmos.DrawLine(pt4, pt1); 42 | Gizmos.DrawLine(pt1, pt3); 43 | Gizmos.DrawLine(pt2, pt4); 44 | Gizmos.DrawWireSphere(transform.position, Aperture * 0.5f); 45 | Gizmos.color = Color.white; 46 | } 47 | } -------------------------------------------------------------------------------- /Assets/Shaders/Unlit.shader: -------------------------------------------------------------------------------- 1 | Shader "Tutorial/Unlit" 2 | { 3 | Properties 4 | { 5 | _Color ("Main Color", Color) = (1, 1, 1, 1) 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType" = "Opaque" } 10 | LOD 100 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | // make fog work 18 | #pragma multi_compile_fog 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct appdata 23 | { 24 | float4 vertex : POSITION; 25 | }; 26 | 27 | struct v2f 28 | { 29 | UNITY_FOG_COORDS(0) 30 | float4 vertex : SV_POSITION; 31 | }; 32 | 33 | CBUFFER_START(UnityPerMaterial) 34 | half4 _Color; 35 | CBUFFER_END 36 | 37 | v2f vert (appdata v) 38 | { 39 | v2f o; 40 | o.vertex = UnityObjectToClipPos(v.vertex); 41 | UNITY_TRANSFER_FOG(o,o.vertex); 42 | return o; 43 | } 44 | 45 | half4 frag (v2f i) : SV_Target 46 | { 47 | half4 col = _Color; 48 | // apply fog 49 | UNITY_APPLY_FOG(i.fogCoord, col); 50 | return col; 51 | } 52 | ENDCG 53 | } 54 | } 55 | 56 | SubShader 57 | { 58 | Pass 59 | { 60 | Name "RayTracing" 61 | Tags { "LightMode" = "RayTracing" } 62 | 63 | HLSLPROGRAM 64 | 65 | #pragma raytracing test 66 | 67 | #include "./Common.hlsl" 68 | 69 | CBUFFER_START(UnityPerMaterial) 70 | float4 _Color; 71 | CBUFFER_END 72 | 73 | [shader("closesthit")] 74 | void ClosestHitShader(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) 75 | { 76 | rayIntersection.color = _Color; 77 | } 78 | 79 | ENDHLSL 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /Assets/Materials/Red.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Red 11 | m_Shader: {fileID: 4800000, guid: d6b8deee82a5ebb418040d5c5cc17a8a, type: 3} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 0, b: 0, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Shaders/PRNG.hlsl: -------------------------------------------------------------------------------- 1 | #define M_PI (3.14159265358979323846264338327950288) 2 | 3 | RWStructuredBuffer _PRNGStates; 4 | 5 | inline float cbrt(float d) 6 | { 7 | return pow(d, 1.0f / 3.0f); 8 | } 9 | 10 | uint TausStep(inout uint z, int S1, int S2, int S3, uint M) 11 | { 12 | uint b = (((z << S1) ^ z) >> S2); 13 | return z = (((z & M) << S3) ^ b); 14 | } 15 | 16 | uint LCGStep(inout uint z) 17 | { 18 | return z = (1664525 * z + 1013904223); 19 | } 20 | 21 | float GetRandomValueTauswortheUniform(inout uint4 states) 22 | { 23 | uint taus = TausStep(states.x, 13, 19, 12, 4294967294UL) ^ TausStep(states.y, 2, 25, 4, 4294967288UL) ^ TausStep(states.z, 3, 11, 17, 4294967280UL); 24 | uint lcg = LCGStep(states.w); 25 | 26 | return 2.3283064365387e-10f * (taus ^ lcg); // taus+ 27 | } 28 | 29 | float GetRandomValue(inout uint4 states) 30 | { 31 | float rand = GetRandomValueTauswortheUniform(states); 32 | return rand; 33 | } 34 | 35 | float3 GetRandomInUnitSphere(inout uint4 states) 36 | { 37 | float u = GetRandomValue(states); 38 | float v = GetRandomValue(states); 39 | float theta = u * 2.f * (float)M_PI; 40 | float phi = acos(2.f * v - 1.f); 41 | float r = cbrt(GetRandomValue(states)); 42 | float sinTheta = sin(theta); 43 | float cosTheta = cos(theta); 44 | float sinPhi = sin(phi); 45 | float cosPhi = cos(phi); 46 | float x = r * sinPhi * cosTheta; 47 | float y = r * sinPhi * sinTheta; 48 | float z = r * cosPhi; 49 | return float3(x, y, z); 50 | } 51 | 52 | float3 GetRandomOnUnitSphere(inout uint4 states) 53 | { 54 | float r1 = GetRandomValue(states); 55 | float r2 = GetRandomValue(states); 56 | float x = cos(2.0f * (float)M_PI * r1) * 2.0f * sqrt(r2 * (1.0f - r2)); 57 | float y = sin(2.0f * (float)M_PI * r1) * 2.0f * sqrt(r2 * (1.0f - r2)); 58 | float z = 1.0f - 2.0f * r2; 59 | return float3(x, y, z); 60 | } 61 | 62 | float2 GetRandomInUnitDisk(inout uint4 states) 63 | { 64 | float a = GetRandomValue(states) * 2.0f * (float)M_PI; 65 | float r = sqrt(GetRandomValue(states)); 66 | 67 | return float2(r * cos(a), r * sin(a)); 68 | } 69 | 70 | float3 GetRandomCosineDirection(inout uint4 states) 71 | { 72 | float r1 = GetRandomValue(states); 73 | float r2 = GetRandomValue(states); 74 | float z = sqrt(1.0f - r2); 75 | float phi = 2.0f * M_PI * r1; 76 | float x = cos(phi) * sqrt(r2); 77 | float y = sin(phi) * sqrt(r2); 78 | return float3(x, y, z); 79 | } 80 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | 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 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/AntialiasingTutorial.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | public class AntialiasingTutorial : RayTracingTutorial 5 | { 6 | private static readonly int s_FrameIndex = Shader.PropertyToID("_FrameIndex"); 7 | private static readonly int s_PRNGStates = Shader.PropertyToID("_PRNGStates"); 8 | 9 | private int m_FrameIndex; 10 | 11 | public AntialiasingTutorial(RayTracingTutorialAsset asset) : base(asset) { } 12 | 13 | public override void Render(ScriptableRenderContext context, Camera camera) 14 | { 15 | base.Render(context, camera); 16 | var outputTarget = RequireOutputTarget(camera); 17 | var outputTargetSize = RequireOutputTargetSize(camera); 18 | 19 | var accelerationStructure = m_Pipeline.RequestAccelerationStructure(); 20 | var PRNGStates = m_Pipeline.RequirePRNGStates(camera); 21 | 22 | var cmd = CommandBufferPool.Get(nameof(AntialiasingTutorial)); 23 | try 24 | { 25 | if (m_FrameIndex < 1000) 26 | { 27 | using (new ProfilingScope(cmd, new ProfilingSampler("RayTracing"))) 28 | { 29 | cmd.SetRayTracingShaderPass(m_Shader, "RayTracing"); 30 | cmd.SetRayTracingAccelerationStructure(m_Shader, RayTracingRenderPipeline.s_AccelerationStructure, accelerationStructure); 31 | cmd.SetRayTracingIntParam(m_Shader, s_FrameIndex, m_FrameIndex); 32 | cmd.SetRayTracingBufferParam(m_Shader, s_PRNGStates, PRNGStates); 33 | cmd.SetRayTracingTextureParam(m_Shader, s_OutputTarget, outputTarget); 34 | cmd.SetRayTracingVectorParam(m_Shader, s_OutputTargetSize, outputTargetSize); 35 | cmd.DispatchRays(m_Shader, "AntialiasingRayGenShader", (uint) outputTarget.rt.width, (uint) outputTarget.rt.height, 1, camera); 36 | } 37 | 38 | context.ExecuteCommandBuffer(cmd); 39 | if (camera.cameraType == CameraType.Game) 40 | m_FrameIndex++; 41 | } 42 | 43 | using (new ProfilingScope(cmd, new ProfilingSampler("FinalBlit"))) 44 | { 45 | cmd.Blit(outputTarget, BuiltinRenderTextureType.CameraTarget, Vector2.one, Vector2.zero); 46 | } 47 | 48 | context.ExecuteCommandBuffer(cmd); 49 | } 50 | finally 51 | { 52 | CommandBufferPool.Release(cmd); 53 | } 54 | } 55 | } -------------------------------------------------------------------------------- /Assets/Materials/Diffuse.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Diffuse 11 | m_Shader: {fileID: 4800000, guid: 0820419a37b6409a8dc4c49cf5bebf17, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 0.5, g: 0.5, b: 0.5, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/Diffuse_2.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Diffuse_2 11 | m_Shader: {fileID: 4800000, guid: 0820419a37b6409a8dc4c49cf5bebf17, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 0.8, g: 0.8, b: 0, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/Diffuse_1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Diffuse_1 11 | m_Shader: {fileID: 4800000, guid: 0820419a37b6409a8dc4c49cf5bebf17, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 0.1, g: 0.2, b: 0.5, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/NormalAsColor.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: NormalAsColor 11 | m_Shader: {fileID: 4800000, guid: 38fb1e4053ce44bfa144270b8a39d9cf, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/RandomLambertian.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: RandomLambertian 11 | m_Shader: {fileID: 4800000, guid: 0820419a37b6409a8dc4c49cf5bebf17, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _GlossMapScale: 1 69 | - _Glossiness: 0.5 70 | - _GlossyReflections: 1 71 | - _Metallic: 0 72 | - _Mode: 0 73 | - _OcclusionStrength: 1 74 | - _Parallax: 0.02 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 1 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | m_BuildTextureStacks: [] 84 | -------------------------------------------------------------------------------- /Assets/Materials/Metal_1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Metal_1 11 | m_Shader: {fileID: 4800000, guid: b6f12a2a27ee89d4cbcad79383888a72, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _Fuzz: 1 69 | - _GlossMapScale: 1 70 | - _Glossiness: 0.5 71 | - _GlossyReflections: 1 72 | - _Metallic: 0 73 | - _Mode: 0 74 | - _OcclusionStrength: 1 75 | - _Parallax: 0.02 76 | - _SmoothnessTextureChannel: 0 77 | - _SpecularHighlights: 1 78 | - _SrcBlend: 1 79 | - _UVSec: 0 80 | - _ZWrite: 1 81 | m_Colors: 82 | - _Color: {r: 0.8, g: 0.6, b: 0.2, a: 1} 83 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 84 | m_BuildTextureStacks: [] 85 | -------------------------------------------------------------------------------- /Assets/Materials/Metal_3.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Metal_3 11 | m_Shader: {fileID: 4800000, guid: b6f12a2a27ee89d4cbcad79383888a72, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _Fuzz: 0.1 69 | - _GlossMapScale: 1 70 | - _Glossiness: 0.5 71 | - _GlossyReflections: 1 72 | - _Metallic: 0 73 | - _Mode: 0 74 | - _OcclusionStrength: 1 75 | - _Parallax: 0.02 76 | - _SmoothnessTextureChannel: 0 77 | - _SpecularHighlights: 1 78 | - _SrcBlend: 1 79 | - _UVSec: 0 80 | - _ZWrite: 1 81 | m_Colors: 82 | - _Color: {r: 0.8, g: 0.6, b: 0.2, a: 1} 83 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 84 | m_BuildTextureStacks: [] 85 | -------------------------------------------------------------------------------- /Assets/Materials/RandomMetal.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: RandomMetal 11 | m_Shader: {fileID: 4800000, guid: b6f12a2a27ee89d4cbcad79383888a72, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _Fuzz: 0 69 | - _GlossMapScale: 1 70 | - _Glossiness: 0.5 71 | - _GlossyReflections: 1 72 | - _Metallic: 0 73 | - _Mode: 0 74 | - _OcclusionStrength: 1 75 | - _Parallax: 0.02 76 | - _SmoothnessTextureChannel: 0 77 | - _SpecularHighlights: 1 78 | - _SrcBlend: 1 79 | - _UVSec: 0 80 | - _ZWrite: 1 81 | m_Colors: 82 | - _Color: {r: 1, g: 1, b: 1, a: 1} 83 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 84 | m_BuildTextureStacks: [] 85 | -------------------------------------------------------------------------------- /Assets/Materials/Dielectric_1.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Dielectric_1 11 | m_Shader: {fileID: 4800000, guid: f7e5bb62a1c13e841b5ce0f720ac9126, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _Fuzz: 0.3 69 | - _GlossMapScale: 1 70 | - _Glossiness: 0.5 71 | - _GlossyReflections: 1 72 | - _IOR: 1.5 73 | - _Metallic: 0 74 | - _Mode: 0 75 | - _OcclusionStrength: 1 76 | - _Parallax: 0.02 77 | - _SmoothnessTextureChannel: 0 78 | - _SpecularHighlights: 1 79 | - _SrcBlend: 1 80 | - _UVSec: 0 81 | - _ZWrite: 1 82 | m_Colors: 83 | - _Color: {r: 1, g: 1, b: 1, a: 1} 84 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 85 | m_BuildTextureStacks: [] 86 | -------------------------------------------------------------------------------- /Assets/Materials/Dielectric_2.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: Dielectric_2 11 | m_Shader: {fileID: 4800000, guid: ca38bbf6cd15a90419102e5d4a0f3de4, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _Fuzz: 0.3 69 | - _GlossMapScale: 1 70 | - _Glossiness: 0.5 71 | - _GlossyReflections: 1 72 | - _IOR: 1.5 73 | - _Metallic: 0 74 | - _Mode: 0 75 | - _OcclusionStrength: 1 76 | - _Parallax: 0.02 77 | - _SmoothnessTextureChannel: 0 78 | - _SpecularHighlights: 1 79 | - _SrcBlend: 1 80 | - _UVSec: 0 81 | - _ZWrite: 1 82 | m_Colors: 83 | - _Color: {r: 1, g: 1, b: 1, a: 1} 84 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 85 | m_BuildTextureStacks: [] 86 | -------------------------------------------------------------------------------- /Assets/Materials/RandomDielectric.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 8 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: RandomDielectric 11 | m_Shader: {fileID: 4800000, guid: f7e5bb62a1c13e841b5ce0f720ac9126, type: 3} 12 | m_Parent: {fileID: 0} 13 | m_ModifiedSerializedProperties: 0 14 | m_ValidKeywords: [] 15 | m_InvalidKeywords: [] 16 | m_LightmapFlags: 4 17 | m_EnableInstancingVariants: 0 18 | m_DoubleSidedGI: 0 19 | m_CustomRenderQueue: -1 20 | stringTagMap: {} 21 | disabledShaderPasses: [] 22 | m_LockedProperties: 23 | m_SavedProperties: 24 | serializedVersion: 3 25 | m_TexEnvs: 26 | - _BumpMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Ints: [] 63 | m_Floats: 64 | - _BumpScale: 1 65 | - _Cutoff: 0.5 66 | - _DetailNormalMapScale: 1 67 | - _DstBlend: 0 68 | - _Fuzz: 0 69 | - _GlossMapScale: 1 70 | - _Glossiness: 0.5 71 | - _GlossyReflections: 1 72 | - _IOR: 1.5 73 | - _Metallic: 0 74 | - _Mode: 0 75 | - _OcclusionStrength: 1 76 | - _Parallax: 0.02 77 | - _SmoothnessTextureChannel: 0 78 | - _SpecularHighlights: 1 79 | - _SrcBlend: 1 80 | - _UVSec: 0 81 | - _ZWrite: 1 82 | m_Colors: 83 | - _Color: {r: 1, g: 1, b: 1, a: 1} 84 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 85 | m_BuildTextureStacks: [] 86 | -------------------------------------------------------------------------------- /Assets/Shaders/Common.hlsl: -------------------------------------------------------------------------------- 1 | #include "UnityRaytracingMeshUtils.cginc" 2 | 3 | #define CBUFFER_START(name) cbuffer name { 4 | #define CBUFFER_END }; 5 | 6 | // Macro that interpolate any attribute using barycentric coordinates 7 | #define INTERPOLATE_RAYTRACING_ATTRIBUTE(A0, A1, A2, BARYCENTRIC_COORDINATES) (A0 * BARYCENTRIC_COORDINATES.x + A1 * BARYCENTRIC_COORDINATES.y + A2 * BARYCENTRIC_COORDINATES.z) 8 | 9 | CBUFFER_START(CameraBuffer) 10 | float4x4 _InvCameraViewProj; 11 | float3 _WorldSpaceCameraPos; 12 | float _CameraFarDistance; 13 | float3 _FocusCameraLeftBottomCorner; 14 | float3 _FocusCameraRight; 15 | float3 _FocusCameraUp; 16 | float2 _FocusCameraSize; 17 | float _FocusCameraHalfAperture; 18 | CBUFFER_END 19 | 20 | RaytracingAccelerationStructure _AccelerationStructure; 21 | 22 | struct RayIntersection 23 | { 24 | int remainingDepth; 25 | uint4 PRNGStates; 26 | float4 color; 27 | }; 28 | 29 | struct AttributeData 30 | { 31 | float2 barycentrics; 32 | }; 33 | 34 | inline void GenerateCameraRay(out float3 origin, out float3 direction) 35 | { 36 | float2 xy = DispatchRaysIndex().xy + 0.5f; // center in the middle of the pixel. 37 | float2 screenPos = xy / DispatchRaysDimensions().xy * 2.0f - 1.0f; 38 | 39 | // Un project the pixel coordinate into a ray. 40 | float4 world = mul(_InvCameraViewProj, float4(screenPos, 0, 1)); 41 | 42 | world.xyz /= world.w; 43 | origin = _WorldSpaceCameraPos.xyz; 44 | direction = normalize(world.xyz - origin); 45 | } 46 | 47 | inline void GenerateCameraRayWithOffset(out float3 origin, out float3 direction, float2 offset) 48 | { 49 | float2 xy = DispatchRaysIndex().xy + offset; 50 | float2 screenPos = xy / DispatchRaysDimensions().xy * 2.0f - 1.0f; 51 | 52 | // Un project the pixel coordinate into a ray. 53 | float4 world = mul(_InvCameraViewProj, float4(screenPos, 0, 1)); 54 | 55 | world.xyz /= world.w; 56 | origin = _WorldSpaceCameraPos.xyz; 57 | direction = normalize(world.xyz - origin); 58 | } 59 | 60 | inline void GenerateFocusCameraRayWithOffset(out float3 origin, out float3 direction, float2 apertureOffset, float2 offset) 61 | { 62 | float2 xy = DispatchRaysIndex().xy + offset; 63 | float2 uv = xy / DispatchRaysDimensions().xy; 64 | 65 | float3 world = _FocusCameraLeftBottomCorner + uv.x * _FocusCameraSize.x * _FocusCameraRight + uv.y * _FocusCameraSize.y * _FocusCameraUp; 66 | origin = _WorldSpaceCameraPos.xyz + _FocusCameraHalfAperture * apertureOffset.x * _FocusCameraRight + _FocusCameraHalfAperture * apertureOffset.y * _FocusCameraUp; 67 | direction = normalize(world.xyz - origin); 68 | } 69 | -------------------------------------------------------------------------------- /Assets/Prefabs/Sphere.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &7864595096613505361 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 3120036837204835699} 12 | - component: {fileID: 7185198602718245408} 13 | - component: {fileID: 7000174064849850253} 14 | m_Layer: 0 15 | m_Name: Sphere 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &3120036837204835699 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 7864595096613505361} 28 | serializedVersion: 2 29 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 30 | m_LocalPosition: {x: 0, y: 0, z: 0} 31 | m_LocalScale: {x: 1, y: 1, z: 1} 32 | m_ConstrainProportionsScale: 0 33 | m_Children: [] 34 | m_Father: {fileID: 0} 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | --- !u!33 &7185198602718245408 37 | MeshFilter: 38 | m_ObjectHideFlags: 0 39 | m_CorrespondingSourceObject: {fileID: 0} 40 | m_PrefabInstance: {fileID: 0} 41 | m_PrefabAsset: {fileID: 0} 42 | m_GameObject: {fileID: 7864595096613505361} 43 | m_Mesh: {fileID: 973877516759717424, guid: 242c1eb42b27bac4bb383b910efba150, type: 3} 44 | --- !u!23 &7000174064849850253 45 | MeshRenderer: 46 | m_ObjectHideFlags: 0 47 | m_CorrespondingSourceObject: {fileID: 0} 48 | m_PrefabInstance: {fileID: 0} 49 | m_PrefabAsset: {fileID: 0} 50 | m_GameObject: {fileID: 7864595096613505361} 51 | m_Enabled: 1 52 | m_CastShadows: 1 53 | m_ReceiveShadows: 1 54 | m_DynamicOccludee: 1 55 | m_StaticShadowCaster: 0 56 | m_MotionVectors: 1 57 | m_LightProbeUsage: 1 58 | m_ReflectionProbeUsage: 1 59 | m_RayTracingMode: 2 60 | m_RayTraceProcedural: 0 61 | m_RenderingLayerMask: 1 62 | m_RendererPriority: 0 63 | m_Materials: 64 | - {fileID: 0} 65 | m_StaticBatchInfo: 66 | firstSubMesh: 0 67 | subMeshCount: 0 68 | m_StaticBatchRoot: {fileID: 0} 69 | m_ProbeAnchor: {fileID: 0} 70 | m_LightProbeVolumeOverride: {fileID: 0} 71 | m_ScaleInLightmap: 1 72 | m_ReceiveGI: 1 73 | m_PreserveUVs: 0 74 | m_IgnoreNormalsForChartDetection: 0 75 | m_ImportantGI: 0 76 | m_StitchLightmapSeams: 1 77 | m_SelectedEditorRenderState: 3 78 | m_MinimumChartSize: 4 79 | m_AutoUVMaxDistance: 0.5 80 | m_AutoUVMaxAngle: 89 81 | m_LightmapParameters: {fileID: 0} 82 | m_SortingLayerID: 0 83 | m_SortingLayer: 0 84 | m_SortingOrder: 0 85 | m_AdditionalVertexStreams: {fileID: 0} 86 | -------------------------------------------------------------------------------- /Assets/Shaders/AntialiasingTutorial.raytrace: -------------------------------------------------------------------------------- 1 | #pragma max_recursion_depth 11 2 | 3 | #include "./Common.hlsl" 4 | #include "./PRNG.hlsl" 5 | 6 | #define MAX_DEPTH (10) 7 | #define NUM_OF_SAMPLES (1) 8 | 9 | RWTexture2D _OutputTarget; 10 | float4 _OutputTargetSize; 11 | int _FrameIndex; 12 | 13 | inline float3 BackgroundColor(float3 origin, float3 direction) 14 | { 15 | float t = 0.5f * (direction.y + 1.0f); 16 | return (1.0f - t) * float3(0.7f, 0.9f, 1.0f) + t * float3(0.5f, 0.7f, 1.0f); 17 | } 18 | 19 | [shader("raygeneration")] 20 | void AntialiasingRayGenShader() 21 | { 22 | const uint2 dispatchIdx = DispatchRaysIndex().xy; 23 | const uint PRNGIndex = dispatchIdx.y * (int)_OutputTargetSize.x + dispatchIdx.x; 24 | uint4 PRNGStates = _PRNGStates[PRNGIndex]; 25 | 26 | float4 finalColor = float4(0, 0, 0, 0); 27 | //for (int i = 0; i < NUM_OF_SAMPLES; ++i) 28 | { 29 | float3 origin; 30 | float3 direction; 31 | float2 offset = float2(GetRandomValue(PRNGStates), GetRandomValue(PRNGStates)); 32 | GenerateCameraRayWithOffset(origin, direction, offset); 33 | 34 | RayDesc rayDescriptor; 35 | rayDescriptor.Origin = origin; 36 | rayDescriptor.Direction = direction; 37 | rayDescriptor.TMin = 1e-5f; 38 | rayDescriptor.TMax = _CameraFarDistance; 39 | 40 | RayIntersection rayIntersection; 41 | rayIntersection.remainingDepth = MAX_DEPTH - 1; 42 | rayIntersection.PRNGStates = PRNGStates; 43 | rayIntersection.color = float4(0.0f, 0.0f, 0.0f, 0.0f); 44 | 45 | TraceRay(_AccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xFF, 0, 1, 0, rayDescriptor, rayIntersection); 46 | PRNGStates = rayIntersection.PRNGStates; 47 | finalColor += rayIntersection.color; 48 | //finalColor = float4( 49 | // clamp(0.0f, 1.0f, rayIntersection.color.r), 50 | // clamp(0.0f, 1.0f, rayIntersection.color.g), 51 | // clamp(0.0f, 1.0f, rayIntersection.color.b), 52 | // clamp(0.0f, 1.0f, rayIntersection.color.a)); 53 | } 54 | //finalColor /= (float)NUM_OF_SAMPLES; 55 | finalColor = float4(sqrt(finalColor.r), sqrt(finalColor.g), sqrt(finalColor.b), finalColor.a); 56 | 57 | _PRNGStates[PRNGIndex] = PRNGStates; 58 | if (_FrameIndex > 1) 59 | { 60 | float a = 1.0f / (float)_FrameIndex; 61 | finalColor = _OutputTarget[dispatchIdx] * (1.0f - a) + finalColor * a; 62 | } 63 | 64 | _OutputTarget[dispatchIdx] = finalColor; 65 | } 66 | 67 | [shader("miss")] 68 | void MissShader(inout RayIntersection rayIntersection : SV_RayPayload) 69 | { 70 | float3 origin = WorldRayOrigin(); 71 | float3 direction = WorldRayDirection(); 72 | rayIntersection.color = float4(BackgroundColor(origin, direction), 1.0f); 73 | } 74 | -------------------------------------------------------------------------------- /Assets/Shaders/CameraTutorial.raytrace: -------------------------------------------------------------------------------- 1 | #pragma max_recursion_depth 11 2 | 3 | #include "./Common.hlsl" 4 | #include "./PRNG.hlsl" 5 | 6 | #define MAX_DEPTH (10) 7 | #define NUM_OF_SAMPLES (1) 8 | 9 | RWTexture2D _OutputTarget; 10 | float4 _OutputTargetSize; 11 | int _FrameIndex; 12 | 13 | inline float3 BackgroundColor(float3 origin, float3 direction) 14 | { 15 | float t = 0.5f * (direction.y + 1.0f); 16 | return (1.0f - t) * float3(0.7f, 0.9f, 1.0f) + t * float3(0.5f, 0.7f, 1.0f); 17 | } 18 | 19 | [shader("raygeneration")] 20 | void CameraRayGenShader() 21 | { 22 | const uint2 dispatchIdx = DispatchRaysIndex().xy; 23 | const uint PRNGIndex = dispatchIdx.y * (int)_OutputTargetSize.x + dispatchIdx.x; 24 | uint4 PRNGStates = _PRNGStates[PRNGIndex]; 25 | 26 | float4 finalColor = float4(0, 0, 0, 0); 27 | //for (int i = 0; i < NUM_OF_SAMPLES; ++i) 28 | { 29 | float3 origin; 30 | float3 direction; 31 | float2 apertureOffset = GetRandomInUnitDisk(PRNGStates); 32 | float2 offset = float2(GetRandomValue(PRNGStates), GetRandomValue(PRNGStates)); 33 | GenerateFocusCameraRayWithOffset(origin, direction, apertureOffset, offset); 34 | 35 | RayDesc rayDescriptor; 36 | rayDescriptor.Origin = origin; 37 | rayDescriptor.Direction = direction; 38 | rayDescriptor.TMin = 1e-5f; 39 | rayDescriptor.TMax = _CameraFarDistance; 40 | 41 | RayIntersection rayIntersection; 42 | rayIntersection.remainingDepth = MAX_DEPTH - 1; 43 | rayIntersection.PRNGStates = PRNGStates; 44 | rayIntersection.color = float4(0.0f, 0.0f, 0.0f, 0.0f); 45 | 46 | TraceRay(_AccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xFF, 0, 1, 0, rayDescriptor, rayIntersection); 47 | PRNGStates = rayIntersection.PRNGStates; 48 | finalColor += rayIntersection.color; 49 | //finalColor = float4( 50 | // clamp(0.0f, 1.0f, rayIntersection.color.r), 51 | // clamp(0.0f, 1.0f, rayIntersection.color.g), 52 | // clamp(0.0f, 1.0f, rayIntersection.color.b), 53 | // clamp(0.0f, 1.0f, rayIntersection.color.a)); 54 | } 55 | //finalColor /= (float)NUM_OF_SAMPLES; 56 | finalColor = float4(sqrt(finalColor.r), sqrt(finalColor.g), sqrt(finalColor.b), finalColor.a); 57 | 58 | _PRNGStates[PRNGIndex] = PRNGStates; 59 | if (_FrameIndex > 1) 60 | { 61 | float a = 1.0f / (float)_FrameIndex; 62 | finalColor = _OutputTarget[dispatchIdx] * (1.0f - a) + finalColor * a; 63 | } 64 | 65 | _OutputTarget[dispatchIdx] = finalColor; 66 | } 67 | 68 | [shader("miss")] 69 | void MissShader(inout RayIntersection rayIntersection : SV_RayPayload) 70 | { 71 | float3 origin = WorldRayOrigin(); 72 | float3 direction = WorldRayDirection(); 73 | rayIntersection.color = float4(BackgroundColor(origin, direction), 1.0f); 74 | } 75 | -------------------------------------------------------------------------------- /Assets/Models/Sphere.FBX.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 242c1eb42b27bac4bb383b910efba150 3 | ModelImporter: 4 | serializedVersion: 21202 5 | internalIDToNameTable: [] 6 | externalObjects: {} 7 | materials: 8 | materialImportMode: 0 9 | materialName: 0 10 | materialSearch: 1 11 | materialLocation: 1 12 | animations: 13 | legacyGenerateAnimations: 4 14 | bakeSimulation: 0 15 | resampleCurves: 1 16 | optimizeGameObjects: 0 17 | removeConstantScaleCurves: 0 18 | motionNodeName: 19 | rigImportErrors: 20 | rigImportWarnings: 21 | animationImportErrors: 22 | animationImportWarnings: 23 | animationRetargetingWarnings: 24 | animationDoRetargetingWarnings: 0 25 | importAnimatedCustomProperties: 0 26 | importConstraints: 0 27 | animationCompression: 1 28 | animationRotationError: 0.5 29 | animationPositionError: 0.5 30 | animationScaleError: 0.5 31 | animationWrapMode: 0 32 | extraExposedTransformPaths: [] 33 | extraUserProperties: [] 34 | clipAnimations: [] 35 | isReadable: 0 36 | meshes: 37 | lODScreenPercentages: [] 38 | globalScale: 0.005 39 | meshCompression: 0 40 | addColliders: 0 41 | useSRGBMaterialColor: 1 42 | sortHierarchyByName: 1 43 | importVisibility: 1 44 | importBlendShapes: 1 45 | importCameras: 1 46 | importLights: 1 47 | nodeNameCollisionStrategy: 0 48 | fileIdsGeneration: 1 49 | swapUVChannels: 0 50 | generateSecondaryUV: 0 51 | useFileUnits: 1 52 | keepQuads: 0 53 | weldVertices: 1 54 | bakeAxisConversion: 0 55 | preserveHierarchy: 0 56 | skinWeightsMode: 0 57 | maxBonesPerVertex: 4 58 | minBoneWeight: 0.001 59 | optimizeBones: 1 60 | meshOptimizationFlags: -1 61 | indexFormat: 0 62 | secondaryUVAngleDistortion: 8 63 | secondaryUVAreaDistortion: 15.000001 64 | secondaryUVHardAngle: 88 65 | secondaryUVMarginMethod: 0 66 | secondaryUVMinLightmapResolution: 40 67 | secondaryUVMinObjectScale: 1 68 | secondaryUVPackMargin: 4 69 | useFileScale: 0 70 | tangentSpace: 71 | normalSmoothAngle: 60 72 | normalImportMode: 0 73 | tangentImportMode: 3 74 | normalCalculationMode: 4 75 | legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0 76 | blendShapeNormalImportMode: 1 77 | normalSmoothingSource: 0 78 | referencedClips: [] 79 | importAnimation: 0 80 | humanDescription: 81 | serializedVersion: 3 82 | human: [] 83 | skeleton: [] 84 | armTwist: 0.5 85 | foreArmTwist: 0.5 86 | upperLegTwist: 0.5 87 | legTwist: 0.5 88 | armStretch: 0.05 89 | legStretch: 0.05 90 | feetSpacing: 0 91 | globalScale: 0.005 92 | rootMotionBoneName: 93 | hasTranslationDoF: 0 94 | hasExtraRoot: 0 95 | skeletonHasParents: 1 96 | lastHumanDescriptionAvatarSource: {instanceID: 0} 97 | autoGenerateAvatarMappingIfUnspecified: 1 98 | animationType: 0 99 | humanoidOversampling: 1 100 | avatarSetup: 0 101 | addHumanoidExtraRootOnlyWhenUsingAvatar: 0 102 | additionalBone: 0 103 | userData: 104 | assetBundleName: 105 | assetBundleVariant: 106 | -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/RayTracingTutorial.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using UnityEngine.Experimental.Rendering; 4 | using UnityEngine.Rendering; 5 | 6 | public abstract class RayTracingTutorial 7 | { 8 | protected static readonly int s_OutputTarget = Shader.PropertyToID("_OutputTarget"); 9 | protected static readonly int s_OutputTargetSize = Shader.PropertyToID("_OutputTargetSize"); 10 | private static readonly int s_WorldSpaceCameraPos = Shader.PropertyToID("_WorldSpaceCameraPos"); 11 | private static readonly int s_InvCameraViewProj = Shader.PropertyToID("_InvCameraViewProj"); 12 | private static readonly int s_CameraFarDistance = Shader.PropertyToID("_CameraFarDistance"); 13 | 14 | private readonly RayTracingTutorialAsset m_Asset; 15 | 16 | private readonly Dictionary m_OutputTargets = new(); 17 | private readonly Dictionary m_OutputTargetSizes = new(); 18 | 19 | protected RayTracingRenderPipeline m_Pipeline; 20 | protected RayTracingShader m_Shader; 21 | 22 | protected RayTracingTutorial(RayTracingTutorialAsset asset) => m_Asset = asset; 23 | 24 | public virtual bool Init(RayTracingRenderPipeline pipeline) 25 | { 26 | m_Pipeline = pipeline; 27 | m_Shader = m_Asset.Shader; 28 | return true; 29 | } 30 | 31 | public virtual void Render(ScriptableRenderContext context, Camera camera) 32 | { 33 | Shader.SetGlobalVector(s_WorldSpaceCameraPos, camera.transform.position); 34 | var projMatrix = GL.GetGPUProjectionMatrix(camera.projectionMatrix, false); 35 | var viewMatrix = camera.worldToCameraMatrix; 36 | var viewProjMatrix = projMatrix * viewMatrix; 37 | var invViewProjMatrix = Matrix4x4.Inverse(viewProjMatrix); 38 | Shader.SetGlobalMatrix(s_InvCameraViewProj, invViewProjMatrix); 39 | Shader.SetGlobalFloat(s_CameraFarDistance, camera.farClipPlane); 40 | } 41 | 42 | public virtual void Dispose(bool disposing) 43 | { 44 | foreach (var pair in m_OutputTargets) RTHandles.Release(pair.Value); 45 | m_OutputTargets.Clear(); 46 | } 47 | 48 | protected RTHandle RequireOutputTarget(Camera camera) 49 | { 50 | var id = camera.GetInstanceID(); 51 | 52 | if (m_OutputTargets.TryGetValue(id, out var outputTarget)) 53 | return outputTarget; 54 | 55 | outputTarget = RTHandles.Alloc(camera.pixelWidth, 56 | camera.pixelHeight, 57 | colorFormat: GraphicsFormat.R32G32B32A32_SFloat, 58 | wrapMode: TextureWrapMode.Clamp, 59 | enableRandomWrite: true, 60 | autoGenerateMips: false, 61 | name: $"OutputTarget_{camera.name}"); 62 | 63 | m_OutputTargets.Add(id, outputTarget); 64 | 65 | return outputTarget; 66 | } 67 | 68 | protected Vector4 RequireOutputTargetSize(Camera camera) 69 | { 70 | var id = camera.GetInstanceID(); 71 | 72 | if (m_OutputTargetSizes.TryGetValue(id, out var outputTargetSize)) 73 | return outputTargetSize; 74 | 75 | outputTargetSize = new Vector4(camera.pixelWidth, camera.pixelHeight, 1.0f / camera.pixelWidth, 1.0f / camera.pixelHeight); 76 | m_OutputTargetSizes.Add(id, outputTargetSize); 77 | 78 | return outputTargetSize; 79 | } 80 | } -------------------------------------------------------------------------------- /Assets/Scripts/Tutorials/CameraTutorial.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | 4 | public class CameraTutorial : RayTracingTutorial 5 | { 6 | private static readonly int s_FrameIndex = Shader.PropertyToID("_FrameIndex"); 7 | private static readonly int s_PRNGStates = Shader.PropertyToID("_PRNGStates"); 8 | private static readonly int s_FocusCameraLeftBottomCorner = Shader.PropertyToID("_FocusCameraLeftBottomCorner"); 9 | private static readonly int s_FocusCameraRight = Shader.PropertyToID("_FocusCameraRight"); 10 | private static readonly int s_FocusCameraUp = Shader.PropertyToID("_FocusCameraUp"); 11 | private static readonly int s_FocusCameraSize = Shader.PropertyToID("_FocusCameraSize"); 12 | private static readonly int s_FocusCameraHalfAperture = Shader.PropertyToID("_FocusCameraHalfAperture"); 13 | 14 | private int m_FrameIndex; 15 | 16 | public CameraTutorial(RayTracingTutorialAsset asset) : base(asset) { } 17 | 18 | public override void Render(ScriptableRenderContext context, Camera camera) 19 | { 20 | base.Render(context, camera); 21 | var focusCamera = camera.GetComponent(); 22 | if (focusCamera is null) return; 23 | 24 | var outputTarget = RequireOutputTarget(camera); 25 | var outputTargetSize = RequireOutputTargetSize(camera); 26 | 27 | var accelerationStructure = m_Pipeline.RequestAccelerationStructure(); 28 | var PRNGStates = m_Pipeline.RequirePRNGStates(camera); 29 | 30 | var cmd = CommandBufferPool.Get(nameof(CameraTutorial)); 31 | try 32 | { 33 | if (m_FrameIndex < 1000) 34 | { 35 | using (new ProfilingScope(cmd, new ProfilingSampler("RayTracing"))) 36 | { 37 | cmd.SetRayTracingVectorParam(m_Shader, s_FocusCameraLeftBottomCorner, focusCamera.LeftBottomCorner); 38 | cmd.SetRayTracingVectorParam(m_Shader, s_FocusCameraRight, focusCamera.transform.right); 39 | cmd.SetRayTracingVectorParam(m_Shader, s_FocusCameraUp, focusCamera.transform.up); 40 | cmd.SetRayTracingVectorParam(m_Shader, s_FocusCameraSize, focusCamera.Size); 41 | cmd.SetRayTracingFloatParam(m_Shader, s_FocusCameraHalfAperture, focusCamera.Aperture * 0.5f); 42 | 43 | cmd.SetRayTracingShaderPass(m_Shader, "RayTracing"); 44 | cmd.SetRayTracingAccelerationStructure(m_Shader, RayTracingRenderPipeline.s_AccelerationStructure, accelerationStructure); 45 | cmd.SetRayTracingIntParam(m_Shader, s_FrameIndex, m_FrameIndex); 46 | cmd.SetRayTracingBufferParam(m_Shader, s_PRNGStates, PRNGStates); 47 | cmd.SetRayTracingTextureParam(m_Shader, s_OutputTarget, outputTarget); 48 | cmd.SetRayTracingVectorParam(m_Shader, s_OutputTargetSize, outputTargetSize); 49 | cmd.DispatchRays(m_Shader, "CameraRayGenShader", (uint) outputTarget.rt.width, (uint) outputTarget.rt.height, 1, camera); 50 | } 51 | 52 | context.ExecuteCommandBuffer(cmd); 53 | 54 | if (camera.cameraType == CameraType.Game) m_FrameIndex++; 55 | } 56 | 57 | using (new ProfilingScope(cmd, new ProfilingSampler("FinalBlit"))) 58 | { 59 | cmd.Blit(outputTarget, BuiltinRenderTextureType.CameraTarget, Vector2.one, Vector2.zero); 60 | } 61 | 62 | context.ExecuteCommandBuffer(cmd); 63 | } 64 | finally 65 | { 66 | CommandBufferPool.Release(cmd); 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /Assets/Shaders/NormalAsColor.shader: -------------------------------------------------------------------------------- 1 | Shader "Tutorial/NormalAsColor" 2 | { 3 | Properties 4 | { 5 | } 6 | SubShader 7 | { 8 | Tags { "RenderType" = "Opaque" } 9 | LOD 100 10 | 11 | Pass 12 | { 13 | CGPROGRAM 14 | #pragma vertex vert 15 | #pragma fragment frag 16 | // make fog work 17 | #pragma multi_compile_fog 18 | 19 | #include "UnityCG.cginc" 20 | 21 | struct appdata 22 | { 23 | float4 vertex : POSITION; 24 | float3 normal : NORMAL; 25 | }; 26 | 27 | struct v2f 28 | { 29 | float3 normal : TEXCOORD0; 30 | UNITY_FOG_COORDS(1) 31 | float4 vertex : SV_POSITION; 32 | }; 33 | 34 | v2f vert (appdata v) 35 | { 36 | v2f o; 37 | o.vertex = UnityObjectToClipPos(v.vertex); 38 | o.normal = UnityObjectToWorldNormal(v.normal); 39 | UNITY_TRANSFER_FOG(o, o.vertex); 40 | return o; 41 | } 42 | 43 | half4 frag (v2f i) : SV_Target 44 | { 45 | half4 col = half4(0.5f * (i.normal + 1.0f), 1.0f); 46 | // apply fog 47 | UNITY_APPLY_FOG(i.fogCoord, col); 48 | return col; 49 | } 50 | ENDCG 51 | } 52 | } 53 | 54 | SubShader 55 | { 56 | Pass 57 | { 58 | Name "RayTracing" 59 | Tags { "LightMode" = "RayTracing" } 60 | 61 | HLSLPROGRAM 62 | 63 | #pragma raytracing test 64 | 65 | #include "./Common.hlsl" 66 | 67 | struct IntersectionVertex 68 | { 69 | // Object space normal of the vertex 70 | float3 normalOS; 71 | }; 72 | 73 | void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex) 74 | { 75 | outVertex.normalOS = UnityRayTracingFetchVertexAttribute3(vertexIndex, kVertexAttributeNormal); 76 | } 77 | 78 | [shader("closesthit")] 79 | void ClosestHitShader(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) 80 | { 81 | // Fetch the indices of the currentr triangle 82 | uint3 triangleIndices = UnityRayTracingFetchTriangleIndices(PrimitiveIndex()); 83 | 84 | // Fetch the 3 vertices 85 | IntersectionVertex v0, v1, v2; 86 | FetchIntersectionVertex(triangleIndices.x, v0); 87 | FetchIntersectionVertex(triangleIndices.y, v1); 88 | FetchIntersectionVertex(triangleIndices.z, v2); 89 | 90 | // Compute the full barycentric coordinates 91 | float3 barycentricCoordinates = float3(1.0 - attributeData.barycentrics.x - attributeData.barycentrics.y, attributeData.barycentrics.x, attributeData.barycentrics.y); 92 | 93 | float3 normalOS = INTERPOLATE_RAYTRACING_ATTRIBUTE(v0.normalOS, v1.normalOS, v2.normalOS, barycentricCoordinates); 94 | float3x3 objectToWorld = (float3x3)ObjectToWorld3x4(); 95 | float3 normalWS = normalize(mul(objectToWorld, normalOS)); 96 | 97 | rayIntersection.color = float4(0.5f * (normalWS + 1.0f), 0); 98 | } 99 | 100 | ENDHLSL 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Assets/Scripts/RayTracingRenderPipeline.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEngine.Experimental.Rendering; 5 | using UnityEngine.Rendering; 6 | 7 | public class RayTracingRenderPipeline : RenderPipeline 8 | { 9 | public static readonly int s_AccelerationStructure = Shader.PropertyToID("_AccelerationStructure"); 10 | 11 | private readonly RayTracingRenderPipelineAsset m_PipelineAsset; 12 | private readonly Dictionary m_PRNGStates = new(); 13 | private RayTracingAccelerationStructure m_AccelerationStructure; 14 | private RayTracingTutorial m_Tutorial; 15 | 16 | public RayTracingRenderPipeline(RayTracingRenderPipelineAsset asset) 17 | { 18 | m_PipelineAsset = asset; 19 | m_AccelerationStructure = new RayTracingAccelerationStructure(); 20 | 21 | m_Tutorial = m_PipelineAsset.TutorialAsset.CreateTutorial(); 22 | if (m_Tutorial is null) 23 | { 24 | Debug.LogError("Can't create tutorial."); 25 | return; 26 | } 27 | 28 | if (m_Tutorial.Init(this) == false) 29 | { 30 | m_Tutorial = null; 31 | Debug.LogError("Initialize tutorial failed."); 32 | } 33 | } 34 | 35 | public RayTracingAccelerationStructure RequestAccelerationStructure() 36 | { 37 | return m_AccelerationStructure; 38 | } 39 | 40 | public ComputeBuffer RequirePRNGStates(Camera camera) 41 | { 42 | var id = camera.GetInstanceID(); 43 | if (m_PRNGStates.TryGetValue(id, out var buffer)) 44 | return buffer; 45 | 46 | buffer = new ComputeBuffer(camera.pixelWidth * camera.pixelHeight, 4 * 4, ComputeBufferType.Structured, ComputeBufferMode.Immutable); 47 | 48 | var mt = new MersenneTwister(); 49 | mt.InitGenRand((uint) DateTime.Now.Ticks); 50 | 51 | var data = new uint[camera.pixelWidth * camera.pixelHeight * 4]; 52 | for (var i = 0; i < camera.pixelWidth * camera.pixelHeight * 4; ++i) 53 | data[i] = mt.GenRandInt32(); 54 | buffer.SetData(data); 55 | 56 | m_PRNGStates.Add(id, buffer); 57 | return buffer; 58 | } 59 | 60 | protected override void Render(ScriptableRenderContext context, Camera[] cameras) 61 | { 62 | if (!SystemInfo.supportsRayTracing) 63 | { 64 | Debug.LogError("You system is not support ray tracing. Please check your graphic API is D3D12."); 65 | return; 66 | } 67 | 68 | BeginFrameRendering(context, cameras); 69 | 70 | Array.Sort(cameras, (lhs, rhs) => (int) (lhs.depth - rhs.depth)); 71 | 72 | BuildAccelerationStructure(); 73 | 74 | foreach (var camera in cameras) 75 | { 76 | if (camera.cameraType != CameraType.Game && camera.cameraType != CameraType.SceneView) 77 | continue; 78 | 79 | BeginCameraRendering(context, camera); 80 | m_Tutorial?.Render(context, camera); 81 | context.Submit(); 82 | EndCameraRendering(context, camera); 83 | } 84 | 85 | EndFrameRendering(context, cameras); 86 | } 87 | 88 | protected override void Dispose(bool disposing) 89 | { 90 | m_Tutorial?.Dispose(disposing); 91 | m_Tutorial = null; 92 | 93 | foreach (var pair in m_PRNGStates) pair.Value.Release(); 94 | 95 | m_PRNGStates.Clear(); 96 | 97 | m_AccelerationStructure?.Dispose(); 98 | m_AccelerationStructure = null; 99 | } 100 | 101 | private void BuildAccelerationStructure() 102 | { 103 | if (SceneManager.Instance is null || !SceneManager.Instance.IsDirty) return; 104 | 105 | m_AccelerationStructure?.Dispose(); 106 | m_AccelerationStructure = new RayTracingAccelerationStructure(); 107 | 108 | SceneManager.Instance.FillAccelerationStructure(ref m_AccelerationStructure); 109 | 110 | m_AccelerationStructure.Build(); 111 | 112 | SceneManager.Instance.IsDirty = false; 113 | } 114 | } -------------------------------------------------------------------------------- /Assets/Scripts/Utilities/MersenneTwister.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | 4 | public class MersenneTwister 5 | { 6 | private const int k_N = 624; 7 | private const int k_M = 397; 8 | private const uint k_MatrixA = 0x9908b0dfU; 9 | private const uint k_UMask = 0x80000000U; 10 | private const uint k_LMask = 0x7fffffffU; 11 | 12 | private static readonly uint[] s_Mag01 = { 0x0U, k_MatrixA }; 13 | 14 | private readonly uint[] m_MT = new uint[k_N]; 15 | private int m_Initf; 16 | private int m_Left = 1; 17 | private uint m_Next; 18 | 19 | public void InitGenRand(uint seed) 20 | { 21 | m_MT[0] = seed; 22 | for (var i = 1u; i < k_N; i++) 23 | m_MT[i] = 1812433253U * (m_MT[i - 1] ^ (m_MT[i - 1] >> 30)) + i; 24 | 25 | m_Left = 1; 26 | m_Initf = 1; 27 | } 28 | 29 | public void InitByArray(uint[] initKey, int keyLength) 30 | { 31 | InitGenRand(19650218U); 32 | uint i = 1, j = 0; 33 | var k = Math.Max(k_N, keyLength); 34 | 35 | for (; k != 0; k--) 36 | { 37 | m_MT[i] = (m_MT[i] ^ ((m_MT[i - 1] ^ (m_MT[i - 1] >> 30)) * 1664525U)) + initKey[j] + j; 38 | i++; 39 | j++; 40 | if (i >= k_N) 41 | { 42 | m_MT[0] = m_MT[k_N - 1]; 43 | i = 1; 44 | } 45 | 46 | if (j >= keyLength) j = 0; 47 | } 48 | 49 | for (k = k_N - 1; k != 0; k--) 50 | { 51 | m_MT[i] = (m_MT[i] ^ ((m_MT[i - 1] ^ (m_MT[i - 1] >> 30)) * 1566083941U)) - i; 52 | i++; 53 | if (i >= k_N) 54 | { 55 | m_MT[0] = m_MT[k_N - 1]; 56 | i = 1; 57 | } 58 | } 59 | 60 | m_MT[0] = 0x80000000U; 61 | m_Left = 1; 62 | m_Initf = 1; 63 | } 64 | 65 | public uint GenRandInt32() 66 | { 67 | if (--m_Left == 0) NextState(); 68 | 69 | var y = m_MT[m_Next++]; 70 | y ^= y >> 11; 71 | y ^= (y << 7) & 0x9d2c5680U; 72 | y ^= (y << 15) & 0xefc60000U; 73 | y ^= y >> 18; 74 | 75 | return y; 76 | } 77 | 78 | // generates a random number on [0,0x7fffffff]-interval 79 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 80 | public int GenRandInt31() => (int)(GenRandInt32() >> 1); 81 | 82 | // generates a random number on [0,1]-real-interval 83 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 84 | public double GenRandReal1() => GenRandInt32() * (1.0 / 4294967295.0); 85 | 86 | // generates a random number on [0,1)-real-interval 87 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 88 | public double GenRandReal2() => GenRandInt32() * (1.0 / 4294967296.0); 89 | 90 | // generates a random number on (0,1)-real-interval 91 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 92 | public double GenRandReal3() => (GenRandInt32() + 0.5) * (1.0 / 4294967296.0); 93 | 94 | // generates a random number on [0,1) with 53-bit resolution 95 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 96 | public double GenRandRes53() 97 | { 98 | uint a = GenRandInt32() >> 5, b = GenRandInt32() >> 6; 99 | return (((ulong)a << 26) | b) * (1.0 / 9007199254740992.0); 100 | } 101 | 102 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 103 | private static uint MixBits(uint u, uint v) 104 | { 105 | return (u & k_UMask) | (v & k_LMask); 106 | } 107 | 108 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 109 | private static uint Twist(uint u, uint v) 110 | { 111 | return (MixBits(u, v) >> 1) ^ s_Mag01[v & 1U]; 112 | } 113 | 114 | private void NextState() 115 | { 116 | if (m_Initf == 0) InitGenRand(5489U); 117 | 118 | m_Left = k_N; 119 | m_Next = 0; 120 | 121 | uint p = 0; 122 | for (var j = k_N - k_M + 1; --j > 0; p++) 123 | m_MT[p] = m_MT[p + k_M] ^ Twist(m_MT[p], m_MT[p + 1]); 124 | 125 | for (var j = k_M; --j > 0; p++) 126 | m_MT[p] = m_MT[p + (k_M - k_N)] ^ Twist(m_MT[p], m_MT[p + 1]); 127 | 128 | m_MT[p] = m_MT[p + (k_M - k_N)] ^ Twist(m_MT[p], m_MT[0]); 129 | } 130 | } -------------------------------------------------------------------------------- /Assets/Scripts/Editor/BuildFinalScene.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEditor; 3 | using UnityEngine; 4 | 5 | public static class BuildFinalScene 6 | { 7 | private static MersenneTwister s_MT = new(); 8 | 9 | [MenuItem("Tutorial/Generate Final Scene")] 10 | public static void GenerateScene() 11 | { 12 | s_MT.InitGenRand(95273); 13 | 14 | var templateGo = AssetDatabase.LoadAssetAtPath("Assets/Prefabs/Sphere.prefab"); 15 | var templateLambertian = AssetDatabase.LoadAssetAtPath("Assets/Materials/RandomLambertian.mat"); 16 | var templateMetal = AssetDatabase.LoadAssetAtPath("Assets/Materials/RandomMetal.mat"); 17 | var templateDielectric = AssetDatabase.LoadAssetAtPath("Assets/Materials/RandomDielectric.mat"); 18 | 19 | var renderers = new List(); 20 | 21 | for (var a = -11; a < 11; ++a) 22 | { 23 | for (var b = -11; b < 11; ++b) 24 | { 25 | var center = new Vector3(a + 0.9f * (float)s_MT.GenRandReal1(), 0.2f, b + 0.9f * (float)s_MT.GenRandReal1()); 26 | if ((center - new Vector3(4.0f, 0.2f, 0.0f)).magnitude > 0.9f) 27 | { 28 | renderers.Add(CreateSphere(templateGo, templateLambertian, templateMetal, templateDielectric, center, a, b)); 29 | } 30 | } 31 | } 32 | 33 | renderers.Add(CreateLargeSphere(templateGo, "Sphere_D", new Vector3(0.0f, 1.0f, 0.0f), Vector3.one * 2.0f, templateDielectric, Color.white, 1.5f)); 34 | renderers.Add(CreateLargeSphere(templateGo, "Sphere_L", new Vector3(-4.0f, 1.0f, 0.0f), Vector3.one * 2.0f, templateLambertian, new Color(0.4f, 0.2f, 0.1f))); 35 | renderers.Add(CreateLargeSphere(templateGo, "Sphere_M", new Vector3(4.0f, 1.0f, 0.0f), Vector3.one * 2.0f, templateMetal, new Color(0.7f, 0.6f, 0.5f))); 36 | 37 | SceneManager.Instance.renderers = renderers.ToArray(); 38 | } 39 | 40 | private static Renderer CreateSphere(GameObject templateGo, Material templateLambertian, Material templateMetal, Material templateDielectric, Vector3 center, int a, int b) 41 | { 42 | var chooseMat = s_MT.GenRandReal1(); 43 | Renderer renderer; 44 | Material material; 45 | 46 | var go = Object.Instantiate(templateGo); 47 | 48 | if (chooseMat < 0.8) 49 | { 50 | go.name = $"Sphere_L_{a}_{b}"; 51 | renderer = SetupRenderer(go, center, Vector3.one * 0.4f); 52 | material = new Material(templateLambertian); 53 | material.SetColor("_Color", new Color( 54 | (float)(s_MT.GenRandReal1() * s_MT.GenRandReal1()), 55 | (float)(s_MT.GenRandReal1() * s_MT.GenRandReal1()), 56 | (float)(s_MT.GenRandReal1() * s_MT.GenRandReal1()))); 57 | } 58 | else if (chooseMat < 0.95) 59 | { 60 | go.name = $"Sphere_M_{a}_{b}"; 61 | renderer = SetupRenderer(go, center, Vector3.one * 0.4f); 62 | material = new Material(templateMetal); 63 | material.SetColor("_Color", new Color( 64 | 0.5f * (1.0f + (float)s_MT.GenRandReal1()), 65 | 0.5f * (1.0f + (float)s_MT.GenRandReal1()), 66 | 0.5f * (1.0f + (float)s_MT.GenRandReal1()))); 67 | material.SetFloat("_Fuzz", 0.5f * (float)s_MT.GenRandReal1()); 68 | } 69 | else 70 | { 71 | go.name = $"Sphere_D_{a}_{b}"; 72 | renderer = SetupRenderer(go, center, Vector3.one * 0.4f); 73 | material = new Material(templateDielectric); 74 | material.SetColor("_Color", Color.white); 75 | material.SetFloat("_IOR", 1.5f); 76 | } 77 | 78 | renderer.material = material; 79 | 80 | return renderer; 81 | } 82 | 83 | private static Renderer CreateLargeSphere(GameObject templateGo, string name, Vector3 position, Vector3 scale, Material material, Color color, float ior = 0) 84 | { 85 | var go = Object.Instantiate(templateGo); 86 | go.name = name; 87 | go.transform.localPosition = position; 88 | go.transform.localScale = scale; 89 | 90 | var renderer = go.GetComponent(); 91 | var newMaterial = new Material(material); 92 | newMaterial.SetColor("_Color", color); 93 | if (ior > 0) 94 | { 95 | newMaterial.SetFloat("_IOR", ior); 96 | } 97 | renderer.material = newMaterial; 98 | 99 | return renderer; 100 | } 101 | 102 | private static Renderer SetupRenderer(GameObject go, Vector3 position, Vector3 scale) 103 | { 104 | go.transform.localPosition = position; 105 | go.transform.localScale = scale; 106 | return go.GetComponent(); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Define macros (only works in top-level gitattributes files) 2 | [attr]lfs filter=lfs diff=lfs merge=lfs -text 3 | [attr]unity-json eol=lf linguist-language=json 4 | [attr]unity-yaml merge=unityyamlmerge eol=lf linguist-language=yaml 5 | 6 | # Optionally collapse Unity-generated files on GitHub diffs 7 | # [attr]unity-yaml merge=unityyamlmerge text linguist-language=yaml linguist-generated 8 | 9 | # Unity source files 10 | *.cginc text 11 | *.compute text linguist-language=hlsl 12 | *.cs text diff=csharp 13 | *.hlsl text linguist-language=hlsl 14 | *.raytrace text linguist-language=hlsl 15 | *.shader text 16 | 17 | # Unity JSON files 18 | *.asmdef unity-json 19 | *.asmref unity-json 20 | *.index unity-json 21 | *.inputactions unity-json 22 | *.shadergraph unity-json 23 | *.shadersubgraph unity-json 24 | 25 | # Unity UI Toolkit files 26 | *.tss text diff=css linguist-language=css 27 | *.uss text diff=css linguist-language=css 28 | *.uxml text linguist-language=xml linguist-detectable 29 | 30 | # Unity YAML 31 | *.anim unity-yaml 32 | *.asset unity-yaml 33 | *.brush unity-yaml 34 | *.controller unity-yaml 35 | *.flare unity-yaml 36 | *.fontsettings unity-yaml 37 | *.giparams unity-yaml 38 | *.guiskin unity-yaml 39 | *.lighting unity-yaml 40 | *.mask unity-yaml 41 | *.mat unity-yaml 42 | *.meta unity-yaml 43 | *.mixer unity-yaml 44 | *.overrideController unity-yaml 45 | *.playable unity-yaml 46 | *.prefab unity-yaml 47 | *.preset unity-yaml 48 | *.renderTexture unity-yaml 49 | *.scenetemplate unity-yaml 50 | *.shadervariants unity-yaml 51 | *.signal unity-yaml 52 | *.spriteatlas unity-yaml 53 | *.spriteatlasv2 unity-yaml 54 | *.terrainlayer unity-yaml 55 | *.unity unity-yaml 56 | 57 | # "physic" for 3D but "physics" for 2D 58 | *.physicMaterial unity-yaml 59 | *.physicsMaterial2D unity-yaml 60 | 61 | # Exclude third-party plugins from GitHub stats 62 | Assets/Plugins/** linguist-vendored 63 | 64 | # Unity LFS 65 | *.cubemap lfs 66 | *.unitypackage lfs 67 | 68 | # 3D models 69 | *.3dm lfs 70 | *.3ds lfs 71 | *.blend* lfs 72 | *.c4d lfs 73 | *.collada lfs 74 | *.dae lfs 75 | *.dxf lfs 76 | *.FBX lfs 77 | *.fbx lfs 78 | *.jas lfs 79 | *.lws lfs 80 | *.lxo lfs 81 | *.ma lfs 82 | *.max lfs 83 | *.mb lfs 84 | *.obj lfs 85 | *.ply lfs 86 | *.skp lfs 87 | *.stl lfs 88 | *.ztl lfs 89 | 90 | # Audio 91 | *.aif lfs 92 | *.aiff lfs 93 | *.it lfs 94 | *.mod lfs 95 | *.mp3 lfs 96 | *.ogg lfs 97 | *.s3m lfs 98 | *.wav lfs 99 | *.xm lfs 100 | 101 | # Video 102 | *.asf lfs 103 | *.avi lfs 104 | *.flv lfs 105 | *.mov lfs 106 | *.mp4 lfs 107 | *.mpeg lfs 108 | *.mpg lfs 109 | *.ogv lfs 110 | *.wmv lfs 111 | 112 | # Images 113 | *.bmp lfs 114 | *.exr lfs 115 | *.gif lfs 116 | *.hdr lfs 117 | *.iff lfs 118 | *.jpeg lfs 119 | *.jpg lfs 120 | *.pict lfs 121 | *.png lfs 122 | *.psd lfs 123 | *.tga lfs 124 | *.tif lfs 125 | *.tiff lfs 126 | *.webp lfs 127 | 128 | # Compressed Archive 129 | *.7z lfs 130 | *.bz2 lfs 131 | *.gz lfs 132 | *.rar lfs 133 | *.tar lfs 134 | *.zip lfs 135 | 136 | # Compiled Dynamic Library 137 | *.dll lfs 138 | *.pdb lfs 139 | *.so lfs 140 | 141 | # Fonts 142 | *.otf lfs 143 | *.ttf lfs 144 | 145 | # Executable/Installer 146 | *.apk lfs 147 | *.exe lfs 148 | 149 | # Documents 150 | *.pdf lfs 151 | 152 | # ETC 153 | *.a lfs 154 | *.reason lfs 155 | *.rns lfs 156 | 157 | # Spine export file for Unity 158 | *.skel.bytes lfs 159 | 160 | # Exceptions for .asset files such as lightning pre-baking 161 | LightingData.asset binary -------------------------------------------------------------------------------- /Assets/Shaders/Diffuse.shader: -------------------------------------------------------------------------------- 1 | Shader "Tutorial/Diffuse" 2 | { 3 | Properties 4 | { 5 | _Color ("Main Color", Color) = (1,1,1,1) 6 | } 7 | SubShader 8 | { 9 | Tags { "RenderType" = "Opaque" } 10 | LOD 100 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | // make fog work 18 | #pragma multi_compile_fog 19 | 20 | #include "UnityCG.cginc" 21 | 22 | struct appdata 23 | { 24 | float4 vertex : POSITION; 25 | float3 normal : NORMAL; 26 | }; 27 | 28 | struct v2f 29 | { 30 | float3 normal : TEXCOORD0; 31 | UNITY_FOG_COORDS(1) 32 | float4 vertex : SV_POSITION; 33 | }; 34 | 35 | CBUFFER_START(UnityPerMaterial) 36 | half4 _Color; 37 | CBUFFER_END 38 | 39 | v2f vert(appdata v) 40 | { 41 | v2f o; 42 | o.vertex = UnityObjectToClipPos(v.vertex); 43 | o.normal = UnityObjectToWorldNormal(v.normal); 44 | UNITY_TRANSFER_FOG(o, o.vertex); 45 | return o; 46 | } 47 | 48 | half4 frag(v2f i) : SV_Target 49 | { 50 | half4 col = _Color * half4(dot(i.normal, float3(0.0f, 1.0f, 0.0f)).xxx, 1.0f); 51 | // apply fog 52 | UNITY_APPLY_FOG(i.fogCoord, col); 53 | return col; 54 | } 55 | ENDCG 56 | } 57 | } 58 | 59 | SubShader 60 | { 61 | Pass 62 | { 63 | Name "RayTracing" 64 | Tags { "LightMode" = "RayTracing" } 65 | 66 | HLSLPROGRAM 67 | 68 | #pragma raytracing test 69 | 70 | #include "./Common.hlsl" 71 | #include "./PRNG.hlsl" 72 | 73 | struct IntersectionVertex 74 | { 75 | // Object space normal of the vertex 76 | float3 normalOS; 77 | }; 78 | 79 | CBUFFER_START(UnityPerMaterial) 80 | float4 _Color; 81 | CBUFFER_END 82 | 83 | void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex) 84 | { 85 | outVertex.normalOS = UnityRayTracingFetchVertexAttribute3(vertexIndex, kVertexAttributeNormal); 86 | } 87 | 88 | [shader("closesthit")] 89 | void ClosestHitShader(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) 90 | { 91 | // Fetch the indices of the currentr triangle 92 | uint3 triangleIndices = UnityRayTracingFetchTriangleIndices(PrimitiveIndex()); 93 | 94 | // Fetch the 3 vertices 95 | IntersectionVertex v0, v1, v2; 96 | FetchIntersectionVertex(triangleIndices.x, v0); 97 | FetchIntersectionVertex(triangleIndices.y, v1); 98 | FetchIntersectionVertex(triangleIndices.z, v2); 99 | 100 | // Compute the full barycentric coordinates 101 | float3 barycentricCoordinates = float3(1.0 - attributeData.barycentrics.x - attributeData.barycentrics.y, attributeData.barycentrics.x, attributeData.barycentrics.y); 102 | 103 | // Get normal in world space. 104 | float3 normalOS = INTERPOLATE_RAYTRACING_ATTRIBUTE(v0.normalOS, v1.normalOS, v2.normalOS, barycentricCoordinates); 105 | float3x3 objectToWorld = (float3x3)ObjectToWorld3x4(); 106 | float3 normalWS = normalize(mul(objectToWorld, normalOS)); 107 | 108 | float4 color = float4(0, 0, 0, 1); 109 | if (rayIntersection.remainingDepth > 0) 110 | { 111 | // Get position in world space. 112 | float3 origin = WorldRayOrigin(); 113 | float3 direction = WorldRayDirection(); 114 | float t = RayTCurrent(); 115 | float3 positionWS = origin + direction * t; 116 | 117 | // Make reflection ray. 118 | RayDesc rayDescriptor; 119 | rayDescriptor.Origin = positionWS + 0.001f * normalWS; 120 | rayDescriptor.Direction = normalize(normalWS + GetRandomOnUnitSphere(rayIntersection.PRNGStates)); 121 | rayDescriptor.TMin = 1e-5f; 122 | rayDescriptor.TMax = _CameraFarDistance; 123 | 124 | // Tracing reflection. 125 | RayIntersection reflectionRayIntersection; 126 | reflectionRayIntersection.remainingDepth = rayIntersection.remainingDepth - 1; 127 | reflectionRayIntersection.PRNGStates = rayIntersection.PRNGStates; 128 | reflectionRayIntersection.color = float4(0.0f, 0.0f, 0.0f, 0.0f); 129 | 130 | TraceRay(_AccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xFF, 0, 1, 0, rayDescriptor, reflectionRayIntersection); 131 | 132 | rayIntersection.PRNGStates = reflectionRayIntersection.PRNGStates; 133 | color = reflectionRayIntersection.color; 134 | } 135 | 136 | rayIntersection.color = _Color * 0.5f * color; 137 | } 138 | 139 | ENDHLSL 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /Assets/Shaders/Metal.shader: -------------------------------------------------------------------------------- 1 | Shader "Tutorial/Metal" 2 | { 3 | Properties 4 | { 5 | _Color ("Main Color", Color) = (1, 1, 1, 1) 6 | _Fuzz ("Fuzz", float) = 0 7 | } 8 | SubShader 9 | { 10 | Tags { "RenderType" = "Opaque" } 11 | LOD 100 12 | 13 | Pass 14 | { 15 | CGPROGRAM 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | // make fog work 19 | #pragma multi_compile_fog 20 | 21 | #include "UnityCG.cginc" 22 | 23 | struct appdata 24 | { 25 | float4 vertex : POSITION; 26 | float3 normal : NORMAL; 27 | }; 28 | 29 | struct v2f 30 | { 31 | float3 normal : TEXCOORD0; 32 | UNITY_FOG_COORDS(1) 33 | float4 vertex : SV_POSITION; 34 | }; 35 | 36 | CBUFFER_START(UnityPerMaterial) 37 | half4 _Color; 38 | CBUFFER_END 39 | 40 | v2f vert(appdata v) 41 | { 42 | v2f o; 43 | o.vertex = UnityObjectToClipPos(v.vertex); 44 | o.normal = UnityObjectToWorldNormal(v.normal); 45 | UNITY_TRANSFER_FOG(o, o.vertex); 46 | return o; 47 | } 48 | 49 | half4 frag(v2f i) : SV_Target 50 | { 51 | half4 col = _Color * half4(dot(i.normal, float3(0.0f, 1.0f, 0.0f)).xxx, 1.0f); 52 | // apply fog 53 | UNITY_APPLY_FOG(i.fogCoord, col); 54 | return col; 55 | } 56 | ENDCG 57 | } 58 | } 59 | 60 | SubShader 61 | { 62 | Pass 63 | { 64 | Name "RayTracing" 65 | Tags { "LightMode" = "RayTracing" } 66 | 67 | HLSLPROGRAM 68 | 69 | #pragma raytracing test 70 | 71 | #include "./Common.hlsl" 72 | #include "./PRNG.hlsl" 73 | 74 | struct IntersectionVertex 75 | { 76 | // Object space normal of the vertex 77 | float3 normalOS; 78 | }; 79 | 80 | CBUFFER_START(UnityPerMaterial) 81 | float4 _Color; 82 | float _Fuzz; 83 | CBUFFER_END 84 | 85 | void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex) 86 | { 87 | outVertex.normalOS = UnityRayTracingFetchVertexAttribute3(vertexIndex, kVertexAttributeNormal); 88 | } 89 | 90 | [shader("closesthit")] 91 | void ClosestHitShader(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) 92 | { 93 | // Fetch the indices of the currentr triangle 94 | uint3 triangleIndices = UnityRayTracingFetchTriangleIndices(PrimitiveIndex()); 95 | 96 | // Fetch the 3 vertices 97 | IntersectionVertex v0, v1, v2; 98 | FetchIntersectionVertex(triangleIndices.x, v0); 99 | FetchIntersectionVertex(triangleIndices.y, v1); 100 | FetchIntersectionVertex(triangleIndices.z, v2); 101 | 102 | // Compute the full barycentric coordinates 103 | float3 barycentricCoordinates = float3(1.0 - attributeData.barycentrics.x - attributeData.barycentrics.y, attributeData.barycentrics.x, attributeData.barycentrics.y); 104 | 105 | // Get normal in world space. 106 | float3 normalOS = INTERPOLATE_RAYTRACING_ATTRIBUTE(v0.normalOS, v1.normalOS, v2.normalOS, barycentricCoordinates); 107 | float3x3 objectToWorld = (float3x3)ObjectToWorld3x4(); 108 | float3 normalWS = normalize(mul(objectToWorld, normalOS)); 109 | 110 | float4 color = float4(0, 0, 0, 1); 111 | if (rayIntersection.remainingDepth > 0) 112 | { 113 | // Get position in world space. 114 | float3 origin = WorldRayOrigin(); 115 | float3 direction = WorldRayDirection(); 116 | float t = RayTCurrent(); 117 | float3 positionWS = origin + direction * t; 118 | 119 | // Make reflection ray. 120 | float3 reflectDir = reflect(direction, normalWS); 121 | if (dot(reflectDir, normalWS) < 0.0f) 122 | reflectDir = direction; 123 | RayDesc rayDescriptor; 124 | rayDescriptor.Origin = positionWS + 0.001f * reflectDir; 125 | rayDescriptor.Direction = reflectDir + _Fuzz * GetRandomOnUnitSphere(rayIntersection.PRNGStates); 126 | rayDescriptor.TMin = 1e-5f; 127 | rayDescriptor.TMax = _CameraFarDistance; 128 | 129 | // Tracing reflection. 130 | RayIntersection reflectionRayIntersection; 131 | reflectionRayIntersection.remainingDepth = rayIntersection.remainingDepth - 1; 132 | reflectionRayIntersection.PRNGStates = rayIntersection.PRNGStates; 133 | reflectionRayIntersection.color = float4(0.0f, 0.0f, 0.0f, 0.0f); 134 | 135 | TraceRay(_AccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, 0xFF, 0, 1, 0, rayDescriptor, reflectionRayIntersection); 136 | 137 | rayIntersection.PRNGStates = reflectionRayIntersection.PRNGStates; 138 | color = reflectionRayIntersection.color; 139 | } 140 | 141 | rayIntersection.color = _Color * color; 142 | } 143 | 144 | ENDHLSL 145 | } 146 | } 147 | } -------------------------------------------------------------------------------- /Assets/Shaders/Dielectrics.shader: -------------------------------------------------------------------------------- 1 | Shader "Tutorial/Dielectrics" 2 | { 3 | Properties 4 | { 5 | _Color ("Main Color", Color) = (1,1,1,1) 6 | _IOR ("IOR", float) = 1.5 7 | } 8 | SubShader 9 | { 10 | Tags { "RenderType" = "Opaque" } 11 | LOD 100 12 | 13 | Pass 14 | { 15 | CGPROGRAM 16 | #pragma vertex vert 17 | #pragma fragment frag 18 | // make fog work 19 | #pragma multi_compile_fog 20 | 21 | #include "UnityCG.cginc" 22 | 23 | struct appdata 24 | { 25 | float4 vertex : POSITION; 26 | float3 normal : NORMAL; 27 | }; 28 | 29 | struct v2f 30 | { 31 | float3 normal : TEXCOORD0; 32 | UNITY_FOG_COORDS(1) 33 | float4 vertex : SV_POSITION; 34 | }; 35 | 36 | CBUFFER_START(UnityPerMaterial) 37 | half4 _Color; 38 | CBUFFER_END 39 | 40 | v2f vert(appdata v) 41 | { 42 | v2f o; 43 | o.vertex = UnityObjectToClipPos(v.vertex); 44 | o.normal = UnityObjectToWorldNormal(v.normal); 45 | UNITY_TRANSFER_FOG(o, o.vertex); 46 | return o; 47 | } 48 | 49 | half4 frag(v2f i) : SV_Target 50 | { 51 | half4 col = _Color * half4(dot(i.normal, float3(0.0f, 1.0f, 0.0f)).xxx, 1.0f); 52 | // apply fog 53 | UNITY_APPLY_FOG(i.fogCoord, col); 54 | return col; 55 | } 56 | ENDCG 57 | } 58 | } 59 | 60 | SubShader 61 | { 62 | Pass 63 | { 64 | Name "RayTracing" 65 | Tags { "LightMode" = "RayTracing" } 66 | 67 | HLSLPROGRAM 68 | 69 | #pragma raytracing test 70 | 71 | #include "./Common.hlsl" 72 | #include "./PRNG.hlsl" 73 | 74 | struct IntersectionVertex 75 | { 76 | // Object space normal of the vertex 77 | float3 normalOS; 78 | }; 79 | 80 | CBUFFER_START(UnityPerMaterial) 81 | float4 _Color; 82 | float _IOR; 83 | CBUFFER_END 84 | 85 | void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex) 86 | { 87 | outVertex.normalOS = UnityRayTracingFetchVertexAttribute3(vertexIndex, kVertexAttributeNormal); 88 | } 89 | 90 | inline float schlick(float cosine, float IOR) 91 | { 92 | float r0 = (1.0f - IOR) / (1.0f + IOR); 93 | r0 = r0 * r0; 94 | return r0 + (1.0f - r0) * pow((1.0f - cosine), 5.0f); 95 | } 96 | 97 | [shader("closesthit")] 98 | void ClosestHitShader(inout RayIntersection rayIntersection : SV_RayPayload, 99 | AttributeData attributeData : SV_IntersectionAttributes) 100 | { 101 | // Fetch the indices of the currentr triangle 102 | uint3 triangleIndices = UnityRayTracingFetchTriangleIndices(PrimitiveIndex()); 103 | 104 | // Fetch the 3 vertices 105 | IntersectionVertex v0, v1, v2; 106 | FetchIntersectionVertex(triangleIndices.x, v0); 107 | FetchIntersectionVertex(triangleIndices.y, v1); 108 | FetchIntersectionVertex(triangleIndices.z, v2); 109 | 110 | // Compute the full barycentric coordinates 111 | float3 barycentricCoordinates = float3(1.0 - attributeData.barycentrics.x - attributeData.barycentrics.y, attributeData.barycentrics.x, attributeData.barycentrics.y); 112 | 113 | // Get normal in world space. 114 | float3 normalOS = INTERPOLATE_RAYTRACING_ATTRIBUTE(v0.normalOS, v1.normalOS, v2.normalOS, barycentricCoordinates); 115 | float3x3 objectToWorld = (float3x3)ObjectToWorld3x4(); 116 | float3 normalWS = normalize(mul(objectToWorld, normalOS)); 117 | 118 | float4 color = float4(0, 0, 0, 1); 119 | if (rayIntersection.remainingDepth > 0) 120 | { 121 | // Get position in world space. 122 | float3 origin = WorldRayOrigin(); 123 | float3 direction = WorldRayDirection(); 124 | float t = RayTCurrent(); 125 | float3 positionWS = origin + direction * t; 126 | 127 | // Make reflection & refraction ray. 128 | float3 outwardNormal; 129 | float niOverNt; 130 | float reflectProb; 131 | float cosine; 132 | if (dot(-direction, normalWS) > 0.0f) 133 | { 134 | outwardNormal = normalWS; 135 | niOverNt = 1.0f / _IOR; 136 | cosine = _IOR * dot(-direction, normalWS); 137 | } 138 | else 139 | { 140 | outwardNormal = -normalWS; 141 | niOverNt = _IOR; 142 | cosine = -dot(-direction, normalWS); 143 | } 144 | reflectProb = schlick(cosine, _IOR); 145 | 146 | float3 scatteredDir; 147 | if (GetRandomValue(rayIntersection.PRNGStates) < reflectProb) 148 | scatteredDir = reflect(direction, normalWS); 149 | else 150 | scatteredDir = refract(direction, outwardNormal, niOverNt); 151 | 152 | RayDesc rayDescriptor; 153 | rayDescriptor.Origin = positionWS + 1e-5f * scatteredDir; 154 | rayDescriptor.Direction = scatteredDir; 155 | rayDescriptor.TMin = 1e-5f; 156 | rayDescriptor.TMax = _CameraFarDistance; 157 | 158 | // Tracing reflection. 159 | RayIntersection reflectionRayIntersection; 160 | reflectionRayIntersection.remainingDepth = rayIntersection.remainingDepth - 1; 161 | reflectionRayIntersection.PRNGStates = rayIntersection.PRNGStates; 162 | reflectionRayIntersection.color = float4(0.0f, 0.0f, 0.0f, 0.0f); 163 | 164 | TraceRay(_AccelerationStructure, RAY_FLAG_NONE, 0xFF, 0, 1, 0, rayDescriptor, reflectionRayIntersection); 165 | 166 | rayIntersection.PRNGStates = reflectionRayIntersection.PRNGStates; 167 | color = reflectionRayIntersection.color; 168 | } 169 | 170 | rayIntersection.color = _Color * color; 171 | } 172 | 173 | ENDHLSL 174 | } 175 | } 176 | } -------------------------------------------------------------------------------- /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 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 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: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | GameCoreScarlett: 5 223 | GameCoreXboxOne: 5 224 | Nintendo 3DS: 5 225 | Nintendo Switch: 5 226 | PS4: 5 227 | PS5: 5 228 | Stadia: 5 229 | Standalone: 5 230 | WebGL: 3 231 | Windows Store Apps: 5 232 | XboxOne: 5 233 | iPhone: 2 234 | tvOS: 2 235 | -------------------------------------------------------------------------------- /Assets/Shaders/DielectricsInv.shader: -------------------------------------------------------------------------------- 1 | Shader "Tutorial/DielectricsInv" 2 | { 3 | Properties 4 | { 5 | _Color ("Main Color", Color) = (1,1,1,1) 6 | _IOR ("IOR", float) = 1.5 7 | } 8 | SubShader 9 | { 10 | Tags { "RenderType" = "Opaque" } 11 | LOD 100 12 | Cull Front 13 | 14 | Pass 15 | { 16 | CGPROGRAM 17 | #pragma vertex vert 18 | #pragma fragment frag 19 | // make fog work 20 | #pragma multi_compile_fog 21 | 22 | #include "UnityCG.cginc" 23 | 24 | struct appdata 25 | { 26 | float4 vertex : POSITION; 27 | float3 normal : NORMAL; 28 | }; 29 | 30 | struct v2f 31 | { 32 | float3 normal : TEXCOORD0; 33 | UNITY_FOG_COORDS(1) 34 | float4 vertex : SV_POSITION; 35 | }; 36 | 37 | CBUFFER_START(UnityPerMaterial) 38 | half4 _Color; 39 | CBUFFER_END 40 | 41 | v2f vert(appdata v) 42 | { 43 | v2f o; 44 | o.vertex = UnityObjectToClipPos(v.vertex); 45 | o.normal = -UnityObjectToWorldNormal(v.normal); 46 | UNITY_TRANSFER_FOG(o, o.vertex); 47 | return o; 48 | } 49 | 50 | half4 frag(v2f i) : SV_Target 51 | { 52 | half4 col = _Color * half4(dot(i.normal, float3(0.0f, 1.0f, 0.0f)).xxx, 1.0f); 53 | // apply fog 54 | UNITY_APPLY_FOG(i.fogCoord, col); 55 | return col; 56 | } 57 | ENDCG 58 | } 59 | } 60 | 61 | SubShader 62 | { 63 | Pass 64 | { 65 | Name "RayTracing" 66 | Tags { "LightMode" = "RayTracing" } 67 | 68 | HLSLPROGRAM 69 | #pragma raytracing test 70 | 71 | #include "./Common.hlsl" 72 | #include "./PRNG.hlsl" 73 | 74 | struct IntersectionVertex 75 | { 76 | // Object space normal of the vertex 77 | float3 normalOS; 78 | }; 79 | 80 | CBUFFER_START(UnityPerMaterial) 81 | float4 _Color; 82 | float _IOR; 83 | CBUFFER_END 84 | 85 | void FetchIntersectionVertex(uint vertexIndex, out IntersectionVertex outVertex) 86 | { 87 | outVertex.normalOS = UnityRayTracingFetchVertexAttribute3(vertexIndex, kVertexAttributeNormal); 88 | } 89 | 90 | inline bool refract2(float3 uv, float3 n, float niOverNt, out float3 refracted) 91 | { 92 | float dt = dot(uv, n); 93 | float discriminant = 1.0f - niOverNt * niOverNt * (1 - dt * dt); 94 | if (discriminant > 0) 95 | { 96 | refracted = niOverNt * (uv - n * dt) - n * sqrt(discriminant); 97 | return true; 98 | } 99 | else 100 | return false; 101 | } 102 | 103 | inline float schlick(float cosine, float IOR) 104 | { 105 | float r0 = (1.0f - IOR) / (1.0f + IOR); 106 | r0 = r0 * r0; 107 | return r0 + (1.0f - r0) * pow((1.0f - cosine), 5.0f); 108 | } 109 | 110 | [shader("closesthit")] 111 | void ClosestHitShader(inout RayIntersection rayIntersection : SV_RayPayload, AttributeData attributeData : SV_IntersectionAttributes) 112 | { 113 | // Fetch the indices of the currentr triangle 114 | uint3 triangleIndices = UnityRayTracingFetchTriangleIndices(PrimitiveIndex()); 115 | 116 | // Fetch the 3 vertices 117 | IntersectionVertex v0, v1, v2; 118 | FetchIntersectionVertex(triangleIndices.x, v0); 119 | FetchIntersectionVertex(triangleIndices.y, v1); 120 | FetchIntersectionVertex(triangleIndices.z, v2); 121 | 122 | // Compute the full barycentric coordinates 123 | float3 barycentricCoordinates = float3(1.0 - attributeData.barycentrics.x - attributeData.barycentrics.y, attributeData.barycentrics.x, attributeData.barycentrics.y); 124 | 125 | // Get normal in world space. 126 | float3 normalOS = INTERPOLATE_RAYTRACING_ATTRIBUTE(v0.normalOS, v1.normalOS, v2.normalOS, barycentricCoordinates); 127 | float3x3 objectToWorld = (float3x3)ObjectToWorld3x4(); 128 | float3 normalWS = -normalize(mul(objectToWorld, normalOS)); 129 | 130 | float4 color = float4(0, 0, 0, 1); 131 | if (rayIntersection.remainingDepth > 0) 132 | { 133 | // Get position in world space. 134 | float3 origin = WorldRayOrigin(); 135 | float3 direction = WorldRayDirection(); 136 | float t = RayTCurrent(); 137 | float3 positionWS = origin + direction * t; 138 | 139 | // Make reflection & refraction ray. 140 | float3 outwardNormal; 141 | float niOverNt; 142 | float reflectProb; 143 | float cosine; 144 | if (dot(-direction, normalWS) > 0.0f) 145 | { 146 | outwardNormal = normalWS; 147 | niOverNt = 1.0f / _IOR; 148 | cosine = _IOR * dot(-direction, normalWS); 149 | } 150 | else 151 | { 152 | outwardNormal = -normalWS; 153 | niOverNt = _IOR; 154 | cosine = -dot(-direction, normalWS); 155 | } 156 | reflectProb = schlick(cosine, _IOR); 157 | 158 | float3 scatteredDir; 159 | if (GetRandomValue(rayIntersection.PRNGStates) < reflectProb) 160 | scatteredDir = reflect(direction, normalWS); 161 | else 162 | { 163 | if (refract2(direction, outwardNormal, niOverNt, scatteredDir) == false) 164 | scatteredDir = reflect(direction, normalWS); 165 | } 166 | 167 | RayDesc rayDescriptor; 168 | rayDescriptor.Origin = positionWS + 1e-5f * scatteredDir; 169 | rayDescriptor.Direction = scatteredDir; 170 | rayDescriptor.TMin = 1e-5f; 171 | rayDescriptor.TMax = _CameraFarDistance; 172 | 173 | // Tracing reflection. 174 | RayIntersection reflectionRayIntersection; 175 | reflectionRayIntersection.remainingDepth = rayIntersection.remainingDepth - 1; 176 | reflectionRayIntersection.PRNGStates = rayIntersection.PRNGStates; 177 | reflectionRayIntersection.color = float4(0.0f, 0.0f, 0.0f, 0.0f); 178 | 179 | TraceRay(_AccelerationStructure, RAY_FLAG_NONE, 0xFF, 0, 1, 0, rayDescriptor, reflectionRayIntersection); 180 | 181 | rayIntersection.PRNGStates = reflectionRayIntersection.PRNGStates; 182 | color = reflectionRayIntersection.color; 183 | } 184 | 185 | rayIntersection.color = _Color * color; 186 | } 187 | ENDHLSL 188 | } 189 | } 190 | } -------------------------------------------------------------------------------- /Assets/Scenes/BackgroundTutorialScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_UseRadianceAmbientProbe: 0 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 12 46 | m_GIWorkflowMode: 1 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 1 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 12 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_AtlasSize: 1024 60 | m_AO: 0 61 | m_AOMaxDistance: 1 62 | m_CompAOExponent: 1 63 | m_CompAOExponentDirect: 0 64 | m_ExtractAmbientOcclusion: 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: 512 78 | m_PVRBounces: 2 79 | m_PVREnvironmentSampleCount: 256 80 | m_PVREnvironmentReferencePointCount: 2048 81 | m_PVRFilteringMode: 1 82 | m_PVRDenoiserTypeDirect: 1 83 | m_PVRDenoiserTypeIndirect: 1 84 | m_PVRDenoiserTypeAO: 1 85 | m_PVRFilterTypeDirect: 0 86 | m_PVRFilterTypeIndirect: 0 87 | m_PVRFilterTypeAO: 0 88 | m_PVREnvironmentMIS: 1 89 | m_PVRCulling: 1 90 | m_PVRFilteringGaussRadiusDirect: 1 91 | m_PVRFilteringGaussRadiusIndirect: 5 92 | m_PVRFilteringGaussRadiusAO: 2 93 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 94 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 95 | m_PVRFilteringAtrousPositionSigmaAO: 1 96 | m_ExportTrainingData: 0 97 | m_TrainingDataDestination: TrainingData 98 | m_LightProbeSampleCountMultiplier: 4 99 | m_LightingDataAsset: {fileID: 0} 100 | m_LightingSettings: {fileID: 0} 101 | --- !u!196 &4 102 | NavMeshSettings: 103 | serializedVersion: 2 104 | m_ObjectHideFlags: 0 105 | m_BuildSettings: 106 | serializedVersion: 3 107 | agentTypeID: 0 108 | agentRadius: 0.5 109 | agentHeight: 2 110 | agentSlope: 45 111 | agentClimb: 0.4 112 | ledgeDropHeight: 0 113 | maxJumpAcrossDistance: 0 114 | minRegionArea: 2 115 | manualCellSize: 0 116 | cellSize: 0.16666667 117 | manualTileSize: 0 118 | tileSize: 256 119 | buildHeightMesh: 0 120 | maxJobWorkers: 0 121 | preserveTilesOutsideBounds: 0 122 | debug: 123 | m_Flags: 0 124 | m_NavMeshData: {fileID: 0} 125 | --- !u!1 &26250868 126 | GameObject: 127 | m_ObjectHideFlags: 0 128 | m_CorrespondingSourceObject: {fileID: 0} 129 | m_PrefabInstance: {fileID: 0} 130 | m_PrefabAsset: {fileID: 0} 131 | serializedVersion: 6 132 | m_Component: 133 | - component: {fileID: 26250871} 134 | - component: {fileID: 26250870} 135 | - component: {fileID: 26250869} 136 | m_Layer: 0 137 | m_Name: Main Camera 138 | m_TagString: MainCamera 139 | m_Icon: {fileID: 0} 140 | m_NavMeshLayer: 0 141 | m_StaticEditorFlags: 0 142 | m_IsActive: 1 143 | --- !u!81 &26250869 144 | AudioListener: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 26250868} 150 | m_Enabled: 1 151 | --- !u!20 &26250870 152 | Camera: 153 | m_ObjectHideFlags: 0 154 | m_CorrespondingSourceObject: {fileID: 0} 155 | m_PrefabInstance: {fileID: 0} 156 | m_PrefabAsset: {fileID: 0} 157 | m_GameObject: {fileID: 26250868} 158 | m_Enabled: 1 159 | serializedVersion: 2 160 | m_ClearFlags: 1 161 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 162 | m_projectionMatrixMode: 1 163 | m_GateFitMode: 2 164 | m_FOVAxisMode: 0 165 | m_Iso: 200 166 | m_ShutterSpeed: 0.005 167 | m_Aperture: 16 168 | m_FocusDistance: 10 169 | m_FocalLength: 50 170 | m_BladeCount: 5 171 | m_Curvature: {x: 2, y: 11} 172 | m_BarrelClipping: 0.25 173 | m_Anamorphism: 0 174 | m_SensorSize: {x: 36, y: 24} 175 | m_LensShift: {x: 0, y: 0} 176 | m_NormalizedViewPortRect: 177 | serializedVersion: 2 178 | x: 0 179 | y: 0 180 | width: 1 181 | height: 1 182 | near clip plane: 0.3 183 | far clip plane: 1000 184 | field of view: 60 185 | orthographic: 0 186 | orthographic size: 5 187 | m_Depth: -1 188 | m_CullingMask: 189 | serializedVersion: 2 190 | m_Bits: 4294967295 191 | m_RenderingPath: -1 192 | m_TargetTexture: {fileID: 0} 193 | m_TargetDisplay: 0 194 | m_TargetEye: 3 195 | m_HDR: 1 196 | m_AllowMSAA: 1 197 | m_AllowDynamicResolution: 0 198 | m_ForceIntoRT: 0 199 | m_OcclusionCulling: 1 200 | m_StereoConvergence: 10 201 | m_StereoSeparation: 0.022 202 | --- !u!4 &26250871 203 | Transform: 204 | m_ObjectHideFlags: 0 205 | m_CorrespondingSourceObject: {fileID: 0} 206 | m_PrefabInstance: {fileID: 0} 207 | m_PrefabAsset: {fileID: 0} 208 | m_GameObject: {fileID: 26250868} 209 | serializedVersion: 2 210 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 211 | m_LocalPosition: {x: 0, y: 1, z: -10} 212 | m_LocalScale: {x: 1, y: 1, z: 1} 213 | m_ConstrainProportionsScale: 0 214 | m_Children: [] 215 | m_Father: {fileID: 0} 216 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 217 | --- !u!1 &456778784 218 | GameObject: 219 | m_ObjectHideFlags: 0 220 | m_CorrespondingSourceObject: {fileID: 0} 221 | m_PrefabInstance: {fileID: 0} 222 | m_PrefabAsset: {fileID: 0} 223 | serializedVersion: 6 224 | m_Component: 225 | - component: {fileID: 456778786} 226 | - component: {fileID: 456778785} 227 | m_Layer: 0 228 | m_Name: SceneManager 229 | m_TagString: Untagged 230 | m_Icon: {fileID: 0} 231 | m_NavMeshLayer: 0 232 | m_StaticEditorFlags: 0 233 | m_IsActive: 1 234 | --- !u!114 &456778785 235 | MonoBehaviour: 236 | m_ObjectHideFlags: 0 237 | m_CorrespondingSourceObject: {fileID: 0} 238 | m_PrefabInstance: {fileID: 0} 239 | m_PrefabAsset: {fileID: 0} 240 | m_GameObject: {fileID: 456778784} 241 | m_Enabled: 1 242 | m_EditorHideFlags: 0 243 | m_Script: {fileID: 11500000, guid: 5a6b39f571604bf44bd007ed629d6838, type: 3} 244 | m_Name: 245 | m_EditorClassIdentifier: 246 | renderers: [] 247 | --- !u!4 &456778786 248 | Transform: 249 | m_ObjectHideFlags: 0 250 | m_CorrespondingSourceObject: {fileID: 0} 251 | m_PrefabInstance: {fileID: 0} 252 | m_PrefabAsset: {fileID: 0} 253 | m_GameObject: {fileID: 456778784} 254 | serializedVersion: 2 255 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 256 | m_LocalPosition: {x: 0, y: 0, z: 0} 257 | m_LocalScale: {x: 1, y: 1, z: 1} 258 | m_ConstrainProportionsScale: 0 259 | m_Children: [] 260 | m_Father: {fileID: 0} 261 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 262 | --- !u!1 &748441364 263 | GameObject: 264 | m_ObjectHideFlags: 0 265 | m_CorrespondingSourceObject: {fileID: 0} 266 | m_PrefabInstance: {fileID: 0} 267 | m_PrefabAsset: {fileID: 0} 268 | serializedVersion: 6 269 | m_Component: 270 | - component: {fileID: 748441366} 271 | - component: {fileID: 748441365} 272 | m_Layer: 0 273 | m_Name: TutorialController 274 | m_TagString: Untagged 275 | m_Icon: {fileID: 0} 276 | m_NavMeshLayer: 0 277 | m_StaticEditorFlags: 0 278 | m_IsActive: 1 279 | --- !u!114 &748441365 280 | MonoBehaviour: 281 | m_ObjectHideFlags: 0 282 | m_CorrespondingSourceObject: {fileID: 0} 283 | m_PrefabInstance: {fileID: 0} 284 | m_PrefabAsset: {fileID: 0} 285 | m_GameObject: {fileID: 748441364} 286 | m_Enabled: 1 287 | m_EditorHideFlags: 0 288 | m_Script: {fileID: 11500000, guid: b66b24dadf6e2154bb091a678aad4162, type: 3} 289 | m_Name: 290 | m_EditorClassIdentifier: 291 | renderPipelineAsset: {fileID: 11400000, guid: 78b24dd2cfd4ae24caca8228a8aea74c, type: 2} 292 | --- !u!4 &748441366 293 | Transform: 294 | m_ObjectHideFlags: 0 295 | m_CorrespondingSourceObject: {fileID: 0} 296 | m_PrefabInstance: {fileID: 0} 297 | m_PrefabAsset: {fileID: 0} 298 | m_GameObject: {fileID: 748441364} 299 | serializedVersion: 2 300 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 301 | m_LocalPosition: {x: 0, y: 0, z: 0} 302 | m_LocalScale: {x: 1, y: 1, z: 1} 303 | m_ConstrainProportionsScale: 0 304 | m_Children: [] 305 | m_Father: {fileID: 0} 306 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 307 | --- !u!1660057539 &9223372036854775807 308 | SceneRoots: 309 | m_ObjectHideFlags: 0 310 | m_Roots: 311 | - {fileID: 26250871} 312 | - {fileID: 748441366} 313 | - {fileID: 456778786} 314 | -------------------------------------------------------------------------------- /Assets/Scenes/OutputColorTutorialScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_UseRadianceAmbientProbe: 0 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 12 46 | m_GIWorkflowMode: 1 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 1 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 12 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_AtlasSize: 1024 60 | m_AO: 0 61 | m_AOMaxDistance: 1 62 | m_CompAOExponent: 1 63 | m_CompAOExponentDirect: 0 64 | m_ExtractAmbientOcclusion: 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: 512 78 | m_PVRBounces: 2 79 | m_PVREnvironmentSampleCount: 256 80 | m_PVREnvironmentReferencePointCount: 2048 81 | m_PVRFilteringMode: 1 82 | m_PVRDenoiserTypeDirect: 1 83 | m_PVRDenoiserTypeIndirect: 1 84 | m_PVRDenoiserTypeAO: 1 85 | m_PVRFilterTypeDirect: 0 86 | m_PVRFilterTypeIndirect: 0 87 | m_PVRFilterTypeAO: 0 88 | m_PVREnvironmentMIS: 1 89 | m_PVRCulling: 1 90 | m_PVRFilteringGaussRadiusDirect: 1 91 | m_PVRFilteringGaussRadiusIndirect: 5 92 | m_PVRFilteringGaussRadiusAO: 2 93 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 94 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 95 | m_PVRFilteringAtrousPositionSigmaAO: 1 96 | m_ExportTrainingData: 0 97 | m_TrainingDataDestination: TrainingData 98 | m_LightProbeSampleCountMultiplier: 4 99 | m_LightingDataAsset: {fileID: 0} 100 | m_LightingSettings: {fileID: 0} 101 | --- !u!196 &4 102 | NavMeshSettings: 103 | serializedVersion: 2 104 | m_ObjectHideFlags: 0 105 | m_BuildSettings: 106 | serializedVersion: 3 107 | agentTypeID: 0 108 | agentRadius: 0.5 109 | agentHeight: 2 110 | agentSlope: 45 111 | agentClimb: 0.4 112 | ledgeDropHeight: 0 113 | maxJumpAcrossDistance: 0 114 | minRegionArea: 2 115 | manualCellSize: 0 116 | cellSize: 0.16666667 117 | manualTileSize: 0 118 | tileSize: 256 119 | buildHeightMesh: 0 120 | maxJobWorkers: 0 121 | preserveTilesOutsideBounds: 0 122 | debug: 123 | m_Flags: 0 124 | m_NavMeshData: {fileID: 0} 125 | --- !u!1 &793886226 126 | GameObject: 127 | m_ObjectHideFlags: 0 128 | m_CorrespondingSourceObject: {fileID: 0} 129 | m_PrefabInstance: {fileID: 0} 130 | m_PrefabAsset: {fileID: 0} 131 | serializedVersion: 6 132 | m_Component: 133 | - component: {fileID: 793886229} 134 | - component: {fileID: 793886228} 135 | - component: {fileID: 793886227} 136 | m_Layer: 0 137 | m_Name: Main Camera 138 | m_TagString: MainCamera 139 | m_Icon: {fileID: 0} 140 | m_NavMeshLayer: 0 141 | m_StaticEditorFlags: 0 142 | m_IsActive: 1 143 | --- !u!81 &793886227 144 | AudioListener: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 793886226} 150 | m_Enabled: 1 151 | --- !u!20 &793886228 152 | Camera: 153 | m_ObjectHideFlags: 0 154 | m_CorrespondingSourceObject: {fileID: 0} 155 | m_PrefabInstance: {fileID: 0} 156 | m_PrefabAsset: {fileID: 0} 157 | m_GameObject: {fileID: 793886226} 158 | m_Enabled: 1 159 | serializedVersion: 2 160 | m_ClearFlags: 1 161 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 162 | m_projectionMatrixMode: 1 163 | m_GateFitMode: 2 164 | m_FOVAxisMode: 0 165 | m_Iso: 200 166 | m_ShutterSpeed: 0.005 167 | m_Aperture: 16 168 | m_FocusDistance: 10 169 | m_FocalLength: 50 170 | m_BladeCount: 5 171 | m_Curvature: {x: 2, y: 11} 172 | m_BarrelClipping: 0.25 173 | m_Anamorphism: 0 174 | m_SensorSize: {x: 36, y: 24} 175 | m_LensShift: {x: 0, y: 0} 176 | m_NormalizedViewPortRect: 177 | serializedVersion: 2 178 | x: 0 179 | y: 0 180 | width: 1 181 | height: 1 182 | near clip plane: 0.3 183 | far clip plane: 1000 184 | field of view: 60 185 | orthographic: 0 186 | orthographic size: 5 187 | m_Depth: -1 188 | m_CullingMask: 189 | serializedVersion: 2 190 | m_Bits: 4294967295 191 | m_RenderingPath: -1 192 | m_TargetTexture: {fileID: 0} 193 | m_TargetDisplay: 0 194 | m_TargetEye: 3 195 | m_HDR: 1 196 | m_AllowMSAA: 1 197 | m_AllowDynamicResolution: 0 198 | m_ForceIntoRT: 0 199 | m_OcclusionCulling: 1 200 | m_StereoConvergence: 10 201 | m_StereoSeparation: 0.022 202 | --- !u!4 &793886229 203 | Transform: 204 | m_ObjectHideFlags: 0 205 | m_CorrespondingSourceObject: {fileID: 0} 206 | m_PrefabInstance: {fileID: 0} 207 | m_PrefabAsset: {fileID: 0} 208 | m_GameObject: {fileID: 793886226} 209 | serializedVersion: 2 210 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 211 | m_LocalPosition: {x: 0, y: 1, z: -10} 212 | m_LocalScale: {x: 1, y: 1, z: 1} 213 | m_ConstrainProportionsScale: 0 214 | m_Children: [] 215 | m_Father: {fileID: 0} 216 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 217 | --- !u!1 &1204824183 218 | GameObject: 219 | m_ObjectHideFlags: 0 220 | m_CorrespondingSourceObject: {fileID: 0} 221 | m_PrefabInstance: {fileID: 0} 222 | m_PrefabAsset: {fileID: 0} 223 | serializedVersion: 6 224 | m_Component: 225 | - component: {fileID: 1204824185} 226 | - component: {fileID: 1204824184} 227 | m_Layer: 0 228 | m_Name: TutorialController 229 | m_TagString: Untagged 230 | m_Icon: {fileID: 0} 231 | m_NavMeshLayer: 0 232 | m_StaticEditorFlags: 0 233 | m_IsActive: 1 234 | --- !u!114 &1204824184 235 | MonoBehaviour: 236 | m_ObjectHideFlags: 0 237 | m_CorrespondingSourceObject: {fileID: 0} 238 | m_PrefabInstance: {fileID: 0} 239 | m_PrefabAsset: {fileID: 0} 240 | m_GameObject: {fileID: 1204824183} 241 | m_Enabled: 1 242 | m_EditorHideFlags: 0 243 | m_Script: {fileID: 11500000, guid: b66b24dadf6e2154bb091a678aad4162, type: 3} 244 | m_Name: 245 | m_EditorClassIdentifier: 246 | renderPipelineAsset: {fileID: 11400000, guid: 8319959ec71070c4fa4aa54986d4551d, type: 2} 247 | --- !u!4 &1204824185 248 | Transform: 249 | m_ObjectHideFlags: 0 250 | m_CorrespondingSourceObject: {fileID: 0} 251 | m_PrefabInstance: {fileID: 0} 252 | m_PrefabAsset: {fileID: 0} 253 | m_GameObject: {fileID: 1204824183} 254 | serializedVersion: 2 255 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 256 | m_LocalPosition: {x: 0, y: 0, z: 0} 257 | m_LocalScale: {x: 1, y: 1, z: 1} 258 | m_ConstrainProportionsScale: 0 259 | m_Children: [] 260 | m_Father: {fileID: 0} 261 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 262 | --- !u!1 &1540769327 263 | GameObject: 264 | m_ObjectHideFlags: 0 265 | m_CorrespondingSourceObject: {fileID: 0} 266 | m_PrefabInstance: {fileID: 0} 267 | m_PrefabAsset: {fileID: 0} 268 | serializedVersion: 6 269 | m_Component: 270 | - component: {fileID: 1540769329} 271 | - component: {fileID: 1540769328} 272 | m_Layer: 0 273 | m_Name: SceneManager 274 | m_TagString: Untagged 275 | m_Icon: {fileID: 0} 276 | m_NavMeshLayer: 0 277 | m_StaticEditorFlags: 0 278 | m_IsActive: 1 279 | --- !u!114 &1540769328 280 | MonoBehaviour: 281 | m_ObjectHideFlags: 0 282 | m_CorrespondingSourceObject: {fileID: 0} 283 | m_PrefabInstance: {fileID: 0} 284 | m_PrefabAsset: {fileID: 0} 285 | m_GameObject: {fileID: 1540769327} 286 | m_Enabled: 1 287 | m_EditorHideFlags: 0 288 | m_Script: {fileID: 11500000, guid: 5a6b39f571604bf44bd007ed629d6838, type: 3} 289 | m_Name: 290 | m_EditorClassIdentifier: 291 | renderers: [] 292 | --- !u!4 &1540769329 293 | Transform: 294 | m_ObjectHideFlags: 0 295 | m_CorrespondingSourceObject: {fileID: 0} 296 | m_PrefabInstance: {fileID: 0} 297 | m_PrefabAsset: {fileID: 0} 298 | m_GameObject: {fileID: 1540769327} 299 | serializedVersion: 2 300 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 301 | m_LocalPosition: {x: 0, y: 0, z: 0} 302 | m_LocalScale: {x: 1, y: 1, z: 1} 303 | m_ConstrainProportionsScale: 0 304 | m_Children: [] 305 | m_Father: {fileID: 0} 306 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 307 | --- !u!1660057539 &9223372036854775807 308 | SceneRoots: 309 | m_ObjectHideFlags: 0 310 | m_Roots: 311 | - {fileID: 793886229} 312 | - {fileID: 1204824185} 313 | - {fileID: 1540769329} 314 | -------------------------------------------------------------------------------- /Assets/Scenes/FinalScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_UseRadianceAmbientProbe: 0 42 | --- !u!157 &3 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 12 46 | m_GIWorkflowMode: 1 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 1 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 12 57 | m_Resolution: 2 58 | m_BakeResolution: 40 59 | m_AtlasSize: 1024 60 | m_AO: 0 61 | m_AOMaxDistance: 1 62 | m_CompAOExponent: 1 63 | m_CompAOExponentDirect: 0 64 | m_ExtractAmbientOcclusion: 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: 512 78 | m_PVRBounces: 2 79 | m_PVREnvironmentSampleCount: 256 80 | m_PVREnvironmentReferencePointCount: 2048 81 | m_PVRFilteringMode: 1 82 | m_PVRDenoiserTypeDirect: 1 83 | m_PVRDenoiserTypeIndirect: 1 84 | m_PVRDenoiserTypeAO: 1 85 | m_PVRFilterTypeDirect: 0 86 | m_PVRFilterTypeIndirect: 0 87 | m_PVRFilterTypeAO: 0 88 | m_PVREnvironmentMIS: 1 89 | m_PVRCulling: 1 90 | m_PVRFilteringGaussRadiusDirect: 1 91 | m_PVRFilteringGaussRadiusIndirect: 5 92 | m_PVRFilteringGaussRadiusAO: 2 93 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 94 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 95 | m_PVRFilteringAtrousPositionSigmaAO: 1 96 | m_ExportTrainingData: 0 97 | m_TrainingDataDestination: TrainingData 98 | m_LightProbeSampleCountMultiplier: 4 99 | m_LightingDataAsset: {fileID: 0} 100 | m_LightingSettings: {fileID: 0} 101 | --- !u!196 &4 102 | NavMeshSettings: 103 | serializedVersion: 2 104 | m_ObjectHideFlags: 0 105 | m_BuildSettings: 106 | serializedVersion: 3 107 | agentTypeID: 0 108 | agentRadius: 0.5 109 | agentHeight: 2 110 | agentSlope: 45 111 | agentClimb: 0.4 112 | ledgeDropHeight: 0 113 | maxJumpAcrossDistance: 0 114 | minRegionArea: 2 115 | manualCellSize: 0 116 | cellSize: 0.16666667 117 | manualTileSize: 0 118 | tileSize: 256 119 | buildHeightMesh: 0 120 | maxJobWorkers: 0 121 | preserveTilesOutsideBounds: 0 122 | debug: 123 | m_Flags: 0 124 | m_NavMeshData: {fileID: 0} 125 | --- !u!1 &695655506 126 | GameObject: 127 | m_ObjectHideFlags: 0 128 | m_CorrespondingSourceObject: {fileID: 0} 129 | m_PrefabInstance: {fileID: 0} 130 | m_PrefabAsset: {fileID: 0} 131 | serializedVersion: 6 132 | m_Component: 133 | - component: {fileID: 695655508} 134 | - component: {fileID: 695655507} 135 | m_Layer: 0 136 | m_Name: TutorialController 137 | m_TagString: Untagged 138 | m_Icon: {fileID: 0} 139 | m_NavMeshLayer: 0 140 | m_StaticEditorFlags: 0 141 | m_IsActive: 1 142 | --- !u!114 &695655507 143 | MonoBehaviour: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 695655506} 149 | m_Enabled: 1 150 | m_EditorHideFlags: 0 151 | m_Script: {fileID: 11500000, guid: b66b24dadf6e2154bb091a678aad4162, type: 3} 152 | m_Name: 153 | m_EditorClassIdentifier: 154 | renderPipelineAsset: {fileID: 11400000, guid: b5af963700af58248baac5c9a1073337, type: 2} 155 | --- !u!4 &695655508 156 | Transform: 157 | m_ObjectHideFlags: 0 158 | m_CorrespondingSourceObject: {fileID: 0} 159 | m_PrefabInstance: {fileID: 0} 160 | m_PrefabAsset: {fileID: 0} 161 | m_GameObject: {fileID: 695655506} 162 | serializedVersion: 2 163 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 164 | m_LocalPosition: {x: 0, y: 0, z: 0} 165 | m_LocalScale: {x: 1, y: 1, z: 1} 166 | m_ConstrainProportionsScale: 0 167 | m_Children: [] 168 | m_Father: {fileID: 0} 169 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 170 | --- !u!1 &717223855 171 | GameObject: 172 | m_ObjectHideFlags: 0 173 | m_CorrespondingSourceObject: {fileID: 0} 174 | m_PrefabInstance: {fileID: 0} 175 | m_PrefabAsset: {fileID: 0} 176 | serializedVersion: 6 177 | m_Component: 178 | - component: {fileID: 717223857} 179 | - component: {fileID: 717223856} 180 | m_Layer: 0 181 | m_Name: SceneManager 182 | m_TagString: Untagged 183 | m_Icon: {fileID: 0} 184 | m_NavMeshLayer: 0 185 | m_StaticEditorFlags: 0 186 | m_IsActive: 1 187 | --- !u!114 &717223856 188 | MonoBehaviour: 189 | m_ObjectHideFlags: 0 190 | m_CorrespondingSourceObject: {fileID: 0} 191 | m_PrefabInstance: {fileID: 0} 192 | m_PrefabAsset: {fileID: 0} 193 | m_GameObject: {fileID: 717223855} 194 | m_Enabled: 1 195 | m_EditorHideFlags: 0 196 | m_Script: {fileID: 11500000, guid: 5a6b39f571604bf44bd007ed629d6838, type: 3} 197 | m_Name: 198 | m_EditorClassIdentifier: 199 | renderers: [] 200 | --- !u!4 &717223857 201 | Transform: 202 | m_ObjectHideFlags: 0 203 | m_CorrespondingSourceObject: {fileID: 0} 204 | m_PrefabInstance: {fileID: 0} 205 | m_PrefabAsset: {fileID: 0} 206 | m_GameObject: {fileID: 717223855} 207 | serializedVersion: 2 208 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 209 | m_LocalPosition: {x: 0, y: 0, z: 0} 210 | m_LocalScale: {x: 1, y: 1, z: 1} 211 | m_ConstrainProportionsScale: 0 212 | m_Children: [] 213 | m_Father: {fileID: 0} 214 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 215 | --- !u!1 &1653750554 216 | GameObject: 217 | m_ObjectHideFlags: 0 218 | m_CorrespondingSourceObject: {fileID: 0} 219 | m_PrefabInstance: {fileID: 0} 220 | m_PrefabAsset: {fileID: 0} 221 | serializedVersion: 6 222 | m_Component: 223 | - component: {fileID: 1653750557} 224 | - component: {fileID: 1653750556} 225 | - component: {fileID: 1653750555} 226 | - component: {fileID: 1653750558} 227 | m_Layer: 0 228 | m_Name: Main Camera 229 | m_TagString: MainCamera 230 | m_Icon: {fileID: 0} 231 | m_NavMeshLayer: 0 232 | m_StaticEditorFlags: 0 233 | m_IsActive: 1 234 | --- !u!81 &1653750555 235 | AudioListener: 236 | m_ObjectHideFlags: 0 237 | m_CorrespondingSourceObject: {fileID: 0} 238 | m_PrefabInstance: {fileID: 0} 239 | m_PrefabAsset: {fileID: 0} 240 | m_GameObject: {fileID: 1653750554} 241 | m_Enabled: 1 242 | --- !u!20 &1653750556 243 | Camera: 244 | m_ObjectHideFlags: 0 245 | m_CorrespondingSourceObject: {fileID: 0} 246 | m_PrefabInstance: {fileID: 0} 247 | m_PrefabAsset: {fileID: 0} 248 | m_GameObject: {fileID: 1653750554} 249 | m_Enabled: 1 250 | serializedVersion: 2 251 | m_ClearFlags: 1 252 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 253 | m_projectionMatrixMode: 1 254 | m_GateFitMode: 2 255 | m_FOVAxisMode: 0 256 | m_Iso: 200 257 | m_ShutterSpeed: 0.005 258 | m_Aperture: 16 259 | m_FocusDistance: 10 260 | m_FocalLength: 50 261 | m_BladeCount: 5 262 | m_Curvature: {x: 2, y: 11} 263 | m_BarrelClipping: 0.25 264 | m_Anamorphism: 0 265 | m_SensorSize: {x: 36, y: 24} 266 | m_LensShift: {x: 0, y: 0} 267 | m_NormalizedViewPortRect: 268 | serializedVersion: 2 269 | x: 0 270 | y: 0 271 | width: 1 272 | height: 1 273 | near clip plane: 0.3 274 | far clip plane: 1000 275 | field of view: 60 276 | orthographic: 0 277 | orthographic size: 5 278 | m_Depth: -1 279 | m_CullingMask: 280 | serializedVersion: 2 281 | m_Bits: 4294967295 282 | m_RenderingPath: -1 283 | m_TargetTexture: {fileID: 0} 284 | m_TargetDisplay: 0 285 | m_TargetEye: 3 286 | m_HDR: 1 287 | m_AllowMSAA: 1 288 | m_AllowDynamicResolution: 0 289 | m_ForceIntoRT: 0 290 | m_OcclusionCulling: 1 291 | m_StereoConvergence: 10 292 | m_StereoSeparation: 0.022 293 | --- !u!4 &1653750557 294 | Transform: 295 | m_ObjectHideFlags: 0 296 | m_CorrespondingSourceObject: {fileID: 0} 297 | m_PrefabInstance: {fileID: 0} 298 | m_PrefabAsset: {fileID: 0} 299 | m_GameObject: {fileID: 1653750554} 300 | serializedVersion: 2 301 | m_LocalRotation: {x: 0.10492435, y: -0.5897339, z: 0.077639915, w: 0.79697984} 302 | m_LocalPosition: {x: 7, y: 1.9, z: -2} 303 | m_LocalScale: {x: 1, y: 1, z: 1} 304 | m_ConstrainProportionsScale: 0 305 | m_Children: [] 306 | m_Father: {fileID: 0} 307 | m_LocalEulerAnglesHint: {x: 15, y: -73, z: 0} 308 | --- !u!114 &1653750558 309 | MonoBehaviour: 310 | m_ObjectHideFlags: 0 311 | m_CorrespondingSourceObject: {fileID: 0} 312 | m_PrefabInstance: {fileID: 0} 313 | m_PrefabAsset: {fileID: 0} 314 | m_GameObject: {fileID: 1653750554} 315 | m_Enabled: 1 316 | m_EditorHideFlags: 0 317 | m_Script: {fileID: 11500000, guid: a98622bd0a834508974890cb65a9e4f3, type: 3} 318 | m_Name: 319 | m_EditorClassIdentifier: 320 | FocusDistance: 3.62 321 | Aperture: 0.03 322 | --- !u!1660057539 &9223372036854775807 323 | SceneRoots: 324 | m_ObjectHideFlags: 0 325 | m_Roots: 326 | - {fileID: 1653750557} 327 | - {fileID: 695655508} 328 | - {fileID: 717223857} 329 | --------------------------------------------------------------------------------