diff --git a/.yamato/upm-ci-hdrp_dxr.yml b/.yamato/upm-ci-hdrp_dxr.yml
index 3291636df85..4402f5191ad 100644
--- a/.yamato/upm-ci-hdrp_dxr.yml
+++ b/.yamato/upm-ci-hdrp_dxr.yml
@@ -1,7 +1,7 @@
editors:
- - version: 2020.1
+ - version: 2020.1
rerun_strategy: on-new-revision
- - version: fast- 2020.1
+ - version: fast-2020.1
rerun_strategy: on-new-revision
- version: CUSTOM-REVISION
rerun_strategy: always
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/308_ScreenSpaceGlobalIllumination.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/308_ScreenSpaceGlobalIllumination.png
new file mode 100644
index 00000000000..264ee31cbd6
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/308_ScreenSpaceGlobalIllumination.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5760fbaf16589fb6feb1cc987f8871574e1db95157a5dc4e92f546ed868615d1
+size 445770
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/308_ScreenSpaceGlobalIllumination.png.meta b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/308_ScreenSpaceGlobalIllumination.png.meta
new file mode 100644
index 00000000000..0bafdfe6c80
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/308_ScreenSpaceGlobalIllumination.png.meta
@@ -0,0 +1,94 @@
+fileFormatVersion: 2
+guid: 7cb3e8ed6ebafef45b5a03f3c9ff829f
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 0
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 1
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 0
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/501_RecursiveRendering.png b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/501_RecursiveRendering.png
index 0a8bda173c7..ab6b27f3f3c 100644
--- a/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/501_RecursiveRendering.png
+++ b/TestProjects/HDRP_DXR_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/501_RecursiveRendering.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:4fcb6d155bc04372222b20f973ef94dc3c0447e9af9fb489c4bf59d522458f02
-size 164375
+oid sha256:780cee510502590a10c34e4f73057792db144c28dd6411833131917204553304
+size 164349
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/308_ScreenSpaceGlobalIllumination.unity b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/308_ScreenSpaceGlobalIllumination.unity
new file mode 100644
index 00000000000..125cb9ef5b0
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/308_ScreenSpaceGlobalIllumination.unity
@@ -0,0 +1,510 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 12
+ m_GIWorkflowMode: 1
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 0
+ m_LightmapEditorSettings:
+ serializedVersion: 12
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_ExtractAmbientOcclusion: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 512
+ m_PVRBounces: 2
+ m_PVREnvironmentSampleCount: 256
+ m_PVREnvironmentReferencePointCount: 2048
+ m_PVRFilteringMode: 1
+ m_PVRDenoiserTypeDirect: 1
+ m_PVRDenoiserTypeIndirect: 1
+ m_PVRDenoiserTypeAO: 1
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVREnvironmentMIS: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ExportTrainingData: 0
+ m_TrainingDataDestination: TrainingData
+ m_LightProbeSampleCountMultiplier: 4
+ m_LightingDataAsset: {fileID: 0}
+ m_LightingSettings: {fileID: 4890085278179872738, guid: 2220d1a7e0ac01e4890c58804f90ffcf,
+ type: 2}
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ maxJobWorkers: 0
+ preserveTilesOutsideBounds: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &101661933
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 101661935}
+ - component: {fileID: 101661934}
+ m_Layer: 0
+ m_Name: Volume
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &101661934
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 101661933}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ isGlobal: 1
+ priority: 0
+ blendDistance: 0
+ weight: 1
+ sharedProfile: {fileID: 11400000, guid: 24fdf59ac2decc247a92827f65a8e56c, type: 2}
+--- !u!4 &101661935
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 101661933}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1001 &856466313
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 6117102520564098274, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_Name
+ value: RayTracingFrameIndexDisplay
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0.048
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 0.064
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0.7071068
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: -0.7071068
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 3
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 90
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 180
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalScale.x
+ value: 0.5
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalScale.y
+ value: 0.5
+ objectReference: {fileID: 0}
+ - target: {fileID: 6117102520564098278, guid: 0c9fcf2263b163643b5bc77eddcf9135,
+ type: 3}
+ propertyPath: m_LocalScale.z
+ value: 0.5
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 0c9fcf2263b163643b5bc77eddcf9135, type: 3}
+--- !u!1 &1453285547
+GameObject:
+ m_ObjectHideFlags: 1
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1453285549}
+ - component: {fileID: 1453285548}
+ m_Layer: 0
+ m_Name: StaticLightingSky
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1453285548
+MonoBehaviour:
+ m_ObjectHideFlags: 1
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1453285547}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 441482e8936e35048a1dffac814e3ef8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Profile: {fileID: 11400000, guid: 24fdf59ac2decc247a92827f65a8e56c, type: 2}
+ m_StaticLightingSkyUniqueID: 0
+--- !u!4 &1453285549
+Transform:
+ m_ObjectHideFlags: 1
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1453285547}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1001 &1859526232
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 1132393308280272, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_Name
+ value: HDRP_Test_Camera
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 1.1530278
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 1.87
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.x
+ value: -0.002500722
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0.99832326
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.z
+ value: -0.057298686
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 0.007828522
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_RootOrder
+ value: 2
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: m_Version
+ value: 7
+ objectReference: {fileID: 0}
+ - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1
+ value: 70005818916701
+ objectReference: {fileID: 0}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: renderPipelineAsset
+ value:
+ objectReference: {fileID: 11400000, guid: 14a0f3aaa5e78a3439ec76d270471ebe,
+ type: 2}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: checkMemoryAllocation
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: ImageComparisonSettings.TargetHeight
+ value: 480
+ objectReference: {fileID: 0}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: waitFrames
+ value: 5
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+--- !u!1001 &5229108846403476070
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 3428701081926499078, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_Name
+ value: GlobalIlluminationScene
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108844755917169, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_IsActive
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108844755917182, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_Version
+ value: 11
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108845396451520, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_IsActive
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108845396451521, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_Version
+ value: 11
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108845396451521, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: useVolumetric
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108845396451521, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_ApplyRangeAttenuation
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108846346827036, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_Version
+ value: 11
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108846346827036, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: useVolumetric
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108846346827036, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_ApplyRangeAttenuation
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5229108846346827039, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_IsActive
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalPosition.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_RootOrder
+ value: 4
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 5379669199747340271, guid: 9345716ac27248541acf0f882313d4be,
+ type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: 9345716ac27248541acf0f882313d4be, type: 3}
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/308_ScreenSpaceGlobalIllumination.unity.meta b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/308_ScreenSpaceGlobalIllumination.unity.meta
new file mode 100644
index 00000000000..efff75ed327
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/308_ScreenSpaceGlobalIllumination.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: ccf33fc5169d0624c91b9116ebf44c7f
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/SSGILighting.lighting b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/SSGILighting.lighting
new file mode 100644
index 00000000000..b6d03d7e3de
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/SSGILighting.lighting
@@ -0,0 +1,63 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!850595691 &4890085278179872738
+LightingSettings:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: SSGILighting
+ serializedVersion: 2
+ m_GIWorkflowMode: 1
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 0
+ m_RealtimeEnvironmentLighting: 1
+ m_BounceScale: 1
+ m_AlbedoBoost: 1
+ m_IndirectOutputScale: 1
+ m_UsingShadowmask: 1
+ m_BakeBackend: 1
+ m_LightmapMaxSize: 1024
+ m_BakeResolution: 40
+ m_Padding: 2
+ m_TextureCompression: 1
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_ExtractAO: 0
+ m_MixedBakeMode: 2
+ m_LightmapsBakeMode: 1
+ m_FilterMode: 1
+ m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
+ m_ExportTrainingData: 0
+ m_TrainingDataDestination: TrainingData
+ m_RealtimeResolution: 2
+ m_ForceWhiteAlbedo: 0
+ m_ForceUpdates: 0
+ m_FinalGather: 0
+ m_FinalGatherRayCount: 256
+ m_FinalGatherFiltering: 1
+ m_PVRCulling: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 512
+ m_PVREnvironmentSampleCount: 256
+ m_PVREnvironmentReferencePointCount: 2048
+ m_LightProbeSampleCountMultiplier: 4
+ m_PVRBounces: 2
+ m_PVRRussianRouletteStartBounce: 2
+ m_PVREnvironmentMIS: 1
+ m_PVRFilteringMode: 1
+ m_PVRDenoiserTypeDirect: 1
+ m_PVRDenoiserTypeIndirect: 1
+ m_PVRDenoiserTypeAO: 1
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/SSGILighting.lighting.meta b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/SSGILighting.lighting.meta
new file mode 100644
index 00000000000..5ceb713bbf4
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/SSGILighting.lighting.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2220d1a7e0ac01e4890c58804f90ffcf
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/ScreenSpaceGlobalIllumination.asset b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/ScreenSpaceGlobalIllumination.asset
new file mode 100644
index 00000000000..4d7ed1734b0
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/ScreenSpaceGlobalIllumination.asset
@@ -0,0 +1,146 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &-1061456513750252976
+MonoBehaviour:
+ m_ObjectHideFlags: 3
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 0d7593b3a9277ac4696b20006c21dde2, type: 3}
+ m_Name: VisualEnvironment
+ m_EditorClassIdentifier:
+ active: 1
+ m_AdvancedMode: 0
+ skyType:
+ m_OverrideState: 1
+ m_Value: 0
+ skyAmbientMode:
+ m_OverrideState: 0
+ m_Value: 0
+ fogType:
+ m_OverrideState: 0
+ m_Value: 0
+--- !u!114 &11400000
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
+ m_Name: ScreenSpaceGlobalIllumination
+ m_EditorClassIdentifier:
+ components:
+ - {fileID: 2646528850580886815}
+ - {fileID: -1061456513750252976}
+--- !u!114 &2646528850580886815
+MonoBehaviour:
+ m_ObjectHideFlags: 3
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 42ef2681fa3dc8c4fa031f044e68c63f, type: 3}
+ m_Name: GlobalIllumination
+ m_EditorClassIdentifier:
+ active: 1
+ m_AdvancedMode: 0
+ quality:
+ m_OverrideState: 1
+ m_Value: 2
+ enable:
+ m_OverrideState: 1
+ m_Value: 1
+ depthBufferThickness:
+ m_OverrideState: 0
+ m_Value: 0.01
+ min: 0
+ max: 1
+ m_RaySteps:
+ m_OverrideState: 0
+ m_Value: 24
+ min: 16
+ max: 128
+ m_MaximalRadius:
+ m_OverrideState: 0
+ m_Value: 2
+ min: 0.01
+ max: 50
+ m_FullResolutionSS:
+ m_OverrideState: 0
+ m_Value: 1
+ m_ClampValueSS:
+ m_OverrideState: 0
+ m_Value: 2
+ min: 0.01
+ max: 10
+ m_FilterRadius:
+ m_OverrideState: 0
+ m_Value: 2
+ min: 2
+ max: 8
+ rayTracing:
+ m_OverrideState: 1
+ m_Value: 0
+ layerMask:
+ m_OverrideState: 0
+ m_Value:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ rayLength:
+ m_OverrideState: 0
+ m_Value: 10
+ min: 0.001
+ max: 50
+ clampValue:
+ m_OverrideState: 0
+ m_Value: 1
+ min: 0.001
+ max: 10
+ mode:
+ m_OverrideState: 0
+ m_Value: 2
+ fullResolution:
+ m_OverrideState: 0
+ m_Value: 0
+ upscaleRadius:
+ m_OverrideState: 0
+ m_Value: 2
+ min: 2
+ max: 4
+ sampleCount:
+ m_OverrideState: 0
+ m_Value: 1
+ min: 1
+ max: 32
+ bounceCount:
+ m_OverrideState: 0
+ m_Value: 1
+ min: 1
+ max: 31
+ denoise:
+ m_OverrideState: 1
+ m_Value: 1
+ halfResolutionDenoiser:
+ m_OverrideState: 0
+ m_Value: 0
+ denoiserRadius:
+ m_OverrideState: 0
+ m_Value: 0.6
+ min: 0.001
+ max: 1
+ secondDenoiserPass:
+ m_OverrideState: 0
+ m_Value: 0
+ secondDenoiserRadius:
+ m_OverrideState: 0
+ m_Value: 0.3
+ min: 0.001
+ max: 0.5
diff --git a/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/ScreenSpaceGlobalIllumination.asset.meta b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/ScreenSpaceGlobalIllumination.asset.meta
new file mode 100644
index 00000000000..8b18d3a083a
--- /dev/null
+++ b/TestProjects/HDRP_DXR_Tests/Assets/Scenes/GlobalIlluminationData/ScreenSpaceGlobalIllumination.asset.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 24fdf59ac2decc247a92827f65a8e56c
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset b/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset
index 3078800d4dd..4b089bf9fec 100644
--- a/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset
+++ b/TestProjects/HDRP_DXR_Tests/ProjectSettings/EditorBuildSettings.asset
@@ -56,6 +56,9 @@ EditorBuildSettings:
- enabled: 1
path: Assets/Scenes/307_GlobalIlluminationFog.unity
guid: 8a5a48512a640734394f6427d94fd0f8
+ - enabled: 0
+ path: Assets/Scenes/308_ScreenSpaceGlobalIllumination.unity
+ guid: ccf33fc5169d0624c91b9116ebf44c7f
- enabled: 1
path: Assets/Scenes/406_RayTracedShadows.unity
guid: 4aaf485f4ac39ff4e9fd997caff44abe
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/9701.renderTexture b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/9701.renderTexture
new file mode 100644
index 00000000000..a8d6e591028
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/9701.renderTexture
@@ -0,0 +1,37 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!84 &8400000
+RenderTexture:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: 9701
+ m_ImageContentsHash:
+ serializedVersion: 2
+ Hash: 00000000000000000000000000000000
+ m_ForcedFallbackFormat: 4
+ m_DownscaleFallback: 0
+ serializedVersion: 3
+ m_Width: 640
+ m_Height: 360
+ m_AntiAliasing: 1
+ m_MipCount: -1
+ m_DepthFormat: 2
+ m_ColorFormat: 8
+ m_MipMap: 0
+ m_GenerateMips: 1
+ m_SRGB: 0
+ m_UseDynamicScale: 0
+ m_BindMS: 0
+ m_EnableCompatibleFormat: 1
+ m_TextureSettings:
+ serializedVersion: 2
+ m_FilterMode: 1
+ m_Aniso: 0
+ m_MipBias: 0
+ m_WrapU: 1
+ m_WrapV: 1
+ m_WrapW: 1
+ m_Dimension: 2
+ m_VolumeDepth: 1
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/9701.renderTexture.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/9701.renderTexture.meta
new file mode 100644
index 00000000000..319de26183a
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/9701.renderTexture.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b6b9dcb98c600534fa4922b259aac581
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Outline/Outline.cs b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Outline/Outline.cs
index 78b7db9e7f1..c35eeb62945 100644
--- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Outline/Outline.cs
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Outline/Outline.cs
@@ -15,57 +15,34 @@ class Outline : CustomPass
Shader outlineShader;
Material fullscreenOutline;
- MaterialPropertyBlock outlineProperties;
- ShaderTagId[] shaderTags;
RTHandle outlineBuffer;
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
{
outlineShader = Shader.Find("Hidden/Outline");
fullscreenOutline = CoreUtils.CreateEngineMaterial(outlineShader);
- outlineProperties = new MaterialPropertyBlock();
-
- // List all the materials that will be replaced in the frame
- shaderTags = new ShaderTagId[3]
- {
- new ShaderTagId("Forward"),
- new ShaderTagId("ForwardOnly"),
- new ShaderTagId("SRPDefaultUnlit"),
- };
outlineBuffer = RTHandles.Alloc(
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
- colorFormat: GraphicsFormat.B10G11R11_UFloatPack32,
+ colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, // We don't need alpha for this effect
useDynamicScale: true, name: "Outline Buffer"
);
}
- void DrawOutlineMeshes(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
+ protected override void Execute(CustomPassContext ctx)
{
- var result = new RendererListDesc(shaderTags, cullingResult, hdCamera.camera)
- {
- // We need the lighting render configuration to support rendering lit objects
- rendererConfiguration = PerObjectData.LightProbe | PerObjectData.LightProbeProxyVolume | PerObjectData.Lightmaps,
- renderQueueRange = RenderQueueRange.all,
- sortingCriteria = SortingCriteria.BackToFront,
- excludeObjectMotionVectors = false,
- layerMask = outlineLayer,
- };
-
- CoreUtils.SetRenderTarget(cmd, outlineBuffer, ClearFlag.Color);
- HDUtils.DrawRendererList(renderContext, cmd, RendererList.Create(result));
- }
-
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera camera, CullingResults cullingResult)
- {
- DrawOutlineMeshes(renderContext, cmd, camera, cullingResult);
-
- SetCameraRenderTarget(cmd);
-
- outlineProperties.SetColor("_OutlineColor", outlineColor);
- outlineProperties.SetTexture("_OutlineBuffer", outlineBuffer);
- outlineProperties.SetFloat("_Threshold", threshold);
- CoreUtils.DrawFullScreen(cmd, fullscreenOutline, outlineProperties, shaderPassId: 0);
+ // Render meshes we want to outline in the outline buffer
+ CoreUtils.SetRenderTarget(ctx.cmd, outlineBuffer, ClearFlag.Color);
+ CustomPassUtils.DrawRenderers(ctx, outlineLayer);
+
+ // Setup outline effect properties
+ ctx.propertyBlock.SetColor("_OutlineColor", outlineColor);
+ ctx.propertyBlock.SetTexture("_OutlineBuffer", outlineBuffer);
+ ctx.propertyBlock.SetFloat("_Threshold", threshold);
+
+ // Render the outline as a fullscreen alpha-blended pass on top of the camera color
+ CoreUtils.SetRenderTarget(ctx.cmd, ctx.cameraColorBuffer, ClearFlag.None);
+ CoreUtils.DrawFullScreen(ctx.cmd, fullscreenOutline, ctx.propertyBlock, shaderPassId: 0);
}
protected override void Cleanup()
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Unlit.mat b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Unlit.mat
new file mode 100644
index 00000000000..fdf08e1db0b
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Unlit.mat
@@ -0,0 +1,267 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &-1541268656524681272
+MonoBehaviour:
+ m_ObjectHideFlags: 11
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ version: 3
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: Unlit
+ m_Shader: {fileID: 4800000, guid: c4edd00ff2db5b24391a4fcb1762e459, type: 3}
+ m_ShaderKeywords: _DISABLE_SSR_TRANSPARENT _NORMALMAP_TANGENT_SPACE
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: 2000
+ stringTagMap: {}
+ disabledShaderPasses:
+ - DistortionVectors
+ - MOTIONVECTORS
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - _AnisotropyMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BaseColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BentNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BentNormalMapOS:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _CoatMaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DistortionVectorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissiveColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _HeightMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _IridescenceMaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _IridescenceThicknessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NormalMapOS:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SubsurfaceMaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _TangentMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _TangentMapOS:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ThicknessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _TransmittanceColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _UnlitColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - _AORemapMax: 1
+ - _AORemapMin: 0
+ - _ATDistance: 1
+ - _AddPrecomputedVelocity: 0
+ - _AlbedoAffectEmissive: 0
+ - _AlphaCutoff: 0.5
+ - _AlphaCutoffEnable: 0
+ - _AlphaCutoffPostpass: 0.5
+ - _AlphaCutoffPrepass: 0.5
+ - _AlphaCutoffShadow: 0.5
+ - _AlphaDstBlend: 0
+ - _AlphaSrcBlend: 1
+ - _Anisotropy: 0
+ - _BlendMode: 0
+ - _CoatMask: 0
+ - _CullMode: 2
+ - _CullModeForward: 2
+ - _Cutoff: 0.5
+ - _DepthOffsetEnable: 0
+ - _DetailAlbedoScale: 1
+ - _DetailNormalScale: 1
+ - _DetailSmoothnessScale: 1
+ - _DiffusionProfile: 0
+ - _DiffusionProfileHash: 0
+ - _DisplacementLockObjectScale: 1
+ - _DisplacementLockTilingScale: 1
+ - _DisplacementMode: 0
+ - _DistortionBlendMode: 0
+ - _DistortionBlurBlendMode: 0
+ - _DistortionBlurDstBlend: 1
+ - _DistortionBlurRemapMax: 1
+ - _DistortionBlurRemapMin: 0
+ - _DistortionBlurScale: 1
+ - _DistortionBlurSrcBlend: 1
+ - _DistortionDepthTest: 1
+ - _DistortionDstBlend: 1
+ - _DistortionEnable: 0
+ - _DistortionOnly: 0
+ - _DistortionScale: 1
+ - _DistortionSrcBlend: 1
+ - _DistortionVectorBias: -1
+ - _DistortionVectorScale: 2
+ - _DoubleSidedEnable: 0
+ - _DoubleSidedNormalMode: 1
+ - _DstBlend: 0
+ - _EmissiveColorMode: 1
+ - _EmissiveExposureWeight: 1
+ - _EmissiveIntensity: 1
+ - _EmissiveIntensityUnit: 0
+ - _EnableBlendModePreserveSpecularLighting: 1
+ - _EnableFogOnTransparent: 1
+ - _EnableGeometricSpecularAA: 0
+ - _EnergyConservingSpecularColor: 1
+ - _HeightAmplitude: 0.02
+ - _HeightCenter: 0.5
+ - _HeightMapParametrization: 0
+ - _HeightMax: 1
+ - _HeightMin: -1
+ - _HeightOffset: 0
+ - _HeightPoMAmplitude: 2
+ - _HeightTessAmplitude: 2
+ - _HeightTessCenter: 0.5
+ - _IncludeIndirectLighting: 1
+ - _InvTilingScale: 1
+ - _Ior: 1.5
+ - _IridescenceMask: 1
+ - _IridescenceThickness: 1
+ - _LinkDetailsWithBase: 1
+ - _MaterialID: 1
+ - _Metallic: 0
+ - _NormalMapSpace: 0
+ - _NormalScale: 1
+ - _PPDLodThreshold: 5
+ - _PPDMaxSamples: 15
+ - _PPDMinSamples: 5
+ - _PPDPrimitiveLength: 1
+ - _PPDPrimitiveWidth: 1
+ - _RayTracing: 0
+ - _ReceivesSSR: 1
+ - _ReceivesSSRTransparent: 0
+ - _RefractionModel: 0
+ - _SSRefractionProjectionModel: 0
+ - _Smoothness: 0.5
+ - _SmoothnessRemapMax: 1
+ - _SmoothnessRemapMin: 0
+ - _SpecularAAScreenSpaceVariance: 0.1
+ - _SpecularAAThreshold: 0.2
+ - _SpecularOcclusionMode: 1
+ - _SrcBlend: 1
+ - _StencilRef: 0
+ - _StencilRefDepth: 0
+ - _StencilRefDistortionVec: 4
+ - _StencilRefGBuffer: 10
+ - _StencilRefMV: 32
+ - _StencilWriteMask: 6
+ - _StencilWriteMaskDepth: 8
+ - _StencilWriteMaskDistortionVec: 4
+ - _StencilWriteMaskGBuffer: 14
+ - _StencilWriteMaskMV: 40
+ - _SubsurfaceMask: 1
+ - _SupportDecals: 1
+ - _SurfaceType: 0
+ - _TexWorldScale: 1
+ - _TexWorldScaleEmissive: 1
+ - _Thickness: 1
+ - _TransmissionEnable: 1
+ - _TransparentBackfaceEnable: 0
+ - _TransparentCullMode: 2
+ - _TransparentDepthPostpassEnable: 0
+ - _TransparentDepthPrepassEnable: 0
+ - _TransparentSortPriority: 0
+ - _TransparentWritingMotionVec: 0
+ - _TransparentZWrite: 0
+ - _UVBase: 0
+ - _UVDetail: 0
+ - _UVEmissive: 0
+ - _UseEmissiveIntensity: 0
+ - _UseShadowThreshold: 0
+ - _ZTestDepthEqualForOpaque: 3
+ - _ZTestGBuffer: 4
+ - _ZTestModeDistortion: 4
+ - _ZTestTransparent: 4
+ - _ZWrite: 1
+ m_Colors:
+ - _BaseColor: {r: 1, g: 1, b: 1, a: 1}
+ - _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
+ - _Color: {r: 0, g: 0, b: 0, a: 1}
+ - _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
+ - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
+ - _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
+ - _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
+ - _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
+ - _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
+ - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
+ - _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
+ - _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
+ - _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
+ - _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
+ - _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
+ - _UnlitColor: {r: 1, g: 0, b: 0, a: 1}
+ m_BuildTextureStacks: []
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Unlit.mat.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Unlit.mat.meta
new file mode 100644
index 00000000000..6dbb717a5e7
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/Unlit.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 3519774ed36188e44b17adb192f1a441
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/WriteNormals.cs b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/WriteNormals.cs
index 69e35f35d3f..9ce04f7a1db 100644
--- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/WriteNormals.cs
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen/WriteNormals.cs
@@ -11,10 +11,9 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff
{
}
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
+ protected override void Execute(CustomPassContext ctx)
{
- var normal = GetNormalBuffer();
- HDUtils.DrawFullScreen(cmd, material, normal);
+ HDUtils.DrawFullScreen(ctx.cmd, material, ctx.cameraNormalBuffer);
}
protected override void Cleanup()
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.meta
new file mode 100644
index 00000000000..3994eeba5fa
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: f0c7485bfce378041b1a208d86d55875
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.unity
new file mode 100644
index 00000000000..c35cfcf33b8
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.unity
@@ -0,0 +1,2205 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!29 &1
+OcclusionCullingSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_OcclusionBakeSettings:
+ smallestOccluder: 5
+ smallestHole: 0.25
+ backfaceThreshold: 100
+ m_SceneGUID: 00000000000000000000000000000000
+ m_OcclusionCullingData: {fileID: 0}
+--- !u!104 &2
+RenderSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 9
+ m_Fog: 0
+ m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
+ m_FogMode: 3
+ m_FogDensity: 0.01
+ m_LinearFogStart: 0
+ m_LinearFogEnd: 300
+ m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
+ m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
+ m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
+ m_AmbientIntensity: 1
+ m_AmbientMode: 0
+ m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
+ m_SkyboxMaterial: {fileID: 0}
+ m_HaloStrength: 0.5
+ m_FlareStrength: 1
+ m_FlareFadeSpeed: 3
+ m_HaloTexture: {fileID: 0}
+ m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
+ m_DefaultReflectionMode: 0
+ m_DefaultReflectionResolution: 128
+ m_ReflectionBounces: 1
+ m_ReflectionIntensity: 1
+ m_CustomReflection: {fileID: 0}
+ m_Sun: {fileID: 0}
+ m_IndirectSpecularColor: {r: 0.04969687, g: 0.06986856, b: 0.109084845, a: 1}
+ m_UseRadianceAmbientProbe: 0
+--- !u!157 &3
+LightmapSettings:
+ m_ObjectHideFlags: 0
+ serializedVersion: 12
+ m_GIWorkflowMode: 1
+ m_GISettings:
+ serializedVersion: 2
+ m_BounceScale: 1
+ m_IndirectOutputScale: 1
+ m_AlbedoBoost: 1
+ m_EnvironmentLightingMode: 0
+ m_EnableBakedLightmaps: 1
+ m_EnableRealtimeLightmaps: 1
+ m_LightmapEditorSettings:
+ serializedVersion: 12
+ m_Resolution: 2
+ m_BakeResolution: 40
+ m_AtlasSize: 1024
+ m_AO: 0
+ m_AOMaxDistance: 1
+ m_CompAOExponent: 1
+ m_CompAOExponentDirect: 0
+ m_ExtractAmbientOcclusion: 0
+ m_Padding: 2
+ m_LightmapParameters: {fileID: 0}
+ m_LightmapsBakeMode: 1
+ m_TextureCompression: 1
+ m_FinalGather: 0
+ m_FinalGatherFiltering: 1
+ m_FinalGatherRayCount: 256
+ m_ReflectionCompression: 2
+ m_MixedBakeMode: 2
+ m_BakeBackend: 1
+ m_PVRSampling: 1
+ m_PVRDirectSampleCount: 32
+ m_PVRSampleCount: 512
+ m_PVRBounces: 2
+ m_PVREnvironmentSampleCount: 256
+ m_PVREnvironmentReferencePointCount: 2048
+ m_PVRFilteringMode: 1
+ m_PVRDenoiserTypeDirect: 1
+ m_PVRDenoiserTypeIndirect: 1
+ m_PVRDenoiserTypeAO: 1
+ m_PVRFilterTypeDirect: 0
+ m_PVRFilterTypeIndirect: 0
+ m_PVRFilterTypeAO: 0
+ m_PVREnvironmentMIS: 1
+ m_PVRCulling: 1
+ m_PVRFilteringGaussRadiusDirect: 1
+ m_PVRFilteringGaussRadiusIndirect: 5
+ m_PVRFilteringGaussRadiusAO: 2
+ m_PVRFilteringAtrousPositionSigmaDirect: 0.5
+ m_PVRFilteringAtrousPositionSigmaIndirect: 2
+ m_PVRFilteringAtrousPositionSigmaAO: 1
+ m_ExportTrainingData: 0
+ m_TrainingDataDestination: TrainingData
+ m_LightProbeSampleCountMultiplier: 4
+ m_LightingDataAsset: {fileID: 0}
+ m_LightingSettings: {fileID: 4890085278179872738, guid: dcc90465ec47fe341a09e00fd8b93edf,
+ type: 2}
+--- !u!196 &4
+NavMeshSettings:
+ serializedVersion: 2
+ m_ObjectHideFlags: 0
+ m_BuildSettings:
+ serializedVersion: 2
+ agentTypeID: 0
+ agentRadius: 0.5
+ agentHeight: 2
+ agentSlope: 45
+ agentClimb: 0.4
+ ledgeDropHeight: 0
+ maxJumpAcrossDistance: 0
+ minRegionArea: 2
+ manualCellSize: 0
+ cellSize: 0.16666667
+ manualTileSize: 0
+ tileSize: 256
+ accuratePlacement: 0
+ maxJobWorkers: 0
+ preserveTilesOutsideBounds: 0
+ debug:
+ m_Flags: 0
+ m_NavMeshData: {fileID: 0}
+--- !u!1 &21651893
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 21651896}
+ - component: {fileID: 21651895}
+ - component: {fileID: 21651894}
+ m_Layer: 0
+ m_Name: Directional Light
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &21651894
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 21651893}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Version: 10
+ m_ObsoleteShadowResolutionTier: 1
+ m_ObsoleteUseShadowQualitySettings: 0
+ m_ObsoleteCustomShadowResolution: 512
+ m_ObsoleteContactShadows: 0
+ m_PointlightHDType: 0
+ m_SpotLightShape: 0
+ m_AreaLightShape: 0
+ m_Intensity: 3.1415927
+ m_EnableSpotReflector: 0
+ m_LuxAtDistance: 1
+ m_InnerSpotPercent: 0
+ m_LightDimmer: 1
+ m_VolumetricDimmer: 1
+ m_LightUnit: 2
+ m_FadeDistance: 10000
+ m_AffectDiffuse: 1
+ m_AffectSpecular: 1
+ m_NonLightmappedOnly: 0
+ m_ShapeWidth: 0.5
+ m_ShapeHeight: 0.5
+ m_AspectRatio: 1
+ m_ShapeRadius: 0.025
+ m_SoftnessScale: 1
+ m_UseCustomSpotLightShadowCone: 0
+ m_CustomSpotLightShadowCone: 30
+ m_MaxSmoothness: 0.99
+ m_ApplyRangeAttenuation: 1
+ m_DisplayAreaLightEmissiveMesh: 0
+ m_AreaLightCookie: {fileID: 0}
+ m_AreaLightShadowCone: 120
+ m_UseScreenSpaceShadows: 0
+ m_InteractsWithSky: 1
+ m_AngularDiameter: 0.5
+ m_FlareSize: 2
+ m_FlareTint: {r: 1, g: 1, b: 1, a: 1}
+ m_FlareFalloff: 4
+ m_SurfaceTexture: {fileID: 0}
+ m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1}
+ m_Distance: 1.5e+11
+ m_UseRayTracedShadows: 0
+ m_NumRayTracingSamples: 4
+ m_FilterTracedShadow: 1
+ m_FilterSizeTraced: 16
+ m_SunLightConeAngle: 0.5
+ m_LightShadowRadius: 0.5
+ m_SemiTransparentShadow: 0
+ m_ColorShadow: 1
+ m_DistanceBasedFiltering: 0
+ m_EvsmExponent: 15
+ m_EvsmLightLeakBias: 0
+ m_EvsmVarianceBias: 0.00001
+ m_EvsmBlurPasses: 0
+ m_LightlayersMask: 1
+ m_LinkShadowLayers: 1
+ m_ShadowNearPlane: 0.1
+ m_BlockerSampleCount: 24
+ m_FilterSampleCount: 16
+ m_MinFilterSize: 0.1
+ m_KernelSize: 5
+ m_LightAngle: 1
+ m_MaxDepthBias: 0.001
+ m_ShadowResolution:
+ m_Override: 512
+ m_UseOverride: 1
+ m_Level: 0
+ m_ShadowDimmer: 1
+ m_VolumetricShadowDimmer: 1
+ m_ShadowFadeDistance: 10000
+ m_UseContactShadow:
+ m_Override: 0
+ m_UseOverride: 1
+ m_Level: 0
+ m_RayTracedContactShadow: 0
+ m_ShadowTint: {r: 0, g: 0, b: 0, a: 1}
+ m_PenumbraTint: 0
+ m_NormalBias: 0.75
+ m_SlopeBias: 0.5
+ m_ShadowUpdateMode: 0
+ m_BarnDoorAngle: 90
+ m_BarnDoorLength: 0.05
+ m_ShadowCascadeRatios:
+ - 0.05
+ - 0.2
+ - 0.3
+ m_ShadowCascadeBorders:
+ - 0.2
+ - 0.2
+ - 0.2
+ - 0.2
+ m_ShadowAlgorithm: 0
+ m_ShadowVariant: 0
+ m_ShadowPrecision: 0
+ useOldInspector: 0
+ useVolumetric: 1
+ featuresFoldout: 1
+ showAdditionalSettings: 0
+ m_AreaLightEmissiveMeshShadowCastingMode: 0
+ m_AreaLightEmissiveMeshMotionVectorGenerationMode: 0
+--- !u!108 &21651895
+Light:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 21651893}
+ m_Enabled: 1
+ serializedVersion: 10
+ m_Type: 1
+ m_Shape: 0
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_Intensity: 3.1415927
+ m_Range: 10
+ m_SpotAngle: 30
+ m_InnerSpotAngle: 21.80208
+ m_CookieSize: 10
+ m_Shadows:
+ m_Type: 0
+ m_Resolution: -1
+ m_CustomResolution: -1
+ m_Strength: 1
+ m_Bias: 0.05
+ m_NormalBias: 0.4
+ m_NearPlane: 0.2
+ m_CullingMatrixOverride:
+ e00: 1
+ e01: 0
+ e02: 0
+ e03: 0
+ e10: 0
+ e11: 1
+ e12: 0
+ e13: 0
+ e20: 0
+ e21: 0
+ e22: 1
+ e23: 0
+ e30: 0
+ e31: 0
+ e32: 0
+ e33: 1
+ m_UseCullingMatrixOverride: 0
+ m_Cookie: {fileID: 0}
+ m_DrawHalo: 0
+ m_Flare: {fileID: 0}
+ m_RenderMode: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingLayerMask: 1
+ m_Lightmapping: 4
+ m_LightShadowCasterMode: 2
+ m_AreaSize: {x: 1, y: 1}
+ m_BounceIntensity: 1
+ m_ColorTemperature: 6570
+ m_UseColorTemperature: 0
+ m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
+ m_UseBoundingSphereOverride: 0
+ m_ShadowRadius: 0
+ m_ShadowAngle: 0
+--- !u!4 &21651896
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 21651893}
+ m_LocalRotation: {x: 0.20132819, y: -0.19256037, z: 0.21085635, w: 0.93697757}
+ m_LocalPosition: {x: -66.727, y: 0.028490186, z: 0.49772072}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 27.289, y: -18.09, z: 20.939}
+--- !u!1 &64242708
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 64242709}
+ m_Layer: 0
+ m_Name: BlurPass
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &64242709
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 64242708}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -70.5, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1795749611}
+ - {fileID: 181213261}
+ - {fileID: 995342285}
+ - {fileID: 1289910855}
+ m_Father: {fileID: 0}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1001 &65093927
+PrefabInstance:
+ m_ObjectHideFlags: 0
+ serializedVersion: 2
+ m_Modification:
+ m_TransformParent: {fileID: 0}
+ m_Modifications:
+ - target: {fileID: 1132393308280272, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_Name
+ value: HDRP_Test_Camera
+ objectReference: {fileID: 0}
+ - target: {fileID: 1132393308280272, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_IsActive
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalPosition.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalPosition.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalPosition.z
+ value: -200
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalRotation.w
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_RootOrder
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.x
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.y
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+ propertyPath: m_LocalEulerAnglesHint.z
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: m_projectionMatrixMode
+ value: 2
+ objectReference: {fileID: 0}
+ - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: field of view
+ value: 26.991467
+ objectReference: {fileID: 0}
+ - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: m_Version
+ value: 7
+ objectReference: {fileID: 0}
+ - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1
+ value: 70005818916701
+ objectReference: {fileID: 0}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.size
+ value: 0
+ objectReference: {fileID: 0}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
+ value: 1
+ objectReference: {fileID: 0}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
+ value: 2
+ objectReference: {fileID: 0}
+ - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ propertyPath: checkMemoryAllocation
+ value: 1
+ objectReference: {fileID: 0}
+ m_RemovedComponents: []
+ m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3}
+--- !u!4 &65093928 stripped
+Transform:
+ m_CorrespondingSourceObject: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ m_PrefabInstance: {fileID: 65093927}
+ m_PrefabAsset: {fileID: 0}
+--- !u!20 &65093929 stripped
+Camera:
+ m_CorrespondingSourceObject: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7,
+ type: 3}
+ m_PrefabInstance: {fileID: 65093927}
+ m_PrefabAsset: {fileID: 0}
+--- !u!1 &179283798
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 179283799}
+ m_Layer: 0
+ m_Name: OtherFullscreen
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &179283799
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 179283798}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -70.5, y: 84.75, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1612872288}
+ - {fileID: 2044874742}
+ - {fileID: 1006754252}
+ - {fileID: 1262988724}
+ m_Father: {fileID: 0}
+ m_RootOrder: 4
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &181213260
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 181213261}
+ - component: {fileID: 181213263}
+ - component: {fileID: 181213262}
+ m_Layer: 0
+ m_Name: New Text
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &181213261
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 181213260}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -7.77, y: -4.45, z: 9.68}
+ m_LocalScale: {x: 0.09001844, y: 0.09001844, z: 0.09001844}
+ m_Children: []
+ m_Father: {fileID: 64242709}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!102 &181213262
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 181213260}
+ m_Text: Blur (Downsample + VBlur + HBlur)
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 111
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &181213263
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 181213260}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!1 &211598673
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 211598674}
+ m_Layer: 0
+ m_Name: DrawFromCamera
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 0
+--- !u!4 &211598674
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 211598673}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -110.25, y: 84.75, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 1796147642}
+ - {fileID: 2026715368}
+ - {fileID: 1007981418}
+ - {fileID: 1264929867}
+ m_Father: {fileID: 0}
+ m_RootOrder: 5
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &247597907
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 247597908}
+ - component: {fileID: 247597911}
+ - component: {fileID: 247597910}
+ - component: {fileID: 247597909}
+ m_Layer: 0
+ m_Name: Canvas
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &247597908
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247597907}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 8.9}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children:
+ - {fileID: 503088924}
+ m_Father: {fileID: 65093928}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0, y: 0}
+ m_AnchorMax: {x: 0, y: 0}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 2, y: 2}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &247597909
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247597907}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_IgnoreReversedGraphics: 1
+ m_BlockingObjects: 0
+ m_BlockingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+--- !u!114 &247597910
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247597907}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_UiScaleMode: 0
+ m_ReferencePixelsPerUnit: 100
+ m_ScaleFactor: 1
+ m_ReferenceResolution: {x: 800, y: 600}
+ m_ScreenMatchMode: 0
+ m_MatchWidthOrHeight: 0
+ m_PhysicalUnit: 3
+ m_FallbackScreenDPI: 96
+ m_DefaultSpriteDPI: 96
+ m_DynamicPixelsPerUnit: 1
+--- !u!223 &247597911
+Canvas:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 247597907}
+ m_Enabled: 1
+ serializedVersion: 3
+ m_RenderMode: 2
+ m_Camera: {fileID: 65093929}
+ m_PlaneDistance: 100
+ m_PixelPerfect: 0
+ m_ReceivesEvents: 1
+ m_OverrideSorting: 0
+ m_OverridePixelPerfect: 0
+ m_SortingBucketNormalizedSize: 0
+ m_AdditionalShaderChannelsFlag: 0
+ m_SortingLayerID: 0
+ m_SortingOrder: 0
+ m_TargetDisplay: 0
+--- !u!1 &338225181
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 338225182}
+ - component: {fileID: 338225184}
+ - component: {fileID: 338225183}
+ m_Layer: 0
+ m_Name: EventSystem
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &338225182
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 338225181}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 200}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 65093928}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &338225183
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 338225181}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_HorizontalAxis: Horizontal
+ m_VerticalAxis: Vertical
+ m_SubmitButton: Submit
+ m_CancelButton: Cancel
+ m_InputActionsPerSecond: 10
+ m_RepeatDelay: 0.5
+ m_ForceModuleActive: 0
+--- !u!114 &338225184
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 338225181}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_FirstSelected: {fileID: 0}
+ m_sendNavigationEvents: 1
+ m_DragThreshold: 10
+--- !u!1 &503088923
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 503088924}
+ - component: {fileID: 503088926}
+ - component: {fileID: 503088925}
+ m_Layer: 0
+ m_Name: RawImage
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!224 &503088924
+RectTransform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 503088923}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 247597908}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+ m_AnchorMin: {x: 0.5, y: 0.5}
+ m_AnchorMax: {x: 0.5, y: 0.5}
+ m_AnchoredPosition: {x: 0, y: 0}
+ m_SizeDelta: {x: 6.4, y: 3.6}
+ m_Pivot: {x: 0.5, y: 0.5}
+--- !u!114 &503088925
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 503088923}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Material: {fileID: 0}
+ m_Color: {r: 1, g: 1, b: 1, a: 1}
+ m_RaycastTarget: 1
+ m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+ m_Maskable: 1
+ m_OnCullStateChanged:
+ m_PersistentCalls:
+ m_Calls: []
+ m_Texture: {fileID: 8400000, guid: 94f05850b7f1d654b8127a229aec2c3a, type: 2}
+ m_UVRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 1
+ height: 1
+--- !u!222 &503088926
+CanvasRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 503088923}
+ m_CullTransparentMesh: 0
+--- !u!1 &995342284
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 995342285}
+ - component: {fileID: 995342287}
+ - component: {fileID: 995342286}
+ m_Layer: 0
+ m_Name: Custom Pass
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &995342285
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 995342284}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 64242709}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &995342286
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 995342284}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Size: {x: 1, y: 1, z: 1}
+ m_Center: {x: 0, y: 0, z: 0}
+--- !u!114 &995342287
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 995342284}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 26d6499a6bd256e47b859377446493a1, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ isGlobal: 0
+ fadeRadius: 0
+ priority: 0
+ customPasses:
+ - id: 0
+ injectionPoint: 1
+ references:
+ version: 1
+ 00000000:
+ type: {class: Blur, ns: , asm: Assembly-CSharp}
+ data:
+ m_Name: Blur
+ enabled: 1
+ targetColorBuffer: 0
+ targetDepthBuffer: 0
+ clearFlags: 0
+ passFoldout: 0
+ m_Version: 0
+--- !u!1 &1006754251
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1006754252}
+ - component: {fileID: 1006754254}
+ - component: {fileID: 1006754253}
+ m_Layer: 0
+ m_Name: New Text (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1006754252
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1006754251}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: -4.42, z: 9.68}
+ m_LocalScale: {x: 0.09001844, y: 0.09001844, z: 0.09001844}
+ m_Children: []
+ m_Father: {fileID: 179283799}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!102 &1006754253
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1006754251}
+ m_Text: Copy
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 111
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &1006754254
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1006754251}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!1 &1007981417
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1007981418}
+ - component: {fileID: 1007981420}
+ - component: {fileID: 1007981419}
+ m_Layer: 0
+ m_Name: New Text (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1007981418
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1007981417}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: -4.42, z: 9.68}
+ m_LocalScale: {x: 0.09001844, y: 0.09001844, z: 0.09001844}
+ m_Children: []
+ m_Father: {fileID: 211598674}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!102 &1007981419
+TextMesh:
+ serializedVersion: 3
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1007981417}
+ m_Text: Copy
+ m_OffsetZ: 0
+ m_CharacterSize: 1
+ m_LineSpacing: 1
+ m_Anchor: 0
+ m_Alignment: 0
+ m_TabSize: 4
+ m_FontSize: 111
+ m_FontStyle: 0
+ m_RichText: 1
+ m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+ m_Color:
+ serializedVersion: 2
+ rgba: 4294967295
+--- !u!23 &1007981420
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1007981417}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!1 &1262988723
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1262988724}
+ - component: {fileID: 1262988726}
+ - component: {fileID: 1262988725}
+ m_Layer: 0
+ m_Name: Custom Pass
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1262988724
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1262988723}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 179283799}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &1262988725
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1262988723}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Size: {x: 1, y: 1, z: 1}
+ m_Center: {x: 0, y: 0, z: 0}
+--- !u!114 &1262988726
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1262988723}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 26d6499a6bd256e47b859377446493a1, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ isGlobal: 0
+ fadeRadius: 0
+ priority: 0
+ customPasses:
+ - id: 0
+ injectionPoint: 1
+ references:
+ version: 1
+ 00000000:
+ type: {class: Copy, ns: , asm: Assembly-CSharp}
+ data:
+ m_Name: CustomCopy
+ enabled: 1
+ targetColorBuffer: 0
+ targetDepthBuffer: 0
+ clearFlags: 0
+ passFoldout: 0
+ m_Version: 0
+--- !u!1 &1264929866
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1264929867}
+ - component: {fileID: 1264929869}
+ - component: {fileID: 1264929868}
+ m_Layer: 0
+ m_Name: Custom Pass
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1264929867
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1264929866}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 211598674}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!65 &1264929868
+BoxCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1264929866}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 2
+ m_Size: {x: 1, y: 1, z: 1}
+ m_Center: {x: 0, y: 0, z: 0}
+--- !u!114 &1264929869
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1264929866}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 26d6499a6bd256e47b859377446493a1, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ isGlobal: 0
+ fadeRadius: 0
+ priority: 0
+ customPasses: []
+ injectionPoint: 1
+ references:
+ version: 1
+--- !u!1 &1289910854
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1289910855}
+ - component: {fileID: 1289910858}
+ - component: {fileID: 1289910857}
+ - component: {fileID: 1289910856}
+ m_Layer: 0
+ m_Name: Quad
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1289910855
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1289910854}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 1.1}
+ m_LocalScale: {x: 2.2141, y: 1.2662, z: 1}
+ m_Children: []
+ m_Father: {fileID: 64242709}
+ m_RootOrder: 3
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!64 &1289910856
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1289910854}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 4
+ m_Convex: 0
+ m_CookingOptions: 30
+ m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!23 &1289910857
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1289910854}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: 935f43c84f10daf409aa21b21e2b8b34, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &1289910858
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1289910854}
+ m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &1551760950
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1551760953}
+ - component: {fileID: 1551760952}
+ - component: {fileID: 1551760951}
+ m_Layer: 0
+ m_Name: Scene Settings
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!114 &1551760951
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1551760950}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 441482e8936e35048a1dffac814e3ef8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Profile: {fileID: 11400000, guid: 864689173ea47a14399cb0eb9a1d6e0e, type: 2}
+ m_StaticLightingSkyUniqueID: 2
+--- !u!114 &1551760952
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1551760950}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ isGlobal: 1
+ priority: 0
+ blendDistance: 0
+ weight: 1
+ sharedProfile: {fileID: 11400000, guid: 9ad9379fd70197f448fb2f184be74226, type: 2}
+--- !u!4 &1551760953
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1551760950}
+ m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+ m_LocalPosition: {x: -0.87, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 0}
+ m_RootOrder: 2
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &1612872287
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1612872288}
+ - component: {fileID: 1612872291}
+ - component: {fileID: 1612872289}
+ m_Layer: 0
+ m_Name: Camera
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1612872288
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1612872287}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 179283799}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &1612872289
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1612872287}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Version: 7
+ m_ObsoleteRenderingPath: 0
+ m_ObsoleteFrameSettings:
+ overrides: 0
+ enableShadow: 0
+ enableContactShadows: 0
+ enableShadowMask: 0
+ enableSSR: 0
+ enableSSAO: 0
+ enableSubsurfaceScattering: 0
+ enableTransmission: 0
+ enableAtmosphericScattering: 0
+ enableVolumetrics: 0
+ enableReprojectionForVolumetrics: 0
+ enableLightLayers: 0
+ enableExposureControl: 1
+ diffuseGlobalDimmer: 0
+ specularGlobalDimmer: 0
+ shaderLitMode: 0
+ enableDepthPrepassWithDeferredRendering: 0
+ enableTransparentPrepass: 0
+ enableMotionVectors: 0
+ enableObjectMotionVectors: 0
+ enableDecals: 0
+ enableRoughRefraction: 0
+ enableTransparentPostpass: 0
+ enableDistortion: 0
+ enablePostprocess: 0
+ enableOpaqueObjects: 0
+ enableTransparentObjects: 0
+ enableRealtimePlanarReflection: 0
+ enableMSAA: 0
+ enableAsyncCompute: 0
+ runLightListAsync: 0
+ runSSRAsync: 0
+ runSSAOAsync: 0
+ runContactShadowsAsync: 0
+ runVolumeVoxelizationAsync: 0
+ lightLoopSettings:
+ overrides: 0
+ enableDeferredTileAndCluster: 0
+ enableComputeLightEvaluation: 0
+ enableComputeLightVariants: 0
+ enableComputeMaterialVariants: 0
+ enableFptlForForwardOpaque: 0
+ enableBigTilePrepass: 0
+ isFptlEnabled: 0
+ clearColorMode: 0
+ backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
+ clearDepth: 1
+ volumeLayerMask:
+ serializedVersion: 2
+ m_Bits: 1
+ volumeAnchorOverride: {fileID: 0}
+ antialiasing: 0
+ SMAAQuality: 2
+ dithering: 0
+ stopNaNs: 0
+ taaSharpenStrength: 0.6
+ TAAQuality: 1
+ taaHistorySharpening: 0.35
+ taaAntiFlicker: 0.5
+ taaMotionVectorRejection: 0
+ taaAntiHistoryRinging: 0
+ physicalParameters:
+ m_Iso: 200
+ m_ShutterSpeed: 0.005
+ m_Aperture: 16
+ m_BladeCount: 5
+ m_Curvature: {x: 2, y: 11}
+ m_BarrelClipping: 0.25
+ m_Anamorphism: 0
+ flipYMode: 0
+ xrRendering: 1
+ fullscreenPassthrough: 0
+ allowDynamicResolution: 0
+ customRenderingSettings: 0
+ invertFaceCulling: 0
+ probeLayerMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ hasPersistentHistory: 0
+ m_RenderingPathCustomFrameSettings:
+ bitDatas:
+ data1: 70297877217101
+ data2: 4539628425463136256
+ lodBias: 1
+ lodBiasMode: 0
+ lodBiasQualityLevel: 0
+ maximumLODLevel: 0
+ maximumLODLevelMode: 0
+ maximumLODLevelQualityLevel: 0
+ sssQualityMode: 0
+ sssQualityLevel: 0
+ sssCustomSampleBudget: 20
+ materialQuality: 0
+ renderingPathCustomFrameSettingsOverrideMask:
+ mask:
+ data1: 0
+ data2: 0
+ defaultFrameSettings: 0
+--- !u!20 &1612872291
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1612872287}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_GateFitMode: 2
+ m_FOVAxisMode: 0
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_FocalLength: 50
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0.5
+ y: 0
+ width: 0.5
+ height: 0.5
+ near clip plane: 0.3
+ far clip plane: 50
+ field of view: 60
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 8400000, guid: 94f05850b7f1d654b8127a229aec2c3a, type: 2}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 0
+ m_AllowMSAA: 0
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!1 &1795749610
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1795749611}
+ - component: {fileID: 1795749614}
+ - component: {fileID: 1795749612}
+ m_Layer: 0
+ m_Name: Camera
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1795749611
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1795749610}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 64242709}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &1795749612
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1795749610}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Version: 7
+ m_ObsoleteRenderingPath: 0
+ m_ObsoleteFrameSettings:
+ overrides: 0
+ enableShadow: 0
+ enableContactShadows: 0
+ enableShadowMask: 0
+ enableSSR: 0
+ enableSSAO: 0
+ enableSubsurfaceScattering: 0
+ enableTransmission: 0
+ enableAtmosphericScattering: 0
+ enableVolumetrics: 0
+ enableReprojectionForVolumetrics: 0
+ enableLightLayers: 0
+ enableExposureControl: 1
+ diffuseGlobalDimmer: 0
+ specularGlobalDimmer: 0
+ shaderLitMode: 0
+ enableDepthPrepassWithDeferredRendering: 0
+ enableTransparentPrepass: 0
+ enableMotionVectors: 0
+ enableObjectMotionVectors: 0
+ enableDecals: 0
+ enableRoughRefraction: 0
+ enableTransparentPostpass: 0
+ enableDistortion: 0
+ enablePostprocess: 0
+ enableOpaqueObjects: 0
+ enableTransparentObjects: 0
+ enableRealtimePlanarReflection: 0
+ enableMSAA: 0
+ enableAsyncCompute: 0
+ runLightListAsync: 0
+ runSSRAsync: 0
+ runSSAOAsync: 0
+ runContactShadowsAsync: 0
+ runVolumeVoxelizationAsync: 0
+ lightLoopSettings:
+ overrides: 0
+ enableDeferredTileAndCluster: 0
+ enableComputeLightEvaluation: 0
+ enableComputeLightVariants: 0
+ enableComputeMaterialVariants: 0
+ enableFptlForForwardOpaque: 0
+ enableBigTilePrepass: 0
+ isFptlEnabled: 0
+ clearColorMode: 0
+ backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
+ clearDepth: 1
+ volumeLayerMask:
+ serializedVersion: 2
+ m_Bits: 1
+ volumeAnchorOverride: {fileID: 0}
+ antialiasing: 0
+ SMAAQuality: 2
+ dithering: 0
+ stopNaNs: 0
+ taaSharpenStrength: 0.6
+ TAAQuality: 1
+ taaHistorySharpening: 0.35
+ taaAntiFlicker: 0.5
+ taaMotionVectorRejection: 0
+ taaAntiHistoryRinging: 0
+ physicalParameters:
+ m_Iso: 200
+ m_ShutterSpeed: 0.005
+ m_Aperture: 16
+ m_BladeCount: 5
+ m_Curvature: {x: 2, y: 11}
+ m_BarrelClipping: 0.25
+ m_Anamorphism: 0
+ flipYMode: 0
+ xrRendering: 1
+ fullscreenPassthrough: 0
+ allowDynamicResolution: 0
+ customRenderingSettings: 0
+ invertFaceCulling: 0
+ probeLayerMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ hasPersistentHistory: 0
+ m_RenderingPathCustomFrameSettings:
+ bitDatas:
+ data1: 70297877217101
+ data2: 4539628425463136256
+ lodBias: 1
+ lodBiasMode: 0
+ lodBiasQualityLevel: 0
+ maximumLODLevel: 0
+ maximumLODLevelMode: 0
+ maximumLODLevelQualityLevel: 0
+ sssQualityMode: 0
+ sssQualityLevel: 0
+ sssCustomSampleBudget: 20
+ materialQuality: 0
+ renderingPathCustomFrameSettingsOverrideMask:
+ mask:
+ data1: 0
+ data2: 0
+ defaultFrameSettings: 0
+--- !u!20 &1795749614
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1795749610}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_GateFitMode: 2
+ m_FOVAxisMode: 0
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_FocalLength: 50
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0
+ y: 0
+ width: 0.5
+ height: 0.5
+ near clip plane: 0.3
+ far clip plane: 50
+ field of view: 60
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: 1
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 8400000, guid: 94f05850b7f1d654b8127a229aec2c3a, type: 2}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 0
+ m_AllowMSAA: 0
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!1 &1796147641
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 1796147642}
+ - component: {fileID: 1796147645}
+ - component: {fileID: 1796147644}
+ - component: {fileID: 1796147643}
+ m_Layer: 0
+ m_Name: Camera
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &1796147642
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1796147641}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 0}
+ m_LocalScale: {x: 1, y: 1, z: 1}
+ m_Children: []
+ m_Father: {fileID: 211598674}
+ m_RootOrder: 0
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!114 &1796147643
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1796147641}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ m_Version: 7
+ m_ObsoleteRenderingPath: 0
+ m_ObsoleteFrameSettings:
+ overrides: 0
+ enableShadow: 0
+ enableContactShadows: 0
+ enableShadowMask: 0
+ enableSSR: 0
+ enableSSAO: 0
+ enableSubsurfaceScattering: 0
+ enableTransmission: 0
+ enableAtmosphericScattering: 0
+ enableVolumetrics: 0
+ enableReprojectionForVolumetrics: 0
+ enableLightLayers: 0
+ enableExposureControl: 1
+ diffuseGlobalDimmer: 0
+ specularGlobalDimmer: 0
+ shaderLitMode: 0
+ enableDepthPrepassWithDeferredRendering: 0
+ enableTransparentPrepass: 0
+ enableMotionVectors: 0
+ enableObjectMotionVectors: 0
+ enableDecals: 0
+ enableRoughRefraction: 0
+ enableTransparentPostpass: 0
+ enableDistortion: 0
+ enablePostprocess: 0
+ enableOpaqueObjects: 0
+ enableTransparentObjects: 0
+ enableRealtimePlanarReflection: 0
+ enableMSAA: 0
+ enableAsyncCompute: 0
+ runLightListAsync: 0
+ runSSRAsync: 0
+ runSSAOAsync: 0
+ runContactShadowsAsync: 0
+ runVolumeVoxelizationAsync: 0
+ lightLoopSettings:
+ overrides: 0
+ enableDeferredTileAndCluster: 0
+ enableComputeLightEvaluation: 0
+ enableComputeLightVariants: 0
+ enableComputeMaterialVariants: 0
+ enableFptlForForwardOpaque: 0
+ enableBigTilePrepass: 0
+ isFptlEnabled: 0
+ clearColorMode: 0
+ backgroundColorHDR: {r: 0.025, g: 0.07, b: 0.19, a: 0}
+ clearDepth: 1
+ volumeLayerMask:
+ serializedVersion: 2
+ m_Bits: 1
+ volumeAnchorOverride: {fileID: 0}
+ antialiasing: 0
+ SMAAQuality: 2
+ dithering: 0
+ stopNaNs: 0
+ taaSharpenStrength: 0.6
+ TAAQuality: 1
+ taaHistorySharpening: 0.35
+ taaAntiFlicker: 0.5
+ taaMotionVectorRejection: 0
+ taaAntiHistoryRinging: 0
+ physicalParameters:
+ m_Iso: 200
+ m_ShutterSpeed: 0.005
+ m_Aperture: 16
+ m_BladeCount: 5
+ m_Curvature: {x: 2, y: 11}
+ m_BarrelClipping: 0.25
+ m_Anamorphism: 0
+ flipYMode: 0
+ xrRendering: 1
+ fullscreenPassthrough: 0
+ allowDynamicResolution: 0
+ customRenderingSettings: 0
+ invertFaceCulling: 0
+ probeLayerMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ hasPersistentHistory: 0
+ m_RenderingPathCustomFrameSettings:
+ bitDatas:
+ data1: 70297877217101
+ data2: 4539628425463136256
+ lodBias: 1
+ lodBiasMode: 0
+ lodBiasQualityLevel: 0
+ maximumLODLevel: 0
+ maximumLODLevelMode: 0
+ maximumLODLevelQualityLevel: 0
+ sssQualityMode: 0
+ sssQualityLevel: 0
+ sssCustomSampleBudget: 20
+ materialQuality: 0
+ renderingPathCustomFrameSettingsOverrideMask:
+ mask:
+ data1: 0
+ data2: 0
+ defaultFrameSettings: 0
+--- !u!81 &1796147644
+AudioListener:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1796147641}
+ m_Enabled: 1
+--- !u!20 &1796147645
+Camera:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 1796147641}
+ m_Enabled: 1
+ serializedVersion: 2
+ m_ClearFlags: 1
+ m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
+ m_projectionMatrixMode: 1
+ m_GateFitMode: 2
+ m_FOVAxisMode: 0
+ m_SensorSize: {x: 36, y: 24}
+ m_LensShift: {x: 0, y: 0}
+ m_FocalLength: 50
+ m_NormalizedViewPortRect:
+ serializedVersion: 2
+ x: 0.5
+ y: 0.5
+ width: 0.5
+ height: 0.5
+ near clip plane: 0.3
+ far clip plane: 50
+ field of view: 60
+ orthographic: 0
+ orthographic size: 5
+ m_Depth: 0
+ m_CullingMask:
+ serializedVersion: 2
+ m_Bits: 4294967295
+ m_RenderingPath: -1
+ m_TargetTexture: {fileID: 8400000, guid: 94f05850b7f1d654b8127a229aec2c3a, type: 2}
+ m_TargetDisplay: 0
+ m_TargetEye: 3
+ m_HDR: 0
+ m_AllowMSAA: 0
+ m_AllowDynamicResolution: 0
+ m_ForceIntoRT: 0
+ m_OcclusionCulling: 1
+ m_StereoConvergence: 10
+ m_StereoSeparation: 0.022
+--- !u!1 &2026715367
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2026715368}
+ - component: {fileID: 2026715371}
+ - component: {fileID: 2026715370}
+ - component: {fileID: 2026715369}
+ m_Layer: 0
+ m_Name: Quad (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &2026715368
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2026715367}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 1.1}
+ m_LocalScale: {x: 2.2141, y: 1.2662, z: 1}
+ m_Children: []
+ m_Father: {fileID: 211598674}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!64 &2026715369
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2026715367}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 4
+ m_Convex: 0
+ m_CookingOptions: 30
+ m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!23 &2026715370
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2026715367}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: 935f43c84f10daf409aa21b21e2b8b34, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &2026715371
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2026715367}
+ m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!1 &2044874741
+GameObject:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ serializedVersion: 6
+ m_Component:
+ - component: {fileID: 2044874742}
+ - component: {fileID: 2044874745}
+ - component: {fileID: 2044874744}
+ - component: {fileID: 2044874743}
+ m_Layer: 0
+ m_Name: Quad (1)
+ m_TagString: Untagged
+ m_Icon: {fileID: 0}
+ m_NavMeshLayer: 0
+ m_StaticEditorFlags: 0
+ m_IsActive: 1
+--- !u!4 &2044874742
+Transform:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2044874741}
+ m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+ m_LocalPosition: {x: 0, y: 0, z: 1.1}
+ m_LocalScale: {x: 2.2141, y: 1.2662, z: 1}
+ m_Children: []
+ m_Father: {fileID: 179283799}
+ m_RootOrder: 1
+ m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!64 &2044874743
+MeshCollider:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2044874741}
+ m_Material: {fileID: 0}
+ m_IsTrigger: 0
+ m_Enabled: 1
+ serializedVersion: 4
+ m_Convex: 0
+ m_CookingOptions: 30
+ m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
+--- !u!23 &2044874744
+MeshRenderer:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2044874741}
+ m_Enabled: 1
+ m_CastShadows: 1
+ m_ReceiveShadows: 1
+ m_DynamicOccludee: 1
+ m_MotionVectors: 1
+ m_LightProbeUsage: 1
+ m_ReflectionProbeUsage: 1
+ m_RayTracingMode: 2
+ m_RayTraceProcedural: 0
+ m_RenderingLayerMask: 1
+ m_RendererPriority: 0
+ m_Materials:
+ - {fileID: 2100000, guid: 935f43c84f10daf409aa21b21e2b8b34, type: 2}
+ m_StaticBatchInfo:
+ firstSubMesh: 0
+ subMeshCount: 0
+ m_StaticBatchRoot: {fileID: 0}
+ m_ProbeAnchor: {fileID: 0}
+ m_LightProbeVolumeOverride: {fileID: 0}
+ m_ScaleInLightmap: 1
+ m_ReceiveGI: 1
+ m_PreserveUVs: 0
+ m_IgnoreNormalsForChartDetection: 0
+ m_ImportantGI: 0
+ m_StitchLightmapSeams: 1
+ m_SelectedEditorRenderState: 3
+ m_MinimumChartSize: 4
+ m_AutoUVMaxDistance: 0.5
+ m_AutoUVMaxAngle: 89
+ m_LightmapParameters: {fileID: 0}
+ m_SortingLayerID: 0
+ m_SortingLayer: 0
+ m_SortingOrder: 0
+ m_AdditionalVertexStreams: {fileID: 0}
+--- !u!33 &2044874745
+MeshFilter:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 2044874741}
+ m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.unity.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.unity.meta
new file mode 100644
index 00000000000..5298e5c598b
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 3d584f34970fc5c44871961e3178f4ce
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702.renderTexture b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702.renderTexture
new file mode 100644
index 00000000000..bc475ed7a22
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702.renderTexture
@@ -0,0 +1,37 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!84 &8400000
+RenderTexture:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: 9702
+ m_ImageContentsHash:
+ serializedVersion: 2
+ Hash: 00000000000000000000000000000000
+ m_ForcedFallbackFormat: 4
+ m_DownscaleFallback: 0
+ serializedVersion: 3
+ m_Width: 640
+ m_Height: 360
+ m_AntiAliasing: 1
+ m_MipCount: -1
+ m_DepthFormat: 2
+ m_ColorFormat: 8
+ m_MipMap: 0
+ m_GenerateMips: 1
+ m_SRGB: 0
+ m_UseDynamicScale: 0
+ m_BindMS: 0
+ m_EnableCompatibleFormat: 1
+ m_TextureSettings:
+ serializedVersion: 2
+ m_FilterMode: 1
+ m_Aniso: 0
+ m_MipBias: 0
+ m_WrapU: 1
+ m_WrapV: 1
+ m_WrapW: 1
+ m_Dimension: 2
+ m_VolumeDepth: 1
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702.renderTexture.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702.renderTexture.meta
new file mode 100644
index 00000000000..32af2db0295
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702.renderTexture.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 94f05850b7f1d654b8127a229aec2c3a
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702_UnlitUVChecker.mat b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702_UnlitUVChecker.mat
new file mode 100644
index 00000000000..76b416ffc29
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702_UnlitUVChecker.mat
@@ -0,0 +1,275 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &-6146136251724717348
+MonoBehaviour:
+ m_ObjectHideFlags: 11
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: da692e001514ec24dbc4cca1949ff7e8, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ version: 3
+--- !u!21 &2100000
+Material:
+ serializedVersion: 6
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_Name: 9702_UnlitUVChecker
+ m_Shader: {fileID: 4800000, guid: c4edd00ff2db5b24391a4fcb1762e459, type: 3}
+ m_ShaderKeywords: _DISABLE_SSR_TRANSPARENT _NORMALMAP_TANGENT_SPACE
+ m_LightmapFlags: 4
+ m_EnableInstancingVariants: 0
+ m_DoubleSidedGI: 0
+ m_CustomRenderQueue: 2000
+ stringTagMap:
+ MotionVector: User
+ disabledShaderPasses:
+ - DistortionVectors
+ - MOTIONVECTORS
+ m_SavedProperties:
+ serializedVersion: 3
+ m_TexEnvs:
+ - Texture2D_539F31FE:
+ m_Texture: {fileID: 2800000, guid: b23bea53bdbdb5a4aaacf12522910599, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _AnisotropyMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BaseColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BentNormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _BentNormalMapOS:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _CoatMaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DetailMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _DistortionVectorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _EmissiveColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _HeightMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _IridescenceMaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _IridescenceThicknessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MainTex:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _MaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NormalMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _NormalMapOS:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SpecularColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _SubsurfaceMaskMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _TangentMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _TangentMapOS:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _ThicknessMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _TransmittanceColorMap:
+ m_Texture: {fileID: 0}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ - _UnlitColorMap:
+ m_Texture: {fileID: 2800000, guid: b23bea53bdbdb5a4aaacf12522910599, type: 3}
+ m_Scale: {x: 1, y: 1}
+ m_Offset: {x: 0, y: 0}
+ m_Floats:
+ - Vector1_90AA7A8: 0.5
+ - _AORemapMax: 1
+ - _AORemapMin: 0
+ - _ATDistance: 1
+ - _AddPrecomputedVelocity: 0
+ - _AlbedoAffectEmissive: 0
+ - _AlphaCutoff: 0.5
+ - _AlphaCutoffEnable: 0
+ - _AlphaCutoffPostpass: 0.5
+ - _AlphaCutoffPrepass: 0.5
+ - _AlphaCutoffShadow: 0.5
+ - _AlphaDstBlend: 0
+ - _AlphaSrcBlend: 1
+ - _Anisotropy: 0
+ - _BlendMode: 0
+ - _CoatMask: 0
+ - _CullMode: 2
+ - _CullModeForward: 2
+ - _Cutoff: 0.5
+ - _DepthOffsetEnable: 0
+ - _DetailAlbedoScale: 1
+ - _DetailNormalScale: 1
+ - _DetailSmoothnessScale: 1
+ - _DiffusionProfile: 0
+ - _DiffusionProfileHash: 0
+ - _DisplacementLockObjectScale: 1
+ - _DisplacementLockTilingScale: 1
+ - _DisplacementMode: 0
+ - _DistortionBlendMode: 0
+ - _DistortionBlurBlendMode: 0
+ - _DistortionBlurDstBlend: 1
+ - _DistortionBlurRemapMax: 1
+ - _DistortionBlurRemapMin: 0
+ - _DistortionBlurScale: 1
+ - _DistortionBlurSrcBlend: 1
+ - _DistortionDepthTest: 1
+ - _DistortionDstBlend: 1
+ - _DistortionEnable: 0
+ - _DistortionOnly: 0
+ - _DistortionScale: 1
+ - _DistortionSrcBlend: 1
+ - _DistortionVectorBias: -1
+ - _DistortionVectorScale: 2
+ - _DoubleSidedEnable: 0
+ - _DoubleSidedNormalMode: 1
+ - _DstBlend: 0
+ - _EmissiveColorMode: 1
+ - _EmissiveExposureWeight: 1
+ - _EmissiveIntensity: 1
+ - _EmissiveIntensityUnit: 0
+ - _EnableBlendModePreserveSpecularLighting: 1
+ - _EnableFogOnTransparent: 1
+ - _EnableGeometricSpecularAA: 0
+ - _EnergyConservingSpecularColor: 1
+ - _HeightAmplitude: 0.02
+ - _HeightCenter: 0.5
+ - _HeightMapParametrization: 0
+ - _HeightMax: 1
+ - _HeightMin: -1
+ - _HeightOffset: 0
+ - _HeightPoMAmplitude: 2
+ - _HeightTessAmplitude: 2
+ - _HeightTessCenter: 0.5
+ - _IncludeIndirectLighting: 1
+ - _InvTilingScale: 1
+ - _Ior: 1.5
+ - _IridescenceMask: 1
+ - _IridescenceThickness: 1
+ - _LinkDetailsWithBase: 1
+ - _MaterialID: 1
+ - _Metallic: 0
+ - _NormalMapSpace: 0
+ - _NormalScale: 1
+ - _PPDLodThreshold: 5
+ - _PPDMaxSamples: 15
+ - _PPDMinSamples: 5
+ - _PPDPrimitiveLength: 1
+ - _PPDPrimitiveWidth: 1
+ - _RayTracing: 0
+ - _ReceivesSSR: 1
+ - _ReceivesSSRTransparent: 0
+ - _RefractionModel: 0
+ - _SSRefractionProjectionModel: 0
+ - _Smoothness: 0.5
+ - _SmoothnessRemapMax: 1
+ - _SmoothnessRemapMin: 0
+ - _SpecularAAScreenSpaceVariance: 0.1
+ - _SpecularAAThreshold: 0.2
+ - _SpecularOcclusionMode: 1
+ - _SrcBlend: 1
+ - _StencilRef: 0
+ - _StencilRefDepth: 0
+ - _StencilRefDistortionVec: 4
+ - _StencilRefGBuffer: 10
+ - _StencilRefMV: 32
+ - _StencilWriteMask: 6
+ - _StencilWriteMaskDepth: 8
+ - _StencilWriteMaskDistortionVec: 4
+ - _StencilWriteMaskGBuffer: 14
+ - _StencilWriteMaskMV: 40
+ - _SubsurfaceMask: 1
+ - _SupportDecals: 1
+ - _SurfaceType: 0
+ - _TexWorldScale: 1
+ - _TexWorldScaleEmissive: 1
+ - _Thickness: 1
+ - _TransmissionEnable: 1
+ - _TransparentBackfaceEnable: 0
+ - _TransparentCullMode: 2
+ - _TransparentDepthPostpassEnable: 0
+ - _TransparentDepthPrepassEnable: 0
+ - _TransparentSortPriority: 0
+ - _TransparentWritingMotionVec: 0
+ - _TransparentZWrite: 0
+ - _UVBase: 0
+ - _UVDetail: 0
+ - _UVEmissive: 0
+ - _UseEmissiveIntensity: 0
+ - _UseShadowThreshold: 0
+ - _ZTestDepthEqualForOpaque: 3
+ - _ZTestGBuffer: 4
+ - _ZTestModeDistortion: 4
+ - _ZTestTransparent: 4
+ - _ZWrite: 1
+ m_Colors:
+ - Color_6DBB962E: {r: 1, g: 0.7607843, b: 0, a: 1}
+ - Vector2_C19C925C: {r: 0, g: 0, b: 0, a: 0}
+ - _BaseColor: {r: 1, g: 1, b: 1, a: 1}
+ - _BaseColorMap_MipInfo: {r: 0, g: 0, b: 0, a: 0}
+ - _Color: {r: 0, g: 0, b: 0, a: 1}
+ - _DiffusionProfileAsset: {r: 0, g: 0, b: 0, a: 0}
+ - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
+ - _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
+ - _EmissiveColor: {r: 0, g: 0, b: 0, a: 1}
+ - _EmissiveColorLDR: {r: 0, g: 0, b: 0, a: 1}
+ - _InvPrimScale: {r: 1, g: 1, b: 0, a: 0}
+ - _IridescenceThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
+ - _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
+ - _ThicknessRemap: {r: 0, g: 1, b: 0, a: 0}
+ - _TransmittanceColor: {r: 1, g: 1, b: 1, a: 1}
+ - _UVDetailsMappingMask: {r: 1, g: 0, b: 0, a: 0}
+ - _UVMappingMask: {r: 1, g: 0, b: 0, a: 0}
+ - _UVMappingMaskEmissive: {r: 1, g: 0, b: 0, a: 0}
+ - _UnlitColor: {r: 1, g: 1, b: 1, a: 1}
+ m_BuildTextureStacks: []
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702_UnlitUVChecker.mat.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702_UnlitUVChecker.mat.meta
new file mode 100644
index 00000000000..8c6cd2e24ec
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/9702_UnlitUVChecker.mat.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 935f43c84f10daf409aa21b21e2b8b34
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Blur.cs b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Blur.cs
new file mode 100644
index 00000000000..7bfcf2fa152
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Blur.cs
@@ -0,0 +1,51 @@
+using UnityEngine;
+using UnityEngine.Rendering.HighDefinition;
+using UnityEngine.Rendering;
+using UnityEngine.Experimental.Rendering;
+
+class Blur : CustomPass
+{
+ RTHandle halfResTarget;
+
+ protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
+ {
+ halfResTarget = RTHandles.Alloc(
+ Vector2.one * 0.5f, TextureXR.slices, dimension: TextureXR.dimension,
+ colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, // We don't need alpha for this effect
+ useDynamicScale: true, name: "Half Res Custom Pass"
+ );
+ }
+
+ protected override void Execute(CustomPassContext ctx)
+ {
+ float radius = 8.0f;
+
+ // make radius screen size dependent to have blur size consistent accross dimensions.
+ radius *= ctx.cameraColorBuffer.rtHandleProperties.rtHandleScale.x;
+ CustomPassUtils.GaussianBlur(
+ ctx, ctx.cameraColorBuffer, ctx.cameraColorBuffer, halfResTarget,
+ new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.5f, 0.5f, 0, 0),
+ 4, radius / 2, 0, 0, true
+ );
+ CustomPassUtils.GaussianBlur(
+ ctx, ctx.cameraColorBuffer, ctx.cameraColorBuffer, halfResTarget,
+ new Vector4(0.5f, 0.5f, 0.5f, 0), new Vector4(0.5f, 0.5f, 0.5f, 0),
+ 16, radius, 0, 0, false
+ );
+ CustomPassUtils.GaussianBlur(
+ ctx, ctx.cameraColorBuffer, ctx.cameraColorBuffer, ctx.customColorBuffer.Value,
+ new Vector4(0.5f, 0.5f, 0.5f, 0.5f), new Vector4(0.5f, 0.5f, 0.5f, 0.5f),
+ 16, radius * 2, 0, 0, false
+ );
+ CustomPassUtils.GaussianBlur(
+ ctx, ctx.cameraColorBuffer, ctx.cameraColorBuffer, ctx.customColorBuffer.Value,
+ new Vector4(0.5f, 0.5f, 0, 0.5f), new Vector4(0.5f, 0.5f, 0, 0.5f),
+ 64, radius * 4, 0, 0, true
+ );
+ }
+
+ protected override void Cleanup()
+ {
+ halfResTarget.Release();
+ }
+}
\ No newline at end of file
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Blur.cs.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Blur.cs.meta
new file mode 100644
index 00000000000..8fca9f11c27
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Blur.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3dd0edfb46737cd4dbfac39597215093
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Copy.cs b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Copy.cs
new file mode 100644
index 00000000000..7d23b3b5f6c
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Copy.cs
@@ -0,0 +1,73 @@
+using UnityEngine;
+using UnityEngine.Rendering.HighDefinition;
+using UnityEngine.Rendering;
+using UnityEngine.Experimental.Rendering;
+
+class Copy : CustomPass
+{
+ RTHandle halfResTarget;
+
+ protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
+ {
+ halfResTarget = RTHandles.Alloc(
+ Vector2.one * 0.5f, TextureXR.slices, dimension: TextureXR.dimension,
+ colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, // We don't need alpha for this effect
+ useDynamicScale: true, name: "Half Res Custom Pass",
+ useMipMap: true, autoGenerateMips: false
+ );
+ }
+
+ protected override void Execute(CustomPassContext ctx)
+ {
+ // Top right
+ CustomPassUtils.Copy(
+ ctx, ctx.cameraColorBuffer, ctx.customColorBuffer.Value,
+ new Vector4(0.5f, 0.5f, 0.5f, 0.5f), new Vector4(0.5f, 0.5f, 0, 0),
+ 0, 0
+ );
+ CustomPassUtils.Copy(
+ ctx, ctx.customColorBuffer.Value, ctx.cameraColorBuffer,
+ new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.75f, 0.75f),
+ 0, 0
+ );
+
+ // Bottom left
+ CustomPassUtils.Copy(
+ ctx, ctx.cameraColorBuffer, halfResTarget,
+ new Vector4(0.5f, 0.5f, 0.0f, 0.5f), new Vector4(0.5f, 0.5f, 0, 0),
+ 0, 0
+ );
+ CustomPassUtils.Copy(
+ ctx, halfResTarget, ctx.cameraColorBuffer,
+ new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.5f, 0.5f),
+ 0, 0
+ );
+
+ // Bottom right
+ CustomPassUtils.Copy(
+ ctx, ctx.cameraColorBuffer, ctx.customColorBuffer.Value,
+ new Vector4(0.5f, 0.5f, 0.0f, 0.0f), new Vector4(0.5f, 0.5f, 0, 0),
+ 0, 0
+ );
+ CustomPassUtils.Copy(
+ ctx, ctx.customColorBuffer.Value, ctx.cameraColorBuffer,
+ new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.75f, 0.5f),
+ 0, 0
+ );
+
+ // top left
+ CustomPassUtils.Copy(
+ ctx, ctx.cameraColorBuffer, halfResTarget,
+ new Vector4(0.5f, 0.5f, 0.5f, 0.0f), new Vector4(0.5f, 0.5f, 0, 0),
+ 0, 1
+ );
+ CustomPassUtils.Copy(
+ ctx, halfResTarget, ctx.cameraColorBuffer,
+ new Vector4(0.5f, 0.5f, 0, 0), new Vector4(0.25f, 0.25f, 0.5f, 0.75f),
+ 1, 0
+ );
+
+ }
+
+ protected override void Cleanup() => halfResTarget.Release();
+}
\ No newline at end of file
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Copy.cs.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Copy.cs.meta
new file mode 100644
index 00000000000..6f5c54a7df9
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Copy.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 34f6dc251f990f741b21d74077e96dd0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Scene Settings Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Scene Settings Profile.asset
new file mode 100644
index 00000000000..f19f670668c
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Scene Settings Profile.asset
@@ -0,0 +1,88 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!114 &-6322084644017855310
+MonoBehaviour:
+ m_ObjectHideFlags: 3
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 2d08ce26990eb1a4a9177b860541e702, type: 3}
+ m_Name: Exposure
+ m_EditorClassIdentifier:
+ active: 1
+ m_AdvancedMode: 0
+ mode:
+ m_OverrideState: 1
+ m_Value: 0
+ meteringMode:
+ m_OverrideState: 1
+ m_Value: 2
+ luminanceSource:
+ m_OverrideState: 1
+ m_Value: 1
+ fixedExposure:
+ m_OverrideState: 1
+ m_Value: 0
+ compensation:
+ m_OverrideState: 1
+ m_Value: 0
+ limitMin:
+ m_OverrideState: 1
+ m_Value: -10
+ limitMax:
+ m_OverrideState: 1
+ m_Value: 20
+ curveMap:
+ m_OverrideState: 1
+ m_Value:
+ serializedVersion: 2
+ m_Curve:
+ - serializedVersion: 3
+ time: -10
+ value: -10
+ inSlope: 0
+ outSlope: 1
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0
+ outWeight: 0
+ - serializedVersion: 3
+ time: 20
+ value: 20
+ inSlope: 1
+ outSlope: 0
+ tangentMode: 0
+ weightedMode: 0
+ inWeight: 0
+ outWeight: 0
+ m_PreInfinity: 2
+ m_PostInfinity: 2
+ m_RotationOrder: 4
+ adaptationMode:
+ m_OverrideState: 1
+ m_Value: 1
+ adaptationSpeedDarkToLight:
+ m_OverrideState: 1
+ m_Value: 3
+ min: 0.001
+ adaptationSpeedLightToDark:
+ m_OverrideState: 1
+ m_Value: 1
+ min: 0.001
+--- !u!114 &11400000
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 0}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
+ m_Name: Scene Settings Profile
+ m_EditorClassIdentifier:
+ components:
+ - {fileID: -6322084644017855310}
diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Scene Settings Profile.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Scene Settings Profile.asset.meta
new file mode 100644
index 00000000000..8ad04c21fc9
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9702_CustomPass_API/Scene Settings Profile.asset.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 9ad9379fd70197f448fb2f184be74226
+NativeFormatImporter:
+ externalObjects: {}
+ mainObjectFileID: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/9702_CustomPass_API.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/9702_CustomPass_API.png
new file mode 100644
index 00000000000..61d80a12040
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/9702_CustomPass_API.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ce63f8888a7c2418116f3a038f83dcc9826345b70d718de56a576b640b0f755b
+size 154953
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/9702_CustomPass_API.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/9702_CustomPass_API.png.meta
new file mode 100644
index 00000000000..7158c15b02a
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/9702_CustomPass_API.png.meta
@@ -0,0 +1,106 @@
+fileFormatVersion: 2
+guid: af3a518974e3d174898b4cfbd95855bd
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9702_CustomPass_API.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9702_CustomPass_API.png
new file mode 100644
index 00000000000..61d80a12040
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9702_CustomPass_API.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ce63f8888a7c2418116f3a038f83dcc9826345b70d718de56a576b640b0f755b
+size 154953
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9702_CustomPass_API.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9702_CustomPass_API.png.meta
new file mode 100644
index 00000000000..0fbf951573a
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9702_CustomPass_API.png.meta
@@ -0,0 +1,106 @@
+fileFormatVersion: 2
+guid: 06fad584e68b3fe4795cc3a3f97a821a
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/9702_CustomPass_API.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/9702_CustomPass_API.png
new file mode 100644
index 00000000000..61d80a12040
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/9702_CustomPass_API.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ce63f8888a7c2418116f3a038f83dcc9826345b70d718de56a576b640b0f755b
+size 154953
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/9702_CustomPass_API.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/9702_CustomPass_API.png.meta
new file mode 100644
index 00000000000..32eb79b6dd8
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/9702_CustomPass_API.png.meta
@@ -0,0 +1,106 @@
+fileFormatVersion: 2
+guid: 23af219bc28be18489f70e013adc937f
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/9702_CustomPass_API.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/9702_CustomPass_API.png
new file mode 100644
index 00000000000..61d80a12040
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/9702_CustomPass_API.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ce63f8888a7c2418116f3a038f83dcc9826345b70d718de56a576b640b0f755b
+size 154953
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/9702_CustomPass_API.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/9702_CustomPass_API.png.meta
new file mode 100644
index 00000000000..76f9604d25a
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/9702_CustomPass_API.png.meta
@@ -0,0 +1,106 @@
+fileFormatVersion: 2
+guid: f14c994a2007a26499a588abff6be04c
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9702_CustomPass_API.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9702_CustomPass_API.png
new file mode 100644
index 00000000000..61d80a12040
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9702_CustomPass_API.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ce63f8888a7c2418116f3a038f83dcc9826345b70d718de56a576b640b0f755b
+size 154953
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9702_CustomPass_API.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9702_CustomPass_API.png.meta
new file mode 100644
index 00000000000..2a6d814ea12
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9702_CustomPass_API.png.meta
@@ -0,0 +1,106 @@
+fileFormatVersion: 2
+guid: aa3c29242317ad44193db1996f4a7f87
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Vulkan/None/9702_CustomPass_API.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Vulkan/None/9702_CustomPass_API.png
new file mode 100644
index 00000000000..61d80a12040
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Vulkan/None/9702_CustomPass_API.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:ce63f8888a7c2418116f3a038f83dcc9826345b70d718de56a576b640b0f755b
+size 154953
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Vulkan/None/9702_CustomPass_API.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Vulkan/None/9702_CustomPass_API.png.meta
new file mode 100644
index 00000000000..2fe09ed3f94
--- /dev/null
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Vulkan/None/9702_CustomPass_API.png.meta
@@ -0,0 +1,106 @@
+fileFormatVersion: 2
+guid: 39127067b492852418a9724ad9262e06
+TextureImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 11
+ mipmaps:
+ mipMapMode: 0
+ enableMipMap: 1
+ sRGBTexture: 1
+ linearTexture: 0
+ fadeOut: 0
+ borderMipMap: 0
+ mipMapsPreserveCoverage: 0
+ alphaTestReferenceValue: 0.5
+ mipMapFadeDistanceStart: 1
+ mipMapFadeDistanceEnd: 3
+ bumpmap:
+ convertToNormalMap: 0
+ externalNormalMap: 0
+ heightScale: 0.25
+ normalMapFilter: 0
+ isReadable: 0
+ streamingMipmaps: 0
+ streamingMipmapsPriority: 0
+ vTOnly: 0
+ grayScaleToAlpha: 0
+ generateCubemap: 6
+ cubemapConvolution: 0
+ seamlessCubemap: 0
+ textureFormat: 1
+ maxTextureSize: 2048
+ textureSettings:
+ serializedVersion: 2
+ filterMode: -1
+ aniso: -1
+ mipBias: -100
+ wrapU: -1
+ wrapV: -1
+ wrapW: -1
+ nPOTScale: 1
+ lightmap: 0
+ compressionQuality: 50
+ spriteMode: 0
+ spriteExtrude: 1
+ spriteMeshType: 1
+ alignment: 0
+ spritePivot: {x: 0.5, y: 0.5}
+ spritePixelsToUnits: 100
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+ spriteGenerateFallbackPhysicsShape: 1
+ alphaUsage: 1
+ alphaIsTransparency: 0
+ spriteTessellationDetail: -1
+ textureType: 0
+ textureShape: 1
+ singleChannelComponent: 0
+ maxTextureSizeSet: 0
+ compressionQualitySet: 0
+ textureFormatSet: 0
+ ignorePngGamma: 0
+ applyGammaDecoding: 0
+ platformSettings:
+ - serializedVersion: 3
+ buildTarget: DefaultTexturePlatform
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ - serializedVersion: 3
+ buildTarget: Standalone
+ maxTextureSize: 2048
+ resizeAlgorithm: 0
+ textureFormat: -1
+ textureCompression: 0
+ compressionQuality: 50
+ crunchedCompression: 0
+ allowsAlphaSplitting: 0
+ overridden: 0
+ androidETC2FallbackOverride: 0
+ forceMaximumCompressionQuality_BC6H_BC7: 0
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID:
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset
index 6a5bed01291..80e3bedde07 100644
--- a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset
+++ b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset
@@ -80,9 +80,6 @@ EditorBuildSettings:
- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1220_Sorting.unity
guid: 5c1bc003f0b8e6648a7860ad9ae82213
- - enabled: 0
- path: Assets/GraphicTests/Scenes/1x_Materials/1221_Lit_POM_Emission.unity
- guid: 6a401c36b9353ae43a8f0e8b8a98d6f4
- enabled: 1
path: Assets/GraphicTests/Scenes/1x_Materials/1301_StackLitSG.unity
guid: eefb6e7ceaa685442bbf61fd2b82f9ae
diff --git a/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs b/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs
index a9e96ed1b9d..274016aa54a 100644
--- a/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs
+++ b/com.unity.render-pipelines.core/Editor/Volume/VolumeEditor.cs
@@ -1,4 +1,7 @@
+using System.IO;
+using UnityEditor.PackageManager;
using UnityEngine;
+using UnityEngine.Assertions;
using UnityEngine.Rendering;
namespace UnityEditor.Rendering
@@ -153,7 +156,13 @@ public override void OnInspectorGUI()
// Duplicate the currently assigned profile and save it as a new profile
var origin = profileRef;
var path = AssetDatabase.GetAssetPath(m_Profile.objectReferenceValue);
- path = AssetDatabase.GenerateUniqueAssetPath(path);
+
+ path = IsAssetInReadOnlyPackage(path)
+ // We may be in a read only package, in that case we need to clone the volume profile in an
+ // editable area, such as the root of the project.
+ ? AssetDatabase.GenerateUniqueAssetPath(Path.Combine("Assets", Path.GetFileName(path)))
+ // Otherwise, duplicate next to original asset.
+ : AssetDatabase.GenerateUniqueAssetPath(path);
var asset = Instantiate(origin);
asset.components.Clear();
@@ -202,5 +211,12 @@ public override void OnInspectorGUI()
serializedObject.ApplyModifiedProperties();
}
+
+ static bool IsAssetInReadOnlyPackage(string path)
+ {
+ Assert.IsNotNull(path);
+ var info = PackageManager.PackageInfo.FindForAssetPath(path);
+ return info != null && (info.source != PackageSource.Local && info.source != PackageSource.Embedded);
+ }
}
}
diff --git a/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs
index c8a1b3a32ae..700251d73a0 100644
--- a/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs
+++ b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs
@@ -33,6 +33,8 @@ public ref struct RenderGraphContext
public RenderGraphObjectPool renderGraphPool;
///Render Graph Resource Registry used for accessing resources.
public RenderGraphResourceRegistry resources;
+ ///Render Graph default resources.
+ public RenderGraphDefaultResources defaultResources;
}
///
@@ -50,7 +52,6 @@ public struct RenderGraphExecuteParams
class RenderGraphDebugParams
{
- public bool enableRenderGraph = false; // TODO: TEMP TO REMOVE
public bool tagResourceNamesWithRG;
public bool clearRenderTargetsAtCreation;
public bool clearRenderTargetsAtRelease;
@@ -61,7 +62,6 @@ class RenderGraphDebugParams
public void RegisterDebug()
{
var list = new List();
- list.Add(new DebugUI.BoolField { displayName = "Enable Render Graph", getter = () => enableRenderGraph, setter = value => enableRenderGraph = value });
list.Add(new DebugUI.BoolField { displayName = "Tag Resources with RG", getter = () => tagResourceNamesWithRG, setter = value => tagResourceNamesWithRG = value });
list.Add(new DebugUI.BoolField { displayName = "Clear Render Targets at creation", getter = () => clearRenderTargetsAtCreation, setter = value => clearRenderTargetsAtCreation = value });
list.Add(new DebugUI.BoolField { displayName = "Clear Render Targets at release", getter = () => clearRenderTargetsAtRelease, setter = value => clearRenderTargetsAtRelease = value });
@@ -69,8 +69,8 @@ public void RegisterDebug()
list.Add(new DebugUI.Button { displayName = "Log Frame Information", action = () => logFrameInformation = true });
list.Add(new DebugUI.Button { displayName = "Log Resources", action = () => logResources = true });
- var testPanel = DebugManager.instance.GetPanel("Render Graph", true);
- testPanel.children.Add(list.ToArray());
+ var panel = DebugManager.instance.GetPanel("Render Graph", true);
+ panel.children.Add(list.ToArray());
}
public void UnRegisterDebug()
@@ -194,20 +194,25 @@ internal override bool HasRenderFunc()
List m_RendererLists = new List();
RenderGraphDebugParams m_DebugParameters = new RenderGraphDebugParams();
RenderGraphLogger m_Logger = new RenderGraphLogger();
+ RenderGraphDefaultResources m_DefaultResources = new RenderGraphDefaultResources();
#region Public Interface
- ///
- /// Returns true if rendering with Render Graph is enabled.
- ///
- public bool enabled { get { return m_DebugParameters.enableRenderGraph; } }
-
// TODO: Currently only needed by SSAO to sample correctly depth texture mips. Need to figure out a way to hide this behind a proper formalization.
///
/// Gets the RTHandleProperties structure associated with the Render Graph's RTHandle System.
///
public RTHandleProperties rtHandleProperties { get { return m_Resources.GetRTHandleProperties(); } }
+ public RenderGraphDefaultResources defaultResources
+ {
+ get
+ {
+ m_DefaultResources.InitializeForRendering(this);
+ return m_DefaultResources;
+ }
+ }
+
///
/// Render Graph constructor.
///
@@ -224,6 +229,7 @@ public RenderGraph(bool supportMSAA, MSAASamples initialSampleCount)
public void Cleanup()
{
m_Resources.Cleanup();
+ m_DefaultResources.Cleanup();
}
///
@@ -231,7 +237,7 @@ public void Cleanup()
///
public void RegisterDebug()
{
- //m_DebugParameters.RegisterDebug();
+ m_DebugParameters.RegisterDebug();
}
///
@@ -239,7 +245,7 @@ public void RegisterDebug()
///
public void UnRegisterDebug()
{
- //m_DebugParameters.UnRegisterDebug();
+ m_DebugParameters.UnRegisterDebug();
}
///
@@ -391,6 +397,7 @@ public void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, in
rgContext.renderContext = renderContext;
rgContext.renderGraphPool = m_RenderGraphPool;
rgContext.resources = m_Resources;
+ rgContext.defaultResources = m_DefaultResources;
try
{
@@ -424,6 +431,7 @@ public void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, in
{
ClearRenderPasses();
m_Resources.Clear();
+ m_DefaultResources.Clear();
m_RendererLists.Clear();
if (m_DebugParameters.logFrameInformation || m_DebugParameters.logResources)
diff --git a/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs
new file mode 100644
index 00000000000..05f8ad1c2d8
--- /dev/null
+++ b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs
@@ -0,0 +1,71 @@
+using UnityEngine.Rendering;
+
+namespace UnityEngine.Experimental.Rendering.RenderGraphModule
+{
+ ///
+ /// Helper class allowing access to default resources (black or white texture, etc.) during render passes.
+ ///
+ public class RenderGraphDefaultResources
+ {
+ bool m_IsValid;
+
+ // We need to keep around a RTHandle version of default regular 2D textures since RenderGraph API is all RTHandle.
+ RTHandle m_BlackTexture2D;
+ RTHandle m_WhiteTexture2D;
+
+ /// Default black 2D texture.
+ public TextureHandle blackTexture { get; private set; }
+ /// Default white 2D texture.
+ public TextureHandle whiteTexture { get; private set; }
+ /// Default clear color XR 2D texture.
+ public TextureHandle clearTextureXR { get; private set; }
+ /// Default magenta XR 2D texture.
+ public TextureHandle magentaTextureXR { get; private set; }
+ /// Default black XR 2D texture.
+ public TextureHandle blackTextureXR { get; private set; }
+ /// Default black (UInt) XR 2D texture.
+ public TextureHandle blackUIntTextureXR { get; private set; }
+ /// Default black XR 3D texture.
+ public TextureHandle blackTexture3DXR { get; private set; }
+ /// Default white XR 2D texture.
+ public TextureHandle whiteTextureXR { get; private set; }
+
+ internal RenderGraphDefaultResources()
+ {
+ m_BlackTexture2D = RTHandles.Alloc(Texture2D.blackTexture);
+ m_WhiteTexture2D = RTHandles.Alloc(Texture2D.whiteTexture);
+ }
+
+ internal void Cleanup()
+ {
+ m_BlackTexture2D.Release();
+ m_WhiteTexture2D.Release();
+ }
+
+ internal void InitializeForRendering(RenderGraph renderGraph)
+ {
+ if (!m_IsValid)
+ {
+ blackTexture = renderGraph.ImportTexture(m_BlackTexture2D);
+ whiteTexture = renderGraph.ImportTexture(m_WhiteTexture2D);
+
+ clearTextureXR = renderGraph.ImportTexture(TextureXR.GetClearTexture());
+ magentaTextureXR = renderGraph.ImportTexture(TextureXR.GetMagentaTexture());
+ blackTextureXR = renderGraph.ImportTexture(TextureXR.GetBlackTexture());
+ blackUIntTextureXR = renderGraph.ImportTexture(TextureXR.GetBlackUIntTexture());
+ blackTexture3DXR = renderGraph.ImportTexture(TextureXR.GetBlackTexture3D());
+ whiteTextureXR = renderGraph.ImportTexture(TextureXR.GetWhiteTexture());
+
+ m_IsValid = true;
+ }
+ }
+
+ // Imported resources are cleared everytime the Render Graph is executed, so we need to know if that happens
+ // so that we can re-import all default resources if needed.
+ internal void Clear()
+ {
+ m_IsValid = false;
+ }
+ }
+}
+
diff --git a/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs.meta b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs.meta
new file mode 100644
index 00000000000..16bf971686f
--- /dev/null
+++ b/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphDefaultResources.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d9929b63696b16c4ca41927306959897
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.core/Runtime/Textures/RTHandleSystem.cs b/com.unity.render-pipelines.core/Runtime/Textures/RTHandleSystem.cs
index 80b43911efb..6977801efaf 100644
--- a/com.unity.render-pipelines.core/Runtime/Textures/RTHandleSystem.cs
+++ b/com.unity.render-pipelines.core/Runtime/Textures/RTHandleSystem.cs
@@ -96,7 +96,15 @@ public void Dispose()
/// Number of MSAA samples for automatically scaled RTHandles.
public void Initialize(int width, int height, bool scaledRTsupportsMSAA, MSAASamples scaledRTMSAASamples)
{
- Debug.Assert(m_AutoSizedRTs.Count == 0, "RTHandle.Initialize should only be called once before allocating any Render Texture. This may be caused by an unreleased RTHandle resource.");
+ if (m_AutoSizedRTs.Count != 0)
+ {
+ string leakingResources = "Unreleased RTHandles:";
+ foreach (var rt in m_AutoSizedRTs)
+ {
+ leakingResources = string.Format("{0}\n {1}", leakingResources, rt.name);
+ }
+ Debug.LogError(string.Format("RTHandle.Initialize should only be called once before allocating any Render Texture. This may be caused by an unreleased RTHandle resource.\n{0}\n", leakingResources));
+ }
m_MaxWidths = width;
m_MaxHeights = height;
diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md
index 51faa6ac56f..1dc6efee344 100644
--- a/com.unity.render-pipelines.high-definition/CHANGELOG.md
+++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md
@@ -126,6 +126,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Implemented ray traced reflections for transparent objects.
- Add a new parameter to control reflections in recursive rendering.
- Added an initial version of SSGI.
+- Added CustomPassUtils API to simplify Blur, Copy and DrawRenderers custom passes.
### Fixed
- Fix when rescale probe all direction below zero (1219246)
@@ -612,6 +613,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Tentative fix for missing include in depth of field shaders.
- Fixed the light overlap scene view draw mode (wasn't working at all).
- Fixed taaFrameIndex and XR tests 4052 and 4053
+- Fixed the prefab integration of custom passes (Prefab Override Highlight not working as expected).
+- Cloned volume profile from read only assets are created in the root of the project. (case 1154961)
### Changed
- Improve MIP selection for decals on Transparents
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-API-User-Manual.md b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-API-User-Manual.md
new file mode 100644
index 00000000000..871f329f077
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-API-User-Manual.md
@@ -0,0 +1,67 @@
+# Custom Pass Utils API User Manual
+
+## Blur
+
+### Gaussian Blur
+
+The Gaussian blur function allows you to blur an image with an arbitrary radius and quality (number of samples). For performance reasons, you can run the blur kernel after a downsample pass. This decreases the resource intensity of the blur effect but also decreases the quality.
+
+Here's an example of Custom Pass that blurs the camera color buffer:
+
+```CSharp
+using UnityEngine;
+using UnityEngine.Rendering.HighDefinition;
+using UnityEngine.Rendering;
+using UnityEngine.Experimental.Rendering;
+
+class GaussianBlur : CustomPass
+{
+ RTHandle halfResTarget;
+
+ protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
+ {
+ halfResTarget = RTHandles.Alloc(
+ // Note the * 0.5f here. This allocates a half-resolution target, which saves a lot of memory.
+ Vector2.one * 0.5f, TextureXR.slices, dimension: TextureXR.dimension,
+ // Since alpha is unnecessary for Gaussian blur, this effect uses an HDR texture format with no alpha channel.
+ colorFormat: GraphicsFormat.B10G11R11_UFloatPack32,
+ // When creating textures, be sure to name them as it is useful for debugging.
+ useDynamicScale: true, name: "Half Res Custom Pass"
+ );
+ }
+
+ protected override void Execute(CustomPassContext ctx)
+ {
+ // Specifies the radius for the blur in pixels. This example uses an 8 pixel radius.
+ float radius = 8.0f;
+ // Specifies the precision of the blur. This also affects the resource intensity of the blue. A value of 9 is good for real-time applications.
+ int sampleCount = 9;
+
+ // In cases where you have multiple cameras with different resolutions, this makes the blur coherent across these cameras.
+ radius *= ctx.cameraColorBuffer.rtHandleProperties.rtHandleScale.x;
+
+ // The actual Gaussian blur call. It specifies the current camera's color buffer as the source and destination.
+ // This uses the half-resolution target as a temporary render target between the blur passes.
+ // Note that the Gaussian blur function clears the content of the half-resolution buffer when it finishes.
+ CustomPassUtils.GaussianBlur(
+ ctx, ctx.cameraColorBuffer, ctx.cameraColorBuffer, halfResTarget,
+ sampleCount, radius, downSample: true
+ );
+ }
+
+ // Releases the GPU memory allocated for the half-resolution target. This is important otherwise the memory will leak.
+ protected override void Cleanup() => halfResTarget.Release();
+}
+```
+
+Note that this example uses a half-resolution target, halfResTarget, because the example first processes a downsample pass. Alternatively, you can also use the custom pass buffer that HDRP provides. Even if this is not a half-resolution buffer, the algorithm only uses half of the texture.
+
+
\ No newline at end of file
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass.md b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass.md
index 2e8d98ed523..8ed7d3db022 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass.md
@@ -16,7 +16,7 @@ Custom Passes have been implemented through a volume system, but note that it's
Like in volumes, there is two modes for the custom pass volume: `Local` and `Global`. The `Local` mode uses colliders attached to the GameObject where the custom pass is to define a zone where the effect will be executed. `Global` volumes are executed everywhere in your scene.
The priority is used to determine the execution order when you have multiple custom pass volumes in your scene that share the same injection point.
-A `fade` system is also available to allow you to smooth the transition between your normal rendering and the custom custom pass. The control over the distance of the fade is done by the **Fade Radius** field in the UI of the Custom Pass Volume Component, the radius is exposed in meter and is not scaled with the object transform.
+A `fade` system is also available to allow you to smooth the transition between your normal rendering and the custom pass. The control over the distance of the fade is done by the **Fade Radius** field in the UI of the Custom Pass Volume Component, the radius is exposed in meter and is not scaled with the object transform.
Because we give the full control over what can be done in the custom passes, the fading must be manually included in your effects. To help you, there is a builtin variable `_FadeValue` in the shader and `CustomPass.fadeValue` in the C# that contains a value between 0 and 1 representing how far the camera is from the collider bounding volume. If you want more details about the fading in script, you can [jump to the scripting API tag](#ScriptingAPI).
Here you can see an example of a custom pass with a box collider (solid transparent box) and the fade radius is represented by the wireframe cube.
@@ -101,7 +101,7 @@ In this snippet, we fetch a lot of useful input data that you might need in your
### DrawRenderers Custom Pass
-This pass will allow you to draw a subset of objects that are in the camera view (result of the camera culling).
+This pass will allow you to draw a subset of objects that are in the camera view (the result of the camera culling).
Here is how the inspector for the DrawRenderers pass looks like:

@@ -121,11 +121,11 @@ Before Transparent | Unlit + Lit forward only with refraction
Before Post Process | Unlit + Lit forward only with refraction
After Post Process | Unlit + Lit forward only with refraction
-If you try to render a material in a unsupported configuration, it will result in an undefined behavior. For example rendering lit objects during `After Opaque Depth And Normal` will produce unexpected results.
+If you try to render material in an unsupported configuration, it will result in an undefined behavior. For example rendering lit objects during `After Opaque Depth And Normal` will produce unexpected results.
The pass name is also used to select which pass of the shader we will render, on a ShaderGraph or an HDRP unlit material it is useful because the default pass is the `SceneSelectionPass` and the pass used to render the object is `ForwardOnly`. You might also want to use the `DepthForwardOnly` pass if you want to only render the depth of the object.
-To create advanced effects, you can use the **Custom Renderers Pass** shader that will create an unlit one pass HDRP shader and inside the `GetSurfaceAndBuiltinData` function you will be able ot put your fragment shader code:
+To create advanced effects, you can use the **Custom Renderers Pass** shader that will create an unlit one pass HDRP shader and inside the `GetSurfaceAndBuiltinData` function you will be able to put your fragment shader code:
```HLSL
// Put the code to render the objects in your custom pass in this function
@@ -219,7 +219,7 @@ class #SCRIPTNAME# : CustomPass
{
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) {}
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera camera, CullingResults cullingResult) {}
+ protected override void Execute(CustomPassContext ctx) {}
protected override void Cleanup() {}
}
@@ -233,7 +233,7 @@ To code your custom pass, you have three entry point:
In the `Setup` and `Execute` functions, we gives you access to the [ScriptableRenderContext](https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Rendering.ScriptableRenderContext.html) and a [CommandBuffer](https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Rendering.CommandBuffer.html), these two classes contains everything you need to render pretty much everything but here we will focus on these two functions [ScriptableRenderContext.DrawRenderers](https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Rendering.ScriptableRenderContext.DrawRenderers.html) and [CommandBuffer.DrawProcedural](https://docs.unity3d.com/2019.3/Documentation/ScriptReference/Rendering.CommandBuffer.DrawProcedural.html).
-> **Important:** if the a shader is never referenced in any of your scenes it won't get built and the effect will not work when running the game outside of the editor. Either add it to a [Resources folder](https://docs.unity3d.com/Manual/LoadingResourcesatRuntime.html) or put it in the **Always Included Shaders** list in `Edit -> Project Settings -> Graphics`. Be careful with this especially if you load shaders using `Shader.Find()` otherwise, you'll end up with a black screen.
+> **Important:** if the shader is never referenced in any of your scenes it won't get built and the effect will not work when running the game outside of the editor. Either add it to a [Resources folder](https://docs.unity3d.com/Manual/LoadingResourcesatRuntime.html) or put it in the **Always Included Shaders** list in `Edit -> Project Settings -> Graphics`. Be careful with this especially if you load shaders using `Shader.Find()` otherwise, you'll end up with a black screen.
> **Pro Tips:**
@@ -249,9 +249,13 @@ In the `Setup` and `Execute` functions, we gives you access to the [ScriptableRe
Now that you have allocated your resources you're ready to start doing stuff in the `Execute` function.
+### CustomPassUtils API functions
+
+The CustomPassUtils class contains powerful utility functions to help you build your effects, to learn more, check out the [Custom Pass API User Manual](Custom-Pass-API-User-Manual.md).
+
### Calling a FullScreen Pass in C\#
-To do a FullScreen pass using a material, we uses `CoreUtils.DrawFullScreen` which under the hood call `DrawProcedural` on the Command Buffer in parameter. So when we do a FullScreen Pass the code looks like this:
+To do a FullScreen pass using a material, we uses `CoreUtils.DrawFullScreen` which under the hood call `DrawProcedural` on the Command Buffer. So when we do a FullScreen Pass the code looks like this:
```CSharp
SetCameraRenderTarget(cmd); // Bind the camera color buffer along with depth without clearing the buffers.
@@ -261,9 +265,20 @@ CoreUtils.DrawFullScreen(cmd, material, shaderPassId: 0);
Where `cmd` is the command buffer and shaderPassId is the equivalent of `Pass Name` in the UI but with indices instead. Note that in this example the `SetCameraRenderTarget` is optional because the render target bound when the `Execute` function is called is the one set in the UI with the `Target Color Buffer` and `Target Depth Buffer` fields.
-### Calling DrawRenderers inC\#
+Alternatively, you can also use HDUtils.DrawFullScreen function which takes in parameter the buffer you want to write to, like this:
+```CSharp
+HDUtils.DrawFullScreen(cmd, material, targetBuffer, shaderPassId: shaderPassId);
+```
+
+### Calling DrawRenderers in C\#
+
+Calling the DrawRenderers function on the ScriptableRenderContext require a lot of boilerplate code and to simplify this, the CustomPassUtils class provides a function that takes less arguments:
+
+```CSharp
+CustomPassUtils.DrawRenderers(in CustomPassContext ctx, LayerMask layerMask, CustomPass.RenderQueueType renderQueueFilter = CustomPass.RenderQueueType.All, Material overrideMaterial = null, int overideMaterialIndex = 0)
+```
-Calling the DrawRenderers function on the ScriptableRenderContext require a lot of boilerplate code and to simplify this, HDRP provides a simpler interface:
+But because it is simpler, it is also less flexible so you'll probably need more controls and in this case you can use this more complex syntax:
```CSharp
var result = new RendererListDesc(shaderTags, cullingResult, hdCamera.camera)
@@ -284,9 +299,11 @@ For the `renderQueueRange`, you can use the `GetRenderQueueRange` function in th
> **⚠️ WARNING: Be careful with the override material pass index:** when you call the DrawRenderers with an [override material](https://docs.unity3d.com/ScriptReference/Rendering.DrawingSettings-overrideMaterial.html), then you need to select which pass you're going to render using the override material pass index. But in build, this index can be changed after that the shader stripper removed passes from shader (like every HDRP shaders) and that will shift the pass indices in the shader and so your index will become invalid. To prevent this issue, we recommend to store the name of the pass and then use `Material.FindPass` when issuing the draw.
+> **⚠️ WARNING: Opaque objects may not be visible** if they are rendered only during the custom pass, because we assume that they already are in the depth pre-pass, we set the `Depth Test` to `Depth Equal`. Because of this you may need to override the `Depth Test` to `Less Equal` using the `depthState` property of the [RenderStateBlock](https://docs.unity3d.com/ScriptReference/Rendering.RenderStateBlock.html).
+
### Scripting the volume component
-You can retrieve the `CustomPassVolume` in script using [GetComponent](https://docs.unity3d.com/2019.3/Documentation/ScriptReference/GameObject.GetComponent.html) and access most of the things available from the UI like `isGlobal`, `fadeRadius` and `injectionPoint`.
+You can retrieve the `CustomPassVolume` in a script using [GetComponent](https://docs.unity3d.com/2019.3/Documentation/ScriptReference/GameObject.GetComponent.html) and access most of the things available from the UI like `isGlobal`, `fadeRadius` and `injectionPoint`.
You can also dynamically change the list of Custom Passes executed by modifying the `customPasses` list.
@@ -323,7 +340,24 @@ When you create a custom pass drawer, even if your DoPassGUI is empty, you'll ha
protected override PassUIFlag commonPassUIFlags => PassUIFlag.Name | PassUIFlag.TargetColorBuffer;
```
-### Other API functions
+### Troubleshooting
+
+#### Scaling issues
+
+They can appear when you have two cameras that are not using the same resolution (most common case in-game and scene views) and can be caused by:
+
+- Calls to [CommandBuffer.SetRenderTarget()](https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.SetRenderTarget.html) instead of [CoreUtils.SetRenderTarget()](https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/index.html?subfolder=/api/UnityEngine.Rendering.CoreUtils.html#UnityEngine_Rendering_CoreUtils_SetRenderTarget_CommandBuffer_UnityEngine_Rendering_RTHandle_UnityEngine_Rendering_RTHandle_UnityEngine_Rendering_ClearFlag_System_Int32_CubemapFace_System_Int32_). Note that the CoreUtils one also sets the viewport.
+- In the shader, a missing multiplication by `_RTHandleScale.xy` for the UVs when sampling an RTHandle buffer.
+
+#### Shuriken Particle System
+
+When you render a particle system that is only visible in the custom pass and your particles are facing the wrong direction it's probably because you didn't override the `AggregateCullingParameters`. The orientation of the particles in Shuriken is computed during the culling so if you don't have the correct setup it will not be rendered properly.
+
+#### Decals
+
+Decals applied on objects rendered with custom passes will only be applied to transparent objects rendered after the `After Depth and Normal` injection point. Decals will be ignored with Opaque objects.
+
+#### Culling issues
Sometimes you want to render objects only in a custom pass and not in the camera. To achieve this, you disable the layer of your objects in the camera culling mask, but it also means that the cullingResult you receive in the `Execute` function won't contain this object (because by default this cullingResult is the camera cullingResult). To overcome this issue, you can override this function in the CustomPass class:
@@ -331,18 +365,20 @@ Sometimes you want to render objects only in a custom pass and not in the camera
protected virtual void AggregateCullingParameters(ref ScriptableCullingParameters cullingParameters, HDCamera camera) {}
```
-it will allow you to add more layers / custom culling option to the cullingResult you receive in the `Execute` function.
+it will allow you to add more layers / custom culling options to the cullingResult you receive in the `Execute` function.
-> **⚠️ WARNING: Opaque objects may not be visible** if they are rendered only during the custom pass, because we assume that they already are in the depth pre-pass, we set the `Depth Test` to `Depth Equal`. Because of this you may need to override the `Depth Test` to `Less Equal` using the `depthState` property of the [RenderStateBlock](https://docs.unity3d.com/ScriptReference/Rendering.RenderStateBlock.html).
+## How to debug ?
-### Troubleshooting
-
-**Scaling issues**, they can appear when you have two cameras that are not using the same resolution (most common case in game and scene views) and can be caused by:
+When writing your effect, you'll probably arrive at a point where you want to debug and analyze what's going on.
-- Calls to [CommandBuffer.SetRenderTarget()](https://docs.unity3d.com/ScriptReference/Rendering.CommandBuffer.SetRenderTarget.html) instead of [CoreUtils.SetRenderTarget()](https://docs.unity3d.com/Packages/com.unity.render-pipelines.core@latest/index.html?subfolder=/api/UnityEngine.Rendering.CoreUtils.html#UnityEngine_Rendering_CoreUtils_SetRenderTarget_CommandBuffer_UnityEngine_Rendering_RTHandle_UnityEngine_Rendering_RTHandle_UnityEngine_Rendering_ClearFlag_System_Int32_CubemapFace_System_Int32_). Note that the CoreUtils one also sets the viewport.
-- In the shader, a missing multiplication by `_RTHandleScale.xy` for the UVs when sampling an RTHandle buffer.
+The frame debugger is here to help you, enabling it in the game view allow you to examine every draw calls you issued in the custom pass. To find your pass, you just need to search for the name of custom pass you set in the UI.
+For example, in this image I'm debugging the outline pass which I called "My Outline Pass" in the inspector:
+
-**Shuriken Particle System**, when you render a particle system that is only visible in the custom pass and your particles are facing the wrong direction it's probably because you didn't override the `AggregateCullingParameters`. The orientation of the particles in Shuriken is computed during the culling so if you don't have the correct setup it will not be rendered properly.
+You can now clearly see the steps executed by the custom pass:
+- `Clear` on the 'Outline Buffer'
+- `RenderLoopNewBatcher.Draw` is a call to DrawRenderers, it will draw meshes we selected using the SRP Batcher.
+- `Draw Procedural` is our fullscreen pass which takes the outline buffer in parameter and blits the outline to our camera color buffer.
## Example: Glitch Effect (without code)
@@ -389,57 +425,34 @@ class Outline : CustomPass
Shader outlineShader;
Material fullscreenOutline;
- MaterialPropertyBlock outlineProperties;
- ShaderTagId[] shaderTags;
RTHandle outlineBuffer;
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
{
outlineShader = Shader.Find("Hidden/Outline");
fullscreenOutline = CoreUtils.CreateEngineMaterial(outlineShader);
- outlineProperties = new MaterialPropertyBlock();
-
- // List all the materials that will be replaced in the frame
- shaderTags = new ShaderTagId[3]
- {
- new ShaderTagId("Forward"),
- new ShaderTagId("ForwardOnly"),
- new ShaderTagId("SRPDefaultUnlit"),
- };
outlineBuffer = RTHandles.Alloc(
Vector2.one, TextureXR.slices, dimension: TextureXR.dimension,
- colorFormat: GraphicsFormat.B10G11R11_UFloatPack32,
+ colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, // We don't need alpha for this effect
useDynamicScale: true, name: "Outline Buffer"
);
}
- void DrawOutlineMeshes(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
- {
- var result = new RendererListDesc(shaderTags, cullingResult, hdCamera.camera)
- {
- // We need the lighting render configuration to support rendering lit objects
- rendererConfiguration = PerObjectData.LightProbe | PerObjectData.LightProbeProxyVolume | PerObjectData.Lightmaps,
- renderQueueRange = RenderQueueRange.all,
- sortingCriteria = SortingCriteria.BackToFront,
- excludeObjectMotionVectors = false,
- layerMask = outlineLayer,
- };
-
- CoreUtils.SetRenderTarget(cmd, outlineBuffer, ClearFlag.Color);
- HDUtils.DrawRendererList(renderContext, cmd, RendererList.Create(result));
- }
-
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera camera, CullingResults cullingResult)
+ protected override void Execute(CustomPassContext ctx)
{
- DrawOutlineMeshes(renderContext, cmd, camera, cullingResult);
-
- SetCameraRenderTarget(cmd);
-
- outlineProperties.SetColor("_OutlineColor", outlineColor);
- outlineProperties.SetTexture("_OutlineBuffer", outlineBuffer);
- outlineProperties.SetFloat("_Threshold", threshold);
- CoreUtils.DrawFullScreen(cmd, fullscreenOutline, outlineProperties, shaderPassId: 0);
+ // Render meshes we want to outline in the outline buffer
+ CoreUtils.SetRenderTarget(ctx.cmd, outlineBuffer, ClearFlag.Color);
+ CustomPassUtils.DrawRenderers(ctx, outlineLayer);
+
+ // Setup outline effect properties
+ ctx.propertyBlock.SetColor("_OutlineColor", outlineColor);
+ ctx.propertyBlock.SetTexture("_OutlineBuffer", outlineBuffer);
+ ctx.propertyBlock.SetFloat("_Threshold", threshold);
+
+ // Render the outline as a fullscreen alpha-blended pass on top of the camera color
+ CoreUtils.SetRenderTarget(ctx.cmd, ctx.cameraColorBuffer, ClearFlag.None);
+ CoreUtils.DrawFullScreen(ctx.cmd, fullscreenOutline, ctx.propertyBlock, shaderPassId: 0);
}
protected override void Cleanup()
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/CustomPass_FrameDebugger.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/CustomPass_FrameDebugger.png
new file mode 100644
index 00000000000..73f1ee8968a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/CustomPass_FrameDebugger.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:250bc517d35f454a35bb326ff9ed9779016a1f58d16be42fd3ac2c4af6600033
+size 748344
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassCSharpScript.template b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassCSharpScript.template
index 3acb8547e31..bb5d0deb692 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassCSharpScript.template
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassCSharpScript.template
@@ -14,9 +14,10 @@ class #SCRIPTNAME# : CustomPass
// Setup code here
}
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
+ protected override void Execute(CustomPassContext ctx)
{
- // Executed every frame for all the camera inside the pass volume
+ // Executed every frame for all the camera inside the pass volume.
+ // The context contains the command buffer to use to enqueue graphics commands.
}
protected override void Cleanup()
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassDrawer.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassDrawer.cs
index f9fe32253d7..4921eb510ce 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassDrawer.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassDrawer.cs
@@ -158,36 +158,33 @@ void DoCommonSettingsGUI(ref Rect rect)
rect.y += Styles.defaultLineSpace;
}
-#if true
if ((commonPassUIFlags & PassUIFlag.TargetColorBuffer) != 0)
{
- m_TargetColorBuffer.intValue = (int)(CustomPass.TargetBuffer)EditorGUI.EnumPopup(rect, Styles.targetColorBuffer, (CustomPass.TargetBuffer)m_TargetColorBuffer.intValue);
+ EditorGUI.BeginProperty(rect, Styles.targetColorBuffer, m_TargetColorBuffer);
+ // There is still a bug with SerializedReference and PropertyField so we can't use it yet
+ // EditorGUI.PropertyField(rect, m_TargetColorBuffer, Styles.targetColorBuffer);
+ m_TargetColorBuffer.intValue = (int)(CustomPass.TargetBuffer)EditorGUI.EnumPopup(rect, Styles.targetColorBuffer, (CustomPass.TargetBuffer)m_TargetColorBuffer.intValue);
+ EditorGUI.EndProperty();
rect.y += Styles.defaultLineSpace;
}
if ((commonPassUIFlags & PassUIFlag.TargetDepthBuffer) != 0)
{
- m_TargetDepthBuffer.intValue = (int)(CustomPass.TargetBuffer)EditorGUI.EnumPopup(rect, Styles.targetDepthBuffer, (CustomPass.TargetBuffer)m_TargetDepthBuffer.intValue);
+ EditorGUI.BeginProperty(rect, Styles.targetColorBuffer, m_TargetDepthBuffer);
+ // EditorGUI.PropertyField(rect, m_TargetDepthBuffer, Styles.targetDepthBuffer);
+ m_TargetDepthBuffer.intValue = (int)(CustomPass.TargetBuffer)EditorGUI.EnumPopup(rect, Styles.targetDepthBuffer, (CustomPass.TargetBuffer)m_TargetDepthBuffer.intValue);
+ EditorGUI.EndProperty();
rect.y += Styles.defaultLineSpace;
}
if ((commonPassUIFlags & PassUIFlag.ClearFlags) != 0)
{
- m_ClearFlags.intValue = (int)(ClearFlag)EditorGUI.EnumPopup(rect, Styles.clearFlags, (ClearFlag)m_ClearFlags.intValue);
+ EditorGUI.BeginProperty(rect, Styles.clearFlags, m_ClearFlags);
+ // EditorGUI.PropertyField(rect, m_ClearFlags, Styles.clearFlags);
+ m_ClearFlags.intValue = (int)(ClearFlag)EditorGUI.EnumPopup(rect, Styles.clearFlags, (ClearFlag)m_ClearFlags.intValue);
+ EditorGUI.EndProperty();
rect.y += Styles.defaultLineSpace;
}
-
-#else // TODO: remove all this code when the fix for SerializedReference lands
-
- EditorGUI.PropertyField(rect, m_TargetColorBuffer, Styles.targetColorBuffer);
- rect.y += Styles.defaultLineSpace;
-
- EditorGUI.PropertyField(rect, m_TargetDepthBuffer, Styles.targetDepthBuffer);
- rect.y += Styles.defaultLineSpace;
-
- EditorGUI.PropertyField(rect, m_ClearFlags, Styles.clearFlags);
- rect.y += Styles.defaultLineSpace;
-#endif
}
///
@@ -216,10 +213,18 @@ void DoHeaderGUI(ref Rect rect)
enabledRect.x = rect.xMax - enabledSize.x;
enabledRect.width = enabledSize.x;
- m_PassFoldout.boolValue = EditorGUI.Foldout(headerRect, m_PassFoldout.boolValue, $"{m_Name.stringValue} ({m_PassType.Name})", true, EditorStyles.boldLabel);
- EditorGUIUtility.labelWidth = enabledRect.width - 14;
- m_Enabled.boolValue = EditorGUI.Toggle(enabledRect, Styles.enabled, m_Enabled.boolValue);
- EditorGUIUtility.labelWidth = 0;
+ EditorGUI.BeginProperty(headerRect, GUIContent.none, m_PassFoldout);
+ {
+ m_PassFoldout.boolValue = EditorGUI.Foldout(headerRect, m_PassFoldout.boolValue, $"{m_Name.stringValue} ({m_PassType.Name})", true, EditorStyles.boldLabel);
+ }
+ EditorGUI.EndProperty();
+ EditorGUI.BeginProperty(enabledRect, Styles.enabled, m_Enabled);
+ {
+ EditorGUIUtility.labelWidth = enabledRect.width - 14;
+ m_Enabled.boolValue = EditorGUI.Toggle(enabledRect, Styles.enabled, m_Enabled.boolValue);
+ EditorGUIUtility.labelWidth = 0;
+ }
+ EditorGUI.EndProperty();
}
///
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassVolumeEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassVolumeEditor.cs
index 1c22be4c267..19b8e67f528 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassVolumeEditor.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/CustomPassVolumeEditor.cs
@@ -71,7 +71,7 @@ public override void OnInspectorGUI()
}
List GatherCustomPassesMaterials()
- => m_Volume.customPasses.SelectMany(p => p.RegisterMaterialForInspector()).Where(m => m != null).ToList();
+ => m_Volume.customPasses.Where(p => p != null).SelectMany(p => p.RegisterMaterialForInspector()).Where(m => m != null).ToList();
void UpdateMaterialEditors()
{
@@ -113,6 +113,9 @@ CustomPassDrawer GetCustomPassDrawer(SerializedProperty pass, int listIndex)
var customPass = m_Volume.customPasses[listIndex];
+ if (customPass == null)
+ return null;
+
foreach (var drawerType in TypeCache.GetTypesWithAttribute(typeof(CustomPassDrawerAttribute)))
{
var attr = drawerType.GetCustomAttributes(typeof(CustomPassDrawerAttribute), true)[0] as CustomPassDrawerAttribute;
@@ -140,7 +143,12 @@ void DrawSettingsGUI()
EditorGUI.BeginChangeCheck();
{
- m_SerializedPassVolume.isGlobal.boolValue = EditorGUILayout.Popup(Styles.isGlobal, m_SerializedPassVolume.isGlobal.boolValue ? 0 : 1, Styles.modes) == 0;
+ Rect isGlobalRect = EditorGUILayout.GetControlRect();
+ EditorGUI.BeginProperty(isGlobalRect, Styles.isGlobal, m_SerializedPassVolume.isGlobal);
+ {
+ m_SerializedPassVolume.isGlobal.boolValue = EditorGUI.Popup(isGlobalRect, Styles.isGlobal, m_SerializedPassVolume.isGlobal.boolValue ? 0 : 1, Styles.modes) == 0;
+ }
+ EditorGUI.EndProperty();
EditorGUILayout.PropertyField(m_SerializedPassVolume.injectionPoint, Styles.injectionPoint);
EditorGUILayout.PropertyField(m_SerializedPassVolume.priority, Styles.priority);
if (!m_SerializedPassVolume.isGlobal.boolValue)
@@ -163,9 +171,15 @@ void DrawCustomPassReorderableList()
}
}
- EditorGUILayout.BeginVertical();
- m_CustomPassList.DoLayoutList();
- EditorGUILayout.EndVertical();
+ float customPassListHeight = m_CustomPassList.GetHeight();
+ var customPassRect = EditorGUILayout.GetControlRect(false, customPassListHeight);
+ EditorGUI.BeginProperty(customPassRect, GUIContent.none, m_SerializedPassVolume.customPasses);
+ {
+ EditorGUILayout.BeginVertical();
+ m_CustomPassList.DoList(customPassRect);
+ EditorGUILayout.EndVertical();
+ }
+ EditorGUI.EndProperty();
}
void CreateReorderableList(SerializedProperty passList)
@@ -200,28 +214,34 @@ void CreateReorderableList(SerializedProperty passList)
};
m_CustomPassList.onAddCallback += (list) => {
- Undo.RegisterCompleteObjectUndo(target, "Remove custom pass");
+ Undo.RegisterCompleteObjectUndo(target, "Add custom pass");
var menu = new GenericMenu();
foreach (var customPassType in TypeCache.GetTypesDerivedFrom())
{
if (customPassType.IsAbstract)
continue;
-
+
menu.AddItem(new GUIContent(customPassType.Name), false, () => {
- m_Volume.AddPassOfType(customPassType);
passList.serializedObject.Update();
+ m_Volume.AddPassOfType(customPassType);
UpdateMaterialEditors();
- });
+ passList.serializedObject.ApplyModifiedProperties();
+ // Notify the prefab that something have changed:
+ PrefabUtility.RecordPrefabInstancePropertyModifications(target);
+ });
}
menu.ShowAsContext();
};
m_CustomPassList.onRemoveCallback = (list) => {
+ passList.serializedObject.Update();
Undo.RegisterCompleteObjectUndo(target, "Remove custom pass");
m_Volume.customPasses.RemoveAt(list.index);
- passList.serializedObject.Update();
UpdateMaterialEditors();
+ passList.serializedObject.ApplyModifiedProperties();
+ // Notify the prefab that something have changed:
+ PrefabUtility.RecordPrefabInstancePropertyModifications(target);
};
}
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs
index 0d28dd585c9..dfcb90d269a 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs
@@ -161,8 +161,7 @@ protected override void DoPassGUI(SerializedProperty customPass, Rect rect)
#endif
// TODO: remove all this code when the fix for SerializedReference lands
- // EditorGUI.PropertyField(rect, m_SortingCriteria, Styles.sortingCriteria);
- m_SortingCriteria.intValue = (int)(SortingCriteria)EditorGUI.EnumPopup(rect, Styles.sortingCriteria, (SortingCriteria)m_SortingCriteria.intValue);
+ EditorGUI.PropertyField(rect, m_SortingCriteria, Styles.sortingCriteria);
rect.y += Styles.defaultLineSpace;
EditorGUI.indentLevel--;
@@ -173,7 +172,7 @@ protected override void DoPassGUI(SerializedProperty customPass, Rect rect)
bool ShowOpaqueObjectWarning()
{
// Only opaque objects are concerned
- RenderQueueRange currentRange = CustomPass.GetRenderQueueRangeFromRenderQueueType((CustomPass.RenderQueueType)m_RenderQueue.intValue);
+ RenderQueueRange currentRange = CustomPassUtils.GetRenderQueueRangeFromRenderQueueType((CustomPass.RenderQueueType)m_RenderQueue.intValue);
var allOpaque = HDRenderQueue.k_RenderQueue_AllOpaque;
bool customPassQueueContainsOpaqueObjects = currentRange.upperBound >= allOpaque.lowerBound && currentRange.lowerBound <= allOpaque.upperBound;
if (!customPassQueueContainsOpaqueObjects)
@@ -205,10 +204,11 @@ void DoFilters(ref Rect rect)
if (m_FilterFoldout.boolValue)
{
EditorGUI.indentLevel++;
- //Render queue filter
+ EditorGUI.BeginProperty(rect, Styles.renderQueueFilter, m_RenderQueue);
+ // There is still a bug with SerializedReference and PropertyField so we can't use it yet
// EditorGUI.PropertyField(rect, m_RenderQueue, Styles.renderQueueFilter);
- // TODO: remove all this code when the fix for SerializedReference lands
m_RenderQueue.intValue = (int)(CustomPass.RenderQueueType)EditorGUI.EnumPopup(rect, Styles.renderQueueFilter, (CustomPass.RenderQueueType)m_RenderQueue.intValue);
+ EditorGUI.EndProperty();
rect.y += Styles.defaultLineSpace;
if (ShowOpaqueObjectWarning())
{
@@ -229,9 +229,7 @@ void DoMaterialOverride(ref Rect rect)
{
//Override material
EditorGUI.BeginChangeCheck();
- // TODO: remove all this code when the fix for SerializedReference lands
- m_OverrideMaterial.objectReferenceValue = EditorGUI.ObjectField(rect, Styles.overrideMaterial, m_OverrideMaterial.objectReferenceValue, typeof(Material), false);
- // EditorGUI.PropertyField(rect, m_OverrideMaterial, Styles.overrideMaterial);
+ EditorGUI.PropertyField(rect, m_OverrideMaterial, Styles.overrideMaterial);
if (EditorGUI.EndChangeCheck())
{
var mat = m_OverrideMaterial.objectReferenceValue as Material;
@@ -244,37 +242,49 @@ void DoMaterialOverride(ref Rect rect)
EditorGUI.indentLevel++;
if (m_OverrideMaterial.objectReferenceValue)
{
- var mat = m_OverrideMaterial.objectReferenceValue as Material;
- EditorGUI.BeginChangeCheck();
- int index = mat.FindPass(m_OverrideMaterialPassName.stringValue);
- index = EditorGUI.IntPopup(rect, Styles.overrideMaterialPass, index, GetMaterialPassNames(mat), Enumerable.Range(0, mat.passCount).ToArray());
- if (EditorGUI.EndChangeCheck())
- m_OverrideMaterialPassName.stringValue = mat.GetPassName(index);
+ EditorGUI.BeginProperty(rect, Styles.overrideMaterialPass, m_OverrideMaterialPassName);
+ {
+ var mat = m_OverrideMaterial.objectReferenceValue as Material;
+ EditorGUI.BeginChangeCheck();
+ int index = mat.FindPass(m_OverrideMaterialPassName.stringValue);
+ index = EditorGUI.IntPopup(rect, Styles.overrideMaterialPass, index, GetMaterialPassNames(mat), Enumerable.Range(0, mat.passCount).ToArray());
+ if (EditorGUI.EndChangeCheck())
+ m_OverrideMaterialPassName.stringValue = mat.GetPassName(index);
+ }
+ EditorGUI.EndProperty();
}
else
{
+ EditorGUI.BeginProperty(rect, Styles.renderQueueFilter, m_RenderQueue);
+ // There is still a bug with SerializedReference and PropertyField so we can't use it yet
+ // EditorGUI.PropertyField(rect, m_ShaderPass, Styles.shaderPass);
m_ShaderPass.intValue = (int)(DrawRenderersCustomPass.ShaderPass)EditorGUI.EnumPopup(rect, Styles.shaderPass, (DrawRenderersCustomPass.ShaderPass)m_ShaderPass.intValue);
+ EditorGUI.EndProperty();
}
EditorGUI.indentLevel--;
rect.y += Styles.defaultLineSpace;
- if (customDepthIsNone)
- {
- using (new EditorGUI.DisabledScope(true))
- EditorGUI.Toggle(rect, Styles.overrideDepth, false);
- }
- else
+ EditorGUI.BeginProperty(rect, Styles.overrideDepth, m_OverrideDepthState);
{
- m_OverrideDepthState.boolValue = EditorGUI.Toggle(rect, Styles.overrideDepth, m_OverrideDepthState.boolValue);
+ if (customDepthIsNone)
+ {
+ using (new EditorGUI.DisabledScope(true))
+ EditorGUI.Toggle(rect, Styles.overrideDepth, false);
+ }
+ else
+ {
+ EditorGUI.PropertyField(rect, m_OverrideDepthState, Styles.overrideDepth);
+ }
}
+ EditorGUI.EndProperty();
if (m_OverrideDepthState.boolValue && !customDepthIsNone)
{
EditorGUI.indentLevel++;
rect.y += Styles.defaultLineSpace;
- m_DepthCompareFunction.intValue = (int)(CompareFunction)EditorGUI.EnumPopup(rect, Styles.depthCompareFunction, (CompareFunction)m_DepthCompareFunction.intValue);
+ EditorGUI.PropertyField(rect, m_DepthCompareFunction, Styles.depthCompareFunction);
rect.y += Styles.defaultLineSpace;
- m_DepthWrite.boolValue = EditorGUI.Toggle(rect, Styles.depthWrite, m_DepthWrite.boolValue);
+ EditorGUI.PropertyField(rect, m_DepthWrite, Styles.depthWrite);
EditorGUI.indentLevel--;
}
}
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/FullScreenCustomPassDrawer.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/FullScreenCustomPassDrawer.cs
index 909409738fa..7d52d4b7017 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/FullScreenCustomPassDrawer.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/FullScreenCustomPassDrawer.cs
@@ -54,19 +54,21 @@ protected override void DoPassGUI(SerializedProperty customPass, Rect rect)
rect.y += Styles.defaultLineSpace;
}
- // TODO: remove all this code when the fix for SerializedReference lands
- m_FullScreenPassMaterial.objectReferenceValue = EditorGUI.ObjectField(rect, Styles.fullScreenPassMaterial, m_FullScreenPassMaterial.objectReferenceValue, typeof(Material), false);
- // EditorGUI.PropertyField(rect, m_FullScreenPassMaterial, Styles.fullScreenPassMaterial);
+ EditorGUI.PropertyField(rect, m_FullScreenPassMaterial, Styles.fullScreenPassMaterial);
rect.y += Styles.defaultLineSpace;
if (m_FullScreenPassMaterial.objectReferenceValue is Material mat)
{
using (new EditorGUI.IndentLevelScope())
{
- EditorGUI.BeginChangeCheck();
- int index = mat.FindPass(m_MaterialPassName.stringValue);
- index = EditorGUI.IntPopup(rect, Styles.materialPassName, index, GetMaterialPassNames(mat), Enumerable.Range(0, mat.passCount).ToArray());
- if (EditorGUI.EndChangeCheck())
- m_MaterialPassName.stringValue = mat.GetPassName(index);
+ EditorGUI.BeginProperty(rect, Styles.materialPassName, m_MaterialPassName);
+ {
+ EditorGUI.BeginChangeCheck();
+ int index = mat.FindPass(m_MaterialPassName.stringValue);
+ index = EditorGUI.IntPopup(rect, Styles.materialPassName, index, GetMaterialPassNames(mat), Enumerable.Range(0, mat.passCount).ToArray());
+ if (EditorGUI.EndChangeCheck())
+ m_MaterialPassName.stringValue = mat.GetPassName(index);
+ }
+ EditorGUI.EndProperty();
}
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs
index fb4a2784813..3705f7a65fa 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs
@@ -40,17 +40,17 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff
m_FullscreenPassMaterial = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.customClearPS);
}
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera camera, CullingResults cullingResult)
+ protected override void Execute(CustomPassContext ctx)
{
// Executed every frame for all the camera inside the pass volume
- AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent();
+ AdditionalCompositorData layerData = ctx.hdCamera.camera.gameObject.GetComponent();
if (layerData == null || layerData.clearColorTexture == null)
{
return;
}
else
{
- float cameraAspectRatio = (float)camera.actualWidth / camera.actualHeight;
+ float cameraAspectRatio = (float)ctx.hdCamera.actualWidth / ctx.hdCamera.actualHeight;
float imageAspectRatio = (float)layerData.clearColorTexture.width / layerData.clearColorTexture.height;
var scaleBiasRt = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
@@ -71,7 +71,7 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu
{
m_FullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBiasRt, new Vector4(1.0f, 1.0f, 0.0f, 0.0f));
m_FullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f));
- cmd.DrawProcedural(Matrix4x4.identity, m_FullscreenPassMaterial, (int)PassType.ClearColorAndStencil, MeshTopology.Quads, 4, 1);
+ ctx.cmd.DrawProcedural(Matrix4x4.identity, m_FullscreenPassMaterial, (int)PassType.ClearColorAndStencil, MeshTopology.Quads, 4, 1);
}
m_FullscreenPassMaterial.SetTexture(ShaderIDs.k_BlitTexture, layerData.clearColorTexture);
@@ -80,7 +80,7 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu
m_FullscreenPassMaterial.SetInt(ShaderIDs.k_ClearAlpha, layerData.clearAlpha ? 1 : 0);
// draw a quad (not Triangle), to support letter boxing and stretching
- cmd.DrawProcedural(Matrix4x4.identity, m_FullscreenPassMaterial, (int)PassType.DrawTextureAndClearStencil, MeshTopology.Quads, 4, 1);
+ ctx.cmd.DrawProcedural(Matrix4x4.identity, m_FullscreenPassMaterial, (int)PassType.DrawTextureAndClearStencil, MeshTopology.Quads, 4, 1);
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs
index cc057ec6d07..2c960245d8e 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs
@@ -1436,6 +1436,8 @@ void RegisterRenderingDebug()
widgetList.Add(new DebugUI.BoolField { displayName = "XR single-pass test mode", getter = () => data.xrSinglePassTestMode, setter = value => data.xrSinglePassTestMode = value });
}
+ //widgetList.Add(new DebugUI.BoolField { displayName = "Enable Render Graph", getter = () => HDRenderPipeline.currentPipeline.IsRenderGraphEnabled(), setter = value => HDRenderPipeline.currentPipeline.EnableRenderGraph(value) });
+
m_DebugRenderingItems = widgetList.ToArray();
var panel = DebugManager.instance.GetPanel(k_PanelRendering, true);
panel.children.Add(m_DebugRenderingItems);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs
index 6f09825a3dc..a47709bdaaf 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs
@@ -55,6 +55,19 @@ public void InitData(RenderPipelineResources renderPipelineResources)
m_Blit = CoreUtils.CreateEngineMaterial(renderPipelineResources.shaders.blitPS);
+ InitializeNonRenderGraphResources();
+ }
+
+ public void ReleaseData()
+ {
+ CoreUtils.Destroy(m_Blit);
+ CoreUtils.Destroy(m_DebugLightVolumeMaterial);
+
+ CleanupNonRenderGraphResources();
+ }
+
+ public void InitializeNonRenderGraphResources()
+ {
m_LightCountBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R32_SFloat, enableRandomWrite: false, useMipMap: false, name: "LightVolumeCount");
m_ColorAccumulationBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: false, useMipMap: false, name: "LightVolumeColorAccumulation");
m_DebugLightVolumesTexture = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite: true, useMipMap: false, name: "LightVolumeDebugLightVolumesTexture");
@@ -64,16 +77,12 @@ public void InitData(RenderPipelineResources renderPipelineResources)
m_RTIDs[1] = m_ColorAccumulationBuffer;
}
- public void ReleaseData()
+ public void CleanupNonRenderGraphResources()
{
- CoreUtils.Destroy(m_Blit);
-
RTHandles.Release(m_DepthBuffer);
RTHandles.Release(m_DebugLightVolumesTexture);
RTHandles.Release(m_ColorAccumulationBuffer);
RTHandles.Release(m_LightCountBuffer);
-
- CoreUtils.Destroy(m_DebugLightVolumeMaterial);
}
public struct RenderLightVolumesParameters
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadow.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadow.hlsl
index 17e092d4f3f..8d916005488 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadow.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/HDShadow.hlsl
@@ -57,7 +57,7 @@ float GetPunctualShadowClosestDistance(HDShadowContext shadowContext, SamplerSta
// Note: Here we assume that all the shadow map cube faces have been added contiguously in the buffer to retreive the shadow information
// TODO: if on the light type to retrieve the good shadow data
HDShadowData sd = shadowContext.shadowDatas[shadowDataIndex];
-
+
if (pointLight)
{
sd.shadowToWorld = shadowContext.shadowDatas[shadowDataIndex + CubeMapFaceID(-L)].shadowToWorld;
@@ -66,14 +66,14 @@ float GetPunctualShadowClosestDistance(HDShadowContext shadowContext, SamplerSta
sd.rot1 = shadowContext.shadowDatas[shadowDataIndex + CubeMapFaceID(-L)].rot1;
sd.rot2 = shadowContext.shadowDatas[shadowDataIndex + CubeMapFaceID(-L)].rot2;
}
-
+
return EvalShadow_SampleClosestDistance_Punctual(sd, _ShadowmapAtlas, sampl, positionWS, L, lightPositionWS);
}
float GetAreaLightAttenuation(HDShadowContext shadowContext, float2 positionSS, float3 positionWS, float3 normalWS, int shadowDataIndex, float3 L, float L_dist)
{
HDShadowData sd = shadowContext.shadowDatas[shadowDataIndex];
- return EvalShadow_AreaDepth(sd, _AreaShadowmapMomentAtlas, positionSS, positionWS, normalWS, L, L_dist, true);
+ return EvalShadow_AreaDepth(sd, _ShadowmapAreaAtlas, positionSS, positionWS, normalWS, L, L_dist, true);
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs
index a502c37133c..05dec005554 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs
@@ -2717,6 +2717,7 @@ bool PrepareLightsForGPU(CommandBuffer cmd, HDCamera hdCamera, CullingResults cu
}
PushLightDataGlobalParams(cmd);
+ PushShadowGlobalParams(cmd);
}
m_EnableBakeShadowMask = m_EnableBakeShadowMask && hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask);
@@ -3402,20 +3403,6 @@ HDAdditionalLightData GetHDAdditionalLightData(Light light)
return add;
}
- struct ShadowGlobalParameters
- {
- public HDCamera hdCamera;
- public HDShadowManager shadowManager;
- }
-
- ShadowGlobalParameters PrepareShadowGlobalParameters(HDCamera hdCamera)
- {
- ShadowGlobalParameters parameters = new ShadowGlobalParameters();
- parameters.hdCamera = hdCamera;
- parameters.shadowManager = m_ShadowManager;
- return parameters;
- }
-
struct LightLoopGlobalParameters
{
public HDCamera hdCamera;
@@ -3510,16 +3497,9 @@ void PushLightDataGlobalParams(CommandBuffer cmd)
cmd.SetGlobalBuffer(HDShaderIDs._DirectionalLightDatas, m_LightLoopLightData.directionalLightData);
}
- static void PushShadowGlobalParams(in ShadowGlobalParameters param, CommandBuffer cmd)
+ void PushShadowGlobalParams(CommandBuffer cmd)
{
- using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.PushShadowGlobalParameters)))
- {
- Camera camera = param.hdCamera.camera;
-
- // Shadows
- param.shadowManager.SyncData();
- param.shadowManager.BindResources(cmd);
- }
+ m_ShadowManager.PushGlobalParameters(cmd);
}
static void PushLightLoopGlobalParams(in LightLoopGlobalParameters param, CommandBuffer cmd)
@@ -3550,8 +3530,7 @@ void RenderShadowMaps(ScriptableRenderContext renderContext, CommandBuffer cmd,
m_ShadowManager.RenderShadows(renderContext, cmd, globalCB, cullResults, hdCamera);
// Bind the shadow data
- var globalParams = PrepareShadowGlobalParameters(hdCamera);
- PushShadowGlobalParams(globalParams, cmd);
+ m_ShadowManager.BindResources(cmd);
}
bool WillRenderContactShadow()
@@ -3607,7 +3586,6 @@ struct ContactShadowsParameters
public bool rayTracingEnabled;
public RayTracingShader contactShadowsRTS;
public RayTracingAccelerationStructure accelerationStructure;
- public float rayTracingBias;
public int actualWidth;
public int actualHeight;
public int depthTextureParameterName;
@@ -3627,9 +3605,7 @@ ContactShadowsParameters PrepareContactShadowsParameters(HDCamera hdCamera, floa
parameters.rayTracingEnabled = hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing);
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing))
{
- RayTracingSettings raySettings = hdCamera.volumeStack.GetComponent();
parameters.contactShadowsRTS = m_Asset.renderPipelineRayTracingResources.contactShadowRayTracingRT;
- parameters.rayTracingBias = raySettings.rayBias.value;
parameters.accelerationStructure = RequestAccelerationStructure();
parameters.actualWidth = hdCamera.actualWidth;
@@ -3685,7 +3661,6 @@ static void RenderContactShadows( in ContactShadowsParameters parameters,
if (parameters.rayTracingEnabled)
{
cmd.SetRayTracingShaderPass(parameters.contactShadowsRTS, "VisibilityDXR");
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, parameters.rayTracingBias);
cmd.SetRayTracingAccelerationStructure(parameters.contactShadowsRTS, HDShaderIDs._RaytracingAccelerationStructureName, parameters.accelerationStructure);
cmd.SetRayTracingVectorParam(parameters.contactShadowsRTS, HDShaderIDs._ContactShadowParamsParameters, parameters.params1);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs
index a5f2607b370..25273975777 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs
@@ -234,6 +234,17 @@ internal void Cleanup()
ReleaseRT();
}
+ internal void InitializeNonRenderGraphResources()
+ {
+ float scaleFactor = m_RunningFullRes ? 1.0f : 0.5f;
+ AllocRT(scaleFactor);
+ }
+
+ internal void CleanupNonRenderGraphResources()
+ {
+ ReleaseRT();
+ }
+
internal void InitRaytracing(HDRenderPipeline renderPipeline)
{
m_RaytracingAmbientOcclusion.Init(renderPipeline);
@@ -241,7 +252,7 @@ internal void InitRaytracing(HDRenderPipeline renderPipeline)
internal bool IsActive(HDCamera camera, AmbientOcclusion settings) => camera.frameSettings.IsEnabled(FrameSettingsField.SSAO) && settings.intensity.value > 0f;
- internal void Render(CommandBuffer cmd, HDCamera camera, ScriptableRenderContext renderContext, int frameCount)
+ internal void Render(CommandBuffer cmd, HDCamera camera, ScriptableRenderContext renderContext, in ShaderVariablesRaytracing globalRTCB, int frameCount)
{
var settings = camera.volumeStack.GetComponent();
@@ -253,7 +264,7 @@ internal void Render(CommandBuffer cmd, HDCamera camera, ScriptableRenderContext
else
{
if (camera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) && settings.rayTracing.value)
- m_RaytracingAmbientOcclusion.RenderAO(camera, cmd, m_AmbientOcclusionTex, renderContext, frameCount);
+ m_RaytracingAmbientOcclusion.RenderAO(camera, cmd, m_AmbientOcclusionTex, globalRTCB, renderContext, frameCount);
else
{
Dispatch(cmd, camera, frameCount);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.compute
index 64e18e22537..6f47c1a6a3d 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.compute
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.compute
@@ -31,6 +31,7 @@ CBUFFER_START(UnityScreenSpaceGlobalIllumination)
float2 _DepthPyramidFirstMipLevelOffset;
float4 _HalfScreenSize;
int _IndirectDiffuseSpatialFilter;
+ float _HistoryValidity;
CBUFFER_END
// Denoised output buffer
@@ -204,7 +205,7 @@ void TEMPORAL_FILTER(uint3 dispatchThreadId : SV_DispatchThreadID
// If the history was a background pixel, skip it
bool invalidHistory = false;
- if (historyDepth == UNITY_RAW_FAR_CLIP_VALUE)
+ if (historyDepth == UNITY_RAW_FAR_CLIP_VALUE || _HistoryValidity == 0.0)
invalidHistory = true;
// Compute the world space position (from previous frame)
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.cs
index fb30bdd2939..99a6adf7103 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/SSGIDenoiser.cs
@@ -84,7 +84,7 @@ RTHandle IndirectDiffuseHistoryBufferAllocatorFunction(string viewName, int fram
public void Denoise(CommandBuffer cmd, HDCamera hdCamera,
RTHandle noisyBuffer, RTHandle outputBuffer,
- bool halfResolution = false)
+ bool halfResolution = false, float historyValidity = 1.0f)
{
// Grab the global illumination volume component
var giSettings = hdCamera.volumeStack.GetComponent();
@@ -141,6 +141,7 @@ public void Denoise(CommandBuffer cmd, HDCamera hdCamera,
// Bind the input buffers
cmd.SetComputeTextureParam(m_SSGIDenoiserCS, m_KernelFilter, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthTexture());
cmd.SetComputeTextureParam(m_SSGIDenoiserCS, m_KernelFilter, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
+ cmd.SetComputeFloatParam(m_SSGIDenoiserCS, HDShaderIDs._HistoryValidity, historyValidity);
if (halfResolution)
{
cmd.SetComputeTextureParam(m_SSGIDenoiserCS, m_KernelFilter, HDShaderIDs._HistoryDepthTexture, historyDepthBuffer1);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs
index 9a0d4ee6cd4..445f66fdd32 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceGlobalIllumination.cs
@@ -28,7 +28,7 @@ void InitScreenSpaceGlobalIllumination()
m_IndirectDiffuseBuffer0 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IndirectDiffuseBuffer0");
m_IndirectDiffuseBuffer1 = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IndirectDiffuseBuffer1");
m_IndirectDiffuseHitPointBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16_SFloat, dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, useMipMap: false, autoGenerateMips: false, name: "IndirectDiffuseHitBuffer");
-
+
// Grab the sets of shaders that we'll be using
ComputeShader ssGICS = m_Asset.renderPipelineResources.shaders.screenSpaceGlobalIlluminationCS;
ComputeShader bilateralUpsampleCS = m_Asset.renderPipelineResources.shaders.bilateralUpsampleCS;
@@ -68,7 +68,7 @@ void BindIndirectDiffuseTexture(CommandBuffer cmd)
cmd.SetGlobalTexture(HDShaderIDs._IndirectDiffuseTexture, m_IndirectDiffuseBuffer0);
}
- // If there is no SSGI, bind a black 1x1 texture
+ // If there is no SSGI, bind a black 1x1 texture
void BindBlackIndirectDiffuseTexture(CommandBuffer cmd)
{
cmd.SetGlobalTexture(HDShaderIDs._IndirectDiffuseTexture, TextureXR.GetBlackTexture());
@@ -152,10 +152,14 @@ void RenderSSGI(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext re
// Fetch the right kernel to use
currentKernel = giSettings.fullResolutionSS ? m_ReprojectGlobalIlluminationKernel : m_ReprojectGlobalIlluminationHalfKernel;
+ // Update global constant buffer.
+ // This should probably be a shader specific uniform instead of reusing the global constant buffer one since it's the only one udpated here.
+ m_ShaderVariablesRayTracingCB._RaytracingIntensityClamp = giSettings.clampValueSS;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
+
// Inject all the input scalars
- cmd.SetComputeFloatParam(ssGICS, HDShaderIDs._RaytracingIntensityClamp, giSettings.clampValueSS);
cmd.SetComputeVectorParam(ssGICS, HDShaderIDs._ColorPyramidUvScaleAndLimitPrevFrame, HDUtils.ComputeViewportScaleAndLimit(hdCamera.historyRTHandleProperties.previousViewportSize, hdCamera.historyRTHandleProperties.previousRenderTargetSize));
-
+
// Bind all the input buffers
cmd.SetComputeTextureParam(ssGICS, currentKernel, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthStencilBuffer());
cmd.SetComputeTextureParam(ssGICS, currentKernel, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
@@ -165,16 +169,25 @@ void RenderSSGI(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext re
var historyDepthBuffer = hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Depth);
cmd.SetComputeTextureParam(ssGICS, currentKernel, HDShaderIDs._HistoryDepthTexture, historyDepthBuffer != null ? historyDepthBuffer : TextureXR.GetBlackTexture());
cmd.SetComputeBufferParam(ssGICS, currentKernel, HDShaderIDs._DepthPyramidMipLevelOffsets, info.GetOffsetBufferData(m_DepthPyramidMipLevelOffsetsBuffer));
-
+
// Bind the output texture
cmd.SetComputeTextureParam(ssGICS, currentKernel, HDShaderIDs._IndirectDiffuseTextureRW, buffer1);
// Do the reprojection
cmd.DispatchCompute(ssGICS, currentKernel, numTilesXHR, numTilesYHR, hdCamera.viewCount);
+ float historyValidity = 1.0f;
+#if UNITY_HDRP_DXR_TESTS_DEFINE
+ if (Application.isPlaying)
+ historyValidity = 0.0f;
+ else
+#endif
+ // We need to check if something invalidated the history buffers
+ historyValidity *= ValidRayTracingHistory(hdCamera) ? 1.0f : 0.0f;
+
// Do the denoising part
SSGIDenoiser ssgiDenoiser = GetSSGIDenoiser();
- ssgiDenoiser.Denoise(cmd, hdCamera, buffer1, buffer0, halfResolution: !giSettings.fullResolutionSS);
+ ssgiDenoiser.Denoise(cmd, hdCamera, buffer1, buffer0, halfResolution: !giSettings.fullResolutionSS, historyValidity: historyValidity);
// If this was a half resolution effect, we still have to upscale it
if (!giSettings.fullResolutionSS)
@@ -189,12 +202,12 @@ void RenderSSGI(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext re
cmd.SetComputeVectorParam(bilateralUpsampleCS, HDShaderIDs._HalfScreenSize, halfScreenSize);
firstMipOffset.Set(HDShadowUtils.Asfloat((uint)info.mipLevelOffsets[1].x), HDShadowUtils.Asfloat((uint)info.mipLevelOffsets[1].y));
cmd.SetComputeVectorParam(bilateralUpsampleCS, HDShaderIDs._DepthPyramidFirstMipLevelOffset, firstMipOffset);
-
+
// Inject all the input buffers
cmd.SetComputeTextureParam(bilateralUpsampleCS, m_BilateralUpSampleColorTMKernel, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthTexture());
cmd.SetComputeTextureParam(bilateralUpsampleCS, m_BilateralUpSampleColorTMKernel, HDShaderIDs._LowResolutionTexture, buffer1);
cmd.SetComputeBufferParam(bilateralUpsampleCS, m_BilateralUpSampleColorTMKernel, HDShaderIDs._DepthPyramidMipLevelOffsets, info.GetOffsetBufferData(m_DepthPyramidMipLevelOffsetsBuffer));
-
+
// Inject the output textures
cmd.SetComputeTextureParam(bilateralUpsampleCS, m_BilateralUpSampleColorTMKernel, HDShaderIDs._OutputUpscaledTexture, buffer0);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs
index f83708478b2..2a747077acd 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs
@@ -31,7 +31,6 @@ public enum BlurAlgorithm
RenderTextureFormat m_Format;
string m_Name;
int m_AtlasShaderID;
- int m_MomentAtlasShaderID;
RenderPipelineResources m_RenderPipelineResources;
// Moment shadow data
@@ -52,7 +51,7 @@ public enum BlurAlgorithm
bool m_HasResizedAtlas = false;
int frameCounter = 0;
- public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "", int momentAtlasShaderID = 0)
+ public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width, int height, int atlasShaderID, Material clearMaterial, int maxShadowRequests, BlurAlgorithm blurAlgorithm = BlurAlgorithm.None, FilterMode filterMode = FilterMode.Bilinear, DepthBits depthBufferBits = DepthBits.Depth16, RenderTextureFormat format = RenderTextureFormat.Shadowmap, string name = "")
{
this.width = width;
this.height = height;
@@ -61,7 +60,6 @@ public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width,
m_Format = format;
m_Name = name;
m_AtlasShaderID = atlasShaderID;
- m_MomentAtlasShaderID = momentAtlasShaderID;
m_ClearMaterial = clearMaterial;
m_BlurAlgorithm = blurAlgorithm;
m_RenderPipelineResources = renderPipelineResources;
@@ -76,7 +74,7 @@ public HDShadowAtlas(RenderPipelineResources renderPipelineResources, int width,
AllocateRenderTexture();
}
- void AllocateRenderTexture()
+ public void AllocateRenderTexture()
{
if (m_Atlas != null)
m_Atlas.Release();
@@ -109,7 +107,7 @@ public void BindResources(CommandBuffer cmd)
cmd.SetGlobalTexture(m_AtlasShaderID, m_Atlas);
if (m_BlurAlgorithm == BlurAlgorithm.EVSM)
{
- cmd.SetGlobalTexture(m_MomentAtlasShaderID, m_AtlasMoments[0]);
+ cmd.SetGlobalTexture(m_AtlasShaderID, m_AtlasMoments[0]);
}
}
@@ -471,7 +469,6 @@ struct RenderShadowsParameters
// EVSM
public ComputeShader evsmShadowBlurMomentsCS;
- public int momentAtlasShaderID;
// IM
public ComputeShader imShadowBlurMomentsCS;
@@ -489,7 +486,6 @@ RenderShadowsParameters PrepareRenderShadowsParameters(in ShaderVariablesGlobal
// EVSM
parameters.evsmShadowBlurMomentsCS = m_RenderPipelineResources.shaders.evsmBlurCS;
- parameters.momentAtlasShaderID = m_MomentAtlasShaderID;
// IM
parameters.imShadowBlurMomentsCS = m_RenderPipelineResources.shaders.momentShadowsCS;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowContext.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowContext.hlsl
index dfee6ffa597..3dfe1536d2a 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowContext.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowContext.hlsl
@@ -19,8 +19,7 @@ struct HDShadowContext
TEXTURE2D(_ShadowmapAtlas);
TEXTURE2D(_ShadowmapCascadeAtlas);
-TEXTURE2D(_AreaShadowmapAtlas);
-TEXTURE2D(_AreaShadowmapMomentAtlas);
+TEXTURE2D(_ShadowmapAreaAtlas);
StructuredBuffer _HDShadowDatas;
// Only the first element is used since we only support one directional light
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.RenderGraph.cs
index f3bf3abfe3b..52738760492 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.RenderGraph.cs
@@ -12,7 +12,7 @@ internal struct ShadowResult
partial class HDShadowManager
{
- internal static ShadowResult ReadShadowResult(ShadowResult shadowResult, RenderGraphBuilder builder)
+ internal static ShadowResult ReadShadowResult(in ShadowResult shadowResult, RenderGraphBuilder builder)
{
var result = new ShadowResult();
@@ -30,15 +30,49 @@ internal ShadowResult RenderShadows(RenderGraph renderGraph, in ShaderVariablesG
{
var result = new ShadowResult();
// Avoid to do any commands if there is no shadow to draw
- if (m_ShadowRequestCount == 0)
- return result;
+ if (m_ShadowRequestCount != 0)
+ {
+ result.punctualShadowResult = m_Atlas.RenderShadows(renderGraph, cullResults, globalCB, hdCamera.frameSettings, "Punctual Lights Shadows rendering");
+ result.directionalShadowResult = m_CascadeAtlas.RenderShadows(renderGraph, cullResults, globalCB, hdCamera.frameSettings, "Directional Light Shadows rendering");
+ result.areaShadowResult = m_AreaLightShadowAtlas.RenderShadows(renderGraph, cullResults, globalCB, hdCamera.frameSettings, "Area Light Shadows rendering");
+ }
- result.punctualShadowResult = m_Atlas.RenderShadows(renderGraph, cullResults, globalCB, hdCamera.frameSettings, "Punctual Lights Shadows rendering");
- result.directionalShadowResult = m_CascadeAtlas.RenderShadows(renderGraph, cullResults, globalCB, hdCamera.frameSettings, "Directional Light Shadows rendering");
- result.areaShadowResult = m_AreaLightShadowAtlas.RenderShadows(renderGraph, cullResults, globalCB, hdCamera.frameSettings, "Area Light Shadows rendering");
+ // TODO RENDERGRAPH
+ // Not really good to bind things globally here (makes lifecycle of the textures fuzzy)
+ // Probably better to bind it explicitly where needed (deferred lighting and forward/debug passes)
+ BindShadowGlobalResources(renderGraph, result);
return result;
}
+
+ class BindShadowGlobalResourcesPassData
+ {
+ public ShadowResult shadowResult;
+ }
+
+
+ static void BindAtlasTexture(RenderGraphContext ctx, TextureHandle texture, int shaderId)
+ {
+ if (texture.IsValid())
+ ctx.cmd.SetGlobalTexture(shaderId, ctx.resources.GetTexture(texture));
+ else
+ ctx.cmd.SetGlobalTexture(shaderId, ctx.resources.GetTexture(ctx.defaultResources.blackTexture));
+ }
+
+ void BindShadowGlobalResources(RenderGraph renderGraph, in ShadowResult shadowResult)
+ {
+ using (var builder = renderGraph.AddRenderPass("BindShadowGlobalResources", out var passData))
+ {
+ passData.shadowResult = ReadShadowResult(shadowResult, builder);
+ builder.SetRenderFunc(
+ (BindShadowGlobalResourcesPassData data, RenderGraphContext ctx) =>
+ {
+ BindAtlasTexture(ctx, data.shadowResult.punctualShadowResult, HDShaderIDs._ShadowmapAtlas);
+ BindAtlasTexture(ctx, data.shadowResult.directionalShadowResult, HDShaderIDs._ShadowmapCascadeAtlas);
+ BindAtlasTexture(ctx, data.shadowResult.areaShadowResult, HDShaderIDs._ShadowmapAreaAtlas);
+ });
+ }
+ }
}
partial class HDShadowAtlas
@@ -76,13 +110,13 @@ internal TextureHandle RenderShadows(RenderGraph renderGraph, CullingResults cul
passData.shadowDrawSettings.useRenderingLayerMaskTest = frameSettings.IsEnabled(FrameSettingsField.LightLayers);
passData.atlasTexture = builder.WriteTexture(
renderGraph.CreateTexture( new TextureDesc(width, height)
- { filterMode = m_FilterMode, depthBufferBits = m_DepthBufferBits, isShadowMap = true, name = m_Name, clearBuffer = passData.parameters.debugClearAtlas }, passData.parameters.atlasShaderID));
+ { filterMode = m_FilterMode, depthBufferBits = m_DepthBufferBits, isShadowMap = true, name = m_Name, clearBuffer = passData.parameters.debugClearAtlas }));
result = passData.atlasTexture;
if (passData.parameters.blurAlgorithm == BlurAlgorithm.EVSM)
{
- passData.momentAtlasTexture1 = builder.WriteTexture(AllocateMomentAtlas(renderGraph, string.Format("{0}Moment", m_Name), passData.parameters.momentAtlasShaderID));
+ passData.momentAtlasTexture1 = builder.WriteTexture(AllocateMomentAtlas(renderGraph, string.Format("{0}Moment", m_Name)));
passData.momentAtlasTexture2 = builder.WriteTexture(AllocateMomentAtlas(renderGraph, string.Format("{0}MomentCopy", m_Name)));
result = passData.momentAtlasTexture1;
@@ -90,11 +124,11 @@ internal TextureHandle RenderShadows(RenderGraph renderGraph, CullingResults cul
else if (passData.parameters.blurAlgorithm == BlurAlgorithm.IM)
{
passData.momentAtlasTexture1 = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(width, height)
- { colorFormat = GraphicsFormat.R32G32B32A32_SFloat, name = string.Format("{0}Moment", m_Name), enableRandomWrite = true }, passData.parameters.momentAtlasShaderID));
+ { colorFormat = GraphicsFormat.R32G32B32A32_SFloat, name = string.Format("{0}Moment", m_Name), enableRandomWrite = true }));
passData.intermediateSummedAreaTexture = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(width, height)
- { colorFormat = GraphicsFormat.R32G32B32A32_SInt, name = string.Format("{0}IntermediateSummedArea", m_Name), enableRandomWrite = true }, passData.parameters.momentAtlasShaderID));
+ { colorFormat = GraphicsFormat.R32G32B32A32_SInt, name = string.Format("{0}IntermediateSummedArea", m_Name), enableRandomWrite = true }));
passData.summedAreaTexture = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(width, height)
- { colorFormat = GraphicsFormat.R32G32B32A32_SInt, name = string.Format("{0}SummedArea", m_Name), enableRandomWrite = true }, passData.parameters.momentAtlasShaderID));
+ { colorFormat = GraphicsFormat.R32G32B32A32_SInt, name = string.Format("{0}SummedArea", m_Name), enableRandomWrite = true }));
result = passData.momentAtlasTexture1;
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs
index baca84547a9..ef50ee78de8 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs
@@ -290,7 +290,7 @@ public void InitShadowManager(RenderPipelineResources renderPipelineResources, D
m_CascadeAtlas = new HDShadowAtlas(renderPipelineResources, 1, 1, HDShaderIDs._ShadowmapCascadeAtlas, m_ClearShadowMaterial, maxShadowRequests, cascadeBlur, depthBufferBits: directionalShadowDepthBits, name: "Cascade Shadow Map Atlas");
if (ShaderConfig.s_AreaLights == 1)
- m_AreaLightShadowAtlas = new HDShadowAtlas(renderPipelineResources, areaLightAtlasInfo.shadowAtlasResolution, areaLightAtlasInfo.shadowAtlasResolution, HDShaderIDs._AreaLightShadowmapAtlas, m_ClearShadowMaterial, maxShadowRequests, HDShadowAtlas.BlurAlgorithm.EVSM, depthBufferBits: areaLightAtlasInfo.shadowAtlasDepthBits, name: "Area Light Shadow Map Atlas", momentAtlasShaderID: HDShaderIDs._AreaShadowmapMomentAtlas);
+ m_AreaLightShadowAtlas = new HDShadowAtlas(renderPipelineResources, areaLightAtlasInfo.shadowAtlasResolution, areaLightAtlasInfo.shadowAtlasResolution, HDShaderIDs._ShadowmapAreaAtlas, m_ClearShadowMaterial, maxShadowRequests, HDShadowAtlas.BlurAlgorithm.EVSM, depthBufferBits: areaLightAtlasInfo.shadowAtlasDepthBits, name: "Area Light Shadow Map Atlas");
m_ShadowDataBuffer = new ComputeBuffer(maxShadowRequests, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDShadowData)));
m_DirectionalShadowDataBuffer = new ComputeBuffer(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(HDDirectionalShadowData)));
@@ -298,6 +298,22 @@ public void InitShadowManager(RenderPipelineResources renderPipelineResources, D
m_MaxShadowRequests = maxShadowRequests;
}
+ public void InitializeNonRenderGraphResources()
+ {
+ m_Atlas.AllocateRenderTexture();
+ m_CascadeAtlas.AllocateRenderTexture();
+ if (ShaderConfig.s_AreaLights == 1)
+ m_AreaLightShadowAtlas.AllocateRenderTexture();
+ }
+
+ public void CleanupNonRenderGraphResources()
+ {
+ m_Atlas.Release();
+ m_CascadeAtlas.Release();
+ if (ShaderConfig.s_AreaLights == 1)
+ m_AreaLightShadowAtlas.Release();
+ }
+
// Keep in sync with both HDShadowSampling.hlsl
public static DirectionalShadowAlgorithm GetDirectionalShadowAlgorithm()
{
@@ -686,6 +702,14 @@ unsafe public void PrepareGPUShadowDatas(CullingResults cullResults, HDCamera ca
m_DirectionalShadowData.cascadeDirection = Vector4.zero;
m_DirectionalShadowData.cascadeDirection.w = camera.volumeStack.GetComponent().cascadeShadowSplitCount.value;
+
+ if (m_ShadowRequestCount > 0)
+ {
+ // Upload the shadow buffers to GPU
+ m_ShadowDataBuffer.SetData(m_ShadowDatas);
+ m_CachedDirectionalShadowData[0] = m_DirectionalShadowData;
+ m_DirectionalShadowDataBuffer.SetData(m_CachedDirectionalShadowData);
+ }
}
public void RenderShadows(ScriptableRenderContext renderContext, CommandBuffer cmd, in ShaderVariablesGlobal globalCB, CullingResults cullResults, HDCamera hdCamera)
@@ -712,18 +736,6 @@ public void RenderShadows(ScriptableRenderContext renderContext, CommandBuffer c
}
}
- public void SyncData()
- {
- // Avoid to upload datas which will not be used
- if (m_ShadowRequestCount == 0)
- return;
-
- // Upload the shadow buffers to GPU
- m_ShadowDataBuffer.SetData(m_ShadowDatas);
- m_CachedDirectionalShadowData[0] = m_DirectionalShadowData;
- m_DirectionalShadowDataBuffer.SetData(m_CachedDirectionalShadowData);
- }
-
public void PushGlobalParameters(CommandBuffer cmd)
{
// This code must be in sync with HDShadowContext.hlsl
@@ -733,8 +745,6 @@ public void PushGlobalParameters(CommandBuffer cmd)
public void BindResources(CommandBuffer cmd)
{
- PushGlobalParameters(cmd);
-
m_Atlas.BindResources(cmd);
m_CascadeAtlas.BindResources(cmd);
if (ShaderConfig.s_AreaLights == 1)
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs
index 3dfd208c165..362860a5c7b 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs
@@ -63,7 +63,7 @@ static RTHandle ShadowHistoryBufferAllocatorFunction(string viewName, int frameI
HDRenderPipeline hdrp = (RenderPipelineManager.currentPipeline as HDRenderPipeline);
int numShadowSlices = Math.Max((int)Math.Ceiling(hdrp.m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
return rtHandleSystem.Alloc(Vector2.one, slices: numShadowSlices * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat,
- enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("ScreenSpaceShadowHistoryBuffer{0}", frameIndex));
+ enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("{0}_ScreenSpaceShadowHistoryBuffer{1}", viewName, frameIndex));
}
@@ -77,7 +77,7 @@ static RTHandle ShadowHistoryValidityBufferAllocatorFunction(string viewName, in
GraphicsFormat graphicsFormat = (GraphicsFormat)hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.screenSpaceShadowBufferFormat;
int numShadowSlices = Math.Max((int)Math.Ceiling(hdrp.m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
return rtHandleSystem.Alloc(Vector2.one, slices: numShadowSlices * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat,
- enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("ShadowHistoryValidityBuffer{0}", frameIndex));
+ enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("{0}_ShadowHistoryValidityBuffer{1}", viewName, frameIndex));
}
static RTHandle ShadowHistoryDistanceBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
@@ -87,7 +87,7 @@ static RTHandle ShadowHistoryDistanceBufferAllocatorFunction(string viewName, in
GraphicsFormat graphicsFormat = (GraphicsFormat)hdPipelineAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams.screenSpaceShadowBufferFormat;
int numShadowSlices = Math.Max((int)Math.Ceiling(hdrp.m_Asset.currentPlatformRenderPipelineSettings.hdShadowInitParams.maxScreenSpaceShadowSlots / 4.0f), 1);
return rtHandleSystem.Alloc(Vector2.one, slices: numShadowSlices * TextureXR.slices, dimension: TextureDimension.Tex2DArray, filterMode: FilterMode.Point, colorFormat: graphicsFormat,
- enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("ShadowHistoryDistanceBuffer{0}", frameIndex));
+ enableRandomWrite: true, useDynamicScale: true, useMipMap: false, name: string.Format("{0}_ShadowHistoryDistanceBuffer{1}", viewName, frameIndex));
}
// The three types of shadows that we currently support
@@ -337,10 +337,6 @@ void RenderDirectionalLightScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamer
// Inject the ray-tracing sampling data
m_BlueNoise.BindDitheredRNGData8SPP(cmd);
- // Inject the ray generation data
- RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rayTracingSettings.rayBias.value);
-
// Make sure the right closest hit/any hit will be triggered by using the right multi compile
CoreUtils.SetKeyword(cmd, "TRANSPARENT_COLOR_SHADOW", m_CurrentSunLightAdditionalLightData.colorShadow);
@@ -350,10 +346,13 @@ void RenderDirectionalLightScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamer
// Loop through the samples of this frame
for (int sampleIdx = 0; sampleIdx < m_CurrentSunLightAdditionalLightData.numRayTracingSamples; ++sampleIdx)
{
+ // Update global Constant Buffer
+ m_ShaderVariablesRayTracingCB._RaytracingSampleIndex = sampleIdx;
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = m_CurrentSunLightAdditionalLightData.numRayTracingSamples;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
+
// Bind the light & sampling data
cmd.SetComputeBufferParam(m_ScreenSpaceShadowsCS, m_RaytracingDirectionalShadowSample, HDShaderIDs._DirectionalLightDatas, m_LightLoopLightData.directionalLightData);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingSampleIndex, sampleIdx);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, m_CurrentSunLightAdditionalLightData.numRayTracingSamples);
// Input Buffer
cmd.SetComputeTextureParam(m_ScreenSpaceShadowsCS, m_RaytracingDirectionalShadowSample, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthStencilBuffer());
@@ -370,14 +369,12 @@ void RenderDirectionalLightScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamer
// Set ray count texture
RayCountManager rayCountManager = GetRayCountManager();
- cmd.SetGlobalInt(HDShaderIDs._RayCountEnabled, rayCountManager.RayCountIsEnabled());
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RayCountTexture, rayCountManager.GetRayCountTexture());
// Input buffers
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthStencilBuffer());
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracingDirectionBuffer, directionBuffer);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, m_CurrentSunLightAdditionalLightData.numRayTracingSamples);
// Output buffer
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, m_CurrentSunLightAdditionalLightData.colorShadow ? HDShaderIDs._RaytracedColorShadowIntegration : HDShaderIDs._RaytracedShadowIntegration, intermediateBuffer0);
@@ -546,7 +543,9 @@ void RenderAreaScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
cmd.SetComputeBufferParam(m_ScreenSpaceShadowsCS, m_AreaRaytracingAreaShadowPrepassKernel, HDShaderIDs._LightDatas, m_LightLoopLightData.lightData);
cmd.SetComputeMatrixParam(m_ScreenSpaceShadowsCS, HDShaderIDs._RaytracingAreaWorldToLocal, m_WorldToLocalArea);
cmd.SetComputeIntParam(m_ScreenSpaceShadowsCS, HDShaderIDs._RaytracingTargetAreaLight, lightIndex);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, additionalLightData.numRayTracingSamples);
+
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = additionalLightData.numRayTracingSamples;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
// Bind the input buffers
cmd.SetComputeTextureParam(m_ScreenSpaceShadowsCS, m_AreaRaytracingAreaShadowPrepassKernel, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthStencilBuffer());
@@ -579,7 +578,6 @@ void RenderAreaScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
// Set ray count texture
RayCountManager rayCountManager = GetRayCountManager();
- cmd.SetGlobalInt(HDShaderIDs._RayCountEnabled, rayCountManager.RayCountIsEnabled());
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RayCountTexture, rayCountManager.GetRayCountTexture());
// Input data
@@ -591,8 +589,6 @@ void RenderAreaScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracingDirectionBuffer, directionBuffer);
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracingDistanceBuffer, distanceBuffer);
cmd.SetRayTracingIntParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracingTargetAreaLight, lightIndex);
- RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rayTracingSettings.rayBias.value);
// Output data
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracedAreaShadowIntegration, intermediateBufferRGBA0);
@@ -603,12 +599,15 @@ void RenderAreaScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
// Let's do the following samples (if any)
for (int sampleIndex = 1; sampleIndex < additionalLightData.numRayTracingSamples; ++sampleIndex)
{
+ // Update global Constant Buffer
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = additionalLightData.numRayTracingSamples;
+ m_ShaderVariablesRayTracingCB._RaytracingSampleIndex = sampleIndex;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
+
// Bind the light data
cmd.SetComputeBufferParam(m_ScreenSpaceShadowsCS, m_AreaRaytracingAreaShadowNewSampleKernel, HDShaderIDs._LightDatas, m_LightLoopLightData.lightData);
cmd.SetComputeIntParam(m_ScreenSpaceShadowsCS, HDShaderIDs._RaytracingTargetAreaLight, lightIndex);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingSampleIndex, sampleIndex);
cmd.SetComputeMatrixParam(m_ScreenSpaceShadowsCS, HDShaderIDs._RaytracingAreaWorldToLocal, m_WorldToLocalArea);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, additionalLightData.numRayTracingSamples);
// Input Buffers
cmd.SetComputeTextureParam(m_ScreenSpaceShadowsCS, m_AreaRaytracingAreaShadowNewSampleKernel, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthStencilBuffer());
@@ -780,21 +779,20 @@ void RenderPunctualScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
cmd.DispatchCompute(m_ScreenSpaceShadowsCS, m_ClearShadowTexture, numTilesX, numTilesY, hdCamera.viewCount);
}
- // Bind the ray generation scalars
- RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rayTracingSettings.rayBias.value);
-
// Loop through the samples of this frame
for (int sampleIdx = 0; sampleIdx < additionalLightData.numRayTracingSamples; ++sampleIdx)
{
+ // Update global constant buffer
+ m_ShaderVariablesRayTracingCB._RaytracingSampleIndex = sampleIdx;
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = additionalLightData.numRayTracingSamples;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
+
// Bind the right kernel
int shadowKernel = lightData.lightType == GPULightType.Point ? m_RaytracingPointShadowSample : m_RaytracingSpotShadowSample;
// Bind the light & sampling data
cmd.SetComputeBufferParam(m_ScreenSpaceShadowsCS, shadowKernel, HDShaderIDs._LightDatas, m_LightLoopLightData.lightData);
cmd.SetComputeIntParam(m_ScreenSpaceShadowsCS, HDShaderIDs._RaytracingTargetAreaLight, lightIndex);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingSampleIndex, sampleIdx);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, additionalLightData.numRayTracingSamples);
cmd.SetComputeFloatParam(m_ScreenSpaceShadowsCS, HDShaderIDs._RaytracingLightRadius, additionalLightData.shapeRadius);
// If this is a spot light, inject the spot angle in radians
@@ -820,7 +818,6 @@ void RenderPunctualScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
// Set ray count texture
RayCountManager rayCountManager = GetRayCountManager();
- cmd.SetGlobalInt(HDShaderIDs._RayCountEnabled, rayCountManager.RayCountIsEnabled());
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RayCountTexture, rayCountManager.GetRayCountTexture());
// Input buffers
@@ -828,7 +825,6 @@ void RenderPunctualScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracingDirectionBuffer, directionBuffer);
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracingDistanceBuffer, distanceBuffer);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, additionalLightData.numRayTracingSamples);
// Output buffer
cmd.SetRayTracingTextureParam(m_ScreenSpaceShadowsRT, HDShaderIDs._RaytracedShadowIntegration, intermediateBuffer0);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs
index a0746c77003..eaafd5edd74 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/VolumetricLighting.cs
@@ -214,6 +214,7 @@ public partial class HDRenderPipeline
// These two buffers do not depend on the frameID and are therefore shared by all views.
RTHandle m_DensityBuffer;
RTHandle m_LightingBuffer;
+ Vector3Int m_CurrentVolumetricBufferSize;
ShaderVariablesVolumetric m_ShaderVariablesVolumetricCB = new ShaderVariablesVolumetric();
@@ -451,7 +452,7 @@ internal void CreateVolumetricLightingBuffers()
// We will perform rescaling manually, in a custom manner, based on volume parameters.
const int minSize = 4;
- m_DensityBuffer = RTHandles.Alloc(minSize, minSize, minSize, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, // 8888_sRGB is not precise enough
+ m_DensityBuffer = RTHandles.Alloc(minSize, minSize, minSize, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, // 8888_sRGB is not precise enough
dimension: TextureDimension.Tex3D, enableRandomWrite: true, name: "VBufferDensity");
m_LightingBuffer = RTHandles.Alloc(minSize, minSize, minSize, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, // 8888_sRGB is not precise enough
@@ -466,7 +467,7 @@ internal void DestroyVolumetricLightingBuffers()
CoreUtils.SafeRelease(m_VisibleVolumeDataBuffer);
CoreUtils.SafeRelease(m_VisibleVolumeBoundsBuffer);
- m_VisibleVolumeData = null; // free()
+ m_VisibleVolumeData = null; // free()
m_VisibleVolumeBounds = null; // free()
}
@@ -492,12 +493,17 @@ internal void ResizeVolumetricLightingBuffers(HDCamera hdCamera, int frameIndex)
var currentParams = hdCamera.vBufferParams[currIdx];
- ResizeVolumetricBuffer(ref m_DensityBuffer, "VBufferDensity", currentParams.viewportSize.x,
+ ResizeVolumetricBuffer(ref m_DensityBuffer, "VBufferDensity", currentParams.viewportSize.x,
currentParams.viewportSize.y,
currentParams.viewportSize.z);
ResizeVolumetricBuffer(ref m_LightingBuffer, "VBufferLighting", currentParams.viewportSize.x,
currentParams.viewportSize.y,
currentParams.viewportSize.z);
+
+ // TODO RENDERGRAPH: For now those texture are not handled by render graph.
+ // When they are we won't have the m_DensityBuffer handy for getting the current size in UpdateShaderVariablesGlobalVolumetrics
+ // So we store the size here and in time we'll fill this vector differently.
+ m_CurrentVolumetricBufferSize = new Vector3Int(m_DensityBuffer.rt.width, m_DensityBuffer.rt.height, m_DensityBuffer.rt.volumeDepth);
}
void InitializeVolumetricLighting()
@@ -539,7 +545,7 @@ static float CornetteShanksPhasePartConstant(float anisotropy)
return (3.0f / (8.0f * Mathf.PI)) * (1.0f - g * g) / (2.0f + g * g);
}
- void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, in RTHandleProperties sharedRTHandleProperties, HDCamera hdCamera)
+ void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, HDCamera hdCamera)
{
if (!Fog.IsVolumetricFogEnabled(hdCamera))
{
@@ -557,11 +563,6 @@ void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, in RTH
// The history & feedback buffers are specific to the camera.
// These 2 types of buffers can have different sizes.
// Additionally, history buffers can have different sizes, since they are not resized at the same time.
- Vector3Int lightingBufferSize = new Vector3Int(m_LightingBuffer.rt.width, m_LightingBuffer.rt.height, m_LightingBuffer.rt.volumeDepth);
-
- Debug.Assert(m_LightingBuffer.rt.width == m_DensityBuffer.rt.width);
- Debug.Assert(m_LightingBuffer.rt.height == m_DensityBuffer.rt.height);
-
var cvp = currParams.viewportSize;
// Adjust slices for XR rendering: VBuffer is shared for all single-pass views
@@ -570,26 +571,14 @@ void UpdateShaderVariablesGlobalVolumetrics(ref ShaderVariablesGlobal cb, in RTH
cb._VBufferViewportSize = new Vector4(cvp.x, cvp.y, 1.0f / cvp.x, 1.0f / cvp.y);
cb._VBufferSliceCount = sliceCount;
cb._VBufferRcpSliceCount = 1.0f / sliceCount;
- cb._VBufferLightingViewportScale = currParams.ComputeViewportScale(lightingBufferSize);
- cb._VBufferLightingViewportLimit = currParams.ComputeViewportLimit(lightingBufferSize);
+ cb._VBufferLightingViewportScale = currParams.ComputeViewportScale(m_CurrentVolumetricBufferSize);
+ cb._VBufferLightingViewportLimit = currParams.ComputeViewportLimit(m_CurrentVolumetricBufferSize);
cb._VBufferDistanceEncodingParams = currParams.depthEncodingParams;
cb._VBufferDistanceDecodingParams = currParams.depthDecodingParams;
cb._VBufferLastSliceDist = currParams.ComputeLastSliceDistance(sliceCount);
cb._VBufferRcpInstancedViewCount = 1.0f / hdCamera.viewCount;
}
- void PushVolumetricLightingGlobalParams(HDCamera hdCamera, CommandBuffer cmd, int frameIndex)
- {
- if (!Fog.IsVolumetricFogEnabled(hdCamera))
- {
- cmd.SetGlobalTexture(HDShaderIDs._VBufferLighting, HDUtils.clearTexture3D);
- }
- else
- {
- cmd.SetGlobalTexture(HDShaderIDs._VBufferLighting, m_LightingBuffer);
- }
- }
-
DensityVolumeList PrepareVisibleDensityVolumeList(HDCamera hdCamera, CommandBuffer cmd, float time)
{
DensityVolumeList densityVolumes = new DensityVolumeList();
@@ -724,24 +713,12 @@ unsafe void UpdateShaderVariableslVolumetrics(ref ShaderVariablesVolumetric cb,
// The history & feedback buffers are specific to the camera.
// These 2 types of buffers can have different sizes.
// Additionally, history buffers can have different sizes, since they are not resized at the same time.
- Vector3Int lightingBufferSize = new Vector3Int(m_LightingBuffer.rt.width, m_LightingBuffer.rt.height, m_LightingBuffer.rt.volumeDepth);
-
- Debug.Assert(m_LightingBuffer.rt.width == m_DensityBuffer.rt.width);
- Debug.Assert(m_LightingBuffer.rt.height == m_DensityBuffer.rt.height);
-
Vector3Int historyBufferSize = Vector3Int.zero;
if (hdCamera.IsVolumetricReprojectionEnabled())
{
RTHandle historyRT = hdCamera.volumetricHistoryBuffers[prevIdx];
-
historyBufferSize = new Vector3Int(historyRT.rt.width, historyRT.rt.height, historyRT.rt.volumeDepth);
-
- // Handle case of first frame. When we are on the first frame, we reuse the value of original frame.
- if (historyBufferSize.x == 0.0f && historyBufferSize.y == 0.0f)
- {
- historyBufferSize = lightingBufferSize;
- }
}
cb._VBufferVoxelSize = currParams.voxelSize;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DBufferManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DBufferManager.cs
index 5a30edd2afe..e9bcf7e2ea9 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DBufferManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DBufferManager.cs
@@ -3,7 +3,7 @@
namespace UnityEngine.Rendering.HighDefinition
{
class DBufferManager : MRTBufferManager
- {
+ {
ComputeBuffer m_PropertyMaskBuffer;
int m_PropertyMaskBufferSize;
ComputeShader m_ClearPropertyMaskBufferShader;
@@ -79,7 +79,7 @@ public void ReleaseResolutionDependentBuffers()
}
public void AllocResolutionDependentBuffers(HDCamera hdCamera, int width, int height)
- {
+ {
m_PropertyMaskBufferSize = ((width + 7) / 8) * ((height + 7) / 8);
m_PropertyMaskBufferSize = ((m_PropertyMaskBufferSize + 63) / 64) * 64; // round off to nearest multiple of 64 for ease of use in CS
m_PropertyMaskBuffer = new ComputeBuffer(m_PropertyMaskBufferSize, 4);
@@ -88,7 +88,6 @@ public void AllocResolutionDependentBuffers(HDCamera hdCamera, int width, int he
override public void DestroyBuffers()
{
base.DestroyBuffers();
- ReleaseResolutionDependentBuffers();
}
public void BindBlackTextures(CommandBuffer cmd)
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/SharedRTManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/SharedRTManager.cs
index aaf3e2390c2..46c94318f0f 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Material/SharedRTManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Material/SharedRTManager.cs
@@ -100,8 +100,6 @@ public void InitSharedBuffers(GBufferManager gbufferManager, RenderPipelineSetti
CoreUtils.SetKeyword(m_DepthResolveMaterial, "_HAS_MOTION_VECTORS", m_MotionVectorsSupport);
}
- AllocateCoarseStencilBuffer(RTHandles.maxWidth, RTHandles.maxHeight, TextureXR.slices);
-
// If we are in the forward only mode
if (!m_ReuseGBufferMemory)
{
@@ -298,7 +296,6 @@ public void Cleanup()
RTHandles.Release(m_CameraDepthStencilBuffer);
RTHandles.Release(m_CameraDepthBufferMipChain);
RTHandles.Release(m_CameraHalfResDepthBuffer);
- DisposeCoarseStencilBuffer();
if (m_MSAASupported)
{
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
index b18362f541c..71f5d006f98 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
@@ -80,6 +80,16 @@ void InitSSSBuffers()
m_SSSSetDiffusionProfiles = new DiffusionProfileSettings[DiffusionProfileConstants.DIFFUSION_PROFILE_COUNT];
}
+ void DestroySSSBuffers()
+ {
+ RTHandles.Release(m_SSSColorMSAA);
+ RTHandles.Release(m_SSSCameraFilteringBuffer);
+ if (!m_SSSReuseGBufferMemory)
+ {
+ RTHandles.Release(m_SSSColor);
+ }
+ }
+
RTHandle GetSSSBuffer()
{
return m_SSSColor;
@@ -111,12 +121,7 @@ void CleanupSubsurfaceScattering()
{
CoreUtils.Destroy(m_CombineLightingPass);
CoreUtils.Destroy(m_SSSCopyStencilForSplitLighting);
- if (!m_SSSReuseGBufferMemory)
- {
- RTHandles.Release(m_SSSColor);
- }
- RTHandles.Release(m_SSSColorMSAA);
- RTHandles.Release(m_SSSCameraFilteringBuffer);
+ DestroySSSBuffers();
}
void UpdateCurrentDiffusionProfileSettings(HDCamera hdCamera)
@@ -265,7 +270,7 @@ static RTHandle SubSurfaceHistoryBufferAllocatorFunction(string viewName, int fr
{
return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension,
enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
- name: string.Format("SubSurfaceHistoryBuffer{0}", frameIndex));
+ name: string.Format("{0}_SubSurfaceHistoryBuffer{1}", viewName, frameIndex));
}
void RenderSubsurfaceScattering(HDCamera hdCamera, CommandBuffer cmd, RTHandle colorBufferRT,
@@ -290,7 +295,6 @@ void RenderSubsurfaceScattering(HDCamera hdCamera, CommandBuffer cmd, RTHandle c
// Fetch the volume overrides that we shall be using
RayTracingShader subSurfaceShader = m_Asset.renderPipelineRayTracingResources.subSurfaceRayTracing;
- RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
ComputeShader deferredRayTracing = m_Asset.renderPipelineRayTracingResources.deferredRaytracingCS;
// Fetch all the intermediate buffers that we need
@@ -322,9 +326,9 @@ void RenderSubsurfaceScattering(HDCamera hdCamera, CommandBuffer cmd, RTHandle c
for (int sampleIndex = 0; sampleIndex < settings.sampleCount.value; ++sampleIndex)
{
// Inject the ray generation data
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rayTracingSettings.rayBias.value);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, settings.sampleCount.value);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingSampleIndex, sampleIndex);
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = settings.sampleCount.value;
+ m_ShaderVariablesRayTracingCB._RaytracingSampleIndex = sampleIndex;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
// Bind the textures for ray generation
cmd.SetRayTracingTextureParam(subSurfaceShader, HDShaderIDs._DepthTexture, sharedRTManager.GetDepthStencilBuffer());
diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs
index 498cd19d8fb..5b55edea50a 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs
@@ -237,7 +237,7 @@ public void Render( RenderGraph renderGraph,
passData.parameters = PrepareFinalPass(hdCamera, blueNoise, flipY);
passData.source = builder.ReadTexture(source);
passData.afterPostProcessTexture = builder.ReadTexture(afterPostProcessTexture);
- passData.alphaTexture = builder.ReadTexture(m_KeepAlpha ? alphaTexture : renderGraph.ImportTexture(TextureXR.GetWhiteTexture()));
+ passData.alphaTexture = builder.ReadTexture(m_KeepAlpha ? alphaTexture : renderGraph.defaultResources.whiteTextureXR);
passData.destination = builder.WriteTexture(finalRT);
builder.SetRenderFunc(
diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs
index 53acbb6240e..af115aa692b 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs
@@ -126,6 +126,8 @@ private enum SMAAStage
bool m_MotionBlurSupportsScattering;
+ bool m_NonRenderGraphResourcesAvailable;
+
// Max guard band size is assumed to be 8 pixels
const int k_RTGuardBandSize = 4;
@@ -155,14 +157,81 @@ public PostProcessSystem(HDRenderPipelineAsset hdAsset, RenderPipelineResources
m_UseSafePath = SystemInfo.graphicsDeviceVendor
.ToLowerInvariant().Contains("intel");
- // Project-wise LUT size for all grading operations - meaning that internal LUTs and
- // user-provided LUTs will have to be this size
- var settings = hdAsset.currentPlatformRenderPipelineSettings.postProcessSettings;
- m_LutSize = settings.lutSize;
- var lutFormat = (GraphicsFormat)settings.lutFormat;
+ var postProcessSettings = hdAsset.currentPlatformRenderPipelineSettings.postProcessSettings;
+ m_LutSize = postProcessSettings.lutSize;
// Grading specific
m_HableCurve = new HableCurve();
+
+ m_MotionBlurSupportsScattering = SystemInfo.IsFormatSupported(GraphicsFormat.R32_UInt, FormatUsage.LoadStore) && SystemInfo.IsFormatSupported(GraphicsFormat.R16_UInt, FormatUsage.LoadStore);
+ // TODO: Remove this line when atomic bug in HLSLcc is fixed.
+ m_MotionBlurSupportsScattering = m_MotionBlurSupportsScattering && (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan);
+ // TODO: Write a version that uses structured buffer instead of texture to do atomic as Metal doesn't support atomics on textures.
+ m_MotionBlurSupportsScattering = m_MotionBlurSupportsScattering && (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Metal);
+
+ // Initialize our target pool to ease RT management
+ m_Pool = new TargetPool();
+
+ // Use a custom RNG, we don't want to mess with the Unity one that the users might be
+ // relying on (breaks determinism in their code)
+ m_Random = new System.Random();
+
+ m_ColorFormat = (GraphicsFormat)postProcessSettings.bufferFormat;
+ m_KeepAlpha = false;
+
+ // if both rendering and post-processing support an alpha channel, then post-processing will process (or copy) the alpha
+ m_EnableAlpha = hdAsset.currentPlatformRenderPipelineSettings.supportsAlpha && postProcessSettings.supportsAlpha;
+
+ if (m_EnableAlpha == false)
+ {
+ // if only rendering has an alpha channel (and not post-processing), then we just copy the alpha to the output (but we don't process it).
+ m_KeepAlpha = hdAsset.currentPlatformRenderPipelineSettings.supportsAlpha;
+ }
+
+ // Call after initializing m_LutSize and m_KeepAlpha as it's needed for render target allocation.
+ InitializeNonRenderGraphResources(hdAsset);
+ }
+
+ public void Cleanup()
+ {
+ CleanupNonRenderGraphResources();
+
+ CoreUtils.Destroy(m_ExposureCurveTexture);
+ CoreUtils.Destroy(m_InternalSpectralLut);
+ CoreUtils.Destroy(m_FinalPassMaterial);
+ CoreUtils.Destroy(m_ClearBlackMaterial);
+ CoreUtils.Destroy(m_SMAAMaterial);
+ CoreUtils.Destroy(m_TemporalAAMaterial);
+ CoreUtils.SafeRelease(m_BokehNearKernel);
+ CoreUtils.SafeRelease(m_BokehFarKernel);
+ CoreUtils.SafeRelease(m_BokehIndirectCmd);
+ CoreUtils.SafeRelease(m_NearBokehTileList);
+ CoreUtils.SafeRelease(m_FarBokehTileList);
+ CoreUtils.SafeRelease(m_ContrastAdaptiveSharpen);
+
+ m_ExposureCurveTexture = null;
+ m_InternalSpectralLut = null;
+ m_FinalPassMaterial = null;
+ m_ClearBlackMaterial = null;
+ m_SMAAMaterial = null;
+ m_TemporalAAMaterial = null;
+ m_BokehNearKernel = null;
+ m_BokehFarKernel = null;
+ m_BokehIndirectCmd = null;
+ m_NearBokehTileList = null;
+ m_FarBokehTileList = null;
+ }
+
+ public void InitializeNonRenderGraphResources(HDRenderPipelineAsset hdAsset)
+ {
+ m_NonRenderGraphResourcesAvailable = true;
+
+ var settings = hdAsset.currentPlatformRenderPipelineSettings.postProcessSettings;
+
+ // Project-wide LUT size for all grading operations - meaning that internal LUTs and
+ // user-provided LUTs will have to be this size
+ var lutFormat = (GraphicsFormat)settings.lutFormat;
+
m_InternalLogLut = RTHandles.Alloc(
name: "Color Grading Log Lut",
dimension: TextureDimension.Tex3D,
@@ -186,21 +255,8 @@ public PostProcessSystem(HDRenderPipelineAsset hdAsset, RenderPipelineResources
enableRandomWrite: true, name: "Empty EV100 Exposure"
);
- m_MotionBlurSupportsScattering = SystemInfo.IsFormatSupported(GraphicsFormat.R32_UInt, FormatUsage.LoadStore) && SystemInfo.IsFormatSupported(GraphicsFormat.R16_UInt, FormatUsage.LoadStore);
- // TODO: Remove this line when atomic bug in HLSLcc is fixed.
- m_MotionBlurSupportsScattering = m_MotionBlurSupportsScattering && (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Vulkan);
- // TODO: Write a version that uses structured buffer instead of texture to do atomic as Metal doesn't support atomics on textures.
- m_MotionBlurSupportsScattering = m_MotionBlurSupportsScattering && (SystemInfo.graphicsDeviceType != GraphicsDeviceType.Metal);
-
FillEmptyExposureTexture();
- // Initialize our target pool to ease RT management
- m_Pool = new TargetPool();
-
- // Use a custom RNG, we don't want to mess with the Unity one that the users might be
- // relying on (breaks determinism in their code)
- m_Random = new System.Random();
-
// Misc targets
m_TempTexture1024 = RTHandles.Alloc(
1024, 1024, colorFormat: GraphicsFormat.R16G16_SFloat,
@@ -212,18 +268,6 @@ public PostProcessSystem(HDRenderPipelineAsset hdAsset, RenderPipelineResources
enableRandomWrite: true, name: "Average Luminance Temp 32"
);
- m_ColorFormat = (GraphicsFormat)hdAsset.currentPlatformRenderPipelineSettings.postProcessSettings.bufferFormat;
- m_KeepAlpha = false;
-
- // if both rendering and post-processing support an alpha channel, then post-processing will process (or copy) the alpha
- m_EnableAlpha = hdAsset.currentPlatformRenderPipelineSettings.supportsAlpha && hdAsset.currentPlatformRenderPipelineSettings.postProcessSettings.supportsAlpha;
-
- if (m_EnableAlpha == false)
- {
- // if only rendering has an alpha channel (and not post-processing), then we just copy the alpha to the output (but we don't process it).
- m_KeepAlpha = hdAsset.currentPlatformRenderPipelineSettings.supportsAlpha;
- }
-
if (m_KeepAlpha)
{
m_AlphaTexture = RTHandles.Alloc(
@@ -233,44 +277,23 @@ public PostProcessSystem(HDRenderPipelineAsset hdAsset, RenderPipelineResources
}
}
- public void Cleanup()
+ public void CleanupNonRenderGraphResources()
{
+ m_NonRenderGraphResourcesAvailable = false;
+
m_Pool.Cleanup();
RTHandles.Release(m_EmptyExposureTexture);
RTHandles.Release(m_TempTexture1024);
RTHandles.Release(m_TempTexture32);
RTHandles.Release(m_AlphaTexture);
- CoreUtils.Destroy(m_ExposureCurveTexture);
- CoreUtils.Destroy(m_InternalSpectralLut);
RTHandles.Release(m_InternalLogLut);
- CoreUtils.Destroy(m_FinalPassMaterial);
- CoreUtils.Destroy(m_ClearBlackMaterial);
- CoreUtils.Destroy(m_SMAAMaterial);
- CoreUtils.Destroy(m_TemporalAAMaterial);
- CoreUtils.SafeRelease(m_BokehNearKernel);
- CoreUtils.SafeRelease(m_BokehFarKernel);
- CoreUtils.SafeRelease(m_BokehIndirectCmd);
- CoreUtils.SafeRelease(m_NearBokehTileList);
- CoreUtils.SafeRelease(m_FarBokehTileList);
- CoreUtils.SafeRelease(m_ContrastAdaptiveSharpen);
- m_EmptyExposureTexture = null;
- m_TempTexture1024 = null;
- m_TempTexture32 = null;
- m_AlphaTexture = null;
- m_ExposureCurveTexture = null;
- m_InternalSpectralLut = null;
- m_InternalLogLut = null;
- m_FinalPassMaterial = null;
- m_ClearBlackMaterial = null;
- m_SMAAMaterial = null;
- m_TemporalAAMaterial = null;
- m_BokehNearKernel = null;
- m_BokehFarKernel = null;
- m_BokehIndirectCmd = null;
- m_NearBokehTileList = null;
- m_FarBokehTileList = null;
+ m_EmptyExposureTexture = null;
+ m_TempTexture1024 = null;
+ m_TempTexture32 = null;
+ m_AlphaTexture = null;
+ m_InternalLogLut = null;
}
// In some cases, the internal buffer of render textures might be invalid.
@@ -278,6 +301,9 @@ public void Cleanup()
// This is not the case when these textures are used exclusively with Compute Shaders. So to make sure they work in this case, we recreate them here.
void CheckRenderTexturesValidity()
{
+ if (!m_NonRenderGraphResourcesAvailable)
+ return;
+
if (!m_EmptyExposureTexture.rt.IsCreated())
FillEmptyExposureTexture();
@@ -799,7 +825,7 @@ RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
{
// r: multiplier, g: EV100
return rtHandleSystem.Alloc(1, 1, colorFormat: k_ExposureFormat,
- enableRandomWrite: true, name: $"Exposure Texture ({id}) {frameIndex}"
+ enableRandomWrite: true, name: $"{id} Exposure Texture {frameIndex}"
);
}
@@ -1031,7 +1057,7 @@ RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
return rtHandleSystem.Alloc(
Vector2.one, TextureXR.slices, DepthBits.None, dimension: TextureXR.dimension,
filterMode: FilterMode.Bilinear, colorFormat: m_ColorFormat,
- enableRandomWrite: true, useDynamicScale: true, name: "TAA History"
+ enableRandomWrite: true, useDynamicScale: true, name: $"{id} TAA History"
);
}
@@ -1047,7 +1073,7 @@ RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
return rtHandleSystem.Alloc(
Vector2.one, TextureXR.slices, DepthBits.None, dimension: TextureXR.dimension,
filterMode: FilterMode.Bilinear, colorFormat: GraphicsFormat.R16_SFloat,
- enableRandomWrite: true, useDynamicScale: true, name: "Velocity magnitude"
+ enableRandomWrite: true, useDynamicScale: true, name: $"{id} Velocity magnitude"
);
}
@@ -1673,7 +1699,7 @@ RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
{
return rtHandleSystem.Alloc(
Vector2.one, TextureXR.slices, DepthBits.None, GraphicsFormat.R16_SFloat,
- dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, name: "CoC History"
+ dimension: TextureXR.dimension, enableRandomWrite: true, useDynamicScale: true, name: $"{id} CoC History"
);
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs
index d356d8242b1..81881ecbf12 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs
@@ -820,7 +820,7 @@ struct AmbientOcclusionAllocator
public RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
{
- return rtHandleSystem.Alloc(Vector2.one * scaleFactor, TextureXR.slices, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32_UInt, dimension: TextureXR.dimension, useDynamicScale: true, enableRandomWrite: true, name: string.Format("AO Packed history_{0}", frameIndex));
+ return rtHandleSystem.Alloc(Vector2.one * scaleFactor, TextureXR.slices, filterMode: FilterMode.Point, colorFormat: GraphicsFormat.R32_UInt, dimension: TextureXR.dimension, useDynamicScale: true, enableRandomWrite: true, name: string.Format("{0}_AO Packed history_{1}", id, frameIndex));
}
}
@@ -1267,7 +1267,7 @@ static RTHandle HistoryBufferAllocatorFunction(string viewName, int frameIndex,
return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: (GraphicsFormat)hdPipeline.currentPlatformRenderPipelineSettings.colorBufferFormat,
dimension: TextureXR.dimension, enableRandomWrite: true, useMipMap: true, autoGenerateMips: false, useDynamicScale: true,
- name: string.Format("CameraColorBufferMipChain{0}", frameIndex));
+ name: string.Format("{0}_CameraColorBufferMipChain{1}", viewName, frameIndex));
}
void ReleaseHistoryBuffer()
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs
index 73b9af844f4..e7ccc9ab262 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs
@@ -121,7 +121,6 @@ internal enum HDProfileId
PrepareLightsForGPU,
// Profile sampler for shadow
- PushShadowGlobalParameters,
RenderShadowMaps,
RenderMomentShadowMaps,
RenderPunctualShadowMaps,
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs
index 695f1f899a7..caa18d08333 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs
@@ -27,7 +27,6 @@ static void ReadLightingBuffers(LightingBuffers buffers, RenderGraphBuilder buil
class BuildGPULightListPassData
{
- public ShadowGlobalParameters shadowGlobalParameters;
public LightLoopGlobalParameters lightLoopGlobalParameters;
public BuildGPULightListParameters buildGPULightListParameters;
@@ -93,7 +92,6 @@ BuildGPULightListOutput BuildGPULightList(RenderGraph renderGraph, HDCamera hdCa
{
builder.EnableAsyncCompute(hdCamera.frameSettings.BuildLightListRunsAsync());
- passData.shadowGlobalParameters = PrepareShadowGlobalParameters(hdCamera);
passData.lightLoopGlobalParameters = PrepareLightLoopGlobalParameters(hdCamera, m_TileAndClusterData);
passData.buildGPULightListParameters = PrepareBuildGPULightListParameters(hdCamera, m_TileAndClusterData, ref m_ShaderVariablesLightListCB, m_TotalLightCount);
passData.depthBuffer = builder.ReadTexture(depthStencilBuffer);
@@ -135,7 +133,6 @@ BuildGPULightListOutput BuildGPULightList(RenderGraph renderGraph, HDCamera hdCa
BuildDispatchIndirectArguments(data.buildGPULightListParameters, buildLightListResources, tileFlagsWritten, context.cmd);
// TODO RENDERGRAPH WARNING: Note that the three sets of variables are bound here, but it should be handled differently.
- PushShadowGlobalParams(data.shadowGlobalParameters, context.cmd);
PushLightLoopGlobalParams(data.lightLoopGlobalParameters, context.cmd);
});
@@ -397,9 +394,6 @@ TextureHandle RenderSSR( RenderGraph renderGraph,
}
}
- // TODO RENDERGRAPH
- //cmd.SetGlobalInt(HDShaderIDs._UseRayTracedReflections, usesRaytracedReflections ? 1 : 0);
-
PushFullScreenDebugTexture(renderGraph, result, FullScreenDebugMode.ScreenSpaceReflections);
return result;
}
@@ -411,7 +405,6 @@ class RenderContactShadowPassData
public TextureHandle depthTexture;
public TextureHandle contactShadowsTexture;
public ComputeBufferHandle lightList;
- public HDShadowManager shadowManager;
}
TextureHandle RenderContactShadows(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthTexture, BuildGPULightListOutput lightLists, int firstMipOffsetY)
@@ -431,7 +424,6 @@ TextureHandle RenderContactShadows(RenderGraph renderGraph, HDCamera hdCamera, T
passData.lightLoopLightData = m_LightLoopLightData;
passData.lightList = builder.ReadComputeBuffer(lightLists.lightList);
passData.depthTexture = builder.ReadTexture(depthTexture);
- passData.shadowManager = m_ShadowManager;
passData.contactShadowsTexture = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true)
{ colorFormat = GraphicsFormat.R32_UInt, enableRandomWrite = true, clearBuffer = clearBuffer, clearColor = Color.clear, name = "ContactShadowsBuffer" }, HDShaderIDs._ContactShadowTexture));
@@ -441,8 +433,6 @@ TextureHandle RenderContactShadows(RenderGraph renderGraph, HDCamera hdCamera, T
(RenderContactShadowPassData data, RenderGraphContext context) =>
{
var res = context.resources;
- data.shadowManager.PushGlobalParameters(context.cmd);
-
RenderContactShadows(data.parameters, res.GetTexture(data.contactShadowsTexture), res.GetTexture(data.depthTexture), data.lightLoopLightData, res.GetComputeBuffer(data.lightList), context.cmd);
});
}
@@ -481,15 +471,7 @@ TextureHandle VolumeVoxelizationPass( RenderGraph renderGraph,
float tileSize = 0;
Vector3Int viewportSize = ComputeVolumetricViewportSize(hdCamera, ref tileSize);
- passData.densityBuffer = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(viewportSize.x, viewportSize.y, false, false)
- {
- dimension = TextureDimension.Tex3D,
- colorFormat = GraphicsFormat.R16G16B16A16_SFloat, // 8888_sRGB is not precise enough
- enableRandomWrite = true,
- slices = viewportSize.z,
- /* useDynamicScale: true, // <- TODO ,*/
- name = "VBufferDensity"
- }));
+ passData.densityBuffer = builder.WriteTexture(renderGraph.ImportTexture(m_DensityBuffer));
builder.SetRenderFunc(
(VolumeVoxelizationPassData data, RenderGraphContext ctx) =>
@@ -536,15 +518,9 @@ TextureHandle VolumetricLightingPass(RenderGraph renderGraph, HDCamera hdCamera,
float tileSize = 0;
Vector3Int viewportSize = ComputeVolumetricViewportSize(hdCamera, ref tileSize);
- passData.lightingBuffer = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(viewportSize.x, viewportSize.y, false, false)
- {
- dimension = TextureDimension.Tex3D,
- colorFormat = GraphicsFormat.R16G16B16A16_SFloat, // 8888_sRGB is not precise enough
- enableRandomWrite = true,
- slices = viewportSize.z,
- /* useDynamicScale: true, // <- TODO ,*/
- name = "VBufferLighting"
- }, HDShaderIDs._VBufferLighting));
+ // TODO RENDERGRAPH: Auto-scale of 3D RTs is not supported yet so we need to find a better solution for this. Or keep it as is?
+ passData.lightingBuffer = builder.WriteTexture(renderGraph.ImportTexture(m_LightingBuffer, HDShaderIDs._VBufferLighting));
+
if (passData.parameters.enableReprojection)
{
var currIdx = (frameIndex + 0) & 1;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs
index 0198ccdcf73..2c6aac34fb9 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs
@@ -23,7 +23,7 @@ TextureHandle RenderPostProcess( RenderGraph renderGraph,
{
PostProcessParameters parameters = PreparePostProcess(cullResults, hdCamera);
- TextureHandle afterPostProcessBuffer = renderGraph.ImportTexture(TextureXR.GetBlackTexture());
+ TextureHandle afterPostProcessBuffer = renderGraph.defaultResources.blackTextureXR;
TextureHandle dest = HDUtils.PostProcessIsFinalPass(parameters.hdCamera) ? backBuffer : renderGraph.CreateTexture(
new TextureDesc(Vector2.one, true, true) { colorFormat = GetColorBufferFormat(), name = "Intermediate Postprocess buffer" });
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs
index a2ce07399c5..ffb4c42da01 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs
@@ -584,7 +584,7 @@ void RenderDBuffer(RenderGraph renderGraph, HDCamera hdCamera, ref PrepassOutput
if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals))
{
// Return all black textures for default values.
- var blackTexture = renderGraph.ImportTexture(TextureXR.GetBlackTexture());
+ var blackTexture = renderGraph.defaultResources.blackTextureXR;
output.dbuffer.dBufferCount = use4RTs ? 4 : 3;
for (int i = 0; i < output.dbuffer.dBufferCount; ++i)
output.dbuffer.mrt[i] = blackTexture;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
index 00657624e74..74384efdf78 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
@@ -70,7 +70,7 @@ void ExecuteWithRenderGraph( RenderRequest renderRequest,
PushFullScreenDebugTexture(m_RenderGraph, lightingBuffers.ambientOcclusionBuffer, FullScreenDebugMode.SSAO);
// Evaluate the clear coat mask texture based on the lit shader mode
- var clearCoatMask = hdCamera.frameSettings.litShaderMode == LitShaderMode.Deferred ? prepassOutput.gbuffer.mrt[2] : m_RenderGraph.ImportTexture(TextureXR.GetBlackTexture());
+ var clearCoatMask = hdCamera.frameSettings.litShaderMode == LitShaderMode.Deferred ? prepassOutput.gbuffer.mrt[2] : m_RenderGraph.defaultResources.blackTextureXR;
lightingBuffers.ssrLightingBuffer = RenderSSR(m_RenderGraph,
hdCamera,
prepassOutput.resolvedNormalBuffer,
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
index 7e061b6aec1..f9e29a6c68e 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
@@ -190,6 +190,7 @@ internal static Volume GetOrCreateDefaultVolume()
ShaderVariablesGlobal m_ShaderVariablesGlobalCB = new ShaderVariablesGlobal();
ShaderVariablesXR m_ShaderVariablesXRCB = new ShaderVariablesXR();
ShaderVariablesDebugDisplay m_ShaderVariablesDebugDisplayCB = new ShaderVariablesDebugDisplay();
+ ShaderVariablesRaytracing m_ShaderVariablesRayTracingCB = new ShaderVariablesRaytracing();
// The current MSAA count
MSAASamples m_MSAASamples;
@@ -328,7 +329,8 @@ internal bool showCascade
}
// RENDER GRAPH
- RenderGraph m_RenderGraph;
+ RenderGraph m_RenderGraph;
+ bool m_EnableRenderGraph;
// MSAA resolve materials
Material m_ColorResolveMaterial = null;
@@ -527,15 +529,12 @@ public HDRenderPipeline(HDRenderPipelineAsset asset, HDRenderPipelineAsset defau
CameraCaptureBridge.enabled = true;
- // Render Graph
- m_RenderGraph = new RenderGraph(m_Asset.currentPlatformRenderPipelineSettings.supportMSAA, m_MSAASamples);
- m_RenderGraph.RegisterDebug();
-
InitializePrepass(m_Asset);
m_ColorResolveMaterial = CoreUtils.CreateEngineMaterial(asset.renderPipelineResources.shaders.colorResolvePS);
m_MotionVectorResolve = CoreUtils.CreateEngineMaterial(asset.renderPipelineResources.shaders.resolveMotionVecPS);
InitializeProbeVolumes();
+ CustomPassUtils.Initialize();
}
#if UNITY_EDITOR
@@ -635,7 +634,7 @@ void InitializeRenderTextures()
m_CameraSssDiffuseLightingBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.B10G11R11_UFloatPack32, enableRandomWrite: true, useDynamicScale: true, name: "CameraSSSDiffuseLighting");
m_CustomPassColorBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer"));
- m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R32_UInt, enableRandomWrite: true, useDynamicScale: true, isShadowMap: true, name: "CustomPassDepthBuffer", depthBufferBits: DepthBits.Depth32));
+ m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.R32_UInt, enableRandomWrite: true, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: DepthBits.Depth32));
m_DistortionBuffer = RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: Builtin.GetDistortionBufferFormat(), useDynamicScale: true, name: "Distortion");
@@ -665,6 +664,9 @@ void InitializeRenderTextures()
void GetOrCreateDebugTextures()
{
+ if (m_EnableRenderGraph)
+ return;
+
//Debug.isDebugBuild can be changed during DoBuildPlayer, these allocation has to be check on every frames
//TODO : Clean this with the RenderGraph system
if (Debug.isDebugBuild && m_DebugColorPickerBuffer == null && m_DebugFullScreenTempBuffer == null)
@@ -688,15 +690,18 @@ void DestroyRenderTextures()
#if ENABLE_VIRTUALTEXTURES
m_VtBufferManager.DestroyBuffers();
#endif
- m_MipGenerator.Release();
+
+ DestroySSSBuffers();
+ m_SharedRTManager.Cleanup();
RTHandles.Release(m_CameraColorBuffer);
+ RTHandles.Release(m_OpaqueAtmosphericScatteringBuffer);
+ RTHandles.Release(m_CameraSssDiffuseLightingBuffer);
+
if (m_CustomPassColorBuffer.IsValueCreated)
RTHandles.Release(m_CustomPassColorBuffer.Value);
if (m_CustomPassDepthBuffer.IsValueCreated)
RTHandles.Release(m_CustomPassDepthBuffer.Value);
- RTHandles.Release(m_OpaqueAtmosphericScatteringBuffer);
- RTHandles.Release(m_CameraSssDiffuseLightingBuffer);
RTHandles.Release(m_DistortionBuffer);
RTHandles.Release(m_ContactShadowBuffer);
@@ -707,13 +712,17 @@ void DestroyRenderTextures()
RTHandles.Release(m_SsrHitPointTexture);
RTHandles.Release(m_SsrLightingTexture);
- RTHandles.Release(m_DebugColorPickerBuffer);
- RTHandles.Release(m_DebugFullScreenTempBuffer);
- RTHandles.Release(m_IntermediateAfterPostProcessBuffer);
-
RTHandles.Release(m_CameraColorMSAABuffer);
RTHandles.Release(m_OpaqueAtmosphericScatteringMSAABuffer);
RTHandles.Release(m_CameraSssDiffuseLightingMSAABuffer);
+
+ // Those buffer are initialized lazily so we need to null them for this to work after deallocation.
+ RTHandles.Release(m_DebugColorPickerBuffer);
+ RTHandles.Release(m_DebugFullScreenTempBuffer);
+ RTHandles.Release(m_IntermediateAfterPostProcessBuffer);
+ m_DebugColorPickerBuffer = null;
+ m_DebugFullScreenTempBuffer = null;
+ m_IntermediateAfterPostProcessBuffer = null;
}
void SetRenderingFeatures()
@@ -871,6 +880,65 @@ void UnsetRenderingFeatures()
#endif
}
+ void InitializeRenderGraph()
+ {
+ m_RenderGraph = new RenderGraph(m_Asset.currentPlatformRenderPipelineSettings.supportMSAA, m_MSAASamples);
+ m_RenderGraph.RegisterDebug();
+ }
+
+ void CleanupRenderGraph()
+ {
+ if (m_EnableRenderGraph)
+ {
+ m_RenderGraph.Cleanup();
+ m_RenderGraph.UnRegisterDebug();
+ m_RenderGraph = null;
+ }
+ }
+
+ internal bool IsRenderGraphEnabled()
+ {
+ return m_EnableRenderGraph;
+ }
+
+ internal void EnableRenderGraph(bool value)
+ {
+ bool changed = value != m_EnableRenderGraph;
+ if (changed)
+ {
+ if (value)
+ {
+ CleanupNonRenderGraphResources();
+ InitializeRenderGraph();
+ m_EnableRenderGraph = true;
+ }
+ else
+ {
+ CleanupRenderGraph();
+ InitializeNonRenderGraphResources();
+ m_EnableRenderGraph = false;
+ }
+ }
+ }
+
+ void InitializeNonRenderGraphResources()
+ {
+ InitializeRenderTextures();
+ m_ShadowManager.InitializeNonRenderGraphResources();
+ m_AmbientOcclusionSystem.InitializeNonRenderGraphResources();
+ m_PostProcessSystem.InitializeNonRenderGraphResources(asset);
+ s_lightVolumes.InitializeNonRenderGraphResources();
+ }
+
+ void CleanupNonRenderGraphResources()
+ {
+ DestroyRenderTextures();
+ m_ShadowManager.CleanupNonRenderGraphResources();
+ m_AmbientOcclusionSystem.CleanupNonRenderGraphResources();
+ m_PostProcessSystem.CleanupNonRenderGraphResources();
+ s_lightVolumes.CleanupNonRenderGraphResources();
+ }
+
void InitializeDebugMaterials()
{
m_DebugViewMaterialGBuffer = CoreUtils.CreateEngineMaterial(defaultResources.shaders.debugViewMaterialGBufferPS);
@@ -974,8 +1042,6 @@ protected override void Dispose(bool disposing)
CoreUtils.Destroy(m_ApplyDistortionMaterial);
CoreUtils.Destroy(m_ClearStencilBufferMaterial);
- CleanupSubsurfaceScattering();
- m_SharedRTManager.Cleanup();
m_XRSystem.Cleanup();
m_SkyManager.Cleanup();
CleanupVolumetricLighting();
@@ -992,20 +1058,23 @@ protected override void Dispose(bool disposing)
HDCamera.ClearAll();
+ m_MipGenerator.Release();
+
DestroyRenderTextures();
CullingGroupManager.instance.Cleanup();
+ m_DbufferManager.ReleaseResolutionDependentBuffers();
+ m_SharedRTManager.DisposeCoarseStencilBuffer();
+
CoreUtils.SafeRelease(m_DepthPyramidMipLevelOffsetsBuffer);
CustomPassVolume.Cleanup();
- // RenderGraph
- m_RenderGraph.Cleanup();
- m_RenderGraph.UnRegisterDebug();
CleanupPrepass();
CoreUtils.Destroy(m_ColorResolveMaterial);
CoreUtils.Destroy(m_MotionVectorResolve);
+ CustomPassUtils.Cleanup();
#if UNITY_EDITOR
SceneViewDrawMode.ResetDrawMode();
@@ -1082,13 +1151,23 @@ void Resize(HDCamera hdCamera)
}
}
+ void UpdateGlobalConstantBuffers(HDCamera hdCamera, CommandBuffer cmd)
+ {
+ UpdateShaderVariablesGlobalCB(hdCamera, cmd);
+ UpdateShaderVariablesXRCB(hdCamera, cmd);
+ UpdateShaderVariablesRaytracingCB(hdCamera, cmd);
+
+ // This one is not in a constant buffer because it's only used as a parameter for some shader's render states. It's not actually used inside shader code.
+ cmd.SetGlobalInt(HDShaderIDs._ColorMaskTransparentVel, (int)ColorWriteMask.All);
+ }
+
void UpdateShaderVariablesGlobalCB(HDCamera hdCamera, CommandBuffer cmd)
{
hdCamera.UpdateShaderVariablesGlobalCB(ref m_ShaderVariablesGlobalCB, m_FrameCount);
Fog.UpdateShaderVariablesGlobalCB(ref m_ShaderVariablesGlobalCB, hdCamera);
UpdateShaderVariablesGlobalSubsurface(ref m_ShaderVariablesGlobalCB, hdCamera);
UpdateShaderVariablesGlobalDecal(ref m_ShaderVariablesGlobalCB, hdCamera);
- UpdateShaderVariablesGlobalVolumetrics(ref m_ShaderVariablesGlobalCB, RTHandles.rtHandleProperties, hdCamera);
+ UpdateShaderVariablesGlobalVolumetrics(ref m_ShaderVariablesGlobalCB, hdCamera);
m_ShadowManager.UpdateShaderVariablesGlobalCB(ref m_ShaderVariablesGlobalCB);
UpdateShaderVariablesGlobalLightLoop(ref m_ShaderVariablesGlobalCB, hdCamera);
UpdateShaderVariablesGlobalProbeVolumes(ref m_ShaderVariablesGlobalCB, hdCamera);
@@ -1135,12 +1214,32 @@ void UpdateShaderVariablesGlobalCB(HDCamera hdCamera, CommandBuffer cmd)
}
ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesGlobalCB, HDShaderIDs._ShaderVariablesGlobal);
+ }
+ void UpdateShaderVariablesXRCB(HDCamera hdCamera, CommandBuffer cmd)
+ {
hdCamera.UpdateShaderVariablesXRCB(ref m_ShaderVariablesXRCB);
ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesXRCB, HDShaderIDs._ShaderVariablesXR);
+ }
- // This one is not in a constant buffer because it's only used as a parameter for some shader's render states. It's not actually used inside shader code.
- cmd.SetGlobalInt(HDShaderIDs._ColorMaskTransparentVel, (int)ColorWriteMask.All);
+
+ void UpdateShaderVariablesRaytracingCB(HDCamera hdCamera, CommandBuffer cmd)
+ {
+ if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing))
+ return;
+
+ RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
+ ScreenSpaceReflection screenSpaceReflection = hdCamera.volumeStack.GetComponent();
+
+ // Those are globally set parameters. The others are set per effect and will update the constant buffer as we render.
+ m_ShaderVariablesRayTracingCB._RaytracingRayBias = rayTracingSettings.rayBias.value;
+ m_ShaderVariablesRayTracingCB._RayCountEnabled = m_RayCountManager.RayCountIsEnabled();
+ m_ShaderVariablesRayTracingCB._RaytracingCameraNearPlane = hdCamera.camera.nearClipPlane;
+ m_ShaderVariablesRayTracingCB._RaytracingPixelSpreadAngle = GetPixelSpreadAngle(hdCamera.camera.fieldOfView, hdCamera.actualWidth, hdCamera.actualHeight);
+ m_ShaderVariablesRayTracingCB._RaytracingReflectionMinSmoothness = screenSpaceReflection.minSmoothness.value;
+ m_ShaderVariablesRayTracingCB._RaytracingReflectionSmoothnessFadeStart = screenSpaceReflection.smoothnessFadeStart.value;
+
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
}
void CopyDepthBufferIfNeeded(HDCamera hdCamera, CommandBuffer cmd)
@@ -2104,7 +2203,7 @@ AOVRequestData aovRequest
// So the first thing to do is to go through all the light: PrepareLightsForGPU
bool enableBakeShadowMask = PrepareLightsForGPU(cmd, hdCamera, cullingResults, hdProbeCullingResults, densityVolumes, probeVolumes, m_CurrentDebugDisplaySettings, aovRequest);
- UpdateShaderVariablesGlobalCB(hdCamera, cmd);
+ UpdateGlobalConstantBuffers(hdCamera, cmd);
// Do the same for ray tracing if allowed
if (m_RayTracingSupported)
@@ -2130,7 +2229,7 @@ AOVRequestData aovRequest
return;
}
- if (m_RenderGraph.enabled)
+ if (m_EnableRenderGraph)
{
ExecuteWithRenderGraph(renderRequest, aovRequest, aovBuffers, renderContext, cmd);
return;
@@ -2440,7 +2539,7 @@ void Callback(CommandBuffer c, HDCamera cam)
}
if (!hdCamera.frameSettings.SSAORunsAsync())
- m_AmbientOcclusionSystem.Render(cmd, hdCamera, renderContext, m_FrameCount);
+ m_AmbientOcclusionSystem.Render(cmd, hdCamera, renderContext, m_ShaderVariablesRayTracingCB, m_FrameCount);
// Run the contact shadows here as they need the light list
HDUtils.CheckRTCreated(m_ContactShadowBuffer);
@@ -4921,7 +5020,7 @@ void SendGeometryGraphicsBuffers(CommandBuffer cmd, HDCamera hdCamera)
RTHandle mainNormalBuffer = m_SharedRTManager.GetNormalBuffer();
RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
{
- return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: mainNormalBuffer.rt.graphicsFormat, dimension: TextureXR.dimension, enableRandomWrite: mainNormalBuffer.rt.enableRandomWrite, name: $"Normal History Buffer"
+ return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: mainNormalBuffer.rt.graphicsFormat, dimension: TextureXR.dimension, enableRandomWrite: mainNormalBuffer.rt.enableRandomWrite, name: $"{id}_Normal History Buffer"
);
}
@@ -4936,7 +5035,7 @@ RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
RTHandle mainDepthBuffer = m_SharedRTManager.GetDepthTexture();
RTHandle Allocator(string id, int frameIndex, RTHandleSystem rtHandleSystem)
{
- return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: mainDepthBuffer.rt.graphicsFormat, dimension: TextureXR.dimension, enableRandomWrite: mainDepthBuffer.rt.enableRandomWrite, name: $"Depth History Buffer"
+ return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: mainDepthBuffer.rt.graphicsFormat, dimension: TextureXR.dimension, enableRandomWrite: mainDepthBuffer.rt.enableRandomWrite, name: $"{id}_Depth History Buffer"
);
}
depthBuffer = hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Depth) ?? hdCamera.AllocHistoryFrameRT((int)HDCameraFrameHistoryType.Depth, Allocator, 1);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
index 590af315417..0f491337b7a 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
@@ -80,8 +80,7 @@ static class HDShaderIDs
public static readonly int _HDShadowDatas = Shader.PropertyToID("_HDShadowDatas");
public static readonly int _HDDirectionalShadowData = Shader.PropertyToID("_HDDirectionalShadowData");
public static readonly int _ShadowmapAtlas = Shader.PropertyToID("_ShadowmapAtlas");
- public static readonly int _AreaLightShadowmapAtlas = Shader.PropertyToID("_AreaShadowmapAtlas");
- public static readonly int _AreaShadowmapMomentAtlas = Shader.PropertyToID("_AreaShadowmapMomentAtlas");
+ public static readonly int _ShadowmapAreaAtlas = Shader.PropertyToID("_ShadowmapAreaAtlas");
public static readonly int _ShadowmapCascadeAtlas = Shader.PropertyToID("_ShadowmapCascadeAtlas");
// Moment shadow map data
@@ -292,6 +291,8 @@ static class HDShaderIDs
public static readonly int _ShaderVariablesXR = Shader.PropertyToID("ShaderVariablesXR");
public static readonly int _ShaderVariablesVolumetric = Shader.PropertyToID("ShaderVariablesVolumetric");
public static readonly int _ShaderVariablesLightList = Shader.PropertyToID("ShaderVariablesLightList");
+ public static readonly int _ShaderVariablesRaytracing = Shader.PropertyToID("ShaderVariablesRaytracing");
+ public static readonly int _ShaderVariablesRaytracingLightLoop = Shader.PropertyToID("ShaderVariablesRaytracingLightLoop");
public static readonly int _ShaderVariablesDebugDisplay = Shader.PropertyToID("ShaderVariablesDebugDisplay");
public static readonly int _SSSBufferTexture = Shader.PropertyToID("_SSSBufferTexture");
@@ -346,7 +347,7 @@ static class HDShaderIDs
public static readonly int _InputCubemap = Shader.PropertyToID("_InputCubemap");
public static readonly int _Mipmap = Shader.PropertyToID("_Mipmap");
- public static readonly int _ApplyExposure = Shader.PropertyToID("_ApplyExposure");
+ public static readonly int _ApplyExposure = Shader.PropertyToID("_ApplyExposure");
public static readonly int _DiffusionProfileHash = Shader.PropertyToID("_DiffusionProfileHash");
public static readonly int _MaxRadius = Shader.PropertyToID("_MaxRadius");
@@ -456,13 +457,8 @@ static class HDShaderIDs
public static readonly int _HorizonZenithShiftScale = Shader.PropertyToID("_HorizonZenithShiftScale");
// Raytracing variables
- public static readonly int _RaytracingRayBias = Shader.PropertyToID("_RaytracingRayBias");
public static readonly int _RayTracingLayerMask = Shader.PropertyToID("_RayTracingLayerMask");
- public static readonly int _RaytracingNumSamples = Shader.PropertyToID("_RaytracingNumSamples");
- public static readonly int _RaytracingSampleIndex = Shader.PropertyToID("_RaytracingSampleIndex");
- public static readonly int _RaytracingRayMaxLength = Shader.PropertyToID("_RaytracingRayMaxLength");
public static readonly int _PixelSpreadAngleTangent = Shader.PropertyToID("_PixelSpreadAngleTangent");
- public static readonly int _RaytracingPixelSpreadAngle = Shader.PropertyToID("_RaytracingPixelSpreadAngle");
public static readonly string _RaytracingAccelerationStructureName = "_RaytracingAccelerationStructure";
// Path tracing variables
@@ -470,15 +466,10 @@ static class HDShaderIDs
public static readonly int _InvViewportScaleBias = Shader.PropertyToID("_InvViewportScaleBias");
// Light Cluster
- public static readonly int _MinClusterPos = Shader.PropertyToID("_MinClusterPos");
- public static readonly int _MaxClusterPos = Shader.PropertyToID("_MaxClusterPos");
- public static readonly int _LightPerCellCount = Shader.PropertyToID("_LightPerCellCount");
public static readonly int _LightDatasRT = Shader.PropertyToID("_LightDatasRT");
public static readonly int _EnvLightDatasRT = Shader.PropertyToID("_EnvLightDatasRT");
- public static readonly int _PunctualLightCountRT = Shader.PropertyToID("_PunctualLightCountRT");
- public static readonly int _AreaLightCountRT = Shader.PropertyToID("_AreaLightCountRT");
- public static readonly int _EnvLightCountRT = Shader.PropertyToID("_EnvLightCountRT");
public static readonly int _RaytracingLightCluster = Shader.PropertyToID("_RaytracingLightCluster");
+ public static readonly int _RaytracingLightClusterRW = Shader.PropertyToID("_RaytracingLightClusterRW");
// Denoising
public static readonly int _HistoryBuffer = Shader.PropertyToID("_HistoryBuffer");
@@ -511,14 +502,8 @@ static class HDShaderIDs
public static readonly int _AccumulatedFrameTexture = Shader.PropertyToID("_AccumulatedFrameTexture");
public static readonly int _TemporalAccumuationWeight = Shader.PropertyToID("_TemporalAccumuationWeight");
public static readonly int _SpatialFilterRadius = Shader.PropertyToID("_SpatialFilterRadius");
- public static readonly int _RaytracingReflectionMaxDistance = Shader.PropertyToID("_RaytracingReflectionMaxDistance");
public static readonly int _RaytracingHitDistanceTexture = Shader.PropertyToID("_RaytracingHitDistanceTexture");
- public static readonly int _RaytracingIntensityClamp = Shader.PropertyToID("_RaytracingIntensityClamp");
- public static readonly int _RaytracingPreExposition = Shader.PropertyToID("_RaytracingPreExposition");
- public static readonly int _RaytracingReflectionMinSmoothness = Shader.PropertyToID("_RaytracingReflectionMinSmoothness");
- public static readonly int _RaytracingReflectionSmoothnessFadeStart = Shader.PropertyToID("_RaytracingReflectionSmoothnessFadeStart");
public static readonly int _RaytracingVSNormalTexture = Shader.PropertyToID("_RaytracingVSNormalTexture");
- public static readonly int _RaytracingIncludeSky = Shader.PropertyToID("_RaytracingIncludeSky");
// Shadows
public static readonly int _RaytracingTargetAreaLight = Shader.PropertyToID("_RaytracingTargetAreaLight");
@@ -551,7 +536,6 @@ static class HDShaderIDs
public static readonly int _RaytracingAOIntensity = Shader.PropertyToID("_RaytracingAOIntensity");
// Ray count
- public static readonly int _RayCountEnabled = Shader.PropertyToID("_RayCountEnabled");
public static readonly int _RayCountTexture = Shader.PropertyToID("_RayCountTexture");
public static readonly int _RayCountType = Shader.PropertyToID("_RayCountType");
public static readonly int _InputRayCountTexture = Shader.PropertyToID("_InputRayCountTexture");
@@ -562,10 +546,7 @@ static class HDShaderIDs
// Primary Visibility
public static readonly int _RaytracingFlagMask = Shader.PropertyToID("_RaytracingFlagMask");
- public static readonly int _RaytracingMinRecursion = Shader.PropertyToID("_RaytracingMinRecursion");
- public static readonly int _RaytracingMaxRecursion = Shader.PropertyToID("_RaytracingMaxRecursion");
public static readonly int _RaytracingPrimaryDebug = Shader.PropertyToID("_RaytracingPrimaryDebug");
- public static readonly int _RaytracingCameraNearPlane = Shader.PropertyToID("_RaytracingCameraNearPlane");
public static readonly int _RaytracingCameraSkyEnabled = Shader.PropertyToID("_RaytracingCameraSkyEnabled");
public static readonly int _RaytracingCameraClearColor = Shader.PropertyToID("_RaytracingCameraClearColor");
@@ -587,7 +568,6 @@ static class HDShaderIDs
// Deferred Lighting
public static readonly int _RaytracingLitBufferRW = Shader.PropertyToID("_RaytracingLitBufferRW");
- public static readonly int _RaytracingDiffuseRay = Shader.PropertyToID("_RaytracingDiffuseRay");
public static readonly int _RayTracingDiffuseLightingOnly = Shader.PropertyToID("_RayTracingDiffuseLightingOnly");
// Ray binning
@@ -791,6 +771,16 @@ static class HDShaderIDs
public static readonly int _LoD = Shader.PropertyToID("_LoD");
public static readonly int _FaceIndex = Shader.PropertyToID("_FaceIndex");
+ // Custom Pass Utils API
+ public static readonly int _SourceScaleBias = Shader.PropertyToID("_SourceScaleBias");
+ public static readonly int _GaussianWeights = Shader.PropertyToID("_GaussianWeights");
+ public static readonly int _SampleCount = Shader.PropertyToID("_SampleCount");
+ public static readonly int _Radius = Shader.PropertyToID("_Radius");
+ public static readonly int _ViewPortSize = Shader.PropertyToID("_ViewPortSize");
+ public static readonly int _ViewportScaleBias = Shader.PropertyToID("_ViewportScaleBias");
+ public static readonly int _SourceSize = Shader.PropertyToID("_SourceSize");
+ public static readonly int _SourceScaleFactor = Shader.PropertyToID("_SourceScaleFactor");
+
// Probe Volumes
public static readonly int _ProbeVolumeAtlasSH = Shader.PropertyToID("_ProbeVolumeAtlasSH");
public static readonly int _ProbeVolumeAtlasResolutionAndSliceCount = Shader.PropertyToID("_ProbeVolumeAtlasResolutionAndSliceCount");
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs
index be059b353ca..ba445e3dbad 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs
@@ -207,7 +207,7 @@ static RTHandle PathTracingHistoryBufferAllocatorFunction(string viewName, int f
{
return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R32G32B32A32_SFloat, dimension: TextureXR.dimension,
enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
- name: string.Format("PathTracingHistoryBuffer{0}", frameIndex));
+ name: string.Format("{0}_PathTracingHistoryBuffer{1}", viewName, frameIndex));
}
void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputTexture)
@@ -229,7 +229,6 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText
RayTracingAccelerationStructure accelerationStructure = RequestAccelerationStructure();
HDRaytracingLightCluster lightCluster = RequestLightCluster();
LightCluster lightClusterSettings = hdCamera.volumeStack.GetComponent();
- RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
if (!m_SubFrameManager.isRecording)
{
@@ -255,28 +254,17 @@ void RenderPathTracing(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputText
cmd.SetGlobalTexture(HDShaderIDs._OwenScrambledTexture, m_Asset.renderPipelineResources.textures.owenScrambled256Tex);
cmd.SetGlobalTexture(HDShaderIDs._ScramblingTexture, m_Asset.renderPipelineResources.textures.scramblingTex);
- // Inject the ray generation data
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingNumSamples, m_SubFrameManager.subFrameCount);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingMinRecursion, m_PathTracingSettings.minimumDepth.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingMaxRecursion, m_PathTracingSettings.maximumDepth.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingIntensityClamp, m_PathTracingSettings.maximumIntensity.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rayTracingSettings.rayBias.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingCameraNearPlane, hdCamera.camera.nearClipPlane);
-
- // Set the data for the ray generation
- cmd.SetGlobalInt(HDShaderIDs._RaytracingSampleIndex, (int)m_SubFrameManager.iteration);
-
- // Compute an approximate pixel spread angle value (in radians)
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingPixelSpreadAngle, GetPixelSpreadAngle(hdCamera.camera.fieldOfView, hdCamera.actualWidth, hdCamera.actualHeight));
+ // Update the global constant buffer
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = (int)m_SubFrameManager.subFrameCount;
+ m_ShaderVariablesRayTracingCB._RaytracingMinRecursion = m_PathTracingSettings.minimumDepth.value;
+ m_ShaderVariablesRayTracingCB._RaytracingMaxRecursion = m_PathTracingSettings.maximumDepth.value;
+ m_ShaderVariablesRayTracingCB._RaytracingIntensityClamp = m_PathTracingSettings.maximumIntensity.value;
+ m_ShaderVariablesRayTracingCB._RaytracingSampleIndex = (int)m_SubFrameManager.iteration;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
// LightLoop data
cmd.SetGlobalBuffer(HDShaderIDs._RaytracingLightCluster, lightCluster.GetCluster());
cmd.SetGlobalBuffer(HDShaderIDs._LightDatasRT, lightCluster.GetLightDatas());
- cmd.SetGlobalVector(HDShaderIDs._MinClusterPos, lightCluster.GetMinClusterPos());
- cmd.SetGlobalVector(HDShaderIDs._MaxClusterPos, lightCluster.GetMaxClusterPos());
- cmd.SetGlobalInt(HDShaderIDs._LightPerCellCount, lightClusterSettings.maxNumLightsPercell.value);
- cmd.SetGlobalInt(HDShaderIDs._PunctualLightCountRT, lightCluster.GetPunctualLightCount());
- cmd.SetGlobalInt(HDShaderIDs._AreaLightCountRT, lightCluster.GetAreaLightCount());
// Set the data for the ray miss
cmd.SetRayTracingIntParam(pathTracingShader, HDShaderIDs._RaytracingCameraSkyEnabled, m_CameraSkyEnabled ? 1 : 0);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs
index c295d1ae076..1a1937d6113 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs
@@ -52,7 +52,7 @@ static RTHandle AmbientOcclusionHistoryBufferAllocatorFunction(string viewName,
{
return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16_SFloat, dimension: TextureXR.dimension,
enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
- name: string.Format("AmbientOcclusionHistoryBuffer{0}", frameIndex));
+ name: string.Format("{0}_AmbientOcclusionHistoryBuffer{1}", viewName, frameIndex));
}
@@ -61,7 +61,7 @@ public void SetDefaultAmbientOcclusionTexture(CommandBuffer cmd)
cmd.SetGlobalTexture(HDShaderIDs._AmbientOcclusionTexture, TextureXR.GetBlackTexture());
}
- public void RenderAO(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputTexture, ScriptableRenderContext renderContext, int frameCount)
+ public void RenderAO(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputTexture, ShaderVariablesRaytracing globalCB, ScriptableRenderContext renderContext, int frameCount)
{
// If any of the previous requirements is missing, the effect is not requested or no acceleration structure, set the default one and leave right away
if (!m_RenderPipeline.GetRayTracingState())
@@ -72,7 +72,6 @@ public void RenderAO(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputTextur
RayTracingShader aoShader = m_PipelineRayTracingResources.aoRaytracing;
var aoSettings = hdCamera.volumeStack.GetComponent();
- RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
RayCountManager rayCountManager = m_RenderPipeline.GetRayCountManager();
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.RaytracingAmbientOcclusion)))
@@ -87,10 +86,9 @@ public void RenderAO(HDCamera hdCamera, CommandBuffer cmd, RTHandle outputTextur
cmd.SetRayTracingAccelerationStructure(aoShader, HDShaderIDs._RaytracingAccelerationStructureName, accelerationStructure);
// Inject the ray generation data (be careful of the global constant buffer limitation)
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rayTracingSettings.rayBias.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayMaxLength, aoSettings.rayLength.value);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, aoSettings.sampleCount.value);
- int frameIndex = m_RenderPipeline.RayTracingFrameIndex(hdCamera);
+ globalCB._RaytracingRayMaxLength = aoSettings.rayLength.value;
+ globalCB._RaytracingNumSamples = aoSettings.sampleCount.value;
+ ConstantBuffer.PushGlobal(cmd, globalCB, HDShaderIDs._ShaderVariablesRaytracing);
// Set the data for the ray generation
cmd.SetRayTracingTextureParam(aoShader, HDShaderIDs._DepthTexture, m_RenderPipeline.sharedRTManager.GetDepthStencilBuffer());
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingDeferredLightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingDeferredLightLoop.cs
index be5088abae2..1172f0a4958 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingDeferredLightLoop.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingDeferredLightLoop.cs
@@ -12,21 +12,14 @@ struct DeferredLightingRTParameters
// Generic attributes
public bool rayBinning;
public LayerMask layerMask;
- public float rayBias;
- public float maxRayLength;
- public float clampValue;
- public bool includeSky;
public bool diffuseLightingOnly;
public bool halfResolution;
- public int rayCountFlag;
public int rayCountType;
- public bool preExpose;
// Camera data
public int width;
public int height;
public int viewCount;
- public float fov;
// Compute buffers
public ComputeBuffer rayBinResult;
@@ -38,6 +31,8 @@ struct DeferredLightingRTParameters
public RayTracingShader gBufferRaytracingRT;
public ComputeShader deferredRaytracingCS;
public ComputeShader rayBinningCS;
+
+ public ShaderVariablesRaytracing globalCB;
}
struct DeferredLightingRTResources
@@ -187,6 +182,9 @@ static void RenderRaytracingDeferredLighting(CommandBuffer cmd, in DeferredLight
BinRays(cmd, parameters, buffers.directionBuffer, texWidth, texHeight);
}
+ // Inject the global parameters
+ ConstantBuffer.PushGlobal(cmd, parameters.globalCB, HDShaderIDs._ShaderVariablesRaytracing);
+
// Define the shader pass to use for the reflection pass
cmd.SetRayTracingShaderPass(parameters.gBufferRaytracingRT, "GBufferDXR");
@@ -202,18 +200,14 @@ static void RenderRaytracingDeferredLighting(CommandBuffer cmd, in DeferredLight
cmd.SetRayTracingAccelerationStructure(parameters.gBufferRaytracingRT, HDShaderIDs._RaytracingAccelerationStructureName, parameters.accelerationStructure);
// Set ray count texture
- cmd.SetGlobalInt(HDShaderIDs._RayCountEnabled, parameters.rayCountFlag);
cmd.SetRayTracingIntParam(parameters.gBufferRaytracingRT, HDShaderIDs._RayCountType, parameters.rayCountType);
cmd.SetRayTracingTextureParam(parameters.gBufferRaytracingRT, HDShaderIDs._RayCountTexture, buffers.rayCountTexture);
// Bind all input parameter
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, parameters.rayBias);
cmd.SetRayTracingIntParams(parameters.gBufferRaytracingRT, HDShaderIDs._RayTracingLayerMask, parameters.layerMask);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayMaxLength, parameters.maxRayLength);
cmd.SetRayTracingTextureParam(parameters.gBufferRaytracingRT, HDShaderIDs._DepthTexture, buffers.depthStencilBuffer);
cmd.SetRayTracingTextureParam(parameters.gBufferRaytracingRT, HDShaderIDs._NormalBufferTexture, buffers.normalBuffer);
cmd.SetRayTracingTextureParam(parameters.gBufferRaytracingRT, HDShaderIDs._RaytracingDirectionBuffer, buffers.directionBuffer);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingPixelSpreadAngle, HDRenderPipeline.GetPixelSpreadAngle(parameters.fov, parameters.width, parameters.height));
// Bind the output textures
cmd.SetRayTracingTextureParam(parameters.gBufferRaytracingRT, HDShaderIDs._GBufferTextureRW[0], buffers.gbuffer0);
@@ -227,16 +221,12 @@ static void RenderRaytracingDeferredLighting(CommandBuffer cmd, in DeferredLight
uint heightResolution = (uint)parameters.height;
// Include the sky if required
- cmd.SetGlobalInt(HDShaderIDs._RaytracingIncludeSky, parameters.includeSky ? 1 : 0);
cmd.SetRayTracingTextureParam(parameters.gBufferRaytracingRT, HDShaderIDs._SkyTexture, buffers.skyTexture);
// Only compute diffuse lighting if required
cmd.SetGlobalInt(HDShaderIDs._RayTracingDiffuseLightingOnly, parameters.diffuseLightingOnly ? 1 : 0);
CoreUtils.SetKeyword(cmd, "MULTI_BOUNCE_INDIRECT", false);
- // All rays are diffuse if we are evaluating diffuse lighting only
- cmd.SetGlobalInt(HDShaderIDs._RaytracingDiffuseRay, parameters.diffuseLightingOnly ? 1 : 0);
-
if (parameters.rayBinning)
{
// Evaluate the dispatch parameters
@@ -270,10 +260,6 @@ static void RenderRaytracingDeferredLighting(CommandBuffer cmd, in DeferredLight
cmd.SetComputeTextureParam(parameters.deferredRaytracingCS, currentKernel, HDShaderIDs._GBufferTexture[3], buffers.gbuffer3);
cmd.SetComputeTextureParam(parameters.deferredRaytracingCS, currentKernel, HDShaderIDs._LightLayersTexture, TextureXR.GetWhiteTexture());
- // Inject the other parameters
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingIntensityClamp, parameters.clampValue);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingPreExposition, parameters.preExpose ? 1 : 0);
-
// Bind the output texture
cmd.SetComputeTextureParam(parameters.deferredRaytracingCS, currentKernel, HDShaderIDs._RaytracingLitBufferRW, buffers.litBuffer);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs
index bf6a56d012f..a557580a22b 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.cs
@@ -28,7 +28,7 @@ RTHandle IndirectDiffuseHistoryBufferAllocatorFunction(string viewName, int fram
{
return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension,
enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
- name: string.Format("IndirectDiffuseHistoryBuffer{0}", frameIndex));
+ name: string.Format("{0}_IndirectDiffuseHistoryBuffer{1}", viewName, frameIndex));
}
void RenderRayTracedIndirectDiffuse(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext renderContext, int frameCount)
@@ -114,22 +114,15 @@ DeferredLightingRTParameters PrepareIndirectDiffuseDeferredLightingRTParameters(
// Generic attributes
deferredParameters.rayBinning = true;
deferredParameters.layerMask.value = (int)RayTracingRendererFlag.GlobalIllumination;
- deferredParameters.rayBias = rTSettings.rayBias.value;
- deferredParameters.maxRayLength = settings.rayLength.value;
- deferredParameters.clampValue = settings.clampValue.value;
- deferredParameters.includeSky = true;
deferredParameters.diffuseLightingOnly = true;
deferredParameters.halfResolution = false;
- deferredParameters.rayCountFlag = m_RayCountManager.RayCountIsEnabled();
deferredParameters.rayCountType = (int)RayCountValues.DiffuseGI_Deferred;
- deferredParameters.preExpose = true;
// Camera data
deferredParameters.width = hdCamera.actualWidth;
deferredParameters.height = hdCamera.actualHeight;
deferredParameters.viewCount = hdCamera.viewCount;
- deferredParameters.fov = hdCamera.camera.fieldOfView;
// Compute buffers
deferredParameters.rayBinResult = m_RayBinResult;
@@ -149,6 +142,14 @@ DeferredLightingRTParameters PrepareIndirectDiffuseDeferredLightingRTParameters(
Debug.LogWarning("Ray binning is not supported with XR single-pass rendering!");
}
+ deferredParameters.globalCB = m_ShaderVariablesRayTracingCB;
+ deferredParameters.globalCB._RaytracingIntensityClamp = settings.clampValue.value;
+ deferredParameters.globalCB._RaytracingPreExposition = 1;
+ deferredParameters.globalCB._RaytracingDiffuseRay = 1;
+ deferredParameters.globalCB._RaytracingIncludeSky = 1;
+ deferredParameters.globalCB._RaytracingRayMaxLength = settings.rayLength.value;
+ deferredParameters.globalCB._RayTracingDiffuseLightingOnly = deferredParameters.diffuseLightingOnly ? 1 : 0;
+
return deferredParameters;
}
@@ -180,9 +181,6 @@ void RenderIndirectDiffusePerformance(HDCamera hdCamera, CommandBuffer cmd, Scri
cmd.SetComputeTextureParam(indirectDiffuseCS, currentKernel, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthStencilBuffer());
cmd.SetComputeTextureParam(indirectDiffuseCS, currentKernel, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
- // Bind all the required scalars
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingIntensityClamp, settings.clampValue.value);
-
// Bind the output buffers
cmd.SetComputeTextureParam(indirectDiffuseCS, currentKernel, HDShaderIDs._RaytracingDirectionBuffer, directionBuffer);
@@ -246,7 +244,7 @@ void RenderIndirectDiffusePerformance(HDCamera hdCamera, CommandBuffer cmd, Scri
void BindRayTracedIndirectDiffuseData(CommandBuffer cmd, HDCamera hdCamera
, RayTracingShader indirectDiffuseShader
- , GlobalIllumination settings, LightCluster lightClusterSettings, RayTracingSettings rtSettings
+ , GlobalIllumination settings, LightCluster lightClusterSettings
, RTHandle outputLightingBuffer, RTHandle outputHitPointBuffer)
{
// Grab the acceleration structures and the light cluster to use
@@ -263,36 +261,28 @@ void BindRayTracedIndirectDiffuseData(CommandBuffer cmd, HDCamera hdCamera
// Inject the ray-tracing sampling data
blueNoise.BindDitheredRNGData8SPP(cmd);
- // Inject the ray generation data
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rtSettings.rayBias.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayMaxLength, settings.rayLength.value);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, settings.sampleCount.value);
-
// Set the data for the ray generation
cmd.SetRayTracingTextureParam(indirectDiffuseShader, HDShaderIDs._IndirectDiffuseTextureRW, outputLightingBuffer);
cmd.SetRayTracingTextureParam(indirectDiffuseShader, HDShaderIDs._IndirectDiffuseHitPointTextureRW, outputHitPointBuffer);
cmd.SetRayTracingTextureParam(indirectDiffuseShader, HDShaderIDs._DepthTexture, m_SharedRTManager.GetDepthStencilBuffer());
cmd.SetRayTracingTextureParam(indirectDiffuseShader, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
- // Set the indirect diffuse parameters
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingIntensityClamp, settings.clampValue.value);
-
// Set ray count texture
RayCountManager rayCountManager = GetRayCountManager();
- cmd.SetGlobalInt(HDShaderIDs._RayCountEnabled, rayCountManager.RayCountIsEnabled());
cmd.SetRayTracingTextureParam(indirectDiffuseShader, HDShaderIDs._RayCountTexture, rayCountManager.GetRayCountTexture());
- // Compute the pixel spread value
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingPixelSpreadAngle, GetPixelSpreadAngle(hdCamera.camera.fieldOfView, hdCamera.actualWidth, hdCamera.actualHeight));
-
// LightLoop data
lightCluster.BindLightClusterData(cmd);
// Set the data for the ray miss
cmd.SetRayTracingTextureParam(indirectDiffuseShader, HDShaderIDs._SkyTexture, m_SkyManager.GetSkyReflection(hdCamera));
- // Set the number of bounces to 1
- cmd.SetGlobalInt(HDShaderIDs._RaytracingMaxRecursion, settings.bounceCount.value);
+ // Update global constant buffer
+ m_ShaderVariablesRayTracingCB._RaytracingRayMaxLength = settings.rayLength.value;
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = settings.sampleCount.value;
+ m_ShaderVariablesRayTracingCB._RaytracingIntensityClamp = settings.clampValue.value;
+ m_ShaderVariablesRayTracingCB._RaytracingMaxRecursion = settings.bounceCount.value;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
}
void RenderIndirectDiffuseQuality(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext renderContext, int frameCount)
@@ -300,7 +290,6 @@ void RenderIndirectDiffuseQuality(HDCamera hdCamera, CommandBuffer cmd, Scriptab
// First thing to check is: Do we have a valid ray-tracing environment?
GlobalIllumination giSettings = hdCamera.volumeStack.GetComponent();
LightCluster lightClusterSettings = hdCamera.volumeStack.GetComponent();
- RayTracingSettings rtSettings = hdCamera.volumeStack.GetComponent();
// Shaders that are used
RayTracingShader indirectDiffuseRT = m_Asset.renderPipelineRayTracingResources.indirectDiffuseRaytracingRT;
@@ -309,17 +298,19 @@ void RenderIndirectDiffuseQuality(HDCamera hdCamera, CommandBuffer cmd, Scriptab
RTHandle intermediateBuffer1 = GetRayTracingBuffer(InternalRayTracingBuffers.RGBA1);
// Bind all the parameters for ray tracing
- BindRayTracedIndirectDiffuseData(cmd, hdCamera, indirectDiffuseRT, giSettings, lightClusterSettings, rtSettings, m_IndirectDiffuseBuffer0, intermediateBuffer1);
+ BindRayTracedIndirectDiffuseData(cmd, hdCamera, indirectDiffuseRT, giSettings, lightClusterSettings, m_IndirectDiffuseBuffer0, intermediateBuffer1);
// Compute the actual resolution that is needed base on the quality
int widthResolution = hdCamera.actualWidth;
int heightResolution = hdCamera.actualHeight;
+
// Only use the shader variant that has multi bounce if the bounce count > 1
CoreUtils.SetKeyword(cmd, "MULTI_BOUNCE_INDIRECT", giSettings.bounceCount.value > 1);
// Run the computation
- cmd.SetGlobalInt(HDShaderIDs._RayTracingDiffuseLightingOnly, 1);
+ m_ShaderVariablesRayTracingCB._RayTracingDiffuseLightingOnly = 1;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
cmd.DispatchRays(indirectDiffuseRT, m_RayGenIndirectDiffuseIntegrationName, (uint)widthResolution, (uint)heightResolution, (uint)hdCamera.viewCount);
// Disable the keywords we do not need anymore
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs
index e7e1734040d..3f2bf953156 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs
@@ -449,11 +449,8 @@ void BuildLightCluster(HDCamera hdCamera, CommandBuffer cmd)
int lightClusterKernel = lightClusterCS.FindKernel(m_LightClusterKernelName);
// Inject all the parameters
- cmd.SetComputeBufferParam(lightClusterCS, lightClusterKernel, HDShaderIDs._RaytracingLightCluster, m_LightCluster);
- cmd.SetComputeVectorParam(lightClusterCS, HDShaderIDs._MinClusterPos, minClusterPos);
- cmd.SetComputeVectorParam(lightClusterCS, HDShaderIDs._MaxClusterPos, maxClusterPos);
+ cmd.SetComputeBufferParam(lightClusterCS, lightClusterKernel, HDShaderIDs._RaytracingLightClusterRW, m_LightCluster);
cmd.SetComputeVectorParam(lightClusterCS, _ClusterCellSize, clusterCellSize);
- cmd.SetComputeFloatParam(lightClusterCS, HDShaderIDs._LightPerCellCount, HDShadowUtils.Asfloat(numLightsPerCell));
cmd.SetComputeBufferParam(lightClusterCS, lightClusterKernel, _LightVolumes, m_LightVolumeGPUArray);
cmd.SetComputeFloatParam(lightClusterCS, _LightVolumeCount, HDShadowUtils.Asfloat(totalLightCount));
@@ -618,10 +615,7 @@ public void EvaluateClusterDebugView(CommandBuffer cmd, HDCamera hdCamera)
// Inject all the parameters to the debug compute
cmd.SetComputeBufferParam(lightClusterDebugCS, m_LightClusterDebugKernel, HDShaderIDs._RaytracingLightCluster, m_LightCluster);
- cmd.SetComputeVectorParam(lightClusterDebugCS, HDShaderIDs._MinClusterPos, minClusterPos);
- cmd.SetComputeVectorParam(lightClusterDebugCS, HDShaderIDs._MaxClusterPos, maxClusterPos);
cmd.SetComputeVectorParam(lightClusterDebugCS, _ClusterCellSize, clusterCellSize);
- cmd.SetComputeIntParam(lightClusterDebugCS, HDShaderIDs._LightPerCellCount, numLightsPerCell);
cmd.SetComputeTextureParam(lightClusterDebugCS, m_LightClusterDebugKernel, HDShaderIDs._CameraDepthTexture, m_RenderPipeline.sharedRTManager.GetDepthStencilBuffer());
// Target output texture
@@ -640,10 +634,7 @@ public void EvaluateClusterDebugView(CommandBuffer cmd, HDCamera hdCamera)
// Bind the parameters
m_DebugMaterialProperties.SetBuffer(HDShaderIDs._RaytracingLightCluster, m_LightCluster);
- m_DebugMaterialProperties.SetVector(HDShaderIDs._MinClusterPos, minClusterPos);
- m_DebugMaterialProperties.SetVector(HDShaderIDs._MaxClusterPos, maxClusterPos);
m_DebugMaterialProperties.SetVector(_ClusterCellSize, clusterCellSize);
- m_DebugMaterialProperties.SetInt(HDShaderIDs._LightPerCellCount, numLightsPerCell);
m_DebugMaterialProperties.SetTexture(HDShaderIDs._CameraDepthTexture, m_RenderPipeline.sharedRTManager.GetDepthTexture());
// Draw the faces
@@ -698,6 +689,11 @@ public int GetEnvLightCount()
return envLightCount;
}
+ public int GetLightPerCellCount()
+ {
+ return numLightsPerCell;
+ }
+
void InvalidateCluster()
{
// Invalidate the cluster's bounds so that we never access the buffer
@@ -735,7 +731,14 @@ public void CullForRayTracing(CommandBuffer cmd, HDCamera hdCamera, HDRayTracing
// Evaluate the volume of the cluster
EvaluateClusterVolume(hdCamera);
+ }
+ public void BuildLightClusterBuffer(CommandBuffer cmd, HDCamera hdCamera, HDRayTracingLights rayTracingLights)
+ {
+ // If there is no lights to process or no environment not the shader is missing
+ if (totalLightCount == 0 || rayTracingLights.lightCount == 0 || !m_RenderPipeline.GetRayTracingState())
+ return;
+
// Cull the lights within the evaluated cluster range
CullLights(cmd);
@@ -772,12 +775,6 @@ public void BindLightClusterData(CommandBuffer cmd)
cmd.SetGlobalBuffer(HDShaderIDs._RaytracingLightCluster, GetCluster());
cmd.SetGlobalBuffer(HDShaderIDs._LightDatasRT, GetLightDatas());
cmd.SetGlobalBuffer(HDShaderIDs._EnvLightDatasRT, GetEnvLightDatas());
- cmd.SetGlobalVector(HDShaderIDs._MinClusterPos, GetMinClusterPos());
- cmd.SetGlobalVector(HDShaderIDs._MaxClusterPos, GetMaxClusterPos());
- cmd.SetGlobalInt(HDShaderIDs._LightPerCellCount, numLightsPerCell);
- cmd.SetGlobalInt(HDShaderIDs._PunctualLightCountRT, GetPunctualLightCount());
- cmd.SetGlobalInt(HDShaderIDs._AreaLightCountRT, GetAreaLightCount());
- cmd.SetGlobalInt(HDShaderIDs._EnvLightCountRT, GetEnvLightCount());
}
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs
index 9e64dcc10cc..98d4d13b064 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs
@@ -110,6 +110,8 @@ public partial class HDRenderPipeline
RTHandle m_RayTracingIntermediateBufferRGBA3;
RTHandle m_RayTracingIntermediateBufferRGBA4;
+ ShaderVariablesRaytracingLightLoop m_ShaderVariablesRaytracingLightLoopCB = new ShaderVariablesRaytracingLightLoop();
+
internal void InitRayTracingManager()
{
// Init the ray count manager
@@ -538,7 +540,7 @@ internal int RayTracingFrameIndex(HDCamera hdCamera)
#endif
return hdCamera.IsTAAEnabled() ? hdCamera.taaFrameIndex : (int)m_FrameCount % 8;
}
-
+
internal bool RayTracingLightClusterRequired(HDCamera hdCamera)
{
ScreenSpaceReflection reflSettings = hdCamera.volumeStack.GetComponent();
@@ -547,10 +549,10 @@ internal bool RayTracingLightClusterRequired(HDCamera hdCamera)
PathTracing pathTracingSettings = hdCamera.volumeStack.GetComponent();
SubSurfaceScattering subSurface = hdCamera.volumeStack.GetComponent();
- return (m_ValidRayTracingState && (reflSettings.rayTracing.value
- || giSettings.rayTracing.value
- || recursiveSettings.enable.value
- || pathTracingSettings.enable.value
+ return (m_ValidRayTracingState && (reflSettings.rayTracing.value
+ || giSettings.rayTracing.value
+ || recursiveSettings.enable.value
+ || pathTracingSettings.enable.value
|| subSurface.rayTracing.value));
}
@@ -577,9 +579,25 @@ internal void BuildRayTracingLightData(CommandBuffer cmd, HDCamera hdCamera, Deb
{
m_RayTracingLightCluster.BuildRayTracingLightData(cmd, hdCamera, m_RayTracingLights, debugDisplaySettings);
m_ValidRayTracingCluster = true;
+
+ UpdateShaderVariablesRaytracingLightLoopCB(hdCamera, cmd);
+
+ m_RayTracingLightCluster.BuildLightClusterBuffer(cmd, hdCamera, m_RayTracingLights);
}
}
+ void UpdateShaderVariablesRaytracingLightLoopCB(HDCamera hdCamera, CommandBuffer cmd)
+ {
+ m_ShaderVariablesRaytracingLightLoopCB._MinClusterPos = m_RayTracingLightCluster.GetMinClusterPos();
+ m_ShaderVariablesRaytracingLightLoopCB._LightPerCellCount = (uint)m_RayTracingLightCluster.GetLightPerCellCount();
+ m_ShaderVariablesRaytracingLightLoopCB._MaxClusterPos = m_RayTracingLightCluster.GetMaxClusterPos();
+ m_ShaderVariablesRaytracingLightLoopCB._PunctualLightCountRT = (uint)m_RayTracingLightCluster.GetPunctualLightCount();
+ m_ShaderVariablesRaytracingLightLoopCB._AreaLightCountRT = (uint)m_RayTracingLightCluster.GetAreaLightCount();
+ m_ShaderVariablesRaytracingLightLoopCB._EnvLightCountRT = (uint)m_RayTracingLightCluster.GetEnvLightCount();
+
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRaytracingLightLoopCB, HDShaderIDs._ShaderVariablesRaytracingLightLoop);
+ }
+
internal RayTracingAccelerationStructure RequestAccelerationStructure()
{
if (m_ValidRayTracingState)
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs
index 95069654878..32d1f876c97 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingRecursiveRenderer.cs
@@ -77,14 +77,10 @@ void RaytracingRecursiveRender(HDCamera hdCamera, CommandBuffer cmd, ScriptableR
cmd.SetRayTracingTextureParam(forwardShader, HDShaderIDs._OwenScrambledTexture, m_Asset.renderPipelineResources.textures.owenScrambledRGBATex);
cmd.SetRayTracingTextureParam(forwardShader, HDShaderIDs._ScramblingTexture, m_Asset.renderPipelineResources.textures.scramblingTex);
- // Inject the ray generation data
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rtSettings.rayBias.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayMaxLength, recursiveSettings.rayLength.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingMaxRecursion, recursiveSettings.maxDepth.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingCameraNearPlane, hdCamera.camera.nearClipPlane);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionMinSmoothness, recursiveSettings.minSmoothness.value);
-
- // Set the data for the ray generation
+ // Update Global Constant Buffer.
+ m_ShaderVariablesRayTracingCB._RaytracingRayMaxLength = recursiveSettings.rayLength.value;
+ m_ShaderVariablesRayTracingCB._RaytracingMaxRecursion = recursiveSettings.maxDepth.value;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
// Fecth the temporary buffers we shall be using
RTHandle flagBuffer = GetRayTracingBuffer(InternalRayTracingBuffers.R0);
@@ -94,12 +90,8 @@ void RaytracingRecursiveRender(HDCamera hdCamera, CommandBuffer cmd, ScriptableR
// Set ray count texture
RayCountManager rayCountManager = GetRayCountManager();
- cmd.SetGlobalInt(HDShaderIDs._RayCountEnabled, rayCountManager.RayCountIsEnabled());
cmd.SetRayTracingTextureParam(forwardShader, HDShaderIDs._RayCountTexture, rayCountManager.GetRayCountTexture());
- // Compute an approximate pixel spread angle value (in radians)
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingPixelSpreadAngle, GetPixelSpreadAngle(hdCamera.camera.fieldOfView, hdCamera.actualWidth, hdCamera.actualHeight));
-
// LightLoop data
lightCluster.BindLightClusterData(cmd);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs
index 675731ceef5..b285371c2e8 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingReflection.cs
@@ -27,7 +27,7 @@ static RTHandle ReflectionHistoryBufferAllocatorFunction(string viewName, int fr
{
return rtHandleSystem.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R16G16B16A16_SFloat, dimension: TextureXR.dimension,
enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
- name: string.Format("ReflectionHistoryBuffer{0}", frameIndex));
+ name: string.Format("{0}_ReflectionHistoryBuffer{1}", viewName, frameIndex));
}
void ReleaseRayTracedReflections()
@@ -65,8 +65,8 @@ void RenderRayTracedReflections(HDCamera hdCamera, CommandBuffer cmd, RTHandle o
}
}
- void BindRayTracedReflectionData(CommandBuffer cmd, HDCamera hdCamera, RayTracingShader reflectionShader, ScreenSpaceReflection settings, LightCluster lightClusterSettings, RayTracingSettings rtSettings
- , RTHandle outputLightingBuffer, RTHandle outputHitPointBuffer)
+ void BindRayTracedReflectionData(CommandBuffer cmd, HDCamera hdCamera, RayTracingShader reflectionShader, ScreenSpaceReflection settings, LightCluster lightClusterSettings,
+ RTHandle outputLightingBuffer, RTHandle outputHitPointBuffer)
{
// Grab the acceleration structures and the light cluster to use
RayTracingAccelerationStructure accelerationStructure = RequestAccelerationStructure();
@@ -80,15 +80,14 @@ void BindRayTracedReflectionData(CommandBuffer cmd, HDCamera hdCamera, RayTracin
cmd.SetRayTracingAccelerationStructure(reflectionShader, HDShaderIDs._RaytracingAccelerationStructureName, accelerationStructure);
// Global reflection parameters
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingIntensityClamp, settings.clampValue.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionMinSmoothness, settings.minSmoothness.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionSmoothnessFadeStart, settings.smoothnessFadeStart.value);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingIncludeSky, settings.reflectSky.value ? 1 : 0);
-
+ m_ShaderVariablesRayTracingCB._RaytracingIntensityClamp = settings.clampValue.value;
+ m_ShaderVariablesRayTracingCB._RaytracingIncludeSky = settings.reflectSky.value ? 1 : 0;
// Inject the ray generation data
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayBias, rtSettings.rayBias.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingRayMaxLength, settings.rayLength.value);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingNumSamples, settings.sampleCount.value);
+ m_ShaderVariablesRayTracingCB._RaytracingRayMaxLength = settings.rayLength.value;
+ m_ShaderVariablesRayTracingCB._RaytracingNumSamples = settings.sampleCount.value;
+ // Set the number of bounces for reflections
+ m_ShaderVariablesRayTracingCB._RaytracingMaxRecursion = settings.bounceCount.value;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
// Inject the ray-tracing sampling data
blueNoise.BindDitheredRNGData8SPP(cmd);
@@ -103,12 +102,8 @@ void BindRayTracedReflectionData(CommandBuffer cmd, HDCamera hdCamera, RayTracin
// Set ray count tex
RayCountManager rayCountManager = GetRayCountManager();
- cmd.SetGlobalInt(HDShaderIDs._RayCountEnabled, rayCountManager.RayCountIsEnabled());
cmd.SetRayTracingTextureParam(reflectionShader, HDShaderIDs._RayCountTexture, rayCountManager.GetRayCountTexture());
- // Compute the pixel spread value
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingPixelSpreadAngle, GetPixelSpreadAngle(hdCamera.camera.fieldOfView, hdCamera.actualWidth, hdCamera.actualHeight));
-
// Bind the lightLoop data
lightCluster.BindLightClusterData(cmd);
@@ -119,9 +114,6 @@ void BindRayTracedReflectionData(CommandBuffer cmd, HDCamera hdCamera, RayTracin
RenderTargetIdentifier clearCoatMaskTexture = hdCamera.frameSettings.litShaderMode == LitShaderMode.Deferred ? m_GbufferManager.GetBuffersRTI()[2] : TextureXR.GetBlackTexture();
cmd.SetRayTracingTextureParam(reflectionShader, HDShaderIDs._SsrClearCoatMaskTexture, clearCoatMaskTexture);
- // Set the number of bounces for reflections
- cmd.SetGlobalInt(HDShaderIDs._RaytracingMaxRecursion, settings.bounceCount.value);
-
// Set the data for the ray miss
cmd.SetRayTracingTextureParam(reflectionShader, HDShaderIDs._SkyTexture, m_SkyManager.GetSkyReflection(hdCamera));
}
@@ -140,21 +132,14 @@ DeferredLightingRTParameters PrepareReflectionDeferredLightingRTParameters(HDCam
// Generic attributes
deferredParameters.rayBinning = true;
deferredParameters.layerMask.value = (int)RayTracingRendererFlag.Reflection;
- deferredParameters.rayBias = rTSettings.rayBias.value;
- deferredParameters.maxRayLength = settings.rayLength.value;
- deferredParameters.clampValue = settings.clampValue.value;
- deferredParameters.includeSky = settings.reflectSky.value;
deferredParameters.diffuseLightingOnly = false;
deferredParameters.halfResolution = !settings.fullResolution.value;
- deferredParameters.rayCountFlag = m_RayCountManager.RayCountIsEnabled();
deferredParameters.rayCountType = (int)RayCountValues.ReflectionDeferred;
- deferredParameters.preExpose = false;
// Camera data
deferredParameters.width = hdCamera.actualWidth;
deferredParameters.height = hdCamera.actualHeight;
deferredParameters.viewCount = hdCamera.viewCount;
- deferredParameters.fov = hdCamera.camera.fieldOfView;
// Compute buffers
deferredParameters.rayBinResult = m_RayBinResult;
@@ -174,6 +159,13 @@ DeferredLightingRTParameters PrepareReflectionDeferredLightingRTParameters(HDCam
Debug.LogWarning("Ray binning is not supported with XR single-pass rendering!");
}
+ deferredParameters.globalCB = m_ShaderVariablesRayTracingCB;
+ deferredParameters.globalCB._RaytracingRayMaxLength = settings.rayLength.value;
+ deferredParameters.globalCB._RaytracingIntensityClamp = settings.clampValue.value;
+ deferredParameters.globalCB._RaytracingIncludeSky = settings.reflectSky.value ? 1 : 0;
+ deferredParameters.globalCB._RaytracingPreExposition = 0;
+ deferredParameters.globalCB._RaytracingDiffuseRay = 0;
+
return deferredParameters;
}
@@ -228,9 +220,9 @@ void RenderReflectionsPerformance(HDCamera hdCamera, CommandBuffer cmd, RTHandle
cmd.SetComputeTextureParam(reflectionShaderCS, currentKernel, HDShaderIDs._StencilTexture, m_SharedRTManager.GetDepthStencilBuffer(), 0, RenderTextureSubElement.Stencil);
// Bind all the required scalars
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingIntensityClamp, settings.clampValue.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionMinSmoothness, settings.minSmoothness.value);
- cmd.SetGlobalInt(HDShaderIDs._RaytracingIncludeSky, settings.reflectSky.value ? 1 : 0);
+ m_ShaderVariablesRayTracingCB._RaytracingIntensityClamp = settings.clampValue.value;
+ m_ShaderVariablesRayTracingCB._RaytracingIncludeSky = settings.reflectSky.value ? 1 : 0;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
// Bind the output buffers
cmd.SetComputeTextureParam(reflectionShaderCS, currentKernel, HDShaderIDs._RaytracingDirectionBuffer, intermediateBuffer1);
@@ -278,8 +270,6 @@ void RenderReflectionsPerformance(HDCamera hdCamera, CommandBuffer cmd, RTHandle
cmd.SetComputeTextureParam(reflectionFilter, currentKernel, HDShaderIDs._ScramblingTexture, m_Asset.renderPipelineResources.textures.scramblingTex);
cmd.SetComputeIntParam(reflectionFilter, HDShaderIDs._SpatialFilterRadius, settings.upscaleRadius.value);
cmd.SetComputeIntParam(reflectionFilter, HDShaderIDs._RaytracingDenoiseRadius, settings.denoise.value ? settings.denoiserRadius.value : 0);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionMinSmoothness, settings.minSmoothness.value);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionSmoothnessFadeStart, settings.smoothnessFadeStart.value);
numTilesXHR = (texWidth + (areaTileSize - 1)) / areaTileSize;
numTilesYHR = (texHeight + (areaTileSize - 1)) / areaTileSize;
@@ -328,18 +318,18 @@ void RenderReflectionsQuality(HDCamera hdCamera, CommandBuffer cmd, RTHandle out
var settings = hdCamera.volumeStack.GetComponent();
LightCluster lightClusterSettings = hdCamera.volumeStack.GetComponent();
- RayTracingSettings rtSettings = hdCamera.volumeStack.GetComponent();
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.RaytracingIntegrateReflection)))
{
// Bind all the required data for ray tracing
- BindRayTracedReflectionData(cmd, hdCamera, reflectionShader, settings, lightClusterSettings, rtSettings, intermediateBuffer0, intermediateBuffer1);
+ BindRayTracedReflectionData(cmd, hdCamera, reflectionShader, settings, lightClusterSettings, intermediateBuffer0, intermediateBuffer1);
// Only use the shader variant that has multi bounce if the bounce count > 1
CoreUtils.SetKeyword(cmd, "MULTI_BOUNCE_INDIRECT", settings.bounceCount.value > 1);
// We are not in the diffuse only case
- cmd.SetGlobalInt(HDShaderIDs._RayTracingDiffuseLightingOnly, 0);
+ m_ShaderVariablesRayTracingCB._RayTracingDiffuseLightingOnly = 0;
+ ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesRayTracingCB, HDShaderIDs._ShaderVariablesRaytracing);
// Run the computation
cmd.DispatchRays(reflectionShader, transparent ? m_RayGenIntegrationTransparentName : m_RayGenIntegrationName, (uint)hdCamera.actualWidth, (uint)hdCamera.actualHeight, (uint)hdCamera.viewCount);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs
index b0cf11ec1a0..88192bfabdc 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs
@@ -75,7 +75,6 @@ public void DenoiseBuffer(CommandBuffer cmd, HDCamera hdCamera, int maxKernelSiz
cmd.SetComputeTextureParam(m_ReflectionDenoiserCS, s_BilateralFilterHKernel, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
cmd.SetComputeTextureParam(m_ReflectionDenoiserCS, s_BilateralFilterHKernel, HDShaderIDs._DenoiseOutputTextureRW, intermediateBuffer1);
cmd.SetComputeTextureParam(m_ReflectionDenoiserCS, s_BilateralFilterHKernel, HDShaderIDs._ReflectionFilterMapping, m_ReflectionFilterMapping);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionMinSmoothness, settings.minSmoothness.value);
cmd.DispatchCompute(m_ReflectionDenoiserCS, s_BilateralFilterHKernel, numTilesX, numTilesY, hdCamera.viewCount);
// Horizontal pass of the bilateral filter
@@ -85,7 +84,6 @@ public void DenoiseBuffer(CommandBuffer cmd, HDCamera hdCamera, int maxKernelSiz
cmd.SetComputeTextureParam(m_ReflectionDenoiserCS, s_BilateralFilterVKernel, HDShaderIDs._NormalBufferTexture, m_SharedRTManager.GetNormalBuffer());
cmd.SetComputeTextureParam(m_ReflectionDenoiserCS, s_BilateralFilterVKernel, HDShaderIDs._DenoiseOutputTextureRW, outputSignal);
cmd.SetComputeTextureParam(m_ReflectionDenoiserCS, s_BilateralFilterVKernel, HDShaderIDs._ReflectionFilterMapping, m_ReflectionFilterMapping);
- cmd.SetGlobalFloat(HDShaderIDs._RaytracingReflectionMinSmoothness, settings.minSmoothness.value);
cmd.DispatchCompute(m_ReflectionDenoiserCS, s_BilateralFilterVKernel, numTilesX, numTilesY, hdCamera.viewCount);
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute
index e1529dabe20..a1a1bf1e5c2 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingLightCluster.compute
@@ -5,8 +5,9 @@
// SRP & HDRP includes
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
-#include "Packages/com.unity.render-pipelines.high-definition\Runtime\ShaderLibrary\ShaderVariables.hlsl"
-#include "Packages/com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\Raytracing/HDRaytracingLightCluster.cs.hlsl"
+#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
+#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs.hlsl"
+#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl"
#define CLUSTER_GROUP_SIZE 8
@@ -15,11 +16,8 @@ StructuredBuffer _LightVolumes;
uint _LightVolumeCount;
// The target data that this computer shader must fill
-RWStructuredBuffer _RaytracingLightCluster;
-float3 _MinClusterPos;
-float3 _MaxClusterPos;
+RWStructuredBuffer _RaytracingLightClusterRW;
float3 _ClusterCellSize;
-uint _LightPerCellCount;
static const float3 CornerSubDirections[8] = {
float3(-0.5f, -0.5f, -0.5f),
@@ -123,7 +121,7 @@ void RaytracingLightCluster(uint3 threadID : SV_GroupThreadID, uint3 groupId : S
if(intersects)
{
// Flag this light in this cell and increase the light count
- _RaytracingLightCluster[cellIndex * cellDataSize + 4 + currentLightCount] = currentLight.lightIndex;
+ _RaytracingLightClusterRW[cellIndex * cellDataSize + 4 + currentLightCount] = currentLight.lightIndex;
currentLightCount++;
// Also increase the matching light count
@@ -143,10 +141,10 @@ void RaytracingLightCluster(uint3 threadID : SV_GroupThreadID, uint3 groupId : S
}
// Set the light count for the cell
- _RaytracingLightCluster[cellIndex * cellDataSize] = currentLightCount;
- _RaytracingLightCluster[cellIndex * cellDataSize + 1] = punctualLightCount;
- _RaytracingLightCluster[cellIndex * cellDataSize + 2] = punctualLightCount + areaLightCount;
- _RaytracingLightCluster[cellIndex * cellDataSize + 3] = areaLightCount + punctualLightCount + envLightCount;
+ _RaytracingLightClusterRW[cellIndex * cellDataSize] = currentLightCount;
+ _RaytracingLightClusterRW[cellIndex * cellDataSize + 1] = punctualLightCount;
+ _RaytracingLightClusterRW[cellIndex * cellDataSize + 2] = punctualLightCount + areaLightCount;
+ _RaytracingLightClusterRW[cellIndex * cellDataSize + 3] = areaLightCount + punctualLightCount + envLightCount;
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs
new file mode 100644
index 00000000000..1dd95d2a89b
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs
@@ -0,0 +1,36 @@
+namespace UnityEngine.Rendering.HighDefinition
+{
+ [GenerateHLSL(needAccessors = false, generateCBuffer = true, constantRegister = (int)ConstantRegister.RayTracing)]
+ unsafe struct ShaderVariablesRaytracing
+ {
+ // Global ray bias used for all trace rays
+ public float _RaytracingRayBias;
+ // Maximal ray length for trace ray (in case an other one does not override it)
+ public float _RaytracingRayMaxLength;
+ // Number of samples that will be used to evaluate an effect
+ public int _RaytracingNumSamples;
+ // Index of the current sample
+ public int _RaytracingSampleIndex;
+ // Value used to clamp the intensity of the signal to reduce the signal/noise ratio
+ public float _RaytracingIntensityClamp;
+ // Flag that tracks if ray counting is enabled
+ public int _RayCountEnabled;
+ // Flag that tracks if a ray traced signal should be pre-exposed
+ public int _RaytracingPreExposition;
+ // Near plane distance of the camera used for ray tracing
+ public float _RaytracingCameraNearPlane;
+ // Angle of a pixel (used for texture filtering)
+ public float _RaytracingPixelSpreadAngle;
+ // Flag that tracks if only diffuse lighting should be computed
+ public uint _RaytracingDiffuseRay;
+ // Ray traced reflection Data
+ public float _RaytracingReflectionMinSmoothness;
+ public float _RaytracingReflectionSmoothnessFadeStart;
+ public int _RaytracingIncludeSky;
+ // Path tracing parameters
+ public int _RaytracingMinRecursion;
+ public int _RaytracingMaxRecursion;
+ // Ray traced indirect diffuse data
+ public int _RayTracingDiffuseLightingOnly;
+ }
+}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.hlsl
new file mode 100644
index 00000000000..0d4fd6a86a1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.hlsl
@@ -0,0 +1,29 @@
+//
+// This file was automatically generated. Please don't edit by hand.
+//
+
+#ifndef SHADERVARIABLESRAYTRACING_CS_HLSL
+#define SHADERVARIABLESRAYTRACING_CS_HLSL
+// Generated from UnityEngine.Rendering.HighDefinition.ShaderVariablesRaytracing
+// PackingRules = Exact
+GLOBAL_CBUFFER_START(ShaderVariablesRaytracing, b3)
+ float _RaytracingRayBias;
+ float _RaytracingRayMaxLength;
+ int _RaytracingNumSamples;
+ int _RaytracingSampleIndex;
+ float _RaytracingIntensityClamp;
+ int _RayCountEnabled;
+ int _RaytracingPreExposition;
+ float _RaytracingCameraNearPlane;
+ float _RaytracingPixelSpreadAngle;
+ uint _RaytracingDiffuseRay;
+ float _RaytracingReflectionMinSmoothness;
+ float _RaytracingReflectionSmoothnessFadeStart;
+ int _RaytracingIncludeSky;
+ int _RaytracingMinRecursion;
+ int _RaytracingMaxRecursion;
+ int _RayTracingDiffuseLightingOnly;
+CBUFFER_END
+
+
+#endif
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.hlsl.meta b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.hlsl.meta
new file mode 100644
index 00000000000..00fcd01f23d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.hlsl.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 97464d610af37e74bac6dd66d1532218
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.meta
new file mode 100644
index 00000000000..0ce94c1a611
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2103ac3cc7c4e9b429bc457a4bf0f8db
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl
index 77731365d6f..9ff1710085d 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.hlsl
@@ -1,42 +1,10 @@
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRayTracingManager.cs.hlsl"
+#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracing.cs.hlsl"
// The target acceleration acceleration structure should only be defined for non compute shaders
#ifndef SHADER_STAGE_COMPUTE
GLOBAL_RESOURCE(RaytracingAccelerationStructure, _RaytracingAccelerationStructure, RAY_TRACING_ACCELERATION_STRUCTURE_REGISTER);
#endif
-GLOBAL_CBUFFER_START(UnityRayTracingGlobals, UNITY_RAY_TRACING_GLOBAL_CBUFFER_REGISTER)
- // Global ray bias used for all trace rays
- float _RaytracingRayBias;
- // Maximal ray length for trace ray (in case an other one does not override it)
- float _RaytracingRayMaxLength;
- // Number of samples that will be used to evaluate an effect
- int _RaytracingNumSamples;
- // Index of the current sample
- int _RaytracingSampleIndex;
- // Value used to clamp the intensity of the signal to reduce the signal/noise ratio
- float _RaytracingIntensityClamp;
- // Flag that tracks if ray counting is enabled
- int _RayCountEnabled;
- // Flag that tracks if a ray traced signal should be pre-exposed
- int _RaytracingPreExposition;
- // Near plane distance of the camera used for ray tracing
- float _RaytracingCameraNearPlane;
- // Angle of a pixel (used for texture filtering)
- float _RaytracingPixelSpreadAngle;
- // Flag that tracks if only diffuse lighting should be computed
- uint _RaytracingDiffuseRay;
- // Ray traced reflection Data
- float _RaytracingReflectionMaxDistance;
- float _RaytracingReflectionMinSmoothness;
- float _RaytracingReflectionSmoothnessFadeStart;
- int _RaytracingIncludeSky;
- // Path tracing parameters
- int _RaytracingMinRecursion;
- int _RaytracingMaxRecursion;
- // Ray traced indirect diffuse data
- int _RayTracingDiffuseLightingOnly;
-CBUFFER_END
-
RW_TEXTURE2D_ARRAY(uint, _RayCountTexture);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs
new file mode 100644
index 00000000000..0da49a3a9a0
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs
@@ -0,0 +1,13 @@
+namespace UnityEngine.Rendering.HighDefinition
+{
+ [GenerateHLSL(needAccessors = false, generateCBuffer = true, constantRegister = (int)ConstantRegister.RayTracingLightLoop)]
+ unsafe struct ShaderVariablesRaytracingLightLoop
+ {
+ public Vector3 _MinClusterPos;
+ public uint _LightPerCellCount;
+ public Vector3 _MaxClusterPos;
+ public uint _PunctualLightCountRT;
+ public uint _AreaLightCountRT;
+ public uint _EnvLightCountRT;
+ }
+}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.hlsl
new file mode 100644
index 00000000000..fb1a76af2f1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.hlsl
@@ -0,0 +1,19 @@
+//
+// This file was automatically generated. Please don't edit by hand.
+//
+
+#ifndef SHADERVARIABLESRAYTRACINGLIGHTLOOP_CS_HLSL
+#define SHADERVARIABLESRAYTRACINGLIGHTLOOP_CS_HLSL
+// Generated from UnityEngine.Rendering.HighDefinition.ShaderVariablesRaytracingLightLoop
+// PackingRules = Exact
+GLOBAL_CBUFFER_START(ShaderVariablesRaytracingLightLoop, b4)
+ float3 _MinClusterPos;
+ uint _LightPerCellCount;
+ float3 _MaxClusterPos;
+ uint _PunctualLightCountRT;
+ uint _AreaLightCountRT;
+ uint _EnvLightCountRT;
+CBUFFER_END
+
+
+#endif
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.hlsl.meta b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.hlsl.meta
new file mode 100644
index 00000000000..6e113a6d916
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.hlsl.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 6406914af4a2b9a42ae731cf46f90a89
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.meta
new file mode 100644
index 00000000000..bef77758c46
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 9ecef279876c4f94caa6c8bde9d8e297
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl
index d7ba4435888..07c117c3dc0 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.hlsl
@@ -1,19 +1,10 @@
#ifndef UNITY_SHADER_VARIABLES_RAY_TRACING_LIGHT_LOOP_INCLUDED
#define UNITY_SHADER_VARIABLES_RAY_TRACING_LIGHT_LOOP_INCLUDED
-#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.hlsl"
+#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/ShaderVariablesRaytracingLightLoop.cs.hlsl"
-GLOBAL_RESOURCE(StructuredBuffer, _RaytracingLightCluster, RAY_TRACING_LIGHT_CLUSTER_REGISTER);
+GLOBAL_RESOURCE(StructuredBuffer, _RaytracingLightCluster, RAY_TRACING_LIGHT_CLUSTER_REGISTER);
GLOBAL_RESOURCE(StructuredBuffer, _LightDatasRT, RAY_TRACING_LIGHT_DATA_REGISTER);
GLOBAL_RESOURCE(StructuredBuffer, _EnvLightDatasRT, RAY_TRACING_ENV_LIGHT_DATA_REGISTER);
-GLOBAL_CBUFFER_START(UnityRayTracingLightLoop, UNITY_RAY_TRACING_LIGHT_LOOP_CBUFFER_REGISTER)
- uint _LightPerCellCount;
- float3 _MinClusterPos;
- float3 _MaxClusterPos;
- uint _PunctualLightCountRT;
- uint _AreaLightCountRT;
- uint _EnvLightCountRT;
-CBUFFER_END
-
-#endif // UNITY_SHADER_VARIABLES_RAY_TRACING_LIGHT_LOOP_INCLUDED
\ No newline at end of file
+#endif // UNITY_SHADER_VARIABLES_RAY_TRACING_LIGHT_LOOP_INCLUDED
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs
index 8c9de63e61f..cd01e8d37c3 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPass.cs
@@ -1,6 +1,4 @@
using System.Collections.Generic;
-using UnityEngine.Rendering;
-using UnityEngine.Experimental.Rendering;
using System;
using UnityEngine.Serialization;
@@ -68,6 +66,8 @@ internal ProfilingSampler profilingSampler
SharedRTManager currentRTManager;
HDCamera currentHDCamera;
+ MaterialPropertyBlock userMaterialPropertyBlock;
+
///
/// Mirror of the value in the CustomPassVolume where this custom pass is listed
///
@@ -172,12 +172,25 @@ internal void ExecuteInternal(ScriptableRenderContext renderContext, CommandBuff
{
Setup(renderContext, cmd);
isSetup = true;
+ userMaterialPropertyBlock = new MaterialPropertyBlock();
}
SetCustomPassTarget(cmd);
+ // Create the custom pass context:
+ bool msaa = IsMSAAEnabled(hdCamera);
+ CustomPassContext ctx = new CustomPassContext(
+ renderContext, cmd, hdCamera,
+ cullingResult, msaa ? targets.cameraColorMSAABuffer : targets.cameraColorBuffer,
+ rtManager.GetDepthStencilBuffer(msaa),
+ rtManager.GetNormalBuffer(msaa),
+ targets.customColorBuffer,
+ targets.customDepthBuffer,
+ userMaterialPropertyBlock
+ );
+
isExecuting = true;
- Execute(renderContext, cmd, hdCamera, cullingResult);
+ Execute(ctx);
isExecuting = false;
// Set back the camera color buffer if we were using a custom buffer as target
@@ -249,14 +262,27 @@ protected virtual void AggregateCullingParameters(ref ScriptableCullingParameter
///
///
///
- protected abstract void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult);
+ [Obsolete("This Execute signature is obsolete and will be removed in the future. Please use Execute(CustomPassContext) instead")]
+ protected virtual void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult) {}
+
+ ///
+ /// Called when your pass needs to be executed by a camera
+ ///
+ /// The context of the custom pass. Contains command buffer, render context, buffer, etc.
+ // TODO: move this function to abstract when we remove the method above
+ protected virtual void Execute(CustomPassContext ctx)
+ {
+#pragma warning disable CS0618 // Member is obsolete
+ Execute(ctx.renderContext, ctx.cmd, ctx.hdCamera, ctx.cullingResults);
+#pragma warning restore CS0618
+ }
///
/// Called before the first execution of the pass occurs.
/// Allow you to allocate custom buffers.
///
- ///
- ///
+ /// The render context
+ /// Current command buffer of the frame
protected virtual void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) {}
///
@@ -271,6 +297,7 @@ protected virtual void Cleanup() {}
///
/// if true we bind the camera depth buffer in addition to the color
///
+ [Obsolete("Use directly CoreUtils.SetRenderTarget with the render target of your choice.")]
protected void SetCameraRenderTarget(CommandBuffer cmd, bool bindDepth = true, ClearFlag clearFlags = ClearFlag.None)
{
if (!isExecuting)
@@ -288,6 +315,7 @@ protected void SetCameraRenderTarget(CommandBuffer cmd, bool bindDepth = true, C
///
/// if true we bind the custom depth buffer in addition to the color
///
+ [Obsolete("Use directly CoreUtils.SetRenderTarget with the render target of your choice.")]
protected void SetCustomRenderTarget(CommandBuffer cmd, bool bindDepth = true, ClearFlag clearFlags = ClearFlag.None)
{
if (!isExecuting)
@@ -326,6 +354,7 @@ protected void ResolveMSAAColorBuffer(CommandBuffer cmd, HDCamera hdCamera)
///
/// outputs the camera color buffer
/// outputs the camera depth buffer
+ [Obsolete("GetCameraBuffers is obsolete and will be removed in the future. All camera buffers are now avaliable directly in the CustomPassContext in parameter of the Execute function")]
protected void GetCameraBuffers(out RTHandle colorBuffer, out RTHandle depthBuffer)
{
if (!isExecuting)
@@ -341,6 +370,7 @@ protected void GetCameraBuffers(out RTHandle colorBuffer, out RTHandle depthBuff
///
/// outputs the custom color buffer
/// outputs the custom depth buffer
+ [Obsolete("GetCustomBuffers is obsolete and will be removed in the future. All custom buffers are now avaliable directly in the CustomPassContext in parameter of the Execute function")]
protected void GetCustomBuffers(out RTHandle colorBuffer, out RTHandle depthBuffer)
{
if (!isExecuting)
@@ -354,6 +384,7 @@ protected void GetCustomBuffers(out RTHandle colorBuffer, out RTHandle depthBuff
/// Get the current normal buffer (can be MSAA)
///
///
+ [Obsolete("GetNormalBuffer is obsolete and will be removed in the future. Normal buffer is now avaliable directly in the CustomPassContext in parameter of the Execute function")]
protected RTHandle GetNormalBuffer()
{
if (!isExecuting)
@@ -375,27 +406,7 @@ protected RTHandle GetNormalBuffer()
/// The custom pass render queue type.
/// Returns a render queue range compatible with a ScriptableRenderContext.DrawRenderers.
protected RenderQueueRange GetRenderQueueRange(CustomPass.RenderQueueType type)
- => GetRenderQueueRangeFromRenderQueueType(type);
-
- internal static RenderQueueRange GetRenderQueueRangeFromRenderQueueType(RenderQueueType type)
- {
- switch (type)
- {
- case CustomPass.RenderQueueType.OpaqueNoAlphaTest: return HDRenderQueue.k_RenderQueue_OpaqueNoAlphaTest;
- case CustomPass.RenderQueueType.OpaqueAlphaTest: return HDRenderQueue.k_RenderQueue_OpaqueAlphaTest;
- case CustomPass.RenderQueueType.AllOpaque: return HDRenderQueue.k_RenderQueue_AllOpaque;
- case CustomPass.RenderQueueType.AfterPostProcessOpaque: return HDRenderQueue.k_RenderQueue_AfterPostProcessOpaque;
- case CustomPass.RenderQueueType.PreRefraction: return HDRenderQueue.k_RenderQueue_PreRefraction;
- case CustomPass.RenderQueueType.Transparent: return HDRenderQueue.k_RenderQueue_Transparent;
- case CustomPass.RenderQueueType.LowTransparent: return HDRenderQueue.k_RenderQueue_LowTransparent;
- case CustomPass.RenderQueueType.AllTransparent: return HDRenderQueue.k_RenderQueue_AllTransparent;
- case CustomPass.RenderQueueType.AllTransparentWithLowRes: return HDRenderQueue.k_RenderQueue_AllTransparentWithLowRes;
- case CustomPass.RenderQueueType.AfterPostProcessTransparent: return HDRenderQueue.k_RenderQueue_AfterPostProcessTransparent;
- case CustomPass.RenderQueueType.All:
- default:
- return HDRenderQueue.k_RenderQueue_All;
- }
- }
+ => CustomPassUtils.GetRenderQueueRangeFromRenderQueueType(type);
///
/// Create a custom pass to execute a fullscreen pass
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassContext.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassContext.cs
new file mode 100644
index 00000000000..34e97601f4c
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassContext.cs
@@ -0,0 +1,79 @@
+using System;
+
+namespace UnityEngine.Rendering.HighDefinition
+{
+ ///
+ /// Context used when executing custom passes
+ ///
+ public struct CustomPassContext
+ {
+ ///
+ /// Scriptable Render Context, used for any SRP related operations.
+ ///
+ public readonly ScriptableRenderContext renderContext;
+
+ ///
+ /// Command Buffer, used to enqueue graphic commands to the GPU.
+ ///
+ public readonly CommandBuffer cmd;
+
+ ///
+ /// HdCamera, HDRP data related to the rendering camera. Use the camera property to access the Camera class.
+ ///
+ public readonly HDCamera hdCamera;
+
+ ///
+ /// Result of the culling either of the camera or the custom pass if AggregateCullingParameters is used.
+ ///
+ public readonly CullingResults cullingResults;
+
+ ///
+ /// Camera color buffer.
+ ///
+ public readonly RTHandle cameraColorBuffer;
+
+ ///
+ /// Camera depth buffer.
+ ///
+ public readonly RTHandle cameraDepthBuffer;
+
+ ///
+ /// Camera normal buffer.
+ ///
+ public readonly RTHandle cameraNormalBuffer;
+
+ ///
+ /// Lazy handle to the custom color buffer, not allocated if not used.
+ ///
+ public readonly Lazy customColorBuffer;
+
+ ///
+ /// Lazy handle to the custom depth buffer, not allocated if not used.
+ ///
+ public readonly Lazy customDepthBuffer;
+
+ ///
+ /// Material Property Block, unique for each custom pass instance.
+ ///
+ public readonly MaterialPropertyBlock propertyBlock;
+
+ internal CustomPassContext(
+ ScriptableRenderContext renderContext, CommandBuffer cmd,
+ HDCamera hdCamera, CullingResults cullingResults,
+ RTHandle cameraColorBuffer, RTHandle cameraDepthBuffer,
+ RTHandle cameraNormalBuffer, Lazy customColorBuffer,
+ Lazy customDepthBuffer, MaterialPropertyBlock propertyBlock)
+ {
+ this.renderContext = renderContext;
+ this.cmd = cmd;
+ this.hdCamera = hdCamera;
+ this.cullingResults = cullingResults;
+ this.cameraColorBuffer = cameraColorBuffer;
+ this.cameraDepthBuffer = cameraDepthBuffer;
+ this.customColorBuffer = customColorBuffer;
+ this.cameraNormalBuffer = cameraNormalBuffer;
+ this.customDepthBuffer = customDepthBuffer;
+ this.propertyBlock = propertyBlock;
+ }
+ }
+}
\ No newline at end of file
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassContext.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassContext.cs.meta
new file mode 100644
index 00000000000..c5815717ec9
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassContext.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: bb1cfe339cbc2ac47bd24e22cc1cd976
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs
new file mode 100644
index 00000000000..daa9a404890
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs
@@ -0,0 +1,398 @@
+using System;
+using UnityEngine.Rendering;
+using UnityEngine.Experimental.Rendering;
+using System.Collections.Generic;
+
+namespace UnityEngine.Rendering.HighDefinition
+{
+ ///
+ /// A set of custom pass utility function to help you build your effects
+ ///
+ public static class CustomPassUtils
+ {
+ ///
+ /// Fullscreen scale and bias values, it is the default for functions that have scale and bias overloads.
+ ///
+ /// x: scaleX, y: scaleY, z: biasX, w: biasY
+ public static Vector4 fullScreenScaleBias = new Vector4(1, 1, 0, 0);
+
+ static ShaderTagId[] litForwardTags = { HDShaderPassNames.s_ForwardOnlyName, HDShaderPassNames.s_ForwardName, HDShaderPassNames.s_SRPDefaultUnlitName };
+ static ShaderTagId[] depthTags = { HDShaderPassNames.s_DepthForwardOnlyName, HDShaderPassNames.s_DepthOnlyName };
+
+ static ProfilingSampler downSampleSampler = new ProfilingSampler("DownSample");
+ static ProfilingSampler verticalBlurSampler = new ProfilingSampler("Vertical Blur");
+ static ProfilingSampler horizontalBlurSampler = new ProfilingSampler("Horizontal Blur");
+ static ProfilingSampler gaussianblurSampler = new ProfilingSampler("Gaussian Blur");
+ static ProfilingSampler copySampler = new ProfilingSampler("Copy");
+
+ static MaterialPropertyBlock propertyBlock = new MaterialPropertyBlock();
+ static Material customPassUtilsMaterial;
+
+ static Dictionary gaussianWeightsCache = new Dictionary();
+
+ static int downSamplePassIndex;
+ static int verticalBlurPassIndex;
+ static int horizontalBlurPassIndex;
+ static int copyPassIndex;
+
+ internal static void Initialize()
+ {
+ customPassUtilsMaterial = CoreUtils.CreateEngineMaterial(HDRenderPipeline.defaultAsset.renderPipelineResources.shaders.customPassUtils);
+ downSamplePassIndex = customPassUtilsMaterial.FindPass("Downsample");
+ verticalBlurPassIndex = customPassUtilsMaterial.FindPass("VerticalBlur");
+ horizontalBlurPassIndex = customPassUtilsMaterial.FindPass("HorizontalBlur");
+ copyPassIndex = customPassUtilsMaterial.FindPass("Copy");
+ }
+
+ ///
+ /// Convert the source buffer to an half resolution buffer and output it to the destination buffer.
+ ///
+ /// Custom Pass Context
+ ///
+ ///
+ ///
+ ///
+ public static void DownSample(in CustomPassContext ctx, RTHandle source, RTHandle destination, int sourceMip = 0, int destMip = 0)
+ => DownSample(ctx, source, destination, fullScreenScaleBias, fullScreenScaleBias, sourceMip, destMip);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Scale and bias to apply when sampling the source buffer
+ /// Scale and bias to apply when writing into the destination buffer. It's scale is relative to the destination buffer, so if you want an half res downsampling into a fullres buffer you need to specify a scale of 0.5;0,5. If your buffer is already half res Then 1;1 scale works.
+ ///
+ ///
+ public static void DownSample(in CustomPassContext ctx, RTHandle source, RTHandle destination, Vector4 sourceScaleBias, Vector4 destScaleBias, int sourceMip = 0, int destMip = 0)
+ {
+ // Check if the texture provided is at least half of the size of source.
+ if (destination.rt.width < source.rt.width / 2 || destination.rt.height < source.rt.height / 2)
+ Debug.LogError("Destination for DownSample is too small, it needs to be at least half as big as source.");
+
+ using (new ProfilingScope(ctx.cmd, downSampleSampler))
+ {
+ SetRenderTargetWithScaleBias(ctx, propertyBlock, destination, destScaleBias, ClearFlag.None, destMip);
+
+ propertyBlock.SetTexture(HDShaderIDs._Source, source);
+ propertyBlock.SetVector(HDShaderIDs._SourceScaleBias, sourceScaleBias);
+ SetSourceSize(propertyBlock, source);
+ ctx.cmd.DrawProcedural(Matrix4x4.identity, customPassUtilsMaterial, downSamplePassIndex, MeshTopology.Quads, 4, 1, propertyBlock);
+ }
+ }
+
+ // Do we provide an upsample function ?
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void Copy(in CustomPassContext ctx, RTHandle source, RTHandle destination, int sourceMip = 0, int destMip = 0)
+ => Copy(ctx, source, destination, fullScreenScaleBias, fullScreenScaleBias, sourceMip, destMip);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void Copy(in CustomPassContext ctx, RTHandle source, RTHandle destination, Vector4 sourceScaleBias, Vector4 destScaleBias, int sourceMip = 0, int destMip = 0)
+ {
+ if (source == destination)
+ Debug.LogError("Can't copy the buffer. Source has to be different from the destination.");
+
+ using (new ProfilingScope(ctx.cmd, copySampler))
+ {
+ SetRenderTargetWithScaleBias(ctx, propertyBlock, destination, destScaleBias, ClearFlag.None, destMip);
+
+ propertyBlock.SetTexture(HDShaderIDs._Source, source);
+ propertyBlock.SetVector(HDShaderIDs._SourceScaleBias, sourceScaleBias);
+ SetSourceSize(propertyBlock, source);
+ ctx.cmd.DrawProcedural(Matrix4x4.identity, customPassUtilsMaterial, copyPassIndex, MeshTopology.Quads, 4, 1, propertyBlock);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void VerticalGaussianBlur(in CustomPassContext ctx, RTHandle source, RTHandle destination, int sampleCount = 8, float radius = 5, int sourceMip = 0, int destMip = 0)
+ => VerticalGaussianBlur(ctx, source, destination, fullScreenScaleBias, fullScreenScaleBias, sampleCount, radius, sourceMip, destMip);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void VerticalGaussianBlur(in CustomPassContext ctx, RTHandle source, RTHandle destination, Vector4 sourceScaleBias, Vector4 destScaleBias, int sampleCount = 8, float radius = 5, int sourceMip = 0, int destMip = 0)
+ {
+ if (source == destination)
+ Debug.LogError("Can't blur the buffer. Source has to be different from the destination.");
+
+ using (new ProfilingScope(ctx.cmd, verticalBlurSampler))
+ {
+ SetRenderTargetWithScaleBias(ctx, propertyBlock, destination, destScaleBias, ClearFlag.None, destMip);
+
+ propertyBlock.SetTexture(HDShaderIDs._Source, source);
+ propertyBlock.SetVector(HDShaderIDs._SourceScaleBias, sourceScaleBias);
+ propertyBlock.SetBuffer(HDShaderIDs._GaussianWeights, GetGaussianWeights(sampleCount));
+ propertyBlock.SetFloat(HDShaderIDs._SampleCount, sampleCount);
+ propertyBlock.SetFloat(HDShaderIDs._Radius, radius);
+ SetSourceSize(propertyBlock, source);
+ ctx.cmd.DrawProcedural(Matrix4x4.identity, customPassUtilsMaterial, verticalBlurPassIndex, MeshTopology.Quads, 4, 1, propertyBlock);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void HorizontalGaussianBlur(in CustomPassContext ctx, RTHandle source, RTHandle destination, int sampleCount = 8, float radius = 5, int sourceMip = 0, int destMip = 0)
+ => HorizontalGaussianBlur(ctx, source, destination, fullScreenScaleBias, fullScreenScaleBias, sampleCount, radius, sourceMip, destMip);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void HorizontalGaussianBlur(in CustomPassContext ctx, RTHandle source, RTHandle destination, Vector4 sourceScaleBias, Vector4 destScaleBias, int sampleCount = 8, float radius = 5, int sourceMip = 0, int destMip = 0)
+ {
+ if (source == destination)
+ Debug.LogError("Can't blur the buffer. Source has to be different from the destination.");
+
+ using (new ProfilingScope(ctx.cmd, horizontalBlurSampler))
+ {
+ SetRenderTargetWithScaleBias(ctx, propertyBlock, destination, destScaleBias, ClearFlag.None, destMip);
+
+ propertyBlock.SetTexture(HDShaderIDs._Source, source);
+ propertyBlock.SetVector(HDShaderIDs._SourceScaleBias, sourceScaleBias);
+ propertyBlock.SetBuffer(HDShaderIDs._GaussianWeights, GetGaussianWeights(sampleCount));
+ propertyBlock.SetFloat(HDShaderIDs._SampleCount, sampleCount);
+ propertyBlock.SetFloat(HDShaderIDs._Radius, radius);
+ SetSourceSize(propertyBlock, source);
+ ctx.cmd.DrawProcedural(Matrix4x4.identity, customPassUtilsMaterial, horizontalBlurPassIndex, MeshTopology.Quads, 4, 1, propertyBlock);
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void GaussianBlur(in CustomPassContext ctx, RTHandle source, RTHandle destination, RTHandle tempTarget, int sampleCount = 9, float radius = 5, int sourceMip = 0, int destMip = 0, bool downSample = true)
+ => GaussianBlur(ctx, source, destination, tempTarget, fullScreenScaleBias, fullScreenScaleBias, sampleCount, radius, sourceMip, destMip, downSample);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void GaussianBlur(in CustomPassContext ctx, RTHandle source, RTHandle destination, RTHandle tempTarget, Vector4 sourceScaleBias, Vector4 destScaleBias, int sampleCount = 9, float radius = 5, int sourceMip = 0, int destMip = 0, bool downSample = true)
+ {
+ if (source == tempTarget || destination == tempTarget)
+ Debug.LogError("Can't blur the buffer. tempTarget has to be different from both source or destination.");
+ if (tempTarget.scaleFactor.x != tempTarget.scaleFactor.y || (tempTarget.scaleFactor.x != 0.5f && tempTarget.scaleFactor.x != 1.0f))
+ Debug.LogError($"Can't blur the buffer. Only a scaleFactor of 0.5 or 1.0 is supported on tempTarget. Current scaleFactor: {tempTarget.scaleFactor}");
+
+ // Gaussian blur doesn't like even numbers
+ if (sampleCount % 2 == 0)
+ sampleCount++;
+
+ using (new ProfilingScope(ctx.cmd, gaussianblurSampler))
+ {
+ if (downSample)
+ {
+ // Downsample to half res in mip 0 of temp target (in case temp target doesn't have any mipmap we use 0)
+ DownSample(ctx, source, tempTarget, sourceScaleBias, destScaleBias, sourceMip, 0);
+ // Vertical blur
+ VerticalGaussianBlur(ctx, tempTarget, destination, sourceScaleBias, destScaleBias, sampleCount, radius, 0, destMip);
+ // Instead of allocating a new buffer on the fly, we copy the data.
+ // We will be able to allocate it when rendergraph lands
+ Copy(ctx, destination, tempTarget, sourceScaleBias, destScaleBias, 0, destMip);
+ // Horizontal blur and upsample
+ HorizontalGaussianBlur(ctx, tempTarget, destination, sourceScaleBias, destScaleBias, sampleCount, radius, sourceMip, destMip);
+ }
+ else
+ {
+ // Vertical blur
+ VerticalGaussianBlur(ctx, source, tempTarget, sourceScaleBias, destScaleBias, sampleCount, radius, sourceMip, destMip);
+ // Horizontal blur and upsample
+ HorizontalGaussianBlur(ctx, tempTarget, destination, sourceScaleBias, destScaleBias, sampleCount, radius, sourceMip, destMip);
+ }
+ }
+ }
+
+ ///
+ /// Simpler version of ScriptableRenderContext.DrawRenderers to draw HDRP materials.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void DrawRenderers(in CustomPassContext ctx, LayerMask layerMask, CustomPass.RenderQueueType renderQueueFilter = CustomPass.RenderQueueType.All, Material overrideMaterial = null, int overideMaterialIndex = 0)
+ {
+ PerObjectData renderConfig = ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask) ? HDUtils.k_RendererConfigurationBakedLightingWithShadowMask : HDUtils.k_RendererConfigurationBakedLighting;
+
+ var result = new RendererListDesc(litForwardTags, ctx.cullingResults, ctx.hdCamera.camera)
+ {
+ rendererConfiguration = renderConfig,
+ renderQueueRange = GetRenderQueueRangeFromRenderQueueType(renderQueueFilter),
+ sortingCriteria = SortingCriteria.BackToFront,
+ excludeObjectMotionVectors = false,
+ layerMask = layerMask,
+ stateBlock = new RenderStateBlock(RenderStateMask.Depth){ depthState = new DepthState(true, CompareFunction.LessEqual)},
+ };
+
+ HDUtils.DrawRendererList(ctx.renderContext, ctx.cmd, RendererList.Create(result));
+ }
+
+ ///
+ /// Generate gaussian weights for a given number of samples
+ ///
+ /// number of weights you want to generate
+ /// a GPU compute buffer containing the weights
+ internal static ComputeBuffer GetGaussianWeights(int weightCount)
+ {
+ float[] weights;
+ ComputeBuffer gpuWeights;
+
+ if (gaussianWeightsCache.TryGetValue(weightCount, out gpuWeights))
+ return gpuWeights;
+
+ weights = new float[weightCount];
+ float integrationBound = 3;
+ float p = -integrationBound;
+ float c = 0;
+ float step = (1.0f / (float)weightCount) * integrationBound * 2;
+ for (int i = 0; i < weightCount; i++)
+ {
+ float w = (Gaussian(p) / (float)weightCount) * integrationBound * 2;
+ weights[i] = w;
+ p += step;
+ c += w;
+ }
+
+ // Gaussian function
+ float Gaussian(float x, float sigma = 1)
+ {
+ float a = 1.0f / Mathf.Sqrt(2 * Mathf.PI * sigma * sigma);
+ float b = Mathf.Exp(-(x * x) / (2 * sigma * sigma));
+ return a * b;
+ }
+
+ gpuWeights = new ComputeBuffer(weights.Length, sizeof(float));
+ gpuWeights.SetData(weights);
+ gaussianWeightsCache[weightCount] = gpuWeights;
+
+ return gpuWeights;
+ }
+
+ ///
+ /// Convert a Custom Pass render queue type to a RenderQueueRange that can be used in DrawRenderers
+ ///
+ /// The type of render queue
+ /// The converted render queue range
+ public static RenderQueueRange GetRenderQueueRangeFromRenderQueueType(CustomPass.RenderQueueType type)
+ {
+ switch (type)
+ {
+ case CustomPass.RenderQueueType.OpaqueNoAlphaTest: return HDRenderQueue.k_RenderQueue_OpaqueNoAlphaTest;
+ case CustomPass.RenderQueueType.OpaqueAlphaTest: return HDRenderQueue.k_RenderQueue_OpaqueAlphaTest;
+ case CustomPass.RenderQueueType.AllOpaque: return HDRenderQueue.k_RenderQueue_AllOpaque;
+ case CustomPass.RenderQueueType.AfterPostProcessOpaque: return HDRenderQueue.k_RenderQueue_AfterPostProcessOpaque;
+ case CustomPass.RenderQueueType.PreRefraction: return HDRenderQueue.k_RenderQueue_PreRefraction;
+ case CustomPass.RenderQueueType.Transparent: return HDRenderQueue.k_RenderQueue_Transparent;
+ case CustomPass.RenderQueueType.LowTransparent: return HDRenderQueue.k_RenderQueue_LowTransparent;
+ case CustomPass.RenderQueueType.AllTransparent: return HDRenderQueue.k_RenderQueue_AllTransparent;
+ case CustomPass.RenderQueueType.AllTransparentWithLowRes: return HDRenderQueue.k_RenderQueue_AllTransparentWithLowRes;
+ case CustomPass.RenderQueueType.AfterPostProcessTransparent: return HDRenderQueue.k_RenderQueue_AfterPostProcessTransparent;
+ case CustomPass.RenderQueueType.All:
+ default:
+ return HDRenderQueue.k_RenderQueue_All;
+ }
+ }
+
+ // TODO when rendergraph is available: a PostProcess pass which does the copy with a temp target
+
+ internal static void Cleanup()
+ {
+ foreach (var gaussianWeights in gaussianWeightsCache)
+ gaussianWeights.Value.Release();
+ gaussianWeightsCache.Clear();
+ }
+
+ internal static void SetRenderTargetWithScaleBias(in CustomPassContext ctx, MaterialPropertyBlock block, RTHandle destination, Vector4 destScaleBias, ClearFlag clearFlag, int miplevel)
+ {
+ // viewport with RT handle scale and scale factor:
+ Rect viewport = new Rect();
+ Vector2 destSize = viewport.size = destination.GetScaledSize(destination.rtHandleProperties.currentViewportSize);
+ viewport.position = new Vector2(viewport.size.x * destScaleBias.z, viewport.size.y * destScaleBias.w);
+ viewport.size *= new Vector2(destScaleBias.x, destScaleBias.y);
+
+ CoreUtils.SetRenderTarget(ctx.cmd, destination, clearFlag, Color.black, miplevel);
+ ctx.cmd.SetViewport(viewport);
+
+ block.SetVector(HDShaderIDs._ViewPortSize, new Vector4(destSize.x, destSize.y, 1.0f / destSize.x, 1.0f / destSize.y));
+ block.SetVector(HDShaderIDs._ViewportScaleBias, new Vector4(1.0f / destScaleBias.x, 1.0f / destScaleBias.y, destScaleBias.z, destScaleBias.w));
+ }
+
+ static void SetSourceSize(MaterialPropertyBlock block, RTHandle source)
+ {
+ Vector2 sourceSize = source.GetScaledSize(source.rtHandleProperties.currentViewportSize);
+ block.SetVector(HDShaderIDs._SourceSize, new Vector4(sourceSize.x, sourceSize.y, 1.0f / sourceSize.x, 1.0f / sourceSize.y));
+ block.SetVector(HDShaderIDs._SourceScaleFactor, new Vector4(source.scaleFactor.x, source.scaleFactor.y, 1.0f / source.scaleFactor.x, 1.0f / source.scaleFactor.y));
+ }
+ }
+}
\ No newline at end of file
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs.meta
new file mode 100644
index 00000000000..dd9eed530bc
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 1da4e5df446e0e54cb8da8eb449b4ddb
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader
new file mode 100644
index 00000000000..82f3ff92a6d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader
@@ -0,0 +1,152 @@
+Shader "Hidden/HDRP/CustomPassUtils"
+{
+ HLSLINCLUDE
+
+ #pragma vertex Vert
+
+ #pragma target 4.5
+ #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch
+ #pragma enable_d3d11_debug_symbols
+
+ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassCommon.hlsl"
+
+ TEXTURE2D_X(_Source);
+ float _SourceMip;
+ float4 _ViewPortSize; // We need the viewport size because we have a non fullscreen render target (blur buffers are downsampled in half res)
+ float4 _SourceScaleBias;
+ float4 _ViewportScaleBias;
+ float4 _SourceSize;
+ float4 _SourceScaleFactor;
+
+ float _Radius;
+ float _SampleCount;
+ Buffer _GaussianWeights;
+
+ float2 GetScaledUVs(Varyings varyings)
+ {
+ // Remap UV from part of the screen (due to viewport scale / offset) to 0 - 1
+ float2 uv01 = (varyings.positionCS.xy * _RTHandleScale.xy * _ViewPortSize.zw - _ViewportScaleBias.zw) * _ViewportScaleBias.xy;
+ float2 uv = uv01;
+
+ // Apply scale and bias
+ return uv * _SourceScaleBias.xy + _SourceScaleBias.zw;
+ }
+
+ float4 Copy(Varyings varyings) : SV_Target
+ {
+ float2 uv01 = (varyings.positionCS.xy * _ViewPortSize.zw - _ViewportScaleBias.zw) * _ViewportScaleBias.xy;
+ // Apply scale and bias
+ float2 uv = uv01 * _SourceScaleBias.xy + _SourceScaleBias.zw;
+
+ return LOAD_TEXTURE2D_X_LOD(_Source, uv * _SourceSize.xy, _SourceMip);
+ }
+
+ // We need to clamp the UVs to avoid bleeding from bigger render tragets (when we have multiple cameras)
+ float2 ClampUVs(float2 uv)
+ {
+ // Clamp UV to the current viewport:
+ // Note that uv here are scaled with _RTHandleScale.xy to support sampling from RTHandle
+ float2 offset = _ViewportScaleBias.zw * _RTHandleScale.xy;
+ float2 size = rcp(_ViewportScaleBias.xy) * _RTHandleScale.xy;
+ float2 halfPixelSize = _SourceSize.zw * _RTHandleScale.xy / 2 * _SourceScaleFactor.zw;
+ uv = clamp(uv, offset + halfPixelSize, size + offset - halfPixelSize);
+ return saturate(uv);
+ }
+
+ float4 Blur(float2 uv, float2 direction)
+ {
+ // Horizontal blur from the camera color buffer
+ float4 result = 0;
+ for (int i = 0; i < _SampleCount; i++)
+ {
+ float offset = lerp(-_Radius, _Radius, (float(i) / _SampleCount));
+ float2 offsetUV = ClampUVs(uv + direction * offset * _ScreenSize.zw);
+ float4 sourceValue = SAMPLE_TEXTURE2D_X_LOD(_Source, s_linear_clamp_sampler, offsetUV, 0);
+
+ result += sourceValue * _GaussianWeights[i];
+ }
+
+ return result;
+
+ }
+
+ float4 HorizontalBlur(Varyings varyings) : SV_Target
+ {
+ float2 uv = GetScaledUVs(varyings);
+ return Blur(uv, float2(1, 0));
+ }
+
+ float4 VerticalBlur(Varyings varyings) : SV_Target
+ {
+ float2 uv = GetScaledUVs(varyings);
+ return Blur(uv, float2(0, 1));
+ }
+
+ float4 DownSample(Varyings varyings) : SV_Target
+ {
+ float2 uv = GetScaledUVs(varyings);
+ return SAMPLE_TEXTURE2D_X_LOD(_Source, s_linear_clamp_sampler, uv, 0);
+ }
+
+ ENDHLSL
+
+ SubShader
+ {
+ Pass
+ {
+ Name "Copy"
+
+ ZWrite Off
+ ZTest Always
+ Blend Off
+ Cull Off
+
+ HLSLPROGRAM
+ #pragma fragment Copy
+ ENDHLSL
+ }
+
+ Pass
+ {
+ Name "Downsample"
+
+ ZWrite Off
+ ZTest Always
+ Blend Off
+ Cull Off
+
+ HLSLPROGRAM
+ #pragma fragment DownSample
+ ENDHLSL
+ }
+
+ Pass
+ {
+ Name "HorizontalBlur"
+
+ ZWrite Off
+ ZTest Always
+ Blend Off
+ Cull Off
+
+ HLSLPROGRAM
+ #pragma fragment HorizontalBlur
+ ENDHLSL
+ }
+
+ Pass
+ {
+ Name "VerticalBlur"
+
+ ZWrite Off
+ ZTest Always
+ Blend Off
+ Cull Off
+
+ HLSLPROGRAM
+ #pragma fragment VerticalBlur
+ ENDHLSL
+ }
+ }
+ Fallback Off
+}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader.meta b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader.meta
new file mode 100644
index 00000000000..30206b98272
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 7e3722d0388000848acb25fd3cc8c088
+ShaderImporter:
+ externalObjects: {}
+ defaultTextures: []
+ nonModifiableTextures: []
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassVolume.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassVolume.cs
index 6cb40883a61..d1f2e2d08ee 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassVolume.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassVolume.cs
@@ -282,16 +282,26 @@ public static void GetActivePassVolumes(CustomPassInjectionPoint injectionPoint,
///
/// Add a pass of type passType in the active pass list
///
- ///
- public void AddPassOfType(Type passType)
+ /// The type of the CustomPass to create
+ /// The new custom
+ public CustomPass AddPassOfType() where T : CustomPass => AddPassOfType(typeof(T));
+
+ ///
+ /// Add a pass of type passType in the active pass list
+ ///
+ /// The type of the CustomPass to create
+ /// The new custom
+ public CustomPass AddPassOfType(Type passType)
{
if (!typeof(CustomPass).IsAssignableFrom(passType))
{
Debug.LogError($"Can't add pass type {passType} to the list because it does not inherit from CustomPass.");
- return ;
+ return null;
}
- customPasses.Add(Activator.CreateInstance(passType) as CustomPass);
+ var customPass = Activator.CreateInstance(passType) as CustomPass;
+ customPasses.Add(customPass);
+ return customPass;
}
#if UNITY_EDITOR
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs
index 0681fe9fc65..d040f90a0a9 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DrawRenderersCustomPass.cs
@@ -9,7 +9,7 @@ namespace UnityEngine.Rendering.HighDefinition
/// DrawRenderers Custom Pass
///
[System.Serializable]
- class DrawRenderersCustomPass : CustomPass
+ public class DrawRenderersCustomPass : CustomPass
{
///
/// HDRP Shader passes
@@ -17,30 +17,58 @@ class DrawRenderersCustomPass : CustomPass
public enum ShaderPass
{
// Ordered by frame time in HDRP
+ ///Object Depth pre-pass, only the depth of the object will be rendered.
DepthPrepass = 1,
+ ///Forward pass, render the object color.
Forward = 0,
}
// Used only for the UI to keep track of the toggle state
- public bool filterFoldout;
- public bool rendererFoldout;
+ [SerializeField] internal bool filterFoldout;
+ [SerializeField] internal bool rendererFoldout;
//Filter settings
- public CustomPass.RenderQueueType renderQueueType = CustomPass.RenderQueueType.AllOpaque;
- public string[] passNames = new string[1] { "Forward" };
+ ///
+ /// Render Queue filter to select which kind of object to render.
+ ///
+ public RenderQueueType renderQueueType = RenderQueueType.AllOpaque;
+ ///
+ /// Layer Mask filter, select which layer to render.
+ ///
public LayerMask layerMask = 1; // Layer mask Default enabled
+ ///
+ /// Sorting flags of the objects to render.
+ ///
public SortingCriteria sortingCriteria = SortingCriteria.CommonOpaque;
// Override material
+ ///
+ /// Replaces the material of selected renders by this one, be sure to also set overrideMaterialPassName to a good value when using this property.
+ ///
public Material overrideMaterial = null;
[SerializeField]
int overrideMaterialPassIndex = 0;
+ ///
+ /// Select which pass will be used to render objects when using an override material.
+ ///
public string overrideMaterialPassName = "Forward";
+ ///
+ /// When true, overrides the depth state of the objects.
+ ///
public bool overrideDepthState = false;
+ ///
+ /// Overrides the Depth comparison function, only used when overrideDepthState is true.
+ ///
public CompareFunction depthCompareFunction = CompareFunction.LessEqual;
+ ///
+ /// Overrides the Depth write, only used when overrideDepthState is true.
+ ///
public bool depthWrite = true;
+ ///
+ /// Set the shader pass to use when the override material is null
+ ///
public ShaderPass shaderPass = ShaderPass.Forward;
int fadeValueId;
@@ -51,7 +79,12 @@ public enum ShaderPass
// Cache the shaderTagIds so we don't allocate a new array each frame
ShaderTagId[] cachedShaderTagIDs;
- ///
+ ///
+ /// Called before the first execution of the pass occurs.
+ /// Allow you to allocate custom buffers.
+ ///
+ /// The render context
+ /// Current command buffer of the frame
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
{
fadeValueId = Shader.PropertyToID("_FadeValue");
@@ -74,13 +107,18 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff
};
}
- ///
+ ///
+ /// Use this method if you want to draw objects that are not visible in the camera.
+ /// For example if you disable a layer in the camera and add it in the culling parameters, then the culling result will contains your layer.
+ ///
+ /// Aggregate the parameters in this property (use |= for masks fields, etc.)
+ /// The camera where the culling is being done
protected override void AggregateCullingParameters(ref ScriptableCullingParameters cullingParameters, HDCamera hdCamera)
{
cullingParameters.cullingMask |= (uint)(int)layerMask;
}
- protected ShaderTagId[] GetShaderTagIds()
+ ShaderTagId[] GetShaderTagIds()
{
if (shaderPass == ShaderPass.DepthPrepass)
return depthShaderTags;
@@ -91,11 +129,8 @@ protected ShaderTagId[] GetShaderTagIds()
///
/// Execute the DrawRenderers with parameters setup from the editor
///
- ///
- ///
- ///
- ///
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
+ /// The context of the custom pass. Contains command buffer, render context, buffer, etc.
+ protected override void Execute(CustomPassContext ctx)
{
var shaderPasses = GetShaderTagIds();
if (overrideMaterial != null)
@@ -119,9 +154,9 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu
stencilState = new StencilState(false),
};
- PerObjectData renderConfig = hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask) ? HDUtils.k_RendererConfigurationBakedLightingWithShadowMask : HDUtils.k_RendererConfigurationBakedLighting;
+ PerObjectData renderConfig = ctx.hdCamera.frameSettings.IsEnabled(FrameSettingsField.Shadowmask) ? HDUtils.k_RendererConfigurationBakedLightingWithShadowMask : HDUtils.k_RendererConfigurationBakedLighting;
- var result = new RendererListDesc(shaderPasses, cullingResult, hdCamera.camera)
+ var result = new RendererListDesc(shaderPasses, ctx.cullingResults, ctx.hdCamera.camera)
{
rendererConfiguration = renderConfig,
renderQueueRange = GetRenderQueueRange(renderQueueType),
@@ -133,10 +168,14 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu
layerMask = layerMask,
};
- HDUtils.DrawRendererList(renderContext, cmd, RendererList.Create(result));
+ HDUtils.DrawRendererList(ctx.renderContext, ctx.cmd, RendererList.Create(result));
}
- ///
+ ///
+ /// List all the materials that need to be displayed at the bottom of the component.
+ /// All the materials gathered by this method will be used to create a Material Editor and then can be edited directly on the custom pass.
+ ///
+ /// An enumerable of materials to show in the inspector. These materials can be null, the list is cleaned afterwards
public override IEnumerable RegisterMaterialForInspector() { yield return overrideMaterial; }
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/FullScreenCustomPass.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/FullScreenCustomPass.cs
index 088535f75e2..92a278997cf 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/FullScreenCustomPass.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/FullScreenCustomPass.cs
@@ -9,18 +9,31 @@ namespace UnityEngine.Rendering.HighDefinition
/// FullScreen Custom Pass
///
[System.Serializable]
- class FullScreenCustomPass : CustomPass
+ public class FullScreenCustomPass : CustomPass
{
- // Fullscreen pass settings
+ ///
+ /// Material used for the fullscreen pass, it's shader must have been created with.
+ ///
public Material fullscreenPassMaterial;
[SerializeField]
int materialPassIndex = 0;
+ ///
+ /// Name of the pass to use in the fullscreen material.
+ ///
public string materialPassName = "Custom Pass 0";
+ ///
+ /// Set to true if your shader will sample in the camera color buffer.
+ ///
public bool fetchColorBuffer;
int fadeValueId;
- ///
+ ///
+ /// Called before the first execution of the pass occurs.
+ /// Allow you to allocate custom buffers.
+ ///
+ /// The render context
+ /// Current command buffer of the frame
protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd)
{
fadeValueId = Shader.PropertyToID("_FadeValue");
@@ -33,24 +46,28 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff
///
/// Execute the pass with the fullscreen setup
///
- ///
- protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera hdCamera, CullingResults cullingResult)
+ /// The context of the custom pass. Contains command buffer, render context, buffer, etc.
+ protected override void Execute(CustomPassContext ctx)
{
if (fullscreenPassMaterial != null)
{
if (fetchColorBuffer)
{
- ResolveMSAAColorBuffer(cmd, hdCamera);
- // reset the render target to the UI
- SetRenderTargetAuto(cmd);
+ ResolveMSAAColorBuffer(ctx.cmd, ctx.hdCamera);
+ // reset the render target to the UI
+ SetRenderTargetAuto(ctx.cmd);
}
fullscreenPassMaterial.SetFloat(fadeValueId, fadeValue);
- CoreUtils.DrawFullScreen(cmd, fullscreenPassMaterial, shaderPassId: fullscreenPassMaterial.FindPass(materialPassName));
+ CoreUtils.DrawFullScreen(ctx.cmd, fullscreenPassMaterial, shaderPassId: fullscreenPassMaterial.FindPass(materialPassName));
}
}
- ///
+ ///
+ /// List all the materials that need to be displayed at the bottom of the component.
+ /// All the materials gathered by this method will be used to create a Material Editor and then can be edited directly on the custom pass.
+ ///
+ /// An enumerable of materials to show in the inspector. These materials can be null, the list is cleaned afterwards
public override IEnumerable RegisterMaterialForInspector() { yield return fullscreenPassMaterial; }
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs
index 512e90b9f38..391ee0d57e1 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs
@@ -165,6 +165,8 @@ public sealed class ShaderResources
public Shader filterAreaLightCookiesPS;
[Reload("Runtime/Core/CoreResources/ClearUIntTextureArray.compute")]
public ComputeShader clearUIntTextureCS;
+ [Reload("Runtime/RenderPipeline/RenderPass/CustomPass/CustomPassUtils.shader")]
+ public Shader customPassUtils;
// XR
[Reload("Runtime/ShaderLibrary/XRMirrorView.shader")]
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset b/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset
index 77c585398fa..dcafb599476 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset
@@ -123,6 +123,7 @@ MonoBehaviour:
type: 3}
clearUIntTextureCS: {fileID: 7200000, guid: d067ad4b88af51c498875426894aef76,
type: 3}
+ customPassUtils: {fileID: 4800000, guid: 7e3722d0388000848acb25fd3cc8c088, type: 3}
xrMirrorViewPS: {fileID: 4800000, guid: e6255f98cf405eb45ab6f9006cf11e1f, type: 3}
xrOcclusionMeshPS: {fileID: 4800000, guid: 46a45b32bb110604fb36216b63bcdb81, type: 3}
shadowClearPS: {fileID: 4800000, guid: e3cab24f27741f44d8af1e94d006267c, type: 3}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs
index e383be28c1b..b17250fb174 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs
@@ -6,6 +6,8 @@ enum ConstantRegister
Global = 0,
XR = 1,
PBRSky = 2,
+ RayTracing = 3,
+ RayTracingLightLoop = 4,
}
// We need to keep the number of different constant buffers low.
diff --git a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.hlsl b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.hlsl
index 00c9dd5a040..6ef4ea2a0f7 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.hlsl
@@ -12,11 +12,6 @@
#define GLOBAL_CBUFFER_START(name, reg) CBUFFER_START(name)
#endif
-// Global Constant Buffers - b registers. Unity supports a maximum of 16 global constant buffers.
- // Ray tracing specific constant buffers
-#define UNITY_RAY_TRACING_GLOBAL_CBUFFER_REGISTER b3
-#define UNITY_RAY_TRACING_LIGHT_LOOP_CBUFFER_REGISTER b4
-
// Global Input Resources - t registers. Unity supports a maximum of 64 global input resources (compute buffers, textures, acceleration structure).
#define RAY_TRACING_ACCELERATION_STRUCTURE_REGISTER t0
#define RAY_TRACING_LIGHT_CLUSTER_REGISTER t1