diff --git a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/IPhonePlayer/Metal/None/InputNodes.png b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/IPhonePlayer/Metal/None/InputNodes.png index 623bb66c04f..fdd9e5a26e8 100644 --- a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/IPhonePlayer/Metal/None/InputNodes.png +++ b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/IPhonePlayer/Metal/None/InputNodes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:376458b49f8380dacb2f3cca95f219a1b4f549572befb44de084810e88d9ff22 -size 570383 +oid sha256:527ee5302fbee4182af162a5d46f3f6ca75a11b446145eacabe89a6efc38f708 +size 571784 diff --git a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/InputNodes.png b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/InputNodes.png index 059a2c83da6..b77ff60b338 100644 --- a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/InputNodes.png +++ b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/InputNodes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd68f56c4faccbee8526c4c4414e31b37a07a140d533eb8e84381a91fc261410 -size 552912 +oid sha256:74dd89b896150bce2990ccc7a2cf618a26ce27d6a7c79841581b42e634ecc100 +size 554332 diff --git a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxPlayer/Vulkan/None/InputNodes.png b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxPlayer/Vulkan/None/InputNodes.png index 059a2c83da6..cf6b7e485bc 100644 --- a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxPlayer/Vulkan/None/InputNodes.png +++ b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/LinuxPlayer/Vulkan/None/InputNodes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd68f56c4faccbee8526c4c4414e31b37a07a140d533eb8e84381a91fc261410 -size 552912 +oid sha256:c71af7dbc3a3b8918aa3c3c2de5c74e8ef1ab9bef4d7743cab77f1539cc98c79 +size 554407 diff --git a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png index 059a2c83da6..b8a2835a487 100644 --- a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png +++ b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd68f56c4faccbee8526c4c4414e31b37a07a140d533eb8e84381a91fc261410 -size 552912 +oid sha256:7182de48ae0ae35487bf9f9eb5bf5cb8a2ebef33c1ac1040f9d5141a8f06dff6 +size 554268 diff --git a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png.meta b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png.meta index 059baecf658..97a4ec5ee17 100644 --- a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png.meta +++ b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/InputNodes.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cdd86edd1ddceac4e8914ee4c5696e8e +guid: 377807074afd427458a64bc1139f61bb TextureImporter: internalIDToNameTable: [] externalObjects: {} @@ -20,10 +20,12 @@ TextureImporter: externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 + flipGreenChannel: 0 isReadable: 1 streamingMipmaps: 0 streamingMipmapsPriority: 0 vTOnly: 0 + ignoreMasterTextureLimit: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 @@ -62,6 +64,7 @@ TextureImporter: textureFormatSet: 0 ignorePngGamma: 0 applyGammaDecoding: 0 + swizzle: 50462976 platformSettings: - serializedVersion: 3 buildTarget: DefaultTexturePlatform @@ -91,7 +94,6 @@ TextureImporter: nameFileIdTable: {} spritePackingTag: pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 userData: assetBundleName: assetBundleVariant: diff --git a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/InputNodes.png b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/InputNodes.png index 059a2c83da6..f5304ea41af 100644 --- a/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/InputNodes.png +++ b/TestProjects/ShaderGraph/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/InputNodes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cd68f56c4faccbee8526c4c4414e31b37a07a140d533eb8e84381a91fc261410 -size 552912 +oid sha256:c8e8339809fed988aa92f4a752c53e4b0e8aace07b7701c5d960a50e27ef53b0 +size 554336 diff --git a/TestProjects/ShaderGraph/Assets/Scenes/InputNodes.unity b/TestProjects/ShaderGraph/Assets/Scenes/InputNodes.unity index 296990d83ab..c353c7130c8 100644 --- a/TestProjects/ShaderGraph/Assets/Scenes/InputNodes.unity +++ b/TestProjects/ShaderGraph/Assets/Scenes/InputNodes.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.12731713, g: 0.13414736, b: 0.12107852, a: 1} + m_IndirectSpecularColor: {r: 0.12731749, g: 0.13414757, b: 0.1210787, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -3034,6 +3034,10 @@ Transform: - {fileID: 1718807270} - {fileID: 1887502892} - {fileID: 1787014625} + - {fileID: 788973134} + - {fileID: 1700543877} + - {fileID: 1506800243} + - {fileID: 585226728} m_Father: {fileID: 134715868} m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3716,6 +3720,104 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 582133710} m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &585226727 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 585226728} + - component: {fileID: 585226731} + - component: {fileID: 585226730} + - component: {fileID: 585226729} + m_Layer: 0 + m_Name: Cylinder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &585226728 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 585226727} + m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068} + m_LocalPosition: {x: 8, y: -0, z: 3} + m_LocalScale: {x: 0.5, y: 1.5, z: 0.5} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 501824731} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} +--- !u!136 &585226729 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 585226727} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + m_Radius: 0.5000001 + m_Height: 2 + m_Direction: 1 + m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} +--- !u!23 &585226730 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 585226727} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + 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: 31321ba15b8f8eb4c954353edc038b1d, 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 &585226731 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 585226727} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &585441710 GameObject: m_ObjectHideFlags: 0 @@ -4750,6 +4852,103 @@ Transform: m_Father: {fileID: 303484558} m_RootOrder: 10 m_LocalEulerAnglesHint: {x: -90, y: 180, z: -90} +--- !u!1 &788973133 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 788973134} + - component: {fileID: 788973137} + - component: {fileID: 788973136} + - component: {fileID: 788973135} + m_Layer: 0 + m_Name: SceneDepthDifference_Linear01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &788973134 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 788973133} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 8.03, y: 0, z: 2} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 501824731} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &788973135 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 788973133} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + 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: 2967da7148dc7aa4ebd539e60ff154b7, 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: 1 + 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!135 &788973136 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 788973133} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &788973137 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 788973133} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &801207484 GameObject: m_ObjectHideFlags: 0 @@ -8971,6 +9170,103 @@ Transform: m_Father: {fileID: 303484558} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 45, y: 180, z: -90} +--- !u!1 &1506800242 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1506800243} + - component: {fileID: 1506800246} + - component: {fileID: 1506800245} + - component: {fileID: 1506800244} + m_Layer: 0 + m_Name: SceneDepthDifference_Eye + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1506800243 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1506800242} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 8, y: -0, z: 4} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 501824731} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &1506800244 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1506800242} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + 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: 931a40691e516894583f26123e672eb4, 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: 1 + 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!135 &1506800245 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1506800242} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1506800246 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1506800242} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &1536751008 GameObject: m_ObjectHideFlags: 0 @@ -9493,6 +9789,103 @@ Transform: m_Father: {fileID: 303484558} m_RootOrder: 5 m_LocalEulerAnglesHint: {x: -90, y: 180, z: -90} +--- !u!1 &1700543876 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1700543877} + - component: {fileID: 1700543880} + - component: {fileID: 1700543879} + - component: {fileID: 1700543878} + m_Layer: 0 + m_Name: SceneDepthDifference_Raw + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1700543877 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1700543876} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 8, y: 0, z: 3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 501824731} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &1700543878 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1700543876} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + 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: 4a078a43bd9730043945e8cf2f60268a, 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: 1 + 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!135 &1700543879 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1700543876} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!33 &1700543880 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1700543876} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &1701306554 GameObject: m_ObjectHideFlags: 0 diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.mat b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.mat new file mode 100644 index 00000000000..7e7ca3328fa --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.mat @@ -0,0 +1,56 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1940823928126477220 +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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 6 +--- !u!21 &2100000 +Material: + serializedVersion: 7 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SceneDepthDifference_Eye + m_Shader: {fileID: -6465566751694194690, guid: 7d0bb51476b1ef64aa1aa1f6dd9fcaf2, + type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _QueueControl: 0 + - _QueueOffset: 0 + m_Colors: [] + m_BuildTextureStacks: [] diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.mat.meta b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.mat.meta new file mode 100644 index 00000000000..dd74d6b7aa6 --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 931a40691e516894583f26123e672eb4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.shadergraph b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.shadergraph new file mode 100644 index 00000000000..7c120816b5b --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.shadergraph @@ -0,0 +1,531 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "592377c20a2e42dba72d75e0c6308070", + "m_Properties": [], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "08410996cc6c48e2b50e0d16724caac9" + } + ], + "m_Nodes": [ + { + "m_Id": "0e1d7cba35c34dc1aaee32ca4ba90cca" + }, + { + "m_Id": "f9cecd48e4e44243b0b3adef073128b4" + }, + { + "m_Id": "d654fce863f84262b9953eb6183d5d2a" + }, + { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + { + "m_Id": "8362a37b323f4830a782f6e6ef4ecc22" + }, + { + "m_Id": "7ba4f73ce5aa457f806afaab623363b0" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "8362a37b323f4830a782f6e6ef4ecc22" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "0e1d7cba35c34dc1aaee32ca4ba90cca" + }, + { + "m_Id": "f9cecd48e4e44243b0b3adef073128b4" + }, + { + "m_Id": "d654fce863f84262b9953eb6183d5d2a" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + { + "m_Id": "7ba4f73ce5aa457f806afaab623363b0" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_ActiveTargets": [ + { + "m_Id": "f8a02b10dd894bca9a00b316905c73b0" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "08410996cc6c48e2b50e0d16724caac9", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "0e1d7cba35c34dc1aaee32ca4ba90cca", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9229e44addce438c80db36119e7ddb88" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "2cf81dfbc76d46d685780d7a56dcf76e", + "m_Id": 0, + "m_DisplayName": "Alpha", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Alpha", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot", + "m_ObjectId": "64cac7097d2e4b9280a0df8010577647", + "m_Id": 1, + "m_DisplayName": "Scene UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "SceneUV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [], + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "77c7388de81e41ef9f5911600001e6ed", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "7ba4f73ce5aa457f806afaab623363b0", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Alpha", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "2cf81dfbc76d46d685780d7a56dcf76e" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SceneDepthDifferenceNode", + "m_ObjectId": "8362a37b323f4830a782f6e6ef4ecc22", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Scene Depth Difference", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -303.0, + "y": 200.0, + "width": 183.0, + "height": 136.0 + } + }, + "m_Slots": [ + { + "m_Id": "c59052f9d2844d47b410d94df8354249" + }, + { + "m_Id": "64cac7097d2e4b9280a0df8010577647" + }, + { + "m_Id": "8d1f2c2d07e142cf8d70666978d5c587" + } + ], + "synonyms": [ + "zbuffer", + "zdepth", + "difference" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_DepthSamplingMode": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "8ac9dd5e640148c1b0bc77f0010b5871", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "8b7403fb6217456ebfe5ed5166ec0753" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "8d1f2c2d07e142cf8d70666978d5c587", + "m_Id": 2, + "m_DisplayName": "Position WS", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "PositionWS", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "9229e44addce438c80db36119e7ddb88", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "99280e405dcd49d8849b0b30a4ef5930", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9a62d21be04c45faa9aa9aa4292d76c8" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "9a62d21be04c45faa9aa9aa4292d76c8", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "c59052f9d2844d47b410d94df8354249", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "d654fce863f84262b9953eb6183d5d2a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "8ac9dd5e640148c1b0bc77f0010b5871" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "f8a02b10dd894bca9a00b316905c73b0", + "m_ActiveSubTarget": { + "m_Id": "8b7403fb6217456ebfe5ed5166ec0753" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 1, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "f9cecd48e4e44243b0b3adef073128b4", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "77c7388de81e41ef9f5911600001e6ed" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.shadergraph.meta b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.shadergraph.meta new file mode 100644 index 00000000000..de6fac04cfa --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Eye.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7d0bb51476b1ef64aa1aa1f6dd9fcaf2 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.mat b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.mat new file mode 100644 index 00000000000..be43f1e8e41 --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.mat @@ -0,0 +1,56 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4188617748116029523 +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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 6 +--- !u!21 &2100000 +Material: + serializedVersion: 7 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SceneDepthDifference_Linear01 + m_Shader: {fileID: -6465566751694194690, guid: a3c6ee5a1a4d03e4cbe3f5f2401c121b, + type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _QueueControl: 0 + - _QueueOffset: 0 + m_Colors: [] + m_BuildTextureStacks: [] diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.mat.meta b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.mat.meta new file mode 100644 index 00000000000..766c0ba3052 --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2967da7148dc7aa4ebd539e60ff154b7 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.shadergraph b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.shadergraph new file mode 100644 index 00000000000..d25113440f0 --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.shadergraph @@ -0,0 +1,531 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "592377c20a2e42dba72d75e0c6308070", + "m_Properties": [], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "5a6b717f27104dbfbd9c4e00f72aa951" + } + ], + "m_Nodes": [ + { + "m_Id": "0e1d7cba35c34dc1aaee32ca4ba90cca" + }, + { + "m_Id": "f9cecd48e4e44243b0b3adef073128b4" + }, + { + "m_Id": "d654fce863f84262b9953eb6183d5d2a" + }, + { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + { + "m_Id": "f90137738cfd4c718b855306b81172d1" + }, + { + "m_Id": "7bbe7f5341bf4c93b90ff88a11249e5a" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "f90137738cfd4c718b855306b81172d1" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "0e1d7cba35c34dc1aaee32ca4ba90cca" + }, + { + "m_Id": "f9cecd48e4e44243b0b3adef073128b4" + }, + { + "m_Id": "d654fce863f84262b9953eb6183d5d2a" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + { + "m_Id": "7bbe7f5341bf4c93b90ff88a11249e5a" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_ActiveTargets": [ + { + "m_Id": "f8a02b10dd894bca9a00b316905c73b0" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "0e1d7cba35c34dc1aaee32ca4ba90cca", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9229e44addce438c80db36119e7ddb88" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "1e7894ef9a034863adea762b1bb2c9c0", + "m_Id": 0, + "m_DisplayName": "Alpha", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Alpha", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "2d8fd246ce1f4ee3b6821f17ebf49b9d", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "5a6b717f27104dbfbd9c4e00f72aa951", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "77c7388de81e41ef9f5911600001e6ed", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "7bbe7f5341bf4c93b90ff88a11249e5a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Alpha", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "1e7894ef9a034863adea762b1bb2c9c0" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "8ac9dd5e640148c1b0bc77f0010b5871", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "8b7403fb6217456ebfe5ed5166ec0753" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "9229e44addce438c80db36119e7ddb88", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "99280e405dcd49d8849b0b30a4ef5930", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9a62d21be04c45faa9aa9aa4292d76c8" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "9a62d21be04c45faa9aa9aa4292d76c8", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "d654fce863f84262b9953eb6183d5d2a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "8ac9dd5e640148c1b0bc77f0010b5871" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot", + "m_ObjectId": "da90c0a2da5d43709349dc44ff1bff5b", + "m_Id": 1, + "m_DisplayName": "Scene UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "SceneUV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [], + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "dbaa333c9c1849b4ad0a6988ad224c66", + "m_Id": 2, + "m_DisplayName": "Position WS", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "PositionWS", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 2 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "f8a02b10dd894bca9a00b316905c73b0", + "m_ActiveSubTarget": { + "m_Id": "8b7403fb6217456ebfe5ed5166ec0753" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 1, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SceneDepthDifferenceNode", + "m_ObjectId": "f90137738cfd4c718b855306b81172d1", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Scene Depth Difference", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -324.0, + "y": 200.0, + "width": 183.0, + "height": 136.0 + } + }, + "m_Slots": [ + { + "m_Id": "2d8fd246ce1f4ee3b6821f17ebf49b9d" + }, + { + "m_Id": "da90c0a2da5d43709349dc44ff1bff5b" + }, + { + "m_Id": "dbaa333c9c1849b4ad0a6988ad224c66" + } + ], + "synonyms": [ + "zbuffer", + "zdepth", + "difference" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_DepthSamplingMode": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "f9cecd48e4e44243b0b3adef073128b4", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "77c7388de81e41ef9f5911600001e6ed" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.shadergraph.meta b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.shadergraph.meta new file mode 100644 index 00000000000..c6294f17830 --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Linear01.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: a3c6ee5a1a4d03e4cbe3f5f2401c121b +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.mat b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.mat new file mode 100644 index 00000000000..344d4716924 --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.mat @@ -0,0 +1,56 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1641259983381672187 +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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 6 +--- !u!21 &2100000 +Material: + serializedVersion: 7 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SceneDepthDifference_Raw + m_Shader: {fileID: -6465566751694194690, guid: 7889d1d80e3e4ea4b863c78942c59226, + type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _QueueControl: 0 + - _QueueOffset: 0 + m_Colors: [] + m_BuildTextureStacks: [] diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.mat.meta b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.mat.meta new file mode 100644 index 00000000000..d0a42c42aea --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a078a43bd9730043945e8cf2f60268a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.shadergraph b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.shadergraph new file mode 100644 index 00000000000..cbeb62bd572 --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.shadergraph @@ -0,0 +1,531 @@ +{ + "m_SGVersion": 3, + "m_Type": "UnityEditor.ShaderGraph.GraphData", + "m_ObjectId": "592377c20a2e42dba72d75e0c6308070", + "m_Properties": [], + "m_Keywords": [], + "m_Dropdowns": [], + "m_CategoryData": [ + { + "m_Id": "282a8922f6d14a72b8d103254ec246da" + } + ], + "m_Nodes": [ + { + "m_Id": "0e1d7cba35c34dc1aaee32ca4ba90cca" + }, + { + "m_Id": "f9cecd48e4e44243b0b3adef073128b4" + }, + { + "m_Id": "d654fce863f84262b9953eb6183d5d2a" + }, + { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + { + "m_Id": "e52df8f1d04d411c831919f629e3f779" + }, + { + "m_Id": "43ff44897fc64ba3bf06cae25f1941d0" + } + ], + "m_GroupDatas": [], + "m_StickyNoteDatas": [], + "m_Edges": [ + { + "m_OutputSlot": { + "m_Node": { + "m_Id": "e52df8f1d04d411c831919f629e3f779" + }, + "m_SlotId": 0 + }, + "m_InputSlot": { + "m_Node": { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + "m_SlotId": 0 + } + } + ], + "m_VertexContext": { + "m_Position": { + "x": 0.0, + "y": 0.0 + }, + "m_Blocks": [ + { + "m_Id": "0e1d7cba35c34dc1aaee32ca4ba90cca" + }, + { + "m_Id": "f9cecd48e4e44243b0b3adef073128b4" + }, + { + "m_Id": "d654fce863f84262b9953eb6183d5d2a" + } + ] + }, + "m_FragmentContext": { + "m_Position": { + "x": 0.0, + "y": 200.0 + }, + "m_Blocks": [ + { + "m_Id": "99280e405dcd49d8849b0b30a4ef5930" + }, + { + "m_Id": "43ff44897fc64ba3bf06cae25f1941d0" + } + ] + }, + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + }, + "preventRotation": false + }, + "m_Path": "Shader Graphs", + "m_GraphPrecision": 1, + "m_PreviewMode": 2, + "m_OutputNode": { + "m_Id": "" + }, + "m_ActiveTargets": [ + { + "m_Id": "f8a02b10dd894bca9a00b316905c73b0" + } + ] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "0e1d7cba35c34dc1aaee32ca4ba90cca", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Position", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9229e44addce438c80db36119e7ddb88" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Position" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.CategoryData", + "m_ObjectId": "282a8922f6d14a72b8d103254ec246da", + "m_Name": "", + "m_ChildObjectList": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "2f85b9063ba940caa30a2f13a85de608", + "m_Id": 0, + "m_DisplayName": "Alpha", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Alpha", + "m_StageCapability": 2, + "m_Value": 1.0, + "m_DefaultValue": 1.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "43ff44897fc64ba3bf06cae25f1941d0", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.Alpha", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "2f85b9063ba940caa30a2f13a85de608" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.Alpha" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "65744230c0d94c5686a661af72a72cea", + "m_Id": 2, + "m_DisplayName": "Position WS", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "PositionWS", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 2 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.NormalMaterialSlot", + "m_ObjectId": "77c7388de81e41ef9f5911600001e6ed", + "m_Id": 0, + "m_DisplayName": "Normal", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Normal", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot", + "m_ObjectId": "7c965700200341c48eb6ab76c8547b54", + "m_Id": 1, + "m_DisplayName": "Scene UV", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "SceneUV", + "m_StageCapability": 3, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "w": 0.0 + }, + "m_Labels": [], + "m_ScreenSpaceType": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "8414a391aa004f3f8baf7c54e3f6afd6", + "m_Id": 0, + "m_DisplayName": "Out", + "m_SlotType": 1, + "m_Hidden": false, + "m_ShaderOutputName": "Out", + "m_StageCapability": 2, + "m_Value": 0.0, + "m_DefaultValue": 0.0, + "m_Labels": [] +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.TangentMaterialSlot", + "m_ObjectId": "8ac9dd5e640148c1b0bc77f0010b5871", + "m_Id": 0, + "m_DisplayName": "Tangent", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Tangent", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalUnlitSubTarget", + "m_ObjectId": "8b7403fb6217456ebfe5ed5166ec0753" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.PositionMaterialSlot", + "m_ObjectId": "9229e44addce438c80db36119e7ddb88", + "m_Id": 0, + "m_DisplayName": "Position", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Position", + "m_StageCapability": 1, + "m_Value": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_Space": 0 +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "99280e405dcd49d8849b0b30a4ef5930", + "m_Group": { + "m_Id": "" + }, + "m_Name": "SurfaceDescription.BaseColor", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "9a62d21be04c45faa9aa9aa4292d76c8" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "SurfaceDescription.BaseColor" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.ColorRGBMaterialSlot", + "m_ObjectId": "9a62d21be04c45faa9aa9aa4292d76c8", + "m_Id": 0, + "m_DisplayName": "Base Color", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "BaseColor", + "m_StageCapability": 2, + "m_Value": { + "x": 0.5, + "y": 0.5, + "z": 0.5 + }, + "m_DefaultValue": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "m_Labels": [], + "m_ColorMode": 0, + "m_DefaultColor": { + "r": 0.5, + "g": 0.5, + "b": 0.5, + "a": 1.0 + } +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "d654fce863f84262b9953eb6183d5d2a", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Tangent", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "8ac9dd5e640148c1b0bc77f0010b5871" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Tangent" +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.SceneDepthDifferenceNode", + "m_ObjectId": "e52df8f1d04d411c831919f629e3f779", + "m_Group": { + "m_Id": "" + }, + "m_Name": "Scene Depth Difference", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": -310.0, + "y": 200.0, + "width": 183.0, + "height": 136.0 + } + }, + "m_Slots": [ + { + "m_Id": "8414a391aa004f3f8baf7c54e3f6afd6" + }, + { + "m_Id": "7c965700200341c48eb6ab76c8547b54" + }, + { + "m_Id": "65744230c0d94c5686a661af72a72cea" + } + ], + "synonyms": [ + "zbuffer", + "zdepth", + "difference" + ], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_DepthSamplingMode": 1 +} + +{ + "m_SGVersion": 1, + "m_Type": "UnityEditor.Rendering.Universal.ShaderGraph.UniversalTarget", + "m_ObjectId": "f8a02b10dd894bca9a00b316905c73b0", + "m_ActiveSubTarget": { + "m_Id": "8b7403fb6217456ebfe5ed5166ec0753" + }, + "m_AllowMaterialOverride": false, + "m_SurfaceType": 1, + "m_ZTestMode": 4, + "m_ZWriteControl": 0, + "m_AlphaMode": 0, + "m_RenderFace": 2, + "m_AlphaClip": false, + "m_CastShadows": true, + "m_ReceiveShadows": true, + "m_CustomEditorGUI": "", + "m_SupportVFX": false +} + +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "f9cecd48e4e44243b0b3adef073128b4", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Normal", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "77c7388de81e41ef9f5911600001e6ed" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Normal" +} + diff --git a/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.shadergraph.meta b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.shadergraph.meta new file mode 100644 index 00000000000..e2c6a18622c --- /dev/null +++ b/TestProjects/ShaderGraph/Assets/Testing/IntegrationTests/Graphs/Input/Scene/SceneDepthDifference_Raw.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7889d1d80e3e4ea4b863c78942c59226 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Lit-Shader.md b/com.unity.render-pipelines.high-definition/Documentation~/Lit-Shader.md index e280814912c..2bdcc2b9e22 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Lit-Shader.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Lit-Shader.md @@ -26,6 +26,7 @@ To create a new Lit Material, navigate to your Project's Asset window, right-cli | **Base Map** | Assign a Texture that controls both the color and opacity of your Material. To assign a Texture to this field, click the radio button and select your Texture in the Select Texture window. Use the color picker to select the color of the Material. If you do not assign a Texture, this is the absolute color of the Material. If you do assign a Texture, the final color of the Material is a combination of the Texture you assign and the color you select. The alpha value of the color controls the transparency level for the Material if you select **Transparent** from the **Surface Type** drop-down. | | **Metallic** | Use this slider to adjust how "metal-like" the surface of your Material is (between 0 and 1). When a surface is more metallic, it reflects the environment more and its albedo color becomes less visible. At full metallic level, the surface color is entirely driven by reflections from the environment. When a surface is less metallic, its albedo color is clearer and any surface reflections are visible on top of the surface color, rather than obscuring it.
This property only appears when you unassign the Texture in the **Mask Map**. | | **Smoothness** | Use the slider to adjust the smoothness of your Material. Every light ray that hits a smooth surface bounces off at predictable and consistent angles. For a perfectly smooth surface that reflects light like a mirror, set this to a value of 1. Less smooth surfaces reflect light over a wider range of angles (because the light hits the bumps in the microsurface), so the reflections have less detail and spread across the surface in a more diffused pattern.
This property only appears when you unassign the Texture in the **Mask Map**. | +| **Alpha Remapping** | Use this min-max slider to remap the alpha values from the **Base Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Base Map**. | | **Metallic Remapping** | Use this min-max slider to remap the metallic values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | | **Smoothness Remapping** | Use this min-max slider to remap the smoothness values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | | **Ambient Occlusion Remapping** | Use this min-max slider to remap the ambient occlusion values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Lit-Tessellation-Shader.md b/com.unity.render-pipelines.high-definition/Documentation~/Lit-Tessellation-Shader.md index 219b68e45c8..f30e3de13af 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Lit-Tessellation-Shader.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Lit-Tessellation-Shader.md @@ -48,6 +48,7 @@ For information on the properties in this section, see the [Tessellation documen | **Base Map** | Assign a Texture that controls both the color and opacity of your Material. To assign a Texture to this field, click the radio button and select your Texture in the Select Texture window. Use the color picker to select the color of the Material. If you do not assign a Texture, this is the absolute color of the Material. If you do assign a Texture, the final color of the Material is a combination of the Texture you assign and the color you select. The alpha value of the color controls the transparency level for the Material if you select **Transparent** from the **Surface Type** drop-down. | | **Metallic** | Use this slider to adjust how "metal-like" the surface of your Material is (between 0 and 1). When a surface is more metallic, it reflects the environment more and its albedo color becomes less visible. At full metallic level, the surface color is entirely driven by reflections from the environment. When a surface is less metallic, its albedo color is clearer and any surface reflections are visible on top of the surface color, rather than obscuring it.
This property only appears when you unassign the Texture in the **Mask Map**. | | **Smoothness** | Use the slider to adjust the smoothness of your Material. Every light ray that hits a smooth surface bounces off at predictable and consistent angles. For a perfectly smooth surface that reflects light like a mirror, set this to a value of 1. Less smooth surfaces reflect light over a wider range of angles (because the light hits the bumps in the microsurface), so the reflections have less detail and spread across the surface in a more diffused pattern.
This property only appears when you unassign the Texture in the **Mask Map**. | +| **Alpha Remapping** | Use this min-max slider to remap the alpha values from the **Base Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Base Map**. | | **Metallic Remapping** | Use this min-max slider to remap the metallic values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | | **Smoothness Remapping** | Use this min-max slider to remap the smoothness values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | | **Ambient Occlusion Remapping** | Use this min-max slider to remap the ambient occlusion values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/layers.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/layers.md index 086703ca0cf..eac522d71cf 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/layers.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/layers.md @@ -22,6 +22,7 @@ Unity exposes up to four Material layers for you to use in your Layered Material | **Base Map** | Assign a Texture that controls both the color and opacity of your Material. To assign a Texture to this field, click the radio button and select your Texture in the Select Texture window. Use the color picker to select the color of the Material. If you do not assign a Texture, this is the absolute color of the Material. If you do assign a Texture, the final color of the Material is a combination of the Texture you assign and the color you select. The alpha value of the color controls the transparency level for the Material if you select **Transparent** from the **Surface Type** drop-down. | | **Metallic** | Use this slider to adjust how "metal-like" the surface of your Material is (between 0 and 1). When a surface is more metallic, it reflects the environment more and its albedo color becomes less visible. At full metallic level, the surface color is entirely driven by reflections from the environment. When a surface is less metallic, its albedo color is clearer and any surface reflections are visible on top of the surface color, rather than obscuring it.
This property only appears when you unassign the Texture in the **Mask Map** and set **Material Type** to **Standard**. | | **Smoothness** | Use the slider to adjust the smoothness of your Material. Every light ray that hits a smooth surface bounces off at predictable and consistent angles. For a perfectly smooth surface that reflects light like a mirror, set this to a value of 1. Less smooth surfaces reflect light over a wider range of angles (because the light hits the bumps in the microsurface), so the reflections have less detail and spread across the surface in a more diffused pattern.
This property only appears when you unassign the Texture in the **Mask Map**. | +| **Alpha Remapping** | Use this min-max slider to remap the alpha values from the **Base Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Base Map**. | | **Metallic Remapping** | Use this min-max slider to remap the metallic values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | | **Smoothness Remapping** | Use this min-max slider to remap the smoothness values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | | **Ambient Occlusion Remapping** | Use this min-max slider to remap the ambient occlusion values from the **Mask Map** to the range you specify. Rather than [clamping](https://docs.unity3d.com/ScriptReference/Mathf.Clamp.html) values to the new range, Unity condenses the original range down to the new range uniformly.
This property only appears when you assign a **Mask Map**. | diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs index 4aa022f155d..dab9103680e 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs @@ -40,7 +40,7 @@ public struct SurfaceDescription public static BlockFieldDescriptor Distortion = new BlockFieldDescriptor(SurfaceDescription.name, "Distortion", "SURFACEDESCRIPTION_DISTORTION", new Vector2Control(Vector2.zero), ShaderStage.Fragment); // TODO: Lit is Vector2(2.0f, -1.0f) public static BlockFieldDescriptor DistortionBlur = new BlockFieldDescriptor(SurfaceDescription.name, "DistortionBlur", "Distortion Blur", "SURFACEDESCRIPTION_DISTORTIONBLUR", - new FloatControl(1.0f), ShaderStage.Fragment); + new FloatControl(0.0f), ShaderStage.Fragment); public static BlockFieldDescriptor ShadowTint = new BlockFieldDescriptor(SurfaceDescription.name, "ShadowTint", "Shadow Tint", "SURFACEDESCRIPTION_SHADOWTINT", new ColorRGBAControl(Color.black), ShaderStage.Fragment); diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/LitSurfaceInputsUIBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/LitSurfaceInputsUIBlock.cs index aa1ee5f2315..7ed22c465d8 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/LitSurfaceInputsUIBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/LitSurfaceInputsUIBlock.cs @@ -51,6 +51,7 @@ internal class Styles public static GUIContent aoRemappingText = new GUIContent("Ambient Occlusion Remapping", "Controls a remap for the ambient occlusion channel in the Mask Map."); public static GUIContent maskMapSText = new GUIContent("Mask Map", "Specifies the Mask Map for this Material - Metallic (R), Ambient occlusion (G), Detail mask (B), Smoothness (A)."); public static GUIContent maskMapSpecularText = new GUIContent("Mask Map", "Specifies the Mask Map for this Material - Ambient occlusion (G), Detail mask (B), Smoothness (A)."); + public static GUIContent transparencyRemappingText = new GUIContent("Transparency Remapping", "Controls a remap for the alpha channel in the Base Color."); public static GUIContent normalMapSpaceText = new GUIContent("Normal Map Space", ""); public static GUIContent normalMapText = new GUIContent("Normal Map", "Specifies the Normal Map for this Material (BC7/BC5/DXT5(nm)) and controls its strength."); @@ -128,10 +129,15 @@ internal class Styles const string kSmoothnessRemapMin = "_SmoothnessRemapMin"; MaterialProperty[] smoothnessRemapMax = new MaterialProperty[kMaxLayerCount]; const string kSmoothnessRemapMax = "_SmoothnessRemapMax"; + MaterialProperty[] alphaRemapMin = new MaterialProperty[kMaxLayerCount]; + const string kAlphaRemapMin = "_AlphaRemapMin"; + MaterialProperty[] alphaRemapMax = new MaterialProperty[kMaxLayerCount]; + const string kAlphaRemapMax = "_AlphaRemapMax"; MaterialProperty[] aoRemapMin = new MaterialProperty[kMaxLayerCount]; const string kAORemapMin = "_AORemapMin"; MaterialProperty[] aoRemapMax = new MaterialProperty[kMaxLayerCount]; const string kAORemapMax = "_AORemapMax"; + MaterialProperty[] maskMap = new MaterialProperty[kMaxLayerCount]; MaterialProperty[] normalScale = new MaterialProperty[kMaxLayerCount]; const string kNormalScale = "_NormalScale"; @@ -262,14 +268,18 @@ public override void LoadMaterialProperties() baseColor = FindPropertyLayered(kBaseColor, m_LayerCount); baseColorMap = FindPropertyLayered(kBaseColorMap, m_LayerCount); + metallic = FindPropertyLayered(kMetallic, m_LayerCount); metallicRemapMin = FindPropertyLayered(kMetallicRemapMin, m_LayerCount); metallicRemapMax = FindPropertyLayered(kMetallicRemapMax, m_LayerCount); smoothness = FindPropertyLayered(kSmoothness, m_LayerCount); smoothnessRemapMin = FindPropertyLayered(kSmoothnessRemapMin, m_LayerCount); smoothnessRemapMax = FindPropertyLayered(kSmoothnessRemapMax, m_LayerCount); + alphaRemapMin = FindPropertyLayered(kAlphaRemapMin, m_LayerCount); + alphaRemapMax = FindPropertyLayered(kAlphaRemapMax, m_LayerCount); aoRemapMin = FindPropertyLayered(kAORemapMin, m_LayerCount); aoRemapMax = FindPropertyLayered(kAORemapMax, m_LayerCount); + maskMap = FindPropertyLayered(kMaskMap, m_LayerCount); normalMap = FindPropertyLayered(kNormalMap, m_LayerCount); normalMapOS = FindPropertyLayered(kNormalMapOS, m_LayerCount); @@ -365,6 +375,13 @@ void DrawSurfaceInputsGUI() materialEditor.TexturePropertySingleLine(Styles.baseColorText, baseColorMap[m_LayerIndex], baseColor[m_LayerIndex]); + if (baseColorMap[m_LayerIndex].textureValue != null && materials.All(m => m.GetSurfaceType() == SurfaceType.Transparent)) + { + materialEditor.MinMaxShaderProperty(alphaRemapMin[m_LayerIndex], alphaRemapMax[m_LayerIndex], 0.0f, 1.0f, Styles.transparencyRemappingText); + } + + materialEditor.TexturePropertySingleLine((materials.All(m => m.GetMaterialId() == MaterialId.LitSpecular)) ? Styles.maskMapSpecularText : Styles.maskMapSText, maskMap[m_LayerIndex]); + bool hasMetallic = materials.All(m => m.GetMaterialId() == MaterialId.LitStandard || m.GetMaterialId() == MaterialId.LitAniso || @@ -385,8 +402,6 @@ void DrawSurfaceInputsGUI() materialEditor.MinMaxShaderProperty(aoRemapMin[m_LayerIndex], aoRemapMax[m_LayerIndex], 0.0f, 1.0f, Styles.aoRemappingText); } - materialEditor.TexturePropertySingleLine((materials.All(m => m.GetMaterialId() == MaterialId.LitSpecular)) ? Styles.maskMapSpecularText : Styles.maskMapSText, maskMap[m_LayerIndex]); - materialEditor.ShaderProperty(normalMapSpace[m_LayerIndex], Styles.normalMapSpaceText); // Triplanar only work with tangent space normal diff --git a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/UnlitSurfaceInputsUIBlock.cs b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/UnlitSurfaceInputsUIBlock.cs index e0a4df26d22..2b70061b5c6 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/UnlitSurfaceInputsUIBlock.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/UnlitSurfaceInputsUIBlock.cs @@ -12,12 +12,17 @@ internal class Styles public static GUIContent header { get; } = EditorGUIUtility.TrTextContent("Surface Inputs"); public static GUIContent colorText = new GUIContent("Color", " Albedo (RGB) and Transparency (A)."); + public static GUIContent transparencyRemappingText = new GUIContent("Transparency Remapping", "Controls a remap for the alpha channel in the Base Color."); } MaterialProperty color = null; const string kColor = "_UnlitColor"; MaterialProperty colorMap = null; const string kColorMap = "_UnlitColorMap"; + MaterialProperty alphaRemapMin = null; + const string kAlphaRemapMin = "_AlphaRemapMin"; + MaterialProperty alphaRemapMax = null; + const string kAlphaRemapMax = "_AlphaRemapMax"; /// /// Constructs an UnlitSurfaceInputsUIBlock based on the parameters. @@ -35,6 +40,9 @@ public override void LoadMaterialProperties() { color = FindProperty(kColor); colorMap = FindProperty(kColorMap); + + alphaRemapMin = FindProperty(kAlphaRemapMin); + alphaRemapMax = FindProperty(kAlphaRemapMax); } /// @@ -43,6 +51,12 @@ public override void LoadMaterialProperties() protected override void OnGUIOpen() { materialEditor.TexturePropertySingleLine(Styles.colorText, colorMap, color); + + if (colorMap.textureValue != null) + { + materialEditor.MinMaxShaderProperty(alphaRemapMin, alphaRemapMax, 0.0f, 1.0f, Styles.transparencyRemappingText); + } + materialEditor.TextureScaleOffsetProperty(colorMap); } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader index 492e72d7ebf..760a591f684 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader @@ -49,6 +49,16 @@ Shader "HDRP/LayeredLit" _SmoothnessRemapMax2("SmoothnessRemapMax2", Range(0.0, 1.0)) = 1.0 _SmoothnessRemapMax3("SmoothnessRemapMax3", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMin0("AlphaRemapMin0", Range(0.0, 1.0)) = 0.0 + _AlphaRemapMin1("AlphaRemapMin1", Range(0.0, 1.0)) = 0.0 + _AlphaRemapMin2("AlphaRemapMin2", Range(0.0, 1.0)) = 0.0 + _AlphaRemapMin3("AlphaRemapMin3", Range(0.0, 1.0)) = 0.0 + + _AlphaRemapMax0("AlphaRemapMax0", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMax1("AlphaRemapMax1", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMax2("AlphaRemapMax2", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMax3("AlphaRemapMax3", Range(0.0, 1.0)) = 1.0 + _AORemapMin0("AORemapMin0", Range(0.0, 1.0)) = 0.0 _AORemapMin1("AORemapMin1", Range(0.0, 1.0)) = 0.0 _AORemapMin2("AORemapMin2", Range(0.0, 1.0)) = 0.0 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader index a53038b26b5..40da6ece61b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitTessellation.shader @@ -49,6 +49,16 @@ Shader "HDRP/LayeredLitTessellation" _SmoothnessRemapMax2("SmoothnessRemapMax2", Range(0.0, 1.0)) = 1.0 _SmoothnessRemapMax3("SmoothnessRemapMax3", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMin0("AlphaRemapMin0", Range(0.0, 1.0)) = 0.0 + _AlphaRemapMin1("AlphaRemapMin1", Range(0.0, 1.0)) = 0.0 + _AlphaRemapMin2("AlphaRemapMin2", Range(0.0, 1.0)) = 0.0 + _AlphaRemapMin3("AlphaRemapMin3", Range(0.0, 1.0)) = 0.0 + + _AlphaRemapMax0("AlphaRemapMax0", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMax1("AlphaRemapMax1", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMax2("AlphaRemapMax2", Range(0.0, 1.0)) = 1.0 + _AlphaRemapMax3("AlphaRemapMax3", Range(0.0, 1.0)) = 1.0 + _AORemapMin0("AORemapMin0", Range(0.0, 1.0)) = 0.0 _AORemapMin1("AORemapMin1", Range(0.0, 1.0)) = 0.0 _AORemapMin2("AORemapMin2", Range(0.0, 1.0)) = 0.0 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader index 845b9d4293e..42461ed40b0 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.shader @@ -17,6 +17,8 @@ Shader "HDRP/Lit" _MetallicRemapMax("MetallicRemapMax", Float) = 1.0 _SmoothnessRemapMin("SmoothnessRemapMin", Float) = 0.0 _SmoothnessRemapMax("SmoothnessRemapMax", Float) = 1.0 + _AlphaRemapMin("AlphaRemapMin", Float) = 0.0 + _AlphaRemapMax("AlphaRemapMax", Float) = 1.0 _AORemapMin("AORemapMin", Float) = 0.0 _AORemapMax("AORemapMax", Float) = 1.0 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDataIndividualLayer.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDataIndividualLayer.hlsl index 39dc46d0f6d..87108d23324 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDataIndividualLayer.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitDataIndividualLayer.hlsl @@ -203,11 +203,13 @@ float ADD_IDX(GetSurfaceData)(FragInputs input, LayerTexCoord layerTexCoord, out // We split both call due to trilinear mapping detailNormalTS = SAMPLE_UVMAPPING_NORMALMAP_AG(ADD_IDX(_DetailMap), SAMPLER_DETAILMAP_IDX, ADD_IDX(layerTexCoord.details), ADD_IDX(_DetailNormalScale)); #endif + float4 color = SAMPLE_UVMAPPING_TEXTURE2D(ADD_IDX(_BaseColorMap), ADD_ZERO_IDX(sampler_BaseColorMap), ADD_IDX(layerTexCoord.base)).rgba * ADD_IDX(_BaseColor).rgba; surfaceData.baseColor = color.rgb; float alpha = color.a; -#ifdef _DETAIL_MAP_IDX + alpha = lerp(ADD_IDX(_AlphaRemapMin), ADD_IDX(_AlphaRemapMax), alpha); +#ifdef _DETAIL_MAP_IDX // Goal: we want the detail albedo map to be able to darken down to black and brighten up to white the surface albedo. // The scale control the speed of the gradient. We simply remap detailAlbedo from [0..1] to [-1..1] then perform a lerp to black or white // with a factor based on speed. diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl index c815b35fc68..497ae1f9a30 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitProperties.hlsl @@ -156,6 +156,8 @@ float _MetallicRemapMax; float _Smoothness; float _SmoothnessRemapMin; float _SmoothnessRemapMax; +float _AlphaRemapMin; +float _AlphaRemapMax; float _AORemapMin; float _AORemapMax; @@ -212,6 +214,8 @@ PROP_DECL(float, _MetallicRemapMax); PROP_DECL(float, _Smoothness); PROP_DECL(float, _SmoothnessRemapMin); PROP_DECL(float, _SmoothnessRemapMax); +PROP_DECL(float, _AlphaRemapMin); +PROP_DECL(float, _AlphaRemapMax); PROP_DECL(float, _AORemapMin); PROP_DECL(float, _AORemapMax); @@ -329,6 +333,14 @@ UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) UNITY_DOTS_INSTANCED_PROP(float , _SmoothnessRemapMax1) UNITY_DOTS_INSTANCED_PROP(float , _SmoothnessRemapMax2) UNITY_DOTS_INSTANCED_PROP(float , _SmoothnessRemapMax3) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMin0) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMin1) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMin2) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMin3) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMax0) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMax1) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMax2) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMax3) UNITY_DOTS_INSTANCED_PROP(float , _AORemapMin0) UNITY_DOTS_INSTANCED_PROP(float , _AORemapMin1) UNITY_DOTS_INSTANCED_PROP(float , _AORemapMin2) @@ -403,6 +415,14 @@ UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) #define _SmoothnessRemapMax1 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _SmoothnessRemapMax1) #define _SmoothnessRemapMax2 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _SmoothnessRemapMax2) #define _SmoothnessRemapMax3 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _SmoothnessRemapMax3) +#define _AlphaRemapMin0 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMin0) +#define _AlphaRemapMin1 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMin1) +#define _AlphaRemapMin2 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMin2) +#define _AlphaRemapMin3 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMin3) +#define _AlphaRemapMax0 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMax0) +#define _AlphaRemapMax1 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMax1) +#define _AlphaRemapMax2 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMax2) +#define _AlphaRemapMax3 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMax3) #define _AORemapMin0 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AORemapMin0) #define _AORemapMin1 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AORemapMin1) #define _AORemapMin2 UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AORemapMin2) @@ -449,6 +469,8 @@ UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata) UNITY_DOTS_INSTANCED_PROP(float , _Smoothness) UNITY_DOTS_INSTANCED_PROP(float , _SmoothnessRemapMin) UNITY_DOTS_INSTANCED_PROP(float , _SmoothnessRemapMax) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMin) + UNITY_DOTS_INSTANCED_PROP(float , _AlphaRemapMax) UNITY_DOTS_INSTANCED_PROP(float , _AORemapMin) UNITY_DOTS_INSTANCED_PROP(float , _AORemapMax) UNITY_DOTS_INSTANCED_PROP(float , _DetailAlbedoScale) @@ -470,6 +492,8 @@ UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata) #define _Smoothness UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _Smoothness) #define _SmoothnessRemapMin UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _SmoothnessRemapMin) #define _SmoothnessRemapMax UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _SmoothnessRemapMax) +#define _AlphaRemapMin UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMin) +#define _AlphaRemapMax UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AlphaRemapMax) #define _AORemapMin UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AORemapMin) #define _AORemapMax UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _AORemapMax) #define _DetailAlbedoScale UNITY_ACCESS_DOTS_INSTANCED_PROP_WITH_DEFAULT(float , _DetailAlbedoScale) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader index 572ff5c1ae2..8d3b117e3ed 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader @@ -17,6 +17,8 @@ Shader "HDRP/LitTessellation" _MetallicRemapMax("MetallicRemapMax", Float) = 1.0 _SmoothnessRemapMin("SmoothnessRemapMin", Float) = 0.0 _SmoothnessRemapMax("SmoothnessRemapMax", Float) = 1.0 + _AlphaRemapMin("AlphaRemapMin", Float) = 0.0 + _AlphaRemapMax("AlphaRemapMax", Float) = 1.0 _AORemapMin("AORemapMin", Float) = 0.0 _AORemapMax("AORemapMax", Float) = 1.0 diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader index 78916d0c33b..3c8f1636b25 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/Unlit.shader @@ -5,6 +5,8 @@ Shader "HDRP/Unlit" // Be careful, do not change the name here to _Color. It will conflict with the "fake" parameters (see end of properties) required for GI. [MainColor] _UnlitColor("Color", Color) = (1,1,1,1) [MainTexture] _UnlitColorMap("ColorMap", 2D) = "white" {} + [HideInInspector] _AlphaRemapMin("AlphaRemapMin", Float) = 0.0 + [HideInInspector] _AlphaRemapMax("AlphaRemapMax", Float) = 1.0 [HDR] _EmissiveColor("EmissiveColor", Color) = (0, 0, 0) _EmissiveColorMap("EmissiveColorMap", 2D) = "white" {} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl index df0c30c381e..f7aaa769f35 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitData.hlsl @@ -30,7 +30,7 @@ void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs p // Builtin Data ZERO_BUILTIN_INITIALIZE(builtinData); // No call to InitBuiltinData as we don't have any lighting - builtinData.opacity = alpha; + builtinData.opacity = lerp(_AlphaRemapMin, _AlphaRemapMax, alpha); #ifdef _ALPHATEST_ON // Used for sharpening by alpha to mask diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitProperties.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitProperties.hlsl index fe57751a782..4bc5a595540 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitProperties.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Unlit/UnlitProperties.hlsl @@ -25,6 +25,8 @@ float _DistortionVectorBias; float _DistortionBlurScale; float _DistortionBlurRemapMin; float _DistortionBlurRemapMax; +float _AlphaRemapMin; +float _AlphaRemapMax; float _BlendMode; // Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor" diff --git a/com.unity.shadergraph/Documentation~/Scene-Depth-Difference.md b/com.unity.shadergraph/Documentation~/Scene-Depth-Difference.md new file mode 100644 index 00000000000..165dabe773e --- /dev/null +++ b/com.unity.shadergraph/Documentation~/Scene-Depth-Difference.md @@ -0,0 +1,19 @@ +# Scene Depth Difference + +## Description + +Provide a difference between a World Space Position and a Depth value for a given UV. + +## Ports + +| Name | Direction | Type | Binding | Description | +|:-------|:-----------|:------|:--------|:------------| +| Scene UV | Input | Vector4 | None | UV where to sample the depth. | +| Position WS | Input | Vector3 | None | The world space position to compare with scene depth. | +| Out | Output | Float | None | The difference between PositionWS and the depth. The difference is given relative to camera with **Eye** mode, in depth-buffer-value with **Raw** mode and in Linear value remap between 0 and 1 with the **Linear01** Mode. | + +## Controls + +| Name | Type | Options | Description | +|:------------ |:-------------|:-----|:---| +| Mode | Dropdown | Select **Linear01** to have a value between 0 and 1, **Eye** to have a World-Space value comparable to unit used on the scene and **Raw** if it's used with SceneDepthBuffer. | diff --git a/com.unity.shadergraph/Documentation~/TableOfContents.md b/com.unity.shadergraph/Documentation~/TableOfContents.md index ecc20e83b44..0d535add499 100644 --- a/com.unity.shadergraph/Documentation~/TableOfContents.md +++ b/com.unity.shadergraph/Documentation~/TableOfContents.md @@ -123,6 +123,7 @@ * [Object](Object-Node) * [Scene Color](Scene-Color-Node) * [Scene Depth](Scene-Depth-Node) + * [Scene Depth Difference](Scene-Depth-Difference) * [Screen](Screen-Node) * Texture * [Calculate Level Of Detail Texture 2D Node](Calculate-Level-Of-Detail-Texture-2D-Node) diff --git a/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs b/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs new file mode 100644 index 00000000000..7844d0fe3ae --- /dev/null +++ b/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs @@ -0,0 +1,130 @@ +using System.Reflection; +using UnityEngine; +using UnityEditor.Graphing; +using UnityEditor.ShaderGraph.Drawing.Controls; + +namespace UnityEditor.ShaderGraph +{ + [Title("Input", "Scene", "Scene Depth Difference")] + sealed class SceneDepthDifferenceNode : CodeFunctionNode, IMayRequireDepthTexture, IMayRequireScreenPosition, IMayRequirePosition + { + [SerializeField] + private DepthSamplingMode m_DepthSamplingMode = DepthSamplingMode.Linear01; + + [EnumControl("Sampling Mode")] + public DepthSamplingMode depthSamplingMode + { + get { return m_DepthSamplingMode; } + set + { + if (m_DepthSamplingMode == value) + return; + + m_DepthSamplingMode = value; + Dirty(ModificationScope.Graph); + } + } + + public SceneDepthDifferenceNode() + { + name = "Scene Depth Difference"; + synonyms = new string[] { "zbuffer", "zdepth", "difference" }; + UpdateNodeAfterDeserialization(); + } + + public override bool hasPreview { get { return false; } } + + protected override MethodInfo GetFunctionToConvert() + { + switch (m_DepthSamplingMode) + { + case DepthSamplingMode.Raw: + return GetType().GetMethod("Unity_SceneDepthDifference_Raw", BindingFlags.Static | BindingFlags.NonPublic); + case DepthSamplingMode.Eye: + return GetType().GetMethod("Unity_SceneDepthDifference_Eye", BindingFlags.Static | BindingFlags.NonPublic); + case DepthSamplingMode.Linear01: + default: + return GetType().GetMethod("Unity_SceneDepthDifference_Linear01", BindingFlags.Static | BindingFlags.NonPublic); + } + } + + static string Unity_SceneDepthDifference_Linear01( + [Slot(0, Binding.None, ShaderStageCapability.Fragment)] out Vector1 Out, + [Slot(1, Binding.ScreenPosition)] Vector2 SceneUV, + [Slot(2, Binding.WorldSpacePosition)] Vector2 PositionWS) + { + return +@" +{ + $precision dist = Remap01(length(PositionWS), _ProjectionParams.y, _ProjectionParams.z); +#if defined(UNITY_REVERSED_Z) + Out = Linear01Depth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams) - dist; +#else + Out = dist - Linear01Depth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams); +#endif +} +"; + } + + static string Unity_SceneDepthDifference_Raw( + [Slot(0, Binding.None, ShaderStageCapability.Fragment)] out Vector1 Out, + [Slot(1, Binding.ScreenPosition)] Vector2 SceneUV, + [Slot(2, Binding.WorldSpacePosition)] Vector3 PositionWS) + { + return +@" +{ + $precision deviceDepth = ComputeNormalizedDeviceCoordinatesWithZ(PositionWS, GetWorldToHClipMatrix()).z; +#if defined(UNITY_REVERSED_Z) + Out = deviceDepth - SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy); +#else + Out = SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy) - deviceDepth; +#endif +} +"; + } + + static string Unity_SceneDepthDifference_Eye( + [Slot(0, Binding.None, ShaderStageCapability.Fragment)] out Vector1 Out, + [Slot(1, Binding.ScreenPosition)] Vector2 SceneUV, + [Slot(2, Binding.WorldSpacePosition)] Vector3 PositionWS) + { + return +@" +{ + if (IsPerspectiveProjection()) + { +#if defined(UNITY_REVERSED_Z) + Out = LinearEyeDepth(ComputeWorldSpacePosition(SceneUV.xy, SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), UNITY_MATRIX_I_VP), UNITY_MATRIX_V) - length(PositionWS); +#else + Out = length(PositionWS) - LinearEyeDepth(ComputeWorldSpacePosition(SceneUV.xy, SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), UNITY_MATRIX_I_VP), UNITY_MATRIX_V); +#endif + } + else + { +#if defined(UNITY_REVERSED_Z) + Out = LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams) - length(PositionWS); +#else + Out = length(PositionWS) - LinearEyeDepth(SHADERGRAPH_SAMPLE_SCENE_DEPTH(SceneUV.xy), _ZBufferParams); +#endif + } +} +"; + } + + bool IMayRequireDepthTexture.RequiresDepthTexture(ShaderStageCapability stageCapability) + { + return true; + } + + bool IMayRequireScreenPosition.RequiresScreenPosition(ShaderStageCapability stageCapability) + { + return true; + } + + Internal.NeededCoordinateSpace IMayRequirePosition.RequiresPosition(ShaderStageCapability stageCapability) + { + return Internal.NeededCoordinateSpace.World; + } + } +} diff --git a/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs.meta b/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs.meta new file mode 100644 index 00000000000..40ff832251c --- /dev/null +++ b/com.unity.shadergraph/Editor/Data/Nodes/Input/Scene/SceneDepthDifferenceNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd9b023ec03b4e94a848c784c0be713e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: