From 5fd2bd80f93d32dd0215b4764cc0015a15551081 Mon Sep 17 00:00:00 2001 From: "pavlos.mavridis" Date: Thu, 20 Feb 2020 13:50:57 +0100 Subject: [PATCH 01/21] HDRP compositor tool, first code drop documentation typo, move everything in compositor namespace documentation typo bugfix: dynamically add/remove properties when shadergraph changes UI bugfix: properly compute height of UI elements Missing tooltips, button to remove the compositor toggle layers now works when player is paused add chroma keying in the compositor test Changelog, workflow bugfix Use Unity's built'in icons AOV bugfixes AOV tooltip was wrong bugfix: disabling the compositor now disables all compositor cameras Proper monitoring of shadergraph changes Updated test image + minor changes Use better names for internal cameras Bugfix: selecting the same res for a layer Bugfix: deleting in-use texture layers from shadergraph now works Bugfix: setting AOV to none now works properly Use the term SubLayer in the UI Improve AOV tooltip Camera properties in layers are properly refreshed UI: Move checkbox for overrides on the left side of the label Remove default compositor camera when also deleting the compositor Bugfixes: no orphans (delete all children when removing a layer), saving the layer list now works again Hdrp/docs/compositor (#6013) * Added docs review * Changed fodler for images Bugfixe: deleting layers Bugfix: reordering layers Bugfix: creating a new compositor fails Remove redundant check Fix wrong tooltip Bugfix when deleting camera stack layers Bugfix: handle window resize Bugfix: sub-layers without parent when re-ordering, preview remains visible for disabled layers Bugfix: more robust re-ordering (also moves children) Bugfix: mark scene dirty when adding a compositor Bugfix: display warning when alpha is configured properly Change video layer icon Bugfix: adding a layer filter does not reset the UI state Bugfix: do not show composition properties that are marked with hide-in-inspector Better / more clean layer injection implementation minor code clean up Clear color mode should only be editable on the first layer of a stack Bugfix: setup of custom render was not always called Bugfix: make sure additional camera data always exist in the layer/compositor camera Change test id to 9800 Fix typos mark scene dirty when removing or disabling the compositor Default composition shadergraph and profile are now cloned Serialized objects are now properly updated minor code change: range checks bugfix: error message appears at beginning remove layer list from the asset file add default camera layer when creating the compositor replace getter function with c-sharp property update asset in unit test --- .../Scenes/9x_Other/9800_Compositor.meta | 8 + .../Scenes/9x_Other/9800_Compositor.unity | 1675 +++++++++++++++++ .../9x_Other/9800_Compositor.unity.meta | 7 + .../Layer1 volume Profile.asset | 54 + .../Layer1 volume Profile.asset.meta | 8 + .../Layer2 Volume Profile.asset | 54 + .../Layer2 Volume Profile.asset.meta | 8 + .../Layer3 volume Profile.asset | 78 + .../Layer3 volume Profile.asset.meta | 8 + .../9800_Compositor/LightingData.asset | Bin 0 -> 19224 bytes .../9800_Compositor/LightingData.asset.meta | 8 + .../9800_Compositor/Shader Graphs.meta | 8 + .../Shader Graphs/TestCompositionGraph.asset | 35 + .../TestCompositionGraph.asset.meta | 8 + .../TestCompositionGraph.shadergraph | 212 +++ .../TestCompositionGraph.shadergraph.meta | 10 + .../9x_Other/9800_Compositor/greenscreen.png | 3 + .../9800_Compositor/greenscreen.png.meta | 93 + .../9800_Compositor/unity-master-black.png | 3 + .../unity-master-black.png.meta | 93 + .../Direct3D11/9800_Compositor.png | 3 + .../Direct3D11/9800_Compositor.png.meta | 93 + .../ProjectSettings/EditorBuildSettings.asset | 3 + .../CHANGELOG.md | 2 + .../Documentation~/Compositor-Main.md | 32 + .../Documentation~/Compositor-User-Guide.md | 51 + .../Documentation~/Compositor-User-Options.md | 74 + .../Compositor-CompositorSimpleGraph.png | 3 + .../Compositor-HDRPTemplateWithLogo.png | 3 + .../Documentation~/TableOfContents.md | 3 + .../Editor/Compositor.meta | 8 + .../Compositor/CompositionFilterUI.Drawer.cs | 49 + .../CompositionFilterUI.Drawer.cs.meta | 11 + .../Compositor/CompositionLayerUI.Drawers.cs | 212 +++ .../CompositionLayerUI.Drawers.cs.meta | 11 + .../CompositionManagerEditor.Styles.cs | 18 + .../CompositionManagerEditor.Styles.cs.meta | 11 + .../Compositor/CompositionManagerEditor.cs | 385 ++++ .../CompositionManagerEditor.cs.meta | 11 + .../Editor/Compositor/CompositionUtils.cs | 117 ++ .../Compositor/CompositionUtils.cs.meta | 11 + .../Editor/Compositor/CompositorWindow.cs | 161 ++ .../Compositor/CompositorWindow.cs.meta | 11 + .../Compositor/SerializedCompositionFilter.cs | 36 + .../SerializedCompositionFilter.cs.meta | 11 + .../Compositor/SerializedCompositionLayer.cs | 112 ++ .../SerializedCompositionLayer.cs.meta | 11 + .../SerializedCompositionManager.cs | 51 + .../SerializedCompositionManager.cs.meta | 11 + .../Compositor/SeriallizedShaderProperty.cs | 20 + .../SeriallizedShaderProperty.cs.meta | 11 + .../Compositor/ShaderPropertyUI.Drawers.cs | 75 + .../ShaderPropertyUI.Drawers.cs.meta | 11 + .../Runtime/Compositor.meta | 8 + .../Compositor/AdditionalCompositorData.cs | 40 + .../AdditionalCompositorData.cs.meta | 11 + .../Runtime/Compositor/AlphaInjection.cs | 61 + .../Runtime/Compositor/AlphaInjection.cs.meta | 11 + .../Runtime/Compositor/ChromaKeying.cs | 70 + .../Runtime/Compositor/ChromaKeying.cs.meta | 11 + .../Runtime/Compositor/CompositionFilter.cs | 29 + .../Compositor/CompositionFilter.cs.meta | 11 + .../Runtime/Compositor/CompositionLayer.cs | 646 +++++++ .../Compositor/CompositionLayer.cs.meta | 11 + .../Runtime/Compositor/CompositionManager.cs | 764 ++++++++ .../Compositor/CompositionManager.cs.meta | 13 + .../Runtime/Compositor/CompositionProfile.cs | 86 + .../Compositor/CompositionProfile.cs.meta | 11 + .../Runtime/Compositor/CustomClear.cs | 91 + .../Runtime/Compositor/CustomClear.cs.meta | 11 + .../Runtime/Compositor/ShaderGraphs.meta | 8 + .../DefaultCompositionGraph.asset | 15 + .../DefaultCompositionGraph.asset.meta | 8 + .../DefaultCompositionGraph.shadergraph | 56 + .../DefaultCompositionGraph.shadergraph.meta | 10 + .../Runtime/Compositor/ShaderProperty.cs | 41 + .../Runtime/Compositor/ShaderProperty.cs.meta | 11 + .../Runtime/Compositor/Shaders.meta | 8 + .../Compositor/Shaders/AlphaInjection.shader | 72 + .../Shaders/AlphaInjection.shader.meta | 9 + .../Compositor/Shaders/ChromaKeying.shader | 124 ++ .../Shaders/ChromaKeying.shader.meta | 9 + .../Compositor/Shaders/CustomClear.shader | 113 ++ .../Shaders/CustomClear.shader.meta | 9 + .../PostProcessing/PostProcessSystem.cs | 2 +- .../PostProcessing/Shaders/MotionBlur.compute | 53 +- 86 files changed, 6418 insertions(+), 20 deletions(-) create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/LightingData.asset create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/LightingData.asset.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png create mode 100644 TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png.meta create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png.meta create mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Compositor-Main.md create mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md create mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Options.md create mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-CompositorSimpleGraph.png create mode 100644 com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-HDRPTemplateWithLogo.png create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs create mode 100644 com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader.meta create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader create mode 100644 com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader.meta diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.meta new file mode 100644 index 00000000000..8cf668671e0 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 913b8efb655f41147bf563b5ce9f5c3c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity new file mode 100644 index 00000000000..699b3b29119 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity @@ -0,0 +1,1675 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 112000004, guid: 06729bd136f93aa4898017ef0aa0c10a, + type: 2} + m_LightingSettings: {fileID: 445078719} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!84 &29952411 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 640 + m_Height: 360 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 +--- !u!1 &112555164 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 112555168} + - component: {fileID: 112555167} + - component: {fileID: 112555166} + - component: {fileID: 112555165} + m_Layer: 12 + m_Name: Sphere_Layer3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!135 &112555165 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 112555164} + 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!23 &112555166 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 112555164} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, 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 &112555167 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 112555164} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &112555168 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 112555164} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.965, y: 0.75, z: -6.444} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &236318923 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 236318924} + - component: {fileID: 236318925} + m_Layer: 12 + m_Name: Layer3 volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &236318924 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 236318923} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 552454492} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &236318925 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 236318923} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: 4cfe13e3cda68304abbbef7c7e14305d, type: 2} +--- !u!1 &341057511 +GameObject: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 341057513} + - component: {fileID: 341057512} + m_Layer: 0 + m_Name: StaticLightingSky + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &341057512 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 341057511} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 441482e8936e35048a1dffac814e3ef8, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Profile: {fileID: 0} + m_StaticLightingSkyUniqueID: 0 + m_SkySettings: {fileID: 0} + m_SkySettingsFromProfile: {fileID: 0} +--- !u!4 &341057513 +Transform: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 341057511} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!850595691 &445078719 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + serializedVersion: 2 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 1 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_TextureCompression: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRRussianRouletteStartBounce: 2 + m_PVREnvironmentMIS: 1 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 +--- !u!21 &457105371 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Shader Graphs/TestCompositionGraph + m_Shader: {fileID: -6465566751694194690, guid: fea4ff21702af224eb16a7989dfdbd8a, + type: 3} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - GreenScreen: + m_Texture: {fileID: 1851699743} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - Layer0: + m_Texture: {fileID: 29952411} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - Layer1: + m_Texture: {fileID: 1749440052} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - Logo: + m_Texture: {fileID: 1169955371} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: [] + m_Colors: [] + m_BuildTextureStacks: [] +--- !u!1 &480375683 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 480375687} + - component: {fileID: 480375686} + - component: {fileID: 480375685} + - component: {fileID: 480375684} + m_Layer: 13 + m_Name: Cylinder_Layer4 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!136 &480375684 +CapsuleCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 480375683} + 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 &480375685 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 480375683} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, 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 &480375686 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 480375683} + m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &480375687 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 480375683} + m_LocalRotation: {x: 0.12454724, y: 0.12814632, z: 0.7055624, w: 0.6857465} + m_LocalPosition: {x: 1.747, y: -0.576, z: -6.3} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: -0.574, y: 20.580002, z: 91.52801} +--- !u!1 &552454491 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 552454492} + m_Layer: 0 + m_Name: Volumes + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &552454492 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 552454491} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.6175506, y: 0.023329973, z: -6.04135} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 236318924} + - {fileID: 775050992} + - {fileID: 583886034} + m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &583886033 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 583886034} + - component: {fileID: 583886035} + m_Layer: 13 + m_Name: Layer4 Volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &583886034 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 583886033} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 552454492} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &583886035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 583886033} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: b6e11bd621edeeb43a64506cf2cac8c5, type: 2} +--- !u!1 &775050991 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 775050992} + - component: {fileID: 775050993} + m_Layer: 10 + m_Name: Layer1 volume + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &775050992 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 775050991} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 552454492} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &775050993 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 775050991} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 172515602e62fb746b5d573b38a5fe58, type: 3} + m_Name: + m_EditorClassIdentifier: + isGlobal: 1 + priority: 0 + blendDistance: 0 + weight: 1 + sharedProfile: {fileID: 11400000, guid: f702b32cef038544a92000621a19b27f, type: 2} +--- !u!84 &1169955371 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 640 + m_Height: 360 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 +--- !u!1 &1323211074 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1323211078} + - component: {fileID: 1323211077} + - component: {fileID: 1323211076} + - component: {fileID: 1323211075} + m_Layer: 11 + m_Name: Cube_Layer2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &1323211075 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1323211074} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1323211076 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1323211074} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, 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 &1323211077 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1323211074} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1323211078 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1323211074} + m_LocalRotation: {x: -0, y: 0.19811651, z: -0, w: 0.9801785} + m_LocalPosition: {x: -0.735, y: 0.797, z: -5.891} + m_LocalScale: {x: 1.6429179, y: 1.6429179, z: 1.6429179} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 22.854002, z: 0} +--- !u!1 &1378491895 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1378491897} + - component: {fileID: 1378491896} + - component: {fileID: 1378491898} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1378491896 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1378491895} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 3.1415927 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 2 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1378491897 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1378491895} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!114 &1378491898 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1378491895} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a68c43fe1f2a47cfa234b5eeaa98012, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Version: 10 + m_ObsoleteShadowResolutionTier: 1 + m_ObsoleteUseShadowQualitySettings: 0 + m_ObsoleteCustomShadowResolution: 512 + m_ObsoleteContactShadows: 0 + m_PointlightHDType: 0 + m_SpotLightShape: 0 + m_AreaLightShape: 0 + m_Intensity: 3.1415927 + m_EnableSpotReflector: 0 + m_LuxAtDistance: 1 + m_InnerSpotPercent: 0 + m_LightDimmer: 1 + m_VolumetricDimmer: 1 + m_LightUnit: 2 + m_FadeDistance: 10000 + m_AffectDiffuse: 1 + m_AffectSpecular: 1 + m_NonLightmappedOnly: 0 + m_ShapeWidth: 0.5 + m_ShapeHeight: 0.5 + m_AspectRatio: 1 + m_ShapeRadius: 0 + m_SoftnessScale: 1 + m_UseCustomSpotLightShadowCone: 0 + m_CustomSpotLightShadowCone: 30 + m_MaxSmoothness: 0.99 + m_ApplyRangeAttenuation: 1 + m_DisplayAreaLightEmissiveMesh: 0 + m_AreaLightCookie: {fileID: 0} + m_AreaLightShadowCone: 120 + m_UseScreenSpaceShadows: 0 + m_InteractsWithSky: 1 + m_AngularDiameter: 0 + m_FlareSize: 2 + m_FlareTint: {r: 1, g: 1, b: 1, a: 1} + m_FlareFalloff: 4 + m_SurfaceTexture: {fileID: 0} + m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} + m_Distance: 150000000 + m_UseRayTracedShadows: 0 + m_NumRayTracingSamples: 4 + m_FilterTracedShadow: 1 + m_FilterSizeTraced: 16 + m_SunLightConeAngle: 0.5 + m_LightShadowRadius: 0.5 + m_SemiTransparentShadow: 0 + m_ColorShadow: 1 + m_EvsmExponent: 15 + m_EvsmLightLeakBias: 0 + m_EvsmVarianceBias: 0.00001 + m_EvsmBlurPasses: 0 + m_LightlayersMask: 1 + m_LinkShadowLayers: 1 + m_ShadowNearPlane: 0.1 + m_BlockerSampleCount: 24 + m_FilterSampleCount: 16 + m_MinFilterSize: 0.01 + m_KernelSize: 5 + m_LightAngle: 1 + m_MaxDepthBias: 0.001 + m_ShadowResolution: + m_Override: 512 + m_UseOverride: 1 + m_Level: 1 + m_ShadowDimmer: 1 + m_VolumetricShadowDimmer: 1 + m_ShadowFadeDistance: 10000 + m_UseContactShadow: + m_Override: 0 + m_UseOverride: 1 + m_Level: 0 + m_RayTracedContactShadow: 0 + m_ShadowTint: {r: 0, g: 0, b: 0, a: 1} + m_PenumbraTint: 0 + m_NormalBias: 0.75 + m_SlopeBias: 0.5 + m_ShadowUpdateMode: 0 + m_BarnDoorAngle: 90 + m_BarnDoorLength: 0.05 + m_ShadowCascadeRatios: + - 0.05 + - 0.2 + - 0.3 + m_ShadowCascadeBorders: + - 0.2 + - 0.2 + - 0.2 + - 0.2 + m_ShadowAlgorithm: 0 + m_ShadowVariant: 0 + m_ShadowPrecision: 0 + useOldInspector: 0 + useVolumetric: 1 + featuresFoldout: 1 + showAdditionalSettings: 0 + m_AreaLightEmissiveMeshShadowCastingMode: 0 + m_AreaLightEmissiveMeshMotionVectorGenerationMode: 0 +--- !u!84 &1749440052 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 320 + m_Height: 180 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 +--- !u!1 &1827381199 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1827381203} + - component: {fileID: 1827381202} + - component: {fileID: 1827381201} + - component: {fileID: 1827381200} + m_Layer: 10 + m_Name: Cube_Layer1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!65 &1827381200 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1827381199} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &1827381201 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1827381199} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 73c176f402d2c2f4d929aa5da7585d17, 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 &1827381202 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1827381199} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!4 &1827381203 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1827381199} + m_LocalRotation: {x: -0, y: 0.19488715, z: -0, w: 0.9808257} + m_LocalPosition: {x: 0.65, y: -0.451, z: -5.891} + m_LocalScale: {x: 1.4427, y: 1.4427, z: 1.4427} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 22.476002, z: 0} +--- !u!84 &1851699743 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 640 + m_Height: 360 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 +--- !u!1001 &1987531043 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 1132393308280272, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_Name + value: HDRP_Test_Camera + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.x + value: 1.062 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.y + value: 0.515 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalPosition.z + value: -11.06 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.x + value: 0.031612877 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.y + value: -0.05111238 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.z + value: -0.00029601547 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalRotation.w + value: 0.9981924 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 3.617 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: -5.8690004 + objectReference: {fileID: 0} + - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: -0.21900001 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_FocalLength + value: 25.734083 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: field of view + value: 50 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_TargetDisplay + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_TargetTexture + value: + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_Version + value: 7 + objectReference: {fileID: 0} + - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data1 + value: 70005818916701 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.size + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: renderPipelineAsset + value: + objectReference: {fileID: 11400000, guid: d39c8f0447409a541a78d12c526207ee, + type: 2} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.data[0].m_Mode + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: doBeforeTest.m_PersistentCalls.m_Calls.Array.data[0].m_CallState + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: xrCompatible + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: waitFrames + value: 5 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} +--- !u!20 &1987531044 stripped +Camera: + m_CorrespondingSourceObject: {fileID: 20109210616973140, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + m_PrefabInstance: {fileID: 1987531043} + m_PrefabAsset: {fileID: 0} +--- !u!1 &2062691839 +GameObject: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2062691841} + - component: {fileID: 2062691840} + m_Layer: 0 + m_Name: HDRP Compositor + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2062691840 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2062691839} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7e46d2393531446428690b5a5f21645d, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 457105371} + m_OutputDisplay: 0 + m_InputLayers: + - m_LayerName: Layer0 + m_OutputTarget: 0 + m_ClearDepth: 0 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 1 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 0 + m_OverrideVolumeMask: 0 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 0 + m_LayerPositionInStack: 0 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 29952411} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: CameraStackL1 + m_OutputTarget: 1 + m_ClearDepth: 1 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 0 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 1024 + m_OverrideVolumeMask: 1 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 1024 + m_LayerPositionInStack: 0 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 0} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: CameraStackL2 + m_OutputTarget: 1 + m_ClearDepth: 0 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 0 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 2048 + m_OverrideVolumeMask: 1 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 0 + m_LayerPositionInStack: 1 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 0} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: CameraStackL3 + m_OutputTarget: 1 + m_ClearDepth: 0 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 0 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 8192 + m_OverrideVolumeMask: 1 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 8192 + m_LayerPositionInStack: 2 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 0} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: Layer1 + m_OutputTarget: 0 + m_ClearDepth: 0 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 2 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 0 + m_OverrideVolumeMask: 0 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 0 + m_LayerPositionInStack: 0 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 1749440052} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: Sphere layer + m_OutputTarget: 1 + m_ClearDepth: 1 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 0 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4096 + m_OverrideVolumeMask: 1 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 4096 + m_LayerPositionInStack: 0 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 0} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: Logo + m_OutputTarget: 0 + m_ClearDepth: 0 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 1 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 0 + m_OverrideVolumeMask: 0 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 0 + m_LayerPositionInStack: 0 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 1169955371} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: logo (alpha) + m_OutputTarget: 1 + m_ClearDepth: 1 + m_ClearAlpha: 0 + m_OutputRenderer: {fileID: 0} + m_Type: 2 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 2800000, guid: 18424860621f1f34c84767018c9508d0, type: 3} + m_BackgroundFit: 0 + m_ResolutionScale: 0 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 0 + m_OverrideVolumeMask: 0 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 0 + m_LayerPositionInStack: 0 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 0} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: GreenScreen + m_OutputTarget: 0 + m_ClearDepth: 0 + m_ClearAlpha: 1 + m_OutputRenderer: {fileID: 0} + m_Type: 0 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 0} + m_BackgroundFit: 0 + m_ResolutionScale: 1 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 0 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 0 + m_OverrideVolumeMask: 0 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 0 + m_LayerPositionInStack: 0 + m_InputFilters: [] + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 1851699743} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + - m_LayerName: New Layer + m_OutputTarget: 1 + m_ClearDepth: 1 + m_ClearAlpha: 0 + m_OutputRenderer: {fileID: 0} + m_Type: 2 + m_Camera: {fileID: 1987531044} + m_InputVideo: {fileID: 0} + m_InputTexture: {fileID: 2800000, guid: 64f6f649f205d4c4fba3217f1f8023e7, type: 3} + m_BackgroundFit: 0 + m_ResolutionScale: 1 + m_ColorBufferFormat: 24 + m_OverrideAntialiasing: 1 + m_Antialiasing: 0 + m_OverrideClearMode: 0 + m_ClearMode: 0 + m_OverrideCullingMask: 1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 0 + m_OverrideVolumeMask: 1 + m_VolumeMask: + serializedVersion: 2 + m_Bits: 0 + m_LayerPositionInStack: 0 + m_InputFilters: + - m_Type: 0 + m_MaskColor: {r: 0.09431517, g: 1, b: 0, a: 0} + m_KeyThreshold: 2.67 + m_KeyTolerance: 1.31 + m_SpillRemoval: 0 + m_AlphaMask: {fileID: 0} + m_AOVBitmask: 0 + m_AOVRenderTargets: [] + m_RenderTarget: {fileID: 0} + m_ClearsBackGround: 0 + m_Show: 1 + m_LayerCamera: {fileID: 0} + m_Shader: {fileID: -6465566751694194690, guid: fea4ff21702af224eb16a7989dfdbd8a, + type: 3} + m_CompositionProfile: {fileID: 11400000, guid: ee50ee55419ae05409d452c285f7f70a, + type: 2} + m_OutputCamera: {fileID: 1987531044} +--- !u!4 &2062691841 +Transform: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2062691839} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity.meta new file mode 100644 index 00000000000..3c0740b7444 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 708bd21bc204d2342bc1702a5a6de1d3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset new file mode 100644 index 00000000000..6d08dff1078 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset @@ -0,0 +1,54 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: Layer1 volume Profile + m_EditorClassIdentifier: + components: + - {fileID: 1764110905128655486} +--- !u!114 &1764110905128655486 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4b8bcdf71d7fafa419fca1ed162f5fc9, type: 3} + m_Name: ColorAdjustments + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + postExposure: + m_OverrideState: 0 + m_Value: 0 + contrast: + m_OverrideState: 0 + m_Value: 0 + min: -100 + max: 100 + colorFilter: + m_OverrideState: 1 + m_Value: {r: 0.735849, g: 0.3436276, b: 0.3436276, a: 1} + hdr: 1 + showAlpha: 0 + showEyeDropper: 1 + hueShift: + m_OverrideState: 0 + m_Value: 0 + min: -180 + max: 180 + saturation: + m_OverrideState: 0 + m_Value: 0 + min: -100 + max: 100 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset.meta new file mode 100644 index 00000000000..d74aa6609e7 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer1 volume Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f702b32cef038544a92000621a19b27f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset new file mode 100644 index 00000000000..94c3f96b542 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset @@ -0,0 +1,54 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-8491569478184420757 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4b8bcdf71d7fafa419fca1ed162f5fc9, type: 3} + m_Name: ColorAdjustments + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + postExposure: + m_OverrideState: 0 + m_Value: 0 + contrast: + m_OverrideState: 0 + m_Value: 0 + min: -100 + max: 100 + colorFilter: + m_OverrideState: 1 + m_Value: {r: 0.09092929, g: 0.7735849, b: 0.0693307, a: 1} + hdr: 1 + showAlpha: 0 + showEyeDropper: 1 + hueShift: + m_OverrideState: 0 + m_Value: 0 + min: -180 + max: 180 + saturation: + m_OverrideState: 0 + m_Value: 0 + min: -100 + max: 100 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: Layer2 Volume Profile + m_EditorClassIdentifier: + components: + - {fileID: -8491569478184420757} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset.meta new file mode 100644 index 00000000000..1d86aa4322c --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer2 Volume Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b6e11bd621edeeb43a64506cf2cac8c5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset new file mode 100644 index 00000000000..a567e6652e4 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset @@ -0,0 +1,78 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3} + m_Name: Layer3 volume Profile + m_EditorClassIdentifier: + components: + - {fileID: 7879876109548495037} + - {fileID: 7551045031281516481} +--- !u!114 &7551045031281516481 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4b8bcdf71d7fafa419fca1ed162f5fc9, type: 3} + m_Name: ColorAdjustments + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + postExposure: + m_OverrideState: 0 + m_Value: 0 + contrast: + m_OverrideState: 0 + m_Value: 0 + min: -100 + max: 100 + colorFilter: + m_OverrideState: 1 + m_Value: {r: 0.20914915, g: 0.7809654, b: 0.9433962, a: 1} + hdr: 1 + showAlpha: 0 + showEyeDropper: 1 + hueShift: + m_OverrideState: 0 + m_Value: 0 + min: -180 + max: 180 + saturation: + m_OverrideState: 0 + m_Value: 0 + min: -100 + max: 100 +--- !u!114 &7879876109548495037 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: da5ab44aadfb1804db5fd470983ac1b8, type: 3} + m_Name: LiftGammaGain + m_EditorClassIdentifier: + active: 1 + m_AdvancedMode: 0 + lift: + m_OverrideState: 0 + m_Value: {x: 1, y: 1, z: 1, w: 0} + gamma: + m_OverrideState: 1 + m_Value: {x: 1, y: 1, z: 1, w: 0.19011404} + gain: + m_OverrideState: 0 + m_Value: {x: 1, y: 1, z: 1, w: 0} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset.meta new file mode 100644 index 00000000000..a7c847a0a7f --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Layer3 volume Profile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4cfe13e3cda68304abbbef7c7e14305d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/LightingData.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/LightingData.asset new file mode 100644 index 0000000000000000000000000000000000000000..6b7863b34f3deb7d76f944cd44343d833fba1958 GIT binary patch literal 19224 zcmeI4f0$fVdB^YUk8B8-7!ZgFgiU~uge2@t5(os-NjASWiT}qdEc3P=FGd~ zdH6&7wCCA-?z!i4&wJlVLnopE<MD>}yONWt?JEv!7&7rDL>*N+gPM zo51Ig{8Q<0G;Q`8MGGm1{CTubvHW^dSHeVH`J)UkmQJXY-{A3Ba7|56%&~mv;P%gz zf0)+x97LUk9=2KnP?9~pi#ep{$&2lMxOyf%1&uKh{o<2_#I=zk=55}8f0 zpx)8{C;<_^o669i`VqX(AFc2&Fh54&PclDN;ooG=K2~UjL&3+PiB6C!lyECRQNRJ zQxravIs81DVu96f4)YVEkjlan%uiDI>C8`7_*u-SDSQ$0Qxv|0`E-RZXFkK@qk`2m z{;P=7Uog|~V(F|HMLhV=dV=sj#5vdhT>qH`oGFTbRSff}qjl$fSLWImIbTjV4Ei_=^5@5=Z|Ms4OD0iTdxvhq`$#tW2j83@g;d7)e3|q#?(tE<9i-p&#OV*uIVYii;I}Ye;83)& z{C4JND*PViXDR#v<_i`6CFW-<{AuPNQ24XV7b*OC=6|B_A2ClV{59r_75*mkB?^Cw zd9%XnYV7@4s_?PQmnnP#^W`45&!4Hp>xivT_^HfSdfeJ~f;j9O&(e|Xdlh&RnN5}U zeU5+#kNPjg5=xCGM+W=eLsu04U1Lb2$&m>c|6OZHqsfs87yn&nNTbP-!GC{2@)vRc zT1&(hD*YGF=xD0!-})$|GWZGfeg*%;=dnMxcD#L^`c4i7ysQFg;W+U z{+m*`_-}{8#eX{$F8-VLxb@#L6rFnQvG40p^1W{}uBg zg}==l-%-&d_otRVd|@Ad8iiCAPWEm1WeOk9{KE>L!2EKBpTPVIg->H%RQPP>S1NoS z^Q#oTkoiXxzJ&QlJ#PKGg*cwSSA!SJCsq3QH9*NIcl~>38JQCNdke{ie?$JqJYE-& z?!`P`|5}gNJMXt2_qhFjl<)WJ6prh|KCbt;z5We+{ZDw@z5Wdzcdw7{_-I0WNBoiN z-x!5dhJB*{xAOIG^0<5bPkG$E{>@eRe3Fmr$B6B!;Hxv+x(ltjzK$>-w6+#@< z3Vpd{gM~1g&-7&%1-)CAXL`bxrBrB56}qWl&TGwuU8#Y>?rp={dyj)C_i*q*z*^oNb z(U&u4mk;Rt@&UCdA5fb$sX{I@ICpSfSI}#ULDbjYA7EJ217LQL*s_=rBR?E=2A;G9S#O7Q~B1zw5t1Xb8wlGf$^QCaQ6wZ*s0x6s+g*Xi!i!RBImxRYl(&HuZagyJ= zWnEWSJ}gk7Ewdv;clz=f+`>GS*Y;&gw+Z()Ogmj%lj^6FmZUBT)6IQhS68Mp6J}`~ z+WNc0T&6SCvoe+I?aO95^Q#j}=w^HI(O593GSSblBC1Ir`tdxY6lCV+|B!zov++ba2 zXU_nVM7nR7mp&U~jiXUye56AE1v$BLBOgl`_q zImhX6G;KJ?<*@+Y@$WR}Eb^&K742R54IV$VIcJf7nAhHwKgQ#K_&H~MXKtnK2-?Qc z7EKuc{dDi8fB5cm$KUPWc#qq6f^MqEGaI%LD^kX(@}1x)s*fdw;#%%I0lrJ|?2%MM z9PgocCY?lk%sEFno{3M=H|>>FkN#oK+2!_|Mf!KF;YG@A!Z&%;{xGlQ_TS3Ky8z^4 z&UqyH6TSAX{7D|S@^7Vj$j6-XNb)h~?CR&rpX_maf9|1r+#k$2k92<;!IPA6s=Pl_ zsNU7D){H;y5A>hvaXY6d{Gr`N4%Jt4~LYQ-Qc`W!A)%}n* zjNdGeyZ(teXLo#D|HPcL%VS2r*Qp+{^)$mN#=MiBN|k7j zI9-j)Zw3j4pULg#Dm=-2p2Al!$DDJu>#t>wIp=EpJm&PAtI988jydOQ?J=j0{$tL$ z8o!u1o>kTOrOX#9e31Fs3crFm=A5g^zlQlDg@1xM=A5gw-^Dzs@Y|R#R`{LFmni&R z=FJMnoF2w^slp#+zD(gyGGDInuQ6Yt@aLGXRQUIqw-ilpwU88w)}MFm~*bi z7cj@1b2WYz^YcA!^*ft5^uwHUwf3SP=A5f>(eFZqi+-4MuGU`kyU62p!F4o#?W7<5 z1(0hVE?f75C`lUVY+DE8x z(XUJ4qTe=!i+sQnNXy%x6 zuEsH^ih9gBSK~97Z&&zS=9qJ?*8T&`G3V@Z8^2c&NBrIaUZjjuW&FmRb1W$ovfTK6 z8F(2Ro+jC3SLQc4%sIQW_N7J{Y3!yEo_@JfE)ixSi9)dpn*V z*BD-;+$PMaM!zq1QnmYhsyEN4Uy^*p$B!A_NV!ciCoA#sTB>&Ar=7Ev`15gvOZ>r{ zbG7yof3Ekqeg2N6&Y^#pb9V1vy@^l95`_Mkb9TA?%~s;mClxO7=|+W1e7Z^D5}!V$ zaEVVhD_r8!E`>{cx<%m+@#!{&OMKd`aEVWU zp>T;$w|m^$$4P7-e`$D;a+~BgWwDPtsM_@pYd>NidlWAAai_w?KK@GKVjq94aIufO z6fX90x5C9f?oqhd$6ketecY>Xv5(IxT3K#phPvK%8_bXiN<8Kr$_VIa-+xQ+Q z`#}7E0K7;UCwe|Pzo|V)^|7Q-*oqt99|A99!xxfl#CLq#f5GGRW=-=3I*0y(hZUY? z{>3UB&zDP?KceuaK_&sP*K{_~W=#ecr4aPgm~6)yhsjKal#_9)mW0-}1O?AI~aW?Bh9wi+y}s;bI@(QMlO0-z!|~`Ain-Hc#$$rmGSk5 zR6kOD{Smk{Hf8&Liuj87M6s}fyWgk(qHwXlmlZDd_lm;B{(h`*vA=&+xY*xM6fXAn zs=~$oUQ@W(-%k}T_V+V|i~aqZ!o~hxSGd^U8wwZu`*($l{rz0wVt)rbZtd^uY=8d& zUZjjurTx80^&{EeFTka-Dc1!rl5E)D1UmjtkK6B;gLDr41^-orqJ?_TO zUnyMd_n^YXe*atHV!yvuxY+M+6fXArmcqq;f2(k@-?tSm_WM5y7yJF4!o_}v6)yIR zo9o_RJN{z7F@=l$)+k);w^rd|zjYqB_A`d;1NKwzackcbh$Fs^0x!~uoGR_R0X!)b zeRbbo@$Y-+uav;2lWf@c5mbAa$6fu#D0~&`f4IWWXMTjo?fg=jIQsV<@M1|l($)Qa zU@Ukt%H8=T{LV*zr9|TsMCX^@>v4B}X}rQ^e(6Y$Tm5&k{`j|3BkBJ>@MK9n($&@f zXivVY|1lnS^*>hOqW=VsTm5fj{ofB>jOyo(|3vVoqTJPgQiXi1Z@7zO!@kB-v*SGZ z);=Glb723+SF{)V{Vwy#RrssK4$?N7+MnQYYrhSnto%lWPhdX9<8|iWT+Jj-D3}VK zqyi`TeJep6_Io0DQ7GED<98DHQ&H}Y-^t)*OyyehZ#pr4kU!0n@BV&&3V5{BVe&2z85el%50eeZXZ`jWsx<1DLtO{-x>}9gsu)=k5 z9!n$N)yi4ZxUDnHhDI1x+?pfWn=AFE`tx=nA(eP>tpGY_X(ksrYU@s=`?h1jAfd(U z+QY%ZK#tb-Mr1XoI=e%x>E#u_rnOnMna8ywhjIiB*7T*r>dQ8H<>TVs4y^4of?Bex zGubee!%EBl%}Y9EVEe=L`jD3F=E9u00nUNBe`~^g_o86nL)Zs}FqcbZvP*}usoqTI zc^lf=c`5LALCxI**-N6l2kWqDob5VL=ZH@Wq>`kSivndSaX8rDLyK(fZJ;H`f7A<$ zS97N;hPP!YEf9u3tn0Wq>@2jT$*eM6nJ^a=Qn_tm!B+EuU56el%bGC>v!>yiRDVA? zDA})8FLy9sZYfnQ*{;4EEds~--5lTbAZ_oZXx!G`l5HEx7sB2kZ+0zdT9ZpF^Vr6yAHM%mnJYSOr04w^9;T!9YNOY>B zGP47{_S}~21wrIsqju*?_lQh{Lsh9jtIX-1uNx@PIB>v>Rt5c7dtX{#ZSJHU)4on# zt{q)xEq5Ag*G=p*_C+3AwW58fpH{|a2E(*zM|zkxnLN(M$e8{5u&aj*nheWC$>xEM zkOW5J@rdW4qt(QqzI5~W`QRLH2yn=*qvF1r*`=GOQaxVH$9Vh?yL5bQ zsy9q?{Crn0Ez~dbZWJuP|5`B`)S1O**w?&$AH6=6kK6ers*daTa;pot{)zUVJU(gl z{*CnRY0?79F^7a?_N(^YH*4I1&5LiicS*zGtIzGX=QTVw`@vbs+073f*Kp@uFHXjk zLpkB@97<}SlcqQK^ku^thjRKmo`aWqi34y*bhUBHR5Koxjb;3JI4bcU)$uCQ=DaLD zQkJ(tuZH<^2ImY$|5qf|7U#k8F?sk*@Qtqq!Pdn<`}XY{o=pDIiUUghc6Z46SUNL0 XuCwFTHvaF9?Oqz&)^|O&mG=63F&t5| literal 0 HcmV?d00001 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/LightingData.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/LightingData.asset.meta new file mode 100644 index 00000000000..33cae466691 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/LightingData.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06729bd136f93aa4898017ef0aa0c10a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs.meta new file mode 100644 index 00000000000..30390b1aeee --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0d1b9379e0290a247bd19de9672b5e14 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset new file mode 100644 index 00000000000..86b1ff566d8 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84e9807569cd8924fa417ecdee3f8eaf, type: 3} + m_Name: TestCompositionGraph + m_EditorClassIdentifier: + m_ShaderProperties: + - m_PropertyName: Layer0 + m_Type: 4 + m_Value: {x: 0, y: 0, z: 0, w: 0} + m_RangeLimits: {x: 0, y: 0} + m_Flags: 0 + - m_PropertyName: Layer1 + m_Type: 4 + m_Value: {x: 0, y: 0, z: 0, w: 0} + m_RangeLimits: {x: 0, y: 0} + m_Flags: 0 + - m_PropertyName: Logo + m_Type: 4 + m_Value: {x: 0, y: 0, z: 0, w: 0} + m_RangeLimits: {x: 0, y: 0} + m_Flags: 0 + - m_PropertyName: GreenScreen + m_Type: 4 + m_Value: {x: 0, y: 0, z: 0, w: 0} + m_RangeLimits: {x: 0, y: 0} + m_Flags: 0 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset.meta new file mode 100644 index 00000000000..34b2e067557 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ee50ee55419ae05409d452c285f7f70a +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph new file mode 100644 index 00000000000..3e194bcfb50 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph @@ -0,0 +1,212 @@ +{ + "m_SerializedProperties": [ + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty" + }, + "JSONnodeData": "{\n \"m_Guid\": {\n \"m_GuidSerialized\": \"7af8d5f4-e5df-4af6-8813-20abecd259b0\"\n },\n \"m_Name\": \"Layer0\",\n \"m_DefaultReferenceName\": \"Texture2D_606D5EB1\",\n \"m_OverrideReferenceName\": \"Layer0\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Precision\": 0,\n \"m_GPUInstanced\": false,\n \"m_Hidden\": false,\n \"m_Value\": {\n \"m_SerializedTexture\": \"{\\\"texture\\\":{\\\"instanceID\\\":0}}\",\n \"m_Guid\": \"\"\n },\n \"m_Modifiable\": true,\n \"m_DefaultType\": 1\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty" + }, + "JSONnodeData": "{\n \"m_Guid\": {\n \"m_GuidSerialized\": \"a8b03ce6-2cef-45a9-9d35-3be750936dde\"\n },\n \"m_Name\": \"Layer1\",\n \"m_DefaultReferenceName\": \"Texture2D_838DEF22\",\n \"m_OverrideReferenceName\": \"Layer1\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Precision\": 0,\n \"m_GPUInstanced\": false,\n \"m_Hidden\": false,\n \"m_Value\": {\n \"m_SerializedTexture\": \"{\\\"texture\\\":{\\\"instanceID\\\":0}}\",\n \"m_Guid\": \"\"\n },\n \"m_Modifiable\": true,\n \"m_DefaultType\": 1\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty" + }, + "JSONnodeData": "{\n \"m_Guid\": {\n \"m_GuidSerialized\": \"2f87a21c-8bcf-472d-8bf2-1fbdc76faaf9\"\n },\n \"m_Name\": \"Logo\",\n \"m_DefaultReferenceName\": \"Texture2D_F22A8E7\",\n \"m_OverrideReferenceName\": \"Logo\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Precision\": 0,\n \"m_GPUInstanced\": false,\n \"m_Hidden\": false,\n \"m_Value\": {\n \"m_SerializedTexture\": \"{\\\"texture\\\":{\\\"instanceID\\\":0}}\",\n \"m_Guid\": \"\"\n },\n \"m_Modifiable\": true,\n \"m_DefaultType\": 0\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty" + }, + "JSONnodeData": "{\n \"m_Guid\": {\n \"m_GuidSerialized\": \"95538956-d4f7-4713-b3f3-f11ce97b838c\"\n },\n \"m_Name\": \"GreenScreen\",\n \"m_DefaultReferenceName\": \"Texture2D_4DC29573\",\n \"m_OverrideReferenceName\": \"GreenScreen\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Precision\": 0,\n \"m_GPUInstanced\": false,\n \"m_Hidden\": false,\n \"m_Value\": {\n \"m_SerializedTexture\": \"{\\\"texture\\\":{\\\"instanceID\\\":0}}\",\n \"m_Guid\": \"\"\n },\n \"m_Modifiable\": true,\n \"m_DefaultType\": 0\n}" + } + ], + "m_SerializedKeywords": [], + "m_SerializableNodes": [ + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.SampleTexture2DNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"3a5a54b9-f651-4ba5-a616-d1a5db536739\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Sample Texture 2D\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -334.9999694824219,\n \"y\": 329.0,\n \"width\": 182.0,\n \"height\": 251.00001525878907\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Texture\\\": {\\n \\\"m_SerializedTexture\\\": \\\"{\\\\\\\"texture\\\\\\\":{\\\\\\\"instanceID\\\\\\\":0}}\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n },\\n \\\"m_DefaultType\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ],\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_TextureType\": 0,\n \"m_NormalMapSpace\": 0\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.PropertyNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"42624434-facc-4adf-946a-da3f797b0781\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Property\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -616.0,\n \"y\": -230.0,\n \"width\": 0.0,\n \"height\": 0.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Layer0\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_PropertyGuidSerialized\": \"7af8d5f4-e5df-4af6-8813-20abecd259b0\"\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.SampleTexture2DNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"66bd1b67-584c-43ba-97ef-995aacb5957f\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Sample Texture 2D\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -349.0,\n \"y\": 33.0,\n \"width\": 182.0,\n \"height\": 251.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Texture\\\": {\\n \\\"m_SerializedTexture\\\": \\\"{\\\\\\\"texture\\\\\\\":{\\\\\\\"instanceID\\\\\\\":0}}\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n },\\n \\\"m_DefaultType\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ],\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_TextureType\": 0,\n \"m_NormalMapSpace\": 0\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.UnlitMasterNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"6ab590f0-4789-46ad-b3b5-4ec43a4583bf\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Unlit Master\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 759.0000610351563,\n \"y\": 168.0,\n \"width\": 200.0,\n \"height\": 197.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Vertex Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.NormalMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 10,\\n \\\"m_DisplayName\\\": \\\"Vertex Normal\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Normal\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.TangentMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 11,\\n \\\"m_DisplayName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.7353569269180298,\\n \\\"y\\\": 0.7353569269180298,\\n \\\"z\\\": 0.7353569269180298\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_ColorMode\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.5,\\n \\\"m_DefaultValue\\\": 0.5,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_DOTSInstancing\": false,\n \"m_SerializableSubShaders\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.Rendering.HighDefinition.UnlitSubShader\"\n },\n \"JSONnodeData\": \"{}\"\n }\n ],\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": true,\n \"m_AddPrecomputedVelocity\": false\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.SampleTexture2DNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"6ceb6624-cfd2-45ea-bdeb-11a444633963\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Sample Texture 2D\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -104.99996185302735,\n \"y\": 588.0,\n \"width\": 182.0,\n \"height\": 251.00001525878907\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Texture\\\": {\\n \\\"m_SerializedTexture\\\": \\\"{\\\\\\\"texture\\\\\\\":{\\\\\\\"instanceID\\\\\\\":0}}\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n },\\n \\\"m_DefaultType\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ],\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_TextureType\": 0,\n \"m_NormalMapSpace\": 0\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.MultiplyNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"73f6f04e-0873-43e8-b897-3aca40c60d79\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Multiply\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 327.00006103515627,\n \"y\": 546.0,\n \"width\": 124.0,\n \"height\": 118.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 0.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 0.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 0.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 0.30000001192092898,\\n \\\"e01\\\": 2.0,\\n \\\"e02\\\": 2.0,\\n \\\"e03\\\": 2.0,\\n \\\"e10\\\": 2.0,\\n \\\"e11\\\": 2.0,\\n \\\"e12\\\": 2.0,\\n \\\"e13\\\": 2.0,\\n \\\"e20\\\": 2.0,\\n \\\"e21\\\": 2.0,\\n \\\"e22\\\": 2.0,\\n \\\"e23\\\": 2.0,\\n \\\"e30\\\": 2.0,\\n \\\"e31\\\": 2.0,\\n \\\"e32\\\": 2.0,\\n \\\"e33\\\": 2.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicValueMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"e00\\\": 0.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 0.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 0.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"e00\\\": 1.0,\\n \\\"e01\\\": 0.0,\\n \\\"e02\\\": 0.0,\\n \\\"e03\\\": 0.0,\\n \\\"e10\\\": 0.0,\\n \\\"e11\\\": 1.0,\\n \\\"e12\\\": 0.0,\\n \\\"e13\\\": 0.0,\\n \\\"e20\\\": 0.0,\\n \\\"e21\\\": 0.0,\\n \\\"e22\\\": 1.0,\\n \\\"e23\\\": 0.0,\\n \\\"e30\\\": 0.0,\\n \\\"e31\\\": 0.0,\\n \\\"e32\\\": 0.0,\\n \\\"e33\\\": 1.0\\n }\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.LerpNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"9a17ddd7-9b75-40f0-9a3a-30c781797fb3\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Lerp\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 6.000047206878662,\n \"y\": -95.0,\n \"width\": 128.0,\n \"height\": 142.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 1.0,\\n \\\"y\\\": 1.0,\\n \\\"z\\\": 1.0,\\n \\\"w\\\": 1.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"T\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"T\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.SampleTexture2DNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"a03315a2-d94b-4cd3-b395-1f9d0d445fc5\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Sample Texture 2D\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -361.0,\n \"y\": -272.0,\n \"width\": 182.0,\n \"height\": 251.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Texture\\\": {\\n \\\"m_SerializedTexture\\\": \\\"{\\\\\\\"texture\\\\\\\":{\\\\\\\"instanceID\\\\\\\":0}}\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n },\\n \\\"m_DefaultType\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ],\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_TextureType\": 0,\n \"m_NormalMapSpace\": 0\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.PropertyNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"b194a920-c717-45c2-97af-93bff33ac4a4\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Property\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -621.0,\n \"y\": 372.0,\n \"width\": 149.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"GreenScreen\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_PropertyGuidSerialized\": \"95538956-d4f7-4713-b3f3-f11ce97b838c\"\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.PropertyNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"c0d15a7c-d36b-4c76-a854-9dc31931d0c4\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Property\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -619.0,\n \"y\": 73.0,\n \"width\": 117.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Layer1\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_PropertyGuidSerialized\": \"a8b03ce6-2cef-45a9-9d35-3be750936dde\"\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.PropertyNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"c4c3c86c-756f-4a88-bfdd-767bb4932787\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Property\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -582.0,\n \"y\": 708.0,\n \"width\": 111.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Logo\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_PropertyGuidSerialized\": \"2f87a21c-8bcf-472d-8bf2-1fbdc76faaf9\"\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.LerpNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"d1c300f9-150e-47b9-a4d3-f127564fc95b\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Lerp\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 212.0000457763672,\n \"y\": 73.00001525878906,\n \"width\": 128.0,\n \"height\": 142.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 1.0,\\n \\\"y\\\": 1.0,\\n \\\"z\\\": 1.0,\\n \\\"w\\\": 1.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"T\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"T\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.LerpNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"d7ac6ae0-0202-4a8c-a993-e45943dca9d7\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Lerp\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 377.0,\n \"y\": 108.99999237060547,\n \"width\": 128.0,\n \"height\": 142.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 1.0,\\n \\\"y\\\": 1.0,\\n \\\"z\\\": 1.0,\\n \\\"w\\\": 1.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"T\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"T\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.DynamicVectorMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Out\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n }\n}" + } + ], + "m_Groups": [], + "m_StickyNotes": [], + "m_SerializableEdges": [ + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"3a5a54b9-f651-4ba5-a616-d1a5db536739\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"d1c300f9-150e-47b9-a4d3-f127564fc95b\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 7,\n \"m_NodeGUIDSerialized\": \"3a5a54b9-f651-4ba5-a616-d1a5db536739\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"d1c300f9-150e-47b9-a4d3-f127564fc95b\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"42624434-facc-4adf-946a-da3f797b0781\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"a03315a2-d94b-4cd3-b395-1f9d0d445fc5\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"66bd1b67-584c-43ba-97ef-995aacb5957f\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"9a17ddd7-9b75-40f0-9a3a-30c781797fb3\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 7,\n \"m_NodeGUIDSerialized\": \"66bd1b67-584c-43ba-97ef-995aacb5957f\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"9a17ddd7-9b75-40f0-9a3a-30c781797fb3\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 7,\n \"m_NodeGUIDSerialized\": \"6ceb6624-cfd2-45ea-bdeb-11a444633963\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"73f6f04e-0873-43e8-b897-3aca40c60d79\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 7,\n \"m_NodeGUIDSerialized\": \"6ceb6624-cfd2-45ea-bdeb-11a444633963\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"d7ac6ae0-0202-4a8c-a993-e45943dca9d7\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"73f6f04e-0873-43e8-b897-3aca40c60d79\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 2,\n \"m_NodeGUIDSerialized\": \"d7ac6ae0-0202-4a8c-a993-e45943dca9d7\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 3,\n \"m_NodeGUIDSerialized\": \"9a17ddd7-9b75-40f0-9a3a-30c781797fb3\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"d1c300f9-150e-47b9-a4d3-f127564fc95b\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"a03315a2-d94b-4cd3-b395-1f9d0d445fc5\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"9a17ddd7-9b75-40f0-9a3a-30c781797fb3\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"b194a920-c717-45c2-97af-93bff33ac4a4\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"3a5a54b9-f651-4ba5-a616-d1a5db536739\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"c0d15a7c-d36b-4c76-a854-9dc31931d0c4\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"66bd1b67-584c-43ba-97ef-995aacb5957f\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"c4c3c86c-756f-4a88-bfdd-767bb4932787\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"6ceb6624-cfd2-45ea-bdeb-11a444633963\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 3,\n \"m_NodeGUIDSerialized\": \"d1c300f9-150e-47b9-a4d3-f127564fc95b\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"d7ac6ae0-0202-4a8c-a993-e45943dca9d7\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 3,\n \"m_NodeGUIDSerialized\": \"d7ac6ae0-0202-4a8c-a993-e45943dca9d7\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"6ab590f0-4789-46ad-b3b5-4ec43a4583bf\"\n }\n}" + } + ], + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + } + }, + "m_Path": "Shader Graphs", + "m_ConcretePrecision": 0, + "m_ActiveOutputNodeGuidSerialized": "6ab590f0-4789-46ad-b3b5-4ec43a4583bf" +} \ No newline at end of file diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph.meta new file mode 100644 index 00000000000..d007c8b2350 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: fea4ff21702af224eb16a7989dfdbd8a +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png new file mode 100644 index 00000000000..7c797d20f98 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50b1f99aa05a55b34895e9f4ef470c6cecdb44ff54551fd88d5b95c00de58301 +size 328465 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png.meta new file mode 100644 index 00000000000..e96fbb5d1f3 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/greenscreen.png.meta @@ -0,0 +1,93 @@ +fileFormatVersion: 2 +guid: 64f6f649f205d4c4fba3217f1f8023e7 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png new file mode 100644 index 00000000000..21c96ba4717 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eec1a66f0805a5d79a74709b26ccfc7ddd337ca568bab262a7c08a0a9308af4f +size 78503 diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png.meta b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png.meta new file mode 100644 index 00000000000..fd57782e528 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/unity-master-black.png.meta @@ -0,0 +1,93 @@ +fileFormatVersion: 2 +guid: 18424860621f1f34c84767018c9508d0 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png new file mode 100644 index 00000000000..410e4ecbfe5 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f20b48b0beb6c8886182e197f3d2d2434fb73f09af5766457742cc23e9502154 +size 105162 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png.meta new file mode 100644 index 00000000000..e6356dd6949 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png.meta @@ -0,0 +1,93 @@ +fileFormatVersion: 2 +guid: 988215e1d00c5c3429b295066e22522e +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 1 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset index 5b410ffabfd..5f9a86492d8 100644 --- a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset +++ b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset @@ -560,6 +560,9 @@ EditorBuildSettings: - enabled: 1 path: Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen.unity guid: 86f8f2a99d6720b48abc19c684103d74 + - enabled: 1 + path: Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity + guid: 708bd21bc204d2342bc1702a5a6de1d3 - enabled: 1 path: Assets/GraphicTests/Scenes/9x_Other/9801_ShurikenLightModule.unity guid: d50ee167e49a2d74988347d7888c3613 diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 57886c699f6..c52509e7a94 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -105,6 +105,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Added Light decomposition lighting debugging modes and support in AOV - Added exposure compensation to Fixed exposure mode - Added support for rasterized area light shadows in StackLit +- Added alpha channel support in motion blur pass. +- Added the HDRP Compositor Tool (in Preview). ### Fixed - Fix when rescale probe all direction below zero (1219246) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Compositor-Main.md b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-Main.md new file mode 100644 index 00000000000..1e8433eef2f --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-Main.md @@ -0,0 +1,32 @@ +# Compositor (Preview) + +The Compositor allows for real-time compositing operations between Unity's High Definition Render Pipeline (HDRP) and external media sources, such as videos or images. Depending on the requirements for your application, the Compositor provides multiple composition techniques. You can use each technique independently or use more than one at the same time to create a combination of different types of composition operations. The techniques that the Compositor includes are: +- **Camera Stacking:** Allows you to render multiple [HDRP Cameras](HDRP-Camera.md) to the same render target. +- **Graph-Based Composition:** Allows you to use arbitrary mathematical operations to combine multiple Composition Layers to generate the final frame. +- **3D Composition:** Allows you to use Composition Layers as 3D surfaces in a Unity Scene. This means that, for example, Unity can calculate reflections and refractions between different Composition Layers and GameObjects. + +The following table provides a high level overview of the advantages and disadvantages of each compositing technique: + +| **Technique** | **Performance** | **Memory Overhead** | **Flexibility** | **Feature Coverage [*]** | +| ------------- | ------------- |------------- | ------------- | ------------- | +| **Camera Stacking** | High | Low | Low | High | +| **Graph-Based Composition** | Low | High | High| Low | +| **3D Composition** | Low | High | Low | High | + +[*] *Feature Coverage* indicates whether features such as [screen-space reflections](Override-Screen-Space-Reflection.md), transparencies or refractions can work between layers. + +Furthermore, the Compositor includes functionality such as *"localized post-processing"*, where a Post-Processing Volume only affects certain GameObjects in the Scene. + +For a high level overview of the Compositor's functionality please refer to the [User Guide](Compositor-User-Guide) section. For a description on specific options in the user interface, please refer to the [User Options](Compositor-User-Options) section. + +## Composition example + +The following example uses the Compositor to render a watermark on top of a Unity Scene. +![](Images/Compositor-HDRPTemplateWithLogo.png) + +*The result.* + + +![](Images/Compositor-CompositorSimpleGraph.png) + +*The composition graph for the watermark example:* \ No newline at end of file diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md new file mode 100644 index 00000000000..251500c8010 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md @@ -0,0 +1,51 @@ +# Using the Compositor +To open the Compositor window in the Unity Editor, select **Window > Render Pipeline > HD Render Pipeline Compositor** from the menu. From this window, you can control the Compositor configuration. The first time you open the Compositor window, it automatically uses a default *"pass-through"* composition profile that forwards the output of the main [Camera](HDRP-Camera.md) to the final composed frame. You can edit this profile or you can load another one from disk. For information on the properties in the Compositor window, see [Compositor window](Compositor-User-Options.md). + + +## Layer Types +The HDRP Compositor tool typically handles two types of layers: +- **Composition Layers**: Which you define in the [Composition Graph](#composition-graph). The Composition Graph defines the number of layers and how to combine them but does not define each layer's content. +- **Sub-layers**: Which you define in the Compositor window, in the [Render Schedule](#render-schedule) section. You use stack Sub-layers to define the content of a Composition Layer. + + +## Composition Graph +To specify the output image, the Compositor uses a graph of compositing operations. Specifically, the Compositor uses the [Shader Graph](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html) with an [Unlit Master Node](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Unlit-Master-Node.html) as its target. To specify the output image, the Compositor uses the value you connect to the **Color** port. You do not need to connect any other ports on the Master Node. + +**Note**: When the output of the composition is to a render target, the Material you create from the Master Node must be double-sided. + +When you create a Composition Graph, there are two main types of input property you can expose: +- **Composition Layer**: Any **Texture2D** properties act as Composition Layers which correspond to a layer the graph composites to generate the final frame. These properties appear automatically as Composition Layers in the [Render Schedule](#render-schedule) section of the Compositor window. The **Mode** option for them in Shader Graph corresponds to the default value the Shader uses when you toggle off the visibility of the layer in the Render Schedule list.
**Note**: By default, this value is set to white, but for many compositing operations and behaviors, you may want to set this to black instead. +- **Composition Parameters**: This refers to any exposed property that is not a Texture2D. Composition Parameters can control various aspects of the composition. Examples of Composition Parameters include a Vector1 input to control brightness or a Color input to tint a Texture2D. These properties appear automatically in the [Composition Parameters](#composition-parameters) section of the Compositor window. + +The following graph contains examples of the property types described above. The **Logo** property is an example of a Composition Layer and the **Opacity** property is an example of an input property to control an aspect of the composition: + +![](Images/Compositor-CompositorSimpleGraph.png) + +Unity saves the Compositor settings in a .asset file with the same name as the Composition Graph. When the Compositor loads a Composition Graph, it also loads the settings from the corresponding Asset file if one exists, otherwise, it creates a new Asset with default settings. + +## Adding and removing Composition Layer +To add a new Composition Layer, create a new Texture2D input property in the [Composition Graph](#composition-graph). When you next save the Composition Graph, the new layer appears automatically in the [Render Schedule](#render-schedule) section of the Compositor window. From there, you can control the [layer properties](Compositor-User-Options.md#composition-layer-properties) and specify how to [fill the layer with content](#Sub-layers:-adding-content-to-composition-layers). + +Similarly, to delete a Composition Layer, remove the corresponding Texture 2D property from the [Composition Graph](#composition-graph). + +## Sub-layers: Adding content to Composition Layers +Each Composition Layer can source its content from one or more Sub-layers. There are three types of Sub-layer: +- **Camera Sub-layer:** The source of the content is a Unity Camera. You can select which Camera to use in the properties of the Sub-layer. +- **Video Sub-layer:** The source of the content is a Unity Video Player. You can select which Video Player to use in the properties of the Sub-layer. +- **Image Sub-layer:** The source of the content is a static image. You can select which image to use in the properties of the Sub-layer. + +To add a Sub-layer to a Composition Layer, select the Composition Layer and click the **Add** drop-down button. From the drop-down, you can select the type of Sub-layer. + +To remove a Sub-layer, select the Sub-layer and click the **Delete** button.
**Note**: You can only delete Sub-layers this way and not Composition Layers. Instead, to delete a Composition Layer, remove the corresponding Texture2D property from the Composition Graph. + +## Camera Stacking +When you use more than one Sub-layer to specify the content of a Composition Layer, this "stacks" the Sub-layers on top of the same render target. To specify the size and format of the composition, you use the properties of the parent Composition Layer. The Sub-layers inherit the size and format from their parent Composition Layer and you cannot change these properties independently for a particular Sub-layer. This means every stacked Camera/Sub-layer has the same size and format. To change the stacking order, re-arrange the Sub-layers in the [Render Schedule](#render-schedule) section of the Compositor window. + +The [Sub-layer Properties](Compositor-User-Options.md#Sub-layer-properties) section controls the type of stacking operation. + +## Render Schedule +The Render Schedule is a re-orderable list of Composition Layers and Sub-layers. Sub-layers appear indented below their corresponding parent Composition Layer, which makes it easier to see the hierarchical relationship. When multiple Sub-layers appear below a parent layer, they form a camera stack. Unity renders layers at the top first. To re-order the list, you can click and move both Composition Layers and Sub-layers. You can use this to change the rendering order in a camera stack or move a Sub-layer from one parent Composition Layer to another. + +## Composition Parameters +This sections shows every exposed property that is not an input Composition Layer (for example, a Vector1 to control the brightness of the final composition or a Color to tint a Texture2D). In this section, the window allows you to edit each property value outside of the Composition Graph. It is good practice to expose properties from the graph to the Compositor window, instead of hard-coding their values. This helps you to share composition profiles between Projects because those you do not need to open the Composition Graph to edit any values. + diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Options.md b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Options.md new file mode 100644 index 00000000000..ef6c3faa2af --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Options.md @@ -0,0 +1,74 @@ +# Compositor window +This page provides an outline of the options available in the Compositor window. + +## Output Options +This section allows you to change where and how the Compositor outputs the final frame. + +The Compositor can only output to the Game View. To preview the output while you edit the Scene, enable the **Enable Preview** property. **Tip**: To get the best live preview, undock the Game view window into a separate maximized window. If you have two monitors, you can drag the window to a second screen. + +| **Property** | **Description** | +| ---------------------- | --------------- | +| **Enable Compositor** | Specifies whether your Unity Project uses the Compositor. If you disable this property and the Scene did not previously use the Compositor, this is the only property visible in the window. If you disable this property and the Scene did previously use the Compositor, the rest of the properties appear in the window, but you can not edit them. | +| **Enable Preview** | Specifies whether the Compositor always outputs to the Game view, even when you are not in Play Mode. If you disable this property, performance increases while you edit a Scene, but the Compositor output is only available in Play Mode. | +| **Output Camera** | Specifies the Camera that the Compositor outputs to. You should use a dedicated Camera rather than re-use another Camera from your Scene. Also, make sure the Compositor's Camera targets a different Display to all other Cameras. This is important because, if the Compositor Camera uses the same display as another Camera, the Display output depends on which Camera Unity rendered last. | +| **Composition Graph** | Specifies the Shader that the Compositor uses to create the final output. When you first enable the Compositor for a Scene, this is a pass-through Shader Graph that passes a copy of the input to the output. To set up Camera stacking behavior, this kind of Shader is sufficient, but, for more complex compositing operations, define your own graph. For more details, see [Using the Compositor](Compositor-User-Guide.md). | +| **Display Output** | Specifies the display that the Compositor renders to. Unity supports up to eight displays. To see the compositor output, click the **Display** drop-down in the upper left corner of the Game view and select the display number you specified here. | + +## Composition Layer Properties + +To expose these properties, select a Composition Layer in the **Render Schedule**. + +| **Property** | **Description** | +| ----------------------- | ------------------------------------------------------------ | +| **Color Buffer Format** | Specifies the format to use for this layer's color buffer. | +| **Resolution** | Specifies the pixel resolution of this layer. If you use **Full**, the layer's resolution corresponds to the main Camera in the Scene. If you use **Half** or **Quarter** resolution for a layer, it improves performance when Unity renders that layer, but if you combine layers of different resolutions, artifacts may occur depending on the content and the compositing operation. | +| **Output Renderer** | Specifies a Renderer to direct the output of this layer to. The compositor overrides and automatically updates the **_BaseColorMap** Texture from the Material attached to this Renderer. This is useful when the selected Renderer should be visible by a Camera on another layer. | +| **AOVs** | Specifies the type of output variable in this layer. Aside from Color, you can also output variables like **Albedo**, **Normal**, or **Smoothness**. This option affects all Cameras stacked in this layer. | + +## Sub-layer Properties + +To expose these properties, select a Sub-layer in the **Render Schedule**. + +| **Property** | **Description** | +| ------------ | --------------- | +| **Name** |Sets the name of the Sub-layer. | +| **Source Image** |Specifies a static image/Texture to use as the background for this Sub-layer.
This property is only available for **Image** Sub-layers.| +| **Background Fit** |Specifies the method the Compositor uses to fit the **Source Image** to the screen. The options are:
• **Stretch**: Stretches the image that it completely fills the screen. This method does not maintain the image's original aspect ratio.
• **Fit Horizontally**: Resizes the image so that it fits the screen horizontally. For the vertical axis, Unity either expands the image off the bounds of the screen or uses black bars depending on how tall the image is.
• **Fit Vertically**: Resizes the image so that it fits the screen vertically. For the horizontal axis, Unity either expands the image off the bounds of the screen or uses black bars depending on how wide the image is.
This property is only available for **Image** Sub-layers.| +| **Source Video**| Specifies the [Video Player](https://docs.unity3d.com/ScriptReference/Video.VideoPlayer.html) to use for this Sub-layer.
This property is only available for **Video** Sub-layers. | +| **Source Camera** |Specifies the Camera to use for this Sub-layer. By default, this is set to the main Camera in the Scene.
This property is only available for **Camera** Sub-layers.| +| **Clear Depth**| Specifies whether Unity clears the depth buffer before it draws the contents of this Sub-layer. | +| **Clear Alpha** |Specifies whether Unity clears the alpha channel before it draws the contents of this Sub-layer. If you enable this property, post-processing only affects pixels drawn by previous Sub-layers. Otherwise, post-processing also affects pixels drawn in previous Composition Layers.| +| **Clear Color** |Overrides the **Background Type** for this Sub-layer. By default, this has the same value as **Background Type** on the Sub-layer's Camera. To override this value, enable the checkbox then select the new value from the drop-down.| +| **Anti-aliasing** |Overrides the **Anti-aliasing** mode for this Sub-layer. By default, this has the same value as **Anti-aliasing** on the Sub-layer's Camera.| +| **Culling Mask** |Overrides the **Culling Mask** for this Sub-layer. By default, this has the same value as **Culling Mask** on the Sub-layer's Camera.| +| **Volume Mask** |Overrides the **Volume Layer Mask** for this Sub-layer. By default, this has the same value as **Volume Layer Mask** on the Sub-layer's Camera. You can use this to have different post-processing effects for each Sub-layer.| +| **Input Filters**| A list of [filters](#Sub-layer-filters) to apply to this Sub-layer. | + +### Sub-layer Filters +When you add a new **Input Filter** to a Sub-layer, the properties that appear depend on which filter type you select. The current filter types are: + +* [Chroma Keying](#chroma-keying) +* [Alpha Mask](#alpha-mask) + +you can use filters to apply common color processing operations to Sub-layers. The filter list is empty by default. To add new filters, click the add (**+**) button. + +**Note**: It is possible to implement the functionality of many filters with nodes in the Composition Graph, but if you use the built-in filters instead, it makes the Composition Graph simpler. + +#### Chroma Keying +Applies a chroma keying algorithm to the Sub-layer. When you select this filter, you can use the following properties to customize it. +| **Property** | **Description** | +| ---- | ---- | +|**Key Color**| Specifies a color to indicate the areas of the image to mask/make transparent. | +|**Key Threshold**| Sets a threshold that helps to smooth out the edges of the mask. A value of **0** results in sharp edges. | +|**Key Tolerance**| Sets the sensitivity of the **Key Color** property. If you increase this value, the mask includes pixels with color values close to the **Key Color**. | +|**Spill Removal**| Sets a value that Unity uses to change the tint of non-masked areas. | + +#### Alpha Mask + +Takes as input a static texture that overrides the alpha mask of the Sub-layer. Post-processing is then applied only on the masked frame regions. When you select this filter, you can use the following properties to customize it. + +| **Property** | **Description** | +| ---- | ---- | +| **Alpha Mask** |Specifies the Texture that overrides the Sub-layer's alpha mask.| + + diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-CompositorSimpleGraph.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-CompositorSimpleGraph.png new file mode 100644 index 00000000000..d122e8fde78 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-CompositorSimpleGraph.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e57bf0939ab9385bde56857910f34b4bb86bb292033b43b416cf38c31724c95 +size 108405 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-HDRPTemplateWithLogo.png b/com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-HDRPTemplateWithLogo.png new file mode 100644 index 00000000000..21bd40f600b --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Documentation~/Images/Compositor-HDRPTemplateWithLogo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:716cb8a3d9718c4e0aa4cd04cf55807f10754a56e75166e34a6bf773b7443704 +size 1384707 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md index 96ac363bab4..7a7bc69294b 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md @@ -143,6 +143,9 @@ * Look Dev * [Look Dev Window](Look-Dev) * [Environment Library](Look-Dev-Environment-Library) + * [Compositor](Compositor-Main) + * [User Guide](Compositor-User-Guide) + * [User Options](Compositor-User-Options) * Debugging * [MatCap](MatCap) * [Render Pipeline Debug Window](Render-Pipeline-Debug-Window) diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor.meta new file mode 100644 index 00000000000..69e491ecff7 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f7f337714b5b3bb48a2008caabd4d1a0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs new file mode 100644 index 00000000000..0c2c5634f4b --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs @@ -0,0 +1,49 @@ +using UnityEditor; +using UnityEngine; +using UnityEngine.Rendering.HighDefinition.Compositor; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class CompositionFilterUI + { + static partial class TextUI + { + static public readonly GUIContent ChromaKeing = EditorGUIUtility.TrTextContent("Chroma Keying", "Performs chroma keying in the input frame before any other composition operations are performed."); + static public readonly GUIContent KeyColor = EditorGUIUtility.TrTextContent("Key Color", "Use this parameter to smooth-out the edges of the generated mask. A value of 0 corresponds to sharp edges."); + static public readonly GUIContent Threshold = EditorGUIUtility.TrTextContent("Key Threshold", "Indicates the areas of the image that will be masked (or in other words, the areas that are transparent."); + static public readonly GUIContent Tolerance = EditorGUIUtility.TrTextContent("Key Tolerance", "Controls the sensitivity of the mask color parameter. Increasing this value will include more pixels (with a value close to the mask color) in the masked areas."); + static public readonly GUIContent SpillRemoval = EditorGUIUtility.TrTextContent("Spill Removal", "Use this parameter to change the tint of non-masked areas."); + static public readonly GUIContent AlphaMask = EditorGUIUtility.TrTextContent("Alpha Mask", "A static texture that overrides the alpha mask of the sub-layer. Post-processing is then applied only on the masked frame regions."); + } + public static void Draw(Rect rect, SerializedCompositionFilter serialized) + { + rect.height = CompositorStyle.k_SingleLineHeight; + float spacing = rect.height * 1.1f; + + if (serialized.FilterType.intValue == (int)CompositionFilter.FilterType.CHROMA_KEYING) + { + SerializedProperty KeyColor = serialized.MaskColor; + SerializedProperty KeyThreshold = serialized.KeyThreshold; + SerializedProperty KeyTolerance = serialized.KeyTolerance; + SerializedProperty SpillRemoval = serialized.SpillRemoval; + + EditorGUI.LabelField(rect, TextUI.ChromaKeing); + rect.y += spacing; + rect.x += 20; + rect.width -= 20; + EditorGUI.PropertyField(rect, KeyColor, TextUI.KeyColor); + rect.y += spacing; + EditorGUI.PropertyField(rect, KeyThreshold, TextUI.Threshold); + rect.y += spacing; + EditorGUI.PropertyField(rect, KeyTolerance, TextUI.Tolerance); + rect.y += spacing; + EditorGUI.PropertyField(rect, SpillRemoval, TextUI.SpillRemoval); + } + else + { + SerializedProperty AlphaMask = serialized.AlphaMask; + EditorGUI.PropertyField(rect, AlphaMask, TextUI.AlphaMask); + } + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs.meta new file mode 100644 index 00000000000..17d057c54c5 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f393c6e782c57549a08efa424ed6eb0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs new file mode 100644 index 00000000000..6ce7dd1d006 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs @@ -0,0 +1,212 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering.HighDefinition.Attributes; +using UnityEngine.Rendering.HighDefinition.Compositor; + +using UnityEditor; +using UnityEditorInternal; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class CompositionLayerUI + { + static partial class TextUI + { + // main layer + static public readonly GUIContent Resolution = EditorGUIUtility.TrTextContent("Resolution", "Specifies the resolution of this layer's render target. Lower resolution increases the performance at the expense of visual quality."); + static public readonly GUIContent BufferFormat = EditorGUIUtility.TrTextContent("Format", "Specifies the color buffer format of this layer. "); + static public readonly GUIContent OutputRenderer = EditorGUIUtility.TrTextContent("Output Renderer", "Redirects the output of this layer to the surface which is drawn by the selected mesh renderer. "); + static public readonly GUIContent AOVs = EditorGUIUtility.TrTextContent("AOVs", "Specifies the Arbitrary Output Variable (AOV) that will be drawn on this layer. This option affects all cameras that are stacked on this layer."); + + // Sub layer + static public readonly GUIContent NameContent = EditorGUIUtility.TrTextContent("Layer Name", "Specifies the name of this layer."); + static public readonly GUIContent Camera = EditorGUIUtility.TrTextContent("Source Camera", "Specifies the camera of the scene that will provide the content for this layer."); + static public readonly GUIContent Image = EditorGUIUtility.TrTextContent("Source Image", "Specifies the image that will provide the content for this layer."); + static public readonly GUIContent Video = EditorGUIUtility.TrTextContent("Source Video", "Specifies the video that will provide the content for this layer."); + static public readonly GUIContent ClearDepth = EditorGUIUtility.TrTextContent("Clear Depth", "If enabled, the depth buffer will be cleared before rendering this layer."); + static public readonly GUIContent ClearAlpha = EditorGUIUtility.TrTextContent("Clear Alpha", "If enabled, the alpha channel will be cleared before rendering this layer. If enabled, post processing will affect only the objects of this layer"); + static public readonly GUIContent ClearMode = EditorGUIUtility.TrTextContent("Clear Color", "To override the clear mode of this layer, activate the option by clicking on the check-box and then select the desired value."); + static public readonly GUIContent AAMode = EditorGUIUtility.TrTextContent("Anti Aliasing", "To override the anti-aliasing mode, activate the option by clicking on the check-box and then select the desired value."); + static public readonly GUIContent CullingMask = EditorGUIUtility.TrTextContent("Culling Mask", "To override the culling mask, activate the option by clicking on the check-box and then select the desired value."); + static public readonly GUIContent VolumeMask = EditorGUIUtility.TrTextContent("Volume Mask", "To override the volume mask, activate the option by clicking on the check-box and then select the desired value."); + } + + public static void DrawItemInList(Rect rect, SerializedCompositionLayer serialized, RenderTexture thumbnail, float aspectRatio, bool isAlphaEnbaled) + { + bool isCameraStack = serialized.OutTarget.intValue == (int)CompositorLayer.OutputTarget.CameraStack; + + // Compute the desired indentation + { + rect.x = isCameraStack ? rect.x + CompositorStyle.k_ListItemStackPading + 2 : rect.x + 2; + rect.width = isCameraStack ? rect.width - CompositorStyle.k_ListItemStackPading : rect.width; + rect.y += CompositorStyle.k_ListItemPading; + rect.height = EditorGUIUtility.singleLineHeight; + } + + if (thumbnail) + { + Rect newRect = rect; + newRect.width = 20; + EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none); + rect.x += 20; + Rect previewRect = rect; + previewRect.width = CompositorStyle.k_ThumbnailSize * aspectRatio; + previewRect.height = CompositorStyle.k_ThumbnailSize; + EditorGUI.DrawPreviewTexture(previewRect, thumbnail); + previewRect.x += previewRect.width + 5; + rect.x += previewRect.width + 12; + rect.width -= previewRect.width + 12; + + if (isAlphaEnbaled + && (thumbnail.format == RenderTextureFormat.ARGBHalf + || thumbnail.format == RenderTextureFormat.ARGBFloat + || thumbnail.format == RenderTextureFormat.ARGB64)) + { + EditorGUI.DrawTextureAlpha(previewRect, thumbnail); + rect.x += previewRect.width + 12; + rect.width -= previewRect.width + 12; + } + + rect.y += 6; + EditorGUI.LabelField(rect, serialized.LayerName.stringValue); + } + else + { + Rect newRect = rect; + newRect.width = 20; + EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none); + newRect.x += 20; + if (isCameraStack) + { + Rect iconRect = newRect; + iconRect.width = CompositorStyle.k_IconSize; + iconRect.height = CompositorStyle.k_IconSize; + iconRect.y -= 5; + switch (serialized.InputLayerType.enumValueIndex) + { + case (int)CompositorLayer.LayerType.Camera: + GUI.DrawTexture(iconRect, EditorGUIUtility.ObjectContent(null, typeof(Camera)).image); + break; + case (int)CompositorLayer.LayerType.Video: + GUI.DrawTexture(iconRect, EditorGUIUtility.ObjectContent(null, typeof(UnityEngine.Video.VideoClip)).image); + break; + case (int)CompositorLayer.LayerType.Image: + GUI.DrawTexture(iconRect, EditorGUIUtility.ObjectContent(null, typeof(Texture)).image); + break; + default: + // This will happen if someone adds a new layer type and does not update this switch statement + Debug.Log("Unknown layer type: Please add code here to draw this type of layer."); + break; + } + newRect.x += CompositorStyle.k_IconSize + 5; + } + + newRect.width = rect.width - 60 - 20; + EditorGUI.LabelField(newRect, serialized.LayerName.stringValue); + rect.y += rect.height; + } + } + + public static void DrawOutputLayerProperties(Rect rect, SerializedCompositionLayer serializedProperties, System.Action resetRenderTargetCallback) + { + rect.y += CompositorStyle.k_ListItemPading; + rect.height = CompositorStyle.k_SingleLineHeight; + + EditorGUI.PropertyField(rect, serializedProperties.ColorFormat, TextUI.BufferFormat); + rect.y += CompositorStyle.k_Spacing; + + EditorGUI.BeginChangeCheck(); + EditorGUI.PropertyField(rect, serializedProperties.ResolutionScale, TextUI.Resolution); + + if (EditorGUI.EndChangeCheck()) + { + // if the resolution changes, reset the RTs + resetRenderTargetCallback(); + } + rect.y += CompositorStyle.k_Spacing; + + EditorGUI.PropertyField(rect, serializedProperties.OutputRenderer, TextUI.OutputRenderer); + rect.y += CompositorStyle.k_Spacing; + + EditorGUI.PropertyField(rect, serializedProperties.AOVBitmask, TextUI.AOVs); + //serializedProperties.AOVBitmask.intValue = EditorGUI.MaskField(rect, TextUI.AOVs, serializedProperties.AOVBitmask.intValue, System.Enum.GetNames(typeof(MaterialSharedProperty))); + + rect.y += CompositorStyle.k_Spacing; + } + + public static void DrawStackedLayerProperties(Rect rect, SerializedCompositionLayer serializedProperties, ReorderableList filterList) + { + rect.y += CompositorStyle.k_ListItemPading; + rect.height = CompositorStyle.k_SingleLineHeight; + + EditorGUI.PropertyField(rect, serializedProperties.LayerName, TextUI.NameContent); + rect.y += CompositorStyle.k_Spacing; + + switch (serializedProperties.InputLayerType.enumValueIndex) + { + case (int)CompositorLayer.LayerType.Camera: + EditorGUI.PropertyField(rect, serializedProperties.InputCamera, TextUI.Camera); + break; + case (int)CompositorLayer.LayerType.Video: + EditorGUI.PropertyField(rect, serializedProperties.InputVideo, TextUI.Video); + break; + case (int)CompositorLayer.LayerType.Image: + EditorGUI.PropertyField(rect, serializedProperties.InputTexture, TextUI.Image); + rect.y += CompositorStyle.k_Spacing; + EditorGUI.PropertyField(rect, serializedProperties.FitType); + break; + default: + // This will happen if someone adds a new layer type and does not update this switch statement + Debug.Log("Unknown layer type: Please add code here to handle this type of layer."); + break; + } + rect.y += 1.5f * CompositorStyle.k_Spacing; + + EditorGUI.PropertyField(rect, serializedProperties.ClearDepth, TextUI.ClearDepth); + rect.y += CompositorStyle.k_Spacing; + + EditorGUI.PropertyField(rect, serializedProperties.ClearAlpha, TextUI.ClearAlpha); + rect.y += 1.5f * CompositorStyle.k_Spacing; + + // The clear mode should be visible / configurable only for the first layer in the stack. For the other layers we set a camera-stacking specific clear-mode . + if (serializedProperties.PositionInStack.intValue == 0) + { + DrawPropertyHelper(rect, TextUI.ClearMode, serializedProperties.OverrideClearMode, serializedProperties.ClearMode); + rect.y += CompositorStyle.k_Spacing; + } + + DrawPropertyHelper(rect, TextUI.AAMode, serializedProperties.OverrideAA, serializedProperties.AAMode); + rect.y += CompositorStyle.k_Spacing; + + DrawPropertyHelper(rect, TextUI.CullingMask, serializedProperties.OverrideCulling, serializedProperties.CullingMaskProperty); + rect.y += CompositorStyle.k_Spacing; + + DrawPropertyHelper(rect, TextUI.VolumeMask, serializedProperties.OverrideVolume, serializedProperties.VolumeMask); + rect.y += CompositorStyle.k_Spacing; + + Rect filterRect = rect; + filterRect.y += 0.5f * CompositorStyle.k_Spacing; + filterList.DoList(filterRect); + } + + static void DrawPropertyHelper(Rect rect, GUIContent label, SerializedProperty checkBox, SerializedProperty serializedProperty) + { + Rect rectCopy = rect; + rectCopy.width = EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rectCopy, checkBox, GUIContent.none); + + rectCopy.x += EditorGUIUtility.singleLineHeight; + rectCopy.width = EditorGUIUtility.labelWidth - EditorGUIUtility.singleLineHeight; + EditorGUI.LabelField(rectCopy, label); + + using (new EditorGUI.DisabledScope(checkBox.boolValue != true)) + { + float pad = EditorGUIUtility.labelWidth; + rect.x += pad; + rect.width -= rect.x; + EditorGUI.PropertyField(rect, serializedProperty, GUIContent.none); + } + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs.meta new file mode 100644 index 00000000000..ca5b4ea3e21 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 99c4c84d9ed96d94c8f24691b92a6b7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs new file mode 100644 index 00000000000..85b858bbf67 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs @@ -0,0 +1,18 @@ +using UnityEngine; +using UnityEditor; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using System; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + static internal class CompositorStyle + { + internal static readonly int k_ThumbnailSize = 32; + internal static readonly int k_IconSize = 28; + internal static readonly int k_ListItemPading = 4; + internal static readonly int k_ListItemStackPading = 20; + internal static readonly float k_SingleLineHeight = EditorGUIUtility.singleLineHeight; + internal static readonly float k_Spacing = k_SingleLineHeight * 1.1f; + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs.meta new file mode 100644 index 00000000000..98a02b7821b --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2954ec6f6455886418d8a01d4df3ebe4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs new file mode 100644 index 00000000000..dc3d4d62294 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs @@ -0,0 +1,385 @@ +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +using UnityEngine.SceneManagement; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering.HighDefinition.Attributes; +using UnityEngine.Rendering.HighDefinition.Compositor; +using UnityEngine.Video; + +using UnityEditor; +using UnityEditorInternal; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + // Responsible for drawing the inspector UI of the composition manager + [CustomEditor(typeof(CompositionManager))] + internal class CompositionManagerEditor : Editor + { + static partial class TextUI + { + static public readonly GUIContent CompositionGraph = EditorGUIUtility.TrTextContent("Composition Graph", "Specifies the Shader Graph that will be used to produce the final composited output."); + static public readonly GUIContent OutputCamera = EditorGUIUtility.TrTextContent("Output Camera", "Specifies the camera that will output the final composited image."); + static public readonly GUIContent EnablePreview = EditorGUIUtility.TrTextContent("Enable Preview", "When enabled, the compositor will generate the final composed frame even in edit mode."); + static public readonly GUIContent InputFilters = EditorGUIUtility.TrTextContent("Input Filters", "A list of color filters that will be executed before composing the frame."); + static public readonly GUIContent Properties = EditorGUIUtility.TrTextContent("Properties", "The properties of a layer or sub-layer."); + static public readonly GUIContent RenderSchedule = EditorGUIUtility.TrTextContent("Render Schedule", "A list of layers and sub-layers in the scene. Layers are drawn from top to bottom."); + static public readonly string AlphaWarningPipeline = "The rendering pipeline was not configured to output an alpha channel. You can select a color buffer format that supports alpha in the HDRP quality settings."; + static public readonly string AlphaWarningPost = "The post processing system was not configured to process the alpha channel. You can select a buffer format that supports alpha in the HDRP quality settings."; + } + + ReorderableList m_layerList; + ReorderableList m_filterList; + + // Cached serialized properties + SerializedCompositionManager m_SerializedProperties; + List m_SerializedLayerProperties; + List m_SerializedShaderProperties; + + bool m_IsEditorDirty = true; + bool m_EnablePreview; + bool layerListChange; + CompositionManager m_compositionManager; + + public bool isDirty + { + get + { + return m_IsEditorDirty; + } + } + + void AddLayerOfTypeCallback(object type) + { + m_compositionManager.AddNewLayer(m_layerList.index + 1, (CompositorLayer.LayerType)type); + m_SerializedProperties.LayerList.serializedObject.Update(); + m_compositionManager.UpdateLayerSetup(); + } + + void AddFilterOfTypeCallback(object type) + { + m_compositionManager.AddInputFilterAtLayer(CompositionFilter.Create((CompositionFilter.FilterType)type), m_layerList.index); + m_SerializedProperties.LayerList.serializedObject.Update(); + CacheSerializedObjects(); + } + + void DrawCompositionParameters() + { + ShaderPropertyUI.Draw(m_SerializedShaderProperties); + } + + bool CacheSerializedObjects() + { + m_SerializedProperties = new SerializedCompositionManager(serializedObject); + m_SerializedLayerProperties = new List(); + m_SerializedShaderProperties = new List(); + + var serializedLayerList = m_SerializedProperties.LayerList; + for (int layerIndex = 0; layerIndex < serializedLayerList.arraySize; layerIndex++) + { + var serializedLayer = serializedLayerList.GetArrayElementAtIndex(layerIndex); + m_SerializedLayerProperties.Add(new SerializedCompositionLayer(serializedLayer)); + } + + var serializedPropertyList = m_SerializedProperties.ShaderProperties; + if (m_SerializedProperties.ShaderProperties == null) + { + return false; + } + for (int pIndex = 0; pIndex < serializedPropertyList.arraySize; pIndex++) + { + var serializedProperty = serializedPropertyList.GetArrayElementAtIndex(pIndex); + m_SerializedShaderProperties.Add(new SerializedShaderProperty(serializedProperty)); + } + + return true; + } + + void OnEnable() + { + CacheSerializedObjects(); + m_IsEditorDirty = false; + } + + public override void OnInspectorGUI() + { + m_compositionManager = (CompositionManager)target; + + if (m_compositionManager == null) + { + Debug.LogError("Compositor target was null"); + return; + } + + var headerStyle = EditorStyles.helpBox; + headerStyle.fontSize = 14; + + // Cache the serialized property fields + if (m_IsEditorDirty || m_SerializedProperties == null) + { + if (CacheSerializedObjects()) + { + m_IsEditorDirty = false; + } + else + { + return; + } + } + m_SerializedProperties.Update(); + + m_EnablePreview = EditorGUILayout.Toggle(TextUI.EnablePreview, m_compositionManager.enableOutput); + { + m_compositionManager.enableOutput = m_EnablePreview; + } + + bool cameraChange = false; + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(m_SerializedProperties.OutputCamera, TextUI.OutputCamera); + if (EditorGUI.EndChangeCheck()) + { + cameraChange = true; + } + + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(m_SerializedProperties.CompositionShader, TextUI.CompositionGraph); + + bool shaderChange = false; + if (EditorGUI.EndChangeCheck()) + { + // Clear the existing shader (the new shader will be loaded in the next Update) + m_IsEditorDirty = true; + shaderChange = true; + } + + EditorGUILayout.PropertyField(m_SerializedProperties.DisplayNumber); + + // Draw some warnings in case alpha is not fully supported + if (m_compositionManager.alphaSupport == CompositionManager.AlphaChannelSupport.None) + { + EditorGUILayout.Space(5); + EditorGUILayout.HelpBox(TextUI.AlphaWarningPipeline, MessageType.Warning); + } + else if (m_compositionManager.alphaSupport == CompositionManager.AlphaChannelSupport.Rendering) + { + EditorGUILayout.Space(5); + EditorGUILayout.HelpBox(TextUI.AlphaWarningPost, MessageType.Warning); + } + + // Now draw the composition shader properties + DrawCompositionParameters(); + + // Now draw the list of layers + EditorGUILayout.Separator(); + + layerListChange = false; + if (m_layerList == null) + { + var serializedLayerList = m_SerializedProperties.LayerList; + m_layerList = new ReorderableList(m_SerializedProperties.CompositorSO, serializedLayerList, true, false, true, true); + + m_layerList.drawHeaderCallback = (Rect rect) => + { + //EditorGUI.LabelField(rect, "Render Schedule", EditorStyles.largeLabel); + }; + + m_layerList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => + { + if (index < m_SerializedLayerProperties.Count) + { + var serializedProperties = m_SerializedLayerProperties[index]; + CompositionLayerUI.DrawItemInList(rect, serializedProperties, m_compositionManager.GetRenderTarget(index), m_compositionManager.aspectRatio, m_compositionManager.alphaSupport != CompositionManager.AlphaChannelSupport.None); + } + }; + + m_layerList.onReorderCallbackWithDetails += (list, oldIndex, newIndex) => + { + layerListChange = true; + m_IsEditorDirty = true; + + m_compositionManager.ReorderChildren(oldIndex, newIndex); + m_compositionManager.ValidateLayerListOrder(oldIndex, newIndex); + }; + + m_layerList.elementHeightCallback = (index) => + { + if (index < m_SerializedLayerProperties.Count) + { + return m_SerializedLayerProperties[index].GetListItemHeight(); + } + return 0; + }; + + m_layerList.onAddCallback = (list) => + { + var menu = new GenericMenu(); + menu.AddItem(new GUIContent("Image"), false, AddLayerOfTypeCallback, CompositorLayer.LayerType.Image); + menu.AddItem(new GUIContent("Video"), false, AddLayerOfTypeCallback, CompositorLayer.LayerType.Video); + menu.AddItem(new GUIContent("Camera"), false, AddLayerOfTypeCallback, CompositorLayer.LayerType.Camera); + menu.ShowAsContext(); + m_IsEditorDirty = true; + + m_SerializedProperties.LayerList.serializedObject.Update(); + EditorUtility.SetDirty(m_compositionManager.profile); + }; + + m_layerList.onRemoveCallback = (list) => + { + m_compositionManager.RemoveLayerAtIndex(list.index); + m_IsEditorDirty = true; + EditorUtility.SetDirty(m_compositionManager.profile); + }; + + m_layerList.onSelectCallback = (index) => + { + m_filterList = null; + }; + + m_layerList.onCanRemoveCallback = (list) => + { + return !m_compositionManager.IsOutputLayer(list.index); + }; + m_layerList.onCanAddCallback = (list) => + { + return list.index >= 0; + }; + m_layerList.headerHeight = 0; + } + + EditorGUI.BeginChangeCheck(); + EditorGUILayout.BeginVertical(); + EditorGUILayout.LabelField(TextUI.RenderSchedule, headerStyle); + m_layerList.DoLayoutList(); + EditorGUILayout.EndVertical(); + if (EditorGUI.EndChangeCheck()) + { + layerListChange = true; + } + + float height = EditorGUIUtility.singleLineHeight; + if (m_layerList.index >= 0) + { + height += m_SerializedLayerProperties[m_layerList.index].GetPropertiesHeight(); + } + + var rectagle = EditorGUILayout.BeginVertical(GUILayout.Height(height)); + + EditorGUI.BeginChangeCheck(); + if (m_layerList.index >= 0) + { + EditorGUILayout.LabelField(TextUI.Properties, headerStyle); + + rectagle.y += EditorGUIUtility.singleLineHeight * 1.5f; + rectagle.x += 5; + rectagle.width -= 10; + var serializedProperties = m_SerializedLayerProperties[m_layerList.index]; + DrawLayerProperties(rectagle, serializedProperties, m_layerList.index, null); + } + EditorGUILayout.EndVertical(); + if (EditorGUI.EndChangeCheck()) + { + // Also the layers might need to be re-initialized + layerListChange = true; + } + + if (m_SerializedProperties != null) + { + m_SerializedProperties.ApplyModifiedProperties(); + } + + if (m_compositionManager.shader == null) + { + CompositionUtils.LoadDefaultCompositionGraph(m_compositionManager); + shaderChange = true; + } + + if (shaderChange) + { + // This needs to run after m_SerializedProperties.ApplyModifiedProperties + CompositionUtils.LoadOrCreateCompositionProfileAsset(m_compositionManager); + } + + if (cameraChange) + { + m_compositionManager.DropCompositorCamera(); + m_compositionManager.Init(); + } + + if (layerListChange) + { + // Some properties were changed, mark the profile as dirty so it can be saved if the user saves the scene + EditorUtility.SetDirty(m_compositionManager); + EditorUtility.SetDirty(m_compositionManager.profile); + m_compositionManager.UpdateLayerSetup(); + } + } + + void DrawLayerProperties(Rect rect, SerializedCompositionLayer serializedProperties, int layerIndex, RenderTexture preview = null) + { + if (serializedProperties == null) + { + return; + } + + if (serializedProperties.OutTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) + { + CompositionLayerUI.DrawOutputLayerProperties(rect, serializedProperties, m_compositionManager.DeleteLayerRTs); + } + else + { + if (m_filterList == null) + { + m_filterList = new ReorderableList(serializedProperties.InputFilters.serializedObject, serializedProperties.InputFilters, true, true, true, true); + m_filterList.onAddCallback = (list) => + { + var menu = new GenericMenu(); + menu.AddItem(new GUIContent("Chroma Keying"), false, AddFilterOfTypeCallback, 0); + menu.AddItem(new GUIContent("Alpha Mask"), false, AddFilterOfTypeCallback, 1); + menu.ShowAsContext(); + + EditorUtility.SetDirty(m_compositionManager.profile); + EditorUtility.SetDirty(m_compositionManager); + }; + + m_filterList.drawElementCallback = (Rect r, int index, bool isActive, bool isFocused) => + { + if (index < m_SerializedLayerProperties[m_layerList.index].FilterList.Count) + { + var serializedFilter = m_SerializedLayerProperties[m_layerList.index].FilterList[index]; + CompositionFilterUI.Draw(r, serializedFilter); + } + }; + + m_filterList.drawNoneElementCallback = (Rect r) => + { + using (new EditorGUI.DisabledScope(true)) + { + EditorGUI.LabelField(r, "List Is Empty", EditorStyles.label); + } + }; + + m_filterList.drawHeaderCallback = (Rect r) => + { + EditorGUI.LabelField(r, TextUI.InputFilters, EditorStyles.largeLabel); + }; + + m_filterList.elementHeightCallback = (index) => + { + if (index < m_SerializedLayerProperties[m_layerList.index].FilterList.Count) + { + var filter = m_SerializedLayerProperties[m_layerList.index].FilterList[index]; + return filter.GetHeight(); + } + return 0; + }; + } + + CompositionLayerUI.DrawStackedLayerProperties(rect, serializedProperties, m_filterList); + } + } + + } +} + + diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs.meta new file mode 100644 index 00000000000..7eb1676be96 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 39ecc4f4a5207484fa49c64ebe827a38 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs new file mode 100644 index 00000000000..bb3d5f869e2 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs @@ -0,0 +1,117 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering.HighDefinition.Compositor; + +using UnityEditor; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class CompositionUtils + { + public static readonly string k_DefaultCameraName = "MainCompositorCamera"; + + static public void LoadDefaultCompositionGraph(CompositionManager compositor) + { + if (!AssetDatabase.IsValidFolder("Assets/Compositor")) + { + AssetDatabase.CreateFolder("Assets", "Compositor"); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + + string path = "Assets/Compositor/DefaultCompositionGraph.shadergraph"; + path = AssetDatabase.GenerateUniqueAssetPath(path); + bool ret1 = AssetDatabase.CopyAsset(HDUtils.GetHDRenderPipelinePath() + "Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph", path); + if (ret1 == false) + { + Debug.LogError("Error creating default shader graph"); + return; + } + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + + compositor.shader = AssetDatabase.LoadAssetAtPath(path); + + string profilePath; + { + var fullpath = AssetDatabase.GetAssetPath(compositor.shader); + profilePath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(fullpath), System.IO.Path.GetFileNameWithoutExtension(compositor.shader.name)) + ".asset"; + profilePath = AssetDatabase.GenerateUniqueAssetPath(profilePath); + } + + bool ret2 = AssetDatabase.CopyAsset(HDUtils.GetHDRenderPipelinePath() + "Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset", profilePath); + if (ret2 == false) + { + Debug.LogError("Error creating default profile"); + return; + } + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + + static public void RemoveAudioListeners(Camera camera) + { + var listener = camera.GetComponent(); + if (listener) + { + CoreUtils.Destroy(listener); + } + } + + static public void SetDefaultCamera(CompositionManager compositor) + { + var camera = CompositionManager.GetSceceCamera(); + if (camera != null) + { + var outputCamera = Object.Instantiate(camera); + RemoveAudioListeners(outputCamera); + outputCamera.name = k_DefaultCameraName; + outputCamera.tag = "Untagged"; + outputCamera.cullingMask = 0; // we don't want to render any 3D objects on the compositor camera + compositor.outputCamera = outputCamera; + } + } + + static public void SetDefaultLayers(CompositionManager compositor) + { + for (int i = compositor.numLayers - 1; i>=0; --i) + { + if (compositor.layers[i].outputTarget == CompositorLayer.OutputTarget.CompositorLayer) + { + if ( (i+i < compositor.numLayers - 1) && (compositor.layers[i+1].outputTarget == CompositorLayer.OutputTarget.CameraStack)) + { + continue; + } + compositor.AddNewLayer(i + 1); + } + } + } + + static public void LoadOrCreateCompositionProfileAsset(CompositionManager compositor) + { + var shader = compositor.shader; + var fullpath = AssetDatabase.GetAssetPath(shader); + var path = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(fullpath), System.IO.Path.GetFileNameWithoutExtension(shader.name)) + ".asset"; + + CompositionProfile newProfile = AssetDatabase.LoadAssetAtPath(path); + + if (newProfile == null) + { + Debug.Log($"Creating new composition profile asset at path: {path}"); + + newProfile = ScriptableObject.CreateInstance(); + + // path = AssetDatabase.GenerateUniqueAssetPath(path); + AssetDatabase.CreateAsset(newProfile, path); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + else + { + Debug.Log($"Loading composition profile from {path}"); + } + compositor.profile = newProfile; + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs.meta new file mode 100644 index 00000000000..9e31ad5b266 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b9aec9adc3699b44e8516cecc87c1b8b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs new file mode 100644 index 00000000000..c3e24d6e262 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs @@ -0,0 +1,161 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering.HighDefinition.Compositor; + +#if UNITY_EDITOR +using UnityEditor; +using UnityEditorInternal; +using UnityEditor.ShaderGraph; +using UnityEditor.SceneManagement; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class CompositorWindow : EditorWindow + { + static partial class TextUI + { + static public readonly GUIContent EnableCompositor = EditorGUIUtility.TrTextContent("Enable Compositor", "Enabled the compositor and creates a default composition profile."); + static public readonly GUIContent RemoveCompositor = EditorGUIUtility.TrTextContent("Remove compositor from scene", "Removes the compositor and any composition settings from the scene."); + } + + static CompositorWindow s_Window; + CompositionManagerEditor m_Editor; + Vector2 m_ScrollPosition = Vector2.zero; + bool m_RequiresRedraw = false; + + [MenuItem("Window/Render Pipeline/HD Render Pipeline Compositor", false, 10400)] + static void Init() + { + // Get existing open window or if none, make a new one: + s_Window = (CompositorWindow)EditorWindow.GetWindow(typeof(CompositorWindow)); + s_Window.titleContent = new GUIContent("HDRP Compositor (Preview)"); + s_Window.Show(); + } + + void Update() + { + // This ensures that layer thumbnails are updated every frame (for video layers) + Repaint(); + } + + void OnGUI() + { + CompositionManager compositor = CompositionManager.GetInstance(); + bool enableCompositor = false; + if (compositor) + { + enableCompositor = compositor.enabled; + } + + bool enableCompositorCached = enableCompositor; + enableCompositor = EditorGUILayout.Toggle(TextUI.EnableCompositor, enableCompositor); + + // Track if the user changed the compositor enable state and mark the scene dirty if necessary + if (enableCompositorCached != enableCompositor && compositor != null) + { + EditorUtility.SetDirty(compositor); + } + + if (compositor == null && enableCompositor) + { + Debug.Log("The scene does not have a compositor. Creating a new one with the default configuration."); + GameObject go = new GameObject("HDRP Compositor") { hideFlags = HideFlags.HideInHierarchy }; + compositor = go.AddComponent(); + + // Mark as dirty, so if the user closes the scene right away, the change will be saved. + EditorUtility.SetDirty(compositor); + + // Now add the default configuration + CompositionUtils.LoadDefaultCompositionGraph(compositor); + CompositionUtils.LoadOrCreateCompositionProfileAsset(compositor); + compositor.SetupCompositionMaterial(); + CompositionUtils.SetDefaultCamera(compositor); + CompositionUtils.SetDefaultLayers(compositor); + } + + if (compositor) + { + compositor.enabled = enableCompositor; + } + else + { + return; + } + + if (compositor && compositor.enabled == false) + { + if (GUILayout.Button(new GUIContent("Remove compositor from scene"))) + { + if (compositor.outputCamera) + { + if(compositor.outputCamera.name == CompositionUtils.k_DefaultCameraName) + { + var cameraData = compositor.outputCamera.GetComponent(); + if (cameraData != null) + { + CoreUtils.Destroy(cameraData); + } + CoreUtils.Destroy(compositor.outputCamera.gameObject); + CoreUtils.Destroy(compositor.outputCamera); + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + } + } + + CoreUtils.Destroy(compositor); + return; + } + } + + if (compositor.profile == null) + { + // The compositor was loaded, but there was no profile (someone deleted the asset from disk?), so create a new one + CompositionUtils.LoadOrCreateCompositionProfileAsset(compositor); + compositor.SetupCompositionMaterial(); + return; + } + + if (compositor.shader != null) + { + // keep track of shader graph changes: when the user saves a graph, we should load/reflect any new shader properties + GraphData.onSaveGraph += MarkShaderAsDirty; + } + + if (m_Editor == null || m_Editor.target == null || m_Editor.isDirty || m_RequiresRedraw) + { + m_Editor = (CompositionManagerEditor)Editor.CreateEditor(compositor); + m_RequiresRedraw = false; + } + + m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition); + using (new EditorGUI.DisabledScope(compositor.enabled == false)) + { + if (m_Editor) + { + m_Editor.OnInspectorGUI(); + } + } + GUILayout.EndScrollView(); + } + + void MarkShaderAsDirty(Shader shader, object context) + { + CompositionManager compositor = CompositionManager.GetInstance(); + compositor.shaderPropertiesAreDirty = true; + m_RequiresRedraw = true; + + EditorUtility.SetDirty(compositor); + EditorUtility.SetDirty(compositor.profile); + } + + private void OnDestroy() + { + CompositionManager compositor = CompositionManager.GetInstance(); + if (compositor.shader != null) + { + GraphData.onSaveGraph -= MarkShaderAsDirty; + } + } + } +} +#endif diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs.meta new file mode 100644 index 00000000000..d436ef307be --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 47305bd173a0c8b4eb7c8c5c2b8e080a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs new file mode 100644 index 00000000000..204b3f39549 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs @@ -0,0 +1,36 @@ +using UnityEditor; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class SerializedCompositionFilter + { + public SerializedProperty FilterType; + public SerializedProperty MaskColor; + public SerializedProperty KeyThreshold; + public SerializedProperty KeyTolerance; + public SerializedProperty SpillRemoval; + public SerializedProperty AlphaMask; + + public SerializedCompositionFilter(SerializedProperty root) + { + FilterType = root.FindPropertyRelative("m_Type"); + MaskColor = root.FindPropertyRelative("m_MaskColor"); + KeyThreshold = root.FindPropertyRelative("m_KeyThreshold"); + KeyTolerance = root.FindPropertyRelative("m_KeyTolerance"); + SpillRemoval = root.FindPropertyRelative("m_SpillRemoval"); + AlphaMask = root.FindPropertyRelative("m_AlphaMask"); + } + + public float GetHeight() + { + if (FilterType.intValue == 0) + { + return 5 * CompositorStyle.k_Spacing; + } + else + { + return CompositorStyle.k_Spacing; + } + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs.meta new file mode 100644 index 00000000000..20dd33d97d2 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8327178c39deb6488624ffb0ff1a659 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs new file mode 100644 index 00000000000..7bc8fb96205 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs @@ -0,0 +1,112 @@ +using System.Collections.Generic; + +using UnityEditor; +using UnityEngine.Rendering.HighDefinition.Compositor; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class SerializedCompositionLayer + { + public SerializedProperty LayerName; + public SerializedProperty Show; + public SerializedProperty ResolutionScale; + public SerializedProperty ExpandLayer; + public SerializedProperty OutTarget; + public SerializedProperty OutputRenderer; + public SerializedProperty ClearDepth; + public SerializedProperty ClearAlpha; + public SerializedProperty InputLayerType; + public SerializedProperty InputCamera; + public SerializedProperty InputVideo; + public SerializedProperty InputTexture; + public SerializedProperty FitType; + public SerializedProperty ColorFormat; + public SerializedProperty OverrideAA; + public SerializedProperty AAMode; + public SerializedProperty OverrideClearMode; + public SerializedProperty ClearMode; + public SerializedProperty OverrideCulling; + public SerializedProperty CullingMaskProperty; + public SerializedProperty OverrideVolume; + public SerializedProperty VolumeMask; + public SerializedProperty AOVBitmask; + public SerializedProperty InputFilters; + public SerializedProperty PositionInStack; + + public List FilterList = new List(); + + public SerializedCompositionLayer(SerializedProperty root) + { + LayerName = root.FindPropertyRelative("m_LayerName"); + Show = root.FindPropertyRelative("m_Show"); + ResolutionScale = root.FindPropertyRelative("m_ResolutionScale"); + ExpandLayer = root.FindPropertyRelative("m_ExpandLayer"); + OutTarget = root.FindPropertyRelative("m_OutputTarget"); + ClearDepth = root.FindPropertyRelative("m_ClearDepth"); + ClearAlpha = root.FindPropertyRelative("m_ClearAlpha"); + OutputRenderer = root.FindPropertyRelative("m_OutputRenderer"); + InputLayerType = root.FindPropertyRelative("m_Type"); + InputCamera = root.FindPropertyRelative("m_Camera"); + InputVideo = root.FindPropertyRelative("m_InputVideo"); + InputTexture = root.FindPropertyRelative("m_InputTexture"); + FitType = root.FindPropertyRelative("m_BackgroundFit"); + ColorFormat = root.FindPropertyRelative("m_ColorBufferFormat"); + OverrideClearMode = root.FindPropertyRelative("m_OverrideClearMode"); + ClearMode = root.FindPropertyRelative("m_ClearMode"); + OverrideAA = root.FindPropertyRelative("m_OverrideAntialiasing"); + AAMode = root.FindPropertyRelative("m_Antialiasing"); + OverrideCulling = root.FindPropertyRelative("m_OverrideCullingMask"); + CullingMaskProperty = root.FindPropertyRelative("m_CullingMask"); + OverrideVolume = root.FindPropertyRelative("m_OverrideVolumeMask"); + VolumeMask = root.FindPropertyRelative("m_VolumeMask"); + AOVBitmask = root.FindPropertyRelative("m_AOVBitmask"); + InputFilters = root.FindPropertyRelative("m_InputFilters"); + PositionInStack = root.FindPropertyRelative("m_LayerPositionInStack"); + + for (int index = 0; index < InputFilters.arraySize; index++) + { + var serializedFilter = InputFilters.GetArrayElementAtIndex(index); + FilterList.Add(new SerializedCompositionFilter(serializedFilter)); + } + } + + public float GetPropertiesHeight() + { + if (OutTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) + { + return + EditorGUI.GetPropertyHeight(OutputRenderer, null) + + EditorGUI.GetPropertyHeight(ColorFormat, null) + + EditorGUI.GetPropertyHeight(AOVBitmask, null) + + EditorGUI.GetPropertyHeight(ResolutionScale, null) + + 2 * EditorGUIUtility.singleLineHeight; //for the heading and pading + } + else + { + return EditorGUI.GetPropertyHeight(LayerName, null) + + EditorGUI.GetPropertyHeight(InputCamera, null) + + EditorGUI.GetPropertyHeight(ClearDepth, null) + + EditorGUI.GetPropertyHeight(ClearAlpha, null) + + EditorGUI.GetPropertyHeight(ClearMode, null) + + EditorGUI.GetPropertyHeight(AAMode, null) + + EditorGUI.GetPropertyHeight(CullingMaskProperty, null) + + EditorGUI.GetPropertyHeight(VolumeMask, null) + + EditorGUI.GetPropertyHeight(InputFilters, null) + + 7 * EditorGUIUtility.singleLineHeight; //for the heading and pading + } + } + + public float GetListItemHeight() + { + int pading = 10; + if (OutTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) + { + return CompositorStyle.k_ThumbnailSize + pading; + } + else + { + return EditorGUIUtility.singleLineHeight + pading; + } + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs.meta new file mode 100644 index 00000000000..54d55be7358 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15ca2503b903ba94fae8c342a299cc0a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs new file mode 100644 index 00000000000..7258cd429c7 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs @@ -0,0 +1,51 @@ +using UnityEditor; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class SerializedCompositionManager + { + public SerializedProperty CompositionProfile; + public SerializedProperty LayerList; + public SerializedProperty ShaderProperties; + public SerializedProperty DisplayNumber; + public SerializedProperty CompositionShader; + public SerializedProperty OutputCamera; + + public SerializedObject CompositionProfileSO; + public SerializedObject CompositorSO; + + public SerializedCompositionManager(SerializedObject root) + { + CompositorSO = root; + { + CompositionProfile = CompositorSO.FindProperty("m_CompositionProfile"); + DisplayNumber = CompositorSO.FindProperty("m_OutputDisplay"); + CompositionShader = CompositorSO.FindProperty("m_Shader"); + OutputCamera = CompositorSO.FindProperty("m_OutputCamera"); + } + + LayerList = CompositorSO.FindProperty("m_InputLayers"); + + // Work around to find property on scriptable object + if (CompositionProfile.objectReferenceValue) + { + CompositionProfileSO = new SerializedObject(CompositionProfile.objectReferenceValue); + { + ShaderProperties = CompositionProfileSO.FindProperty("m_ShaderProperties"); + } + } + } + + public void Update() + { + CompositionProfileSO.Update(); + CompositorSO.Update(); + } + + public void ApplyModifiedProperties() + { + CompositionProfileSO.ApplyModifiedProperties(); + CompositorSO.ApplyModifiedProperties(); + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs.meta new file mode 100644 index 00000000000..8a3ef5ea16d --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2c99a250cc4cad4190066209934d2cd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs new file mode 100644 index 00000000000..56163d41eff --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs @@ -0,0 +1,20 @@ +using UnityEditor; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class SerializedShaderProperty + { + public SerializedProperty PropertyName; + public SerializedProperty PropertyType; + public SerializedProperty PropertyValue; + public SerializedProperty RangeLimits; + + public SerializedShaderProperty(SerializedProperty root) + { + PropertyName = root.FindPropertyRelative("m_PropertyName"); + PropertyType = root.FindPropertyRelative("m_Type"); + PropertyValue = root.FindPropertyRelative("m_Value"); + RangeLimits = root.FindPropertyRelative("m_RangeLimits"); + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs.meta new file mode 100644 index 00000000000..412e127ae27 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cc7713c03abe2124c9c74aa782e8ee37 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs new file mode 100644 index 00000000000..b20712307a6 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs @@ -0,0 +1,75 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEditor; + +using System.Collections.Generic; + +namespace UnityEditor.Rendering.HighDefinition.Compositor +{ + internal class ShaderPropertyUI + { + public static void Draw(List propertyList) + { + int index = propertyList.FindIndex(x => x.PropertyType.intValue != (int)ShaderPropertyType.Texture); + if (index >= 0) + { + EditorGUILayout.Separator(); + var headerStyle = EditorStyles.helpBox; + headerStyle.fontSize = 14; + EditorGUILayout.LabelField("Composition Parameters", headerStyle); + } + + foreach (var property in propertyList) + { + Draw(property); + } + } + + public static void Draw(SerializedShaderProperty prop) + { + int columnWidth = (int)EditorGUIUtility.labelWidth; // Set a fixed length for all labels, so everything in the UI is nicely aligned + + switch ((ShaderPropertyType)prop.PropertyType.intValue) + { + case ShaderPropertyType.Range: + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); + Vector2 rangeLimits = prop.RangeLimits.vector2Value; + float val = EditorGUILayout.Slider(prop.PropertyValue.vector4Value.x, rangeLimits.x, rangeLimits.y); + prop.PropertyValue.vector4Value = new Vector4(val, 0, 0, 0); + EditorGUILayout.EndHorizontal(); + } + break; + case ShaderPropertyType.Float: + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); + float val = EditorGUILayout.FloatField(prop.PropertyValue.vector4Value.x); + prop.PropertyValue.vector4Value = new Vector4(val, 0, 0, 0); + EditorGUILayout.EndHorizontal(); + } + break; + case ShaderPropertyType.Vector: + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); + Vector4 val = EditorGUILayout.Vector4Field(GUIContent.none, prop.PropertyValue.vector4Value); + prop.PropertyValue.vector4Value = val; + EditorGUILayout.EndHorizontal(); + } + break; + case ShaderPropertyType.Color: + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); + Color val = prop.PropertyValue.vector4Value; + val = EditorGUILayout.ColorField(GUIContent.none, val); + prop.PropertyValue.vector4Value = val; + EditorGUILayout.EndHorizontal(); + } + break; + } + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs.meta b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs.meta new file mode 100644 index 00000000000..46c881fdb0a --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 50e466354f3d88f4fac33942f3ffd724 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor.meta new file mode 100644 index 00000000000..7c37f968d8f --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8d1e6e8a33362094d823f5a987b64542 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs new file mode 100644 index 00000000000..81e58767a48 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs @@ -0,0 +1,40 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + internal enum BackgroundFitMode + { + Stretch, + FitHorizontally, + FitVertically + }; + + // This class store some additional per-camera data (filters, custom clear modes, etc) that are used by the compositor. + internal class AdditionalCompositorData : MonoBehaviour + { + public Texture m_clearColorTexture = null; + public bool m_clearAlpha = true; // Clearing the alpha allows the post process to run only on the pixels covered by a stacked camera (and not the previous ones). + public BackgroundFitMode m_imageFitMode = BackgroundFitMode.Stretch; + public List m_layerFilters; + + public void Init(List layerFilters, bool clearAlpha) + { + m_layerFilters = new List(layerFilters); + m_clearAlpha = clearAlpha; + } + + public void Reset() + { + m_clearColorTexture = null; + m_clearAlpha = true; + m_imageFitMode = BackgroundFitMode.Stretch; + + if (m_layerFilters !=null ) + { + m_layerFilters.Clear(); + } + + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs.meta new file mode 100644 index 00000000000..3128b6cb73d --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ae910c312a6a6c419b4ff762c33fd95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs new file mode 100644 index 00000000000..da2f76f1ef5 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs @@ -0,0 +1,61 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using System; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + [Serializable, VolumeComponentMenu("Post-processing/Custom/AlphaIjection")] + internal sealed class AlphaInjection : CustomPostProcessVolumeComponent, IPostProcessComponent + { + internal class ShaderIDs + { + public static readonly int _AlphaTexture = Shader.PropertyToID("_AlphaTexture"); + public static readonly int _InputTexture = Shader.PropertyToID("_InputTexture"); + } + + Material m_Material; + + public bool IsActive() => m_Material != null; + + public override CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.BeforePostProcess; + + public override void Setup() + { + if (Shader.Find("Hidden/Shader/AlphaInjection") != null) + m_Material = new Material(Shader.Find("Hidden/Shader/AlphaInjection")); + } + + public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) + { + Debug.Assert(m_Material != null); + + //TODO: can we detect this before we get here? + AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent(); + if (layerData == null || layerData.m_layerFilters == null) + { + HDUtils.BlitCameraTexture(cmd, source, destination); + return; + } + + int indx = layerData.m_layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.ALPHA_MASK); + if (indx < 0) + { + HDUtils.BlitCameraTexture(cmd, source, destination); + return; + } + + var filter = layerData.m_layerFilters[indx]; + m_Material.SetTexture(ShaderIDs._InputTexture, source); + m_Material.SetTexture(ShaderIDs._AlphaTexture, filter.m_AlphaMask); + + HDUtils.DrawFullScreen(cmd, m_Material, destination); + } + + public override void Cleanup() + { + CoreUtils.Destroy(m_Material); + } + } + +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs.meta new file mode 100644 index 00000000000..ef5f23f798d --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: da907761ad48a684aa45e5dc639d9304 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs new file mode 100644 index 00000000000..d7a442d760e --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs @@ -0,0 +1,70 @@ +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using System; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + // Custom post-processing pass that performs chroma keying + // Shader adapted from: https://github.com/keijiro/ProcAmp + [Serializable, VolumeComponentMenu("Post-processing/Custom/ChromaKeying")] + internal sealed class ChromaKeying : CustomPostProcessVolumeComponent, IPostProcessComponent + { + internal class ShaderIDs + { + public static readonly int _KeyColor = Shader.PropertyToID("_KeyColor"); + public static readonly int _KeyParams = Shader.PropertyToID("_KeyParams"); + public static readonly int _InputTexture = Shader.PropertyToID("_InputTexture"); + } + + public BoolParameter activate = new BoolParameter(false); + Material m_Material; + + public bool IsActive() => m_Material != null; + + public override CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.BeforePostProcess; + + public override void Setup() + { + if (Shader.Find("Hidden/Shader/ChromaKeying") != null) + m_Material = new Material(Shader.Find("Hidden/Shader/ChromaKeying")); + } + + public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) + { + Debug.Assert(m_Material != null); + + AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent(); + + if (activate.value == false || layerData == null || layerData.m_layerFilters == null) + { + HDUtils.BlitCameraTexture(cmd, source, destination); + return; + } + + int indx = layerData.m_layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.CHROMA_KEYING); + if (indx < 0) + { + HDUtils.BlitCameraTexture(cmd, source, destination); + return; + } + + var filter = layerData.m_layerFilters[indx]; + Vector4 keyParams; + keyParams.x = filter.m_KeyThreshold; + keyParams.y = filter.m_KeyTolerance; + keyParams.z = filter.m_SpillRemoval; + keyParams.w = 1.0f; + + m_Material.SetVector(ShaderIDs._KeyColor, filter.m_MaskColor); + m_Material.SetVector(ShaderIDs._KeyParams, keyParams); + m_Material.SetTexture(ShaderIDs._InputTexture, source); + HDUtils.DrawFullScreen(cmd, m_Material, destination); + } + + public override void Cleanup() + { + CoreUtils.Destroy(m_Material); + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs.meta new file mode 100644 index 00000000000..788a6af4e2c --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf4ca3f87079ba246a93410400bb24c4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs new file mode 100644 index 00000000000..664e8f3957e --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + [System.Serializable] + internal class CompositionFilter + { + public enum FilterType + { + CHROMA_KEYING = 0, + ALPHA_MASK + } + + //TODO: inheritance? + public int m_Type; + public Color m_MaskColor; + public float m_KeyThreshold = 0.8f; + public float m_KeyTolerance = 0.5f; + public float m_SpillRemoval = 0.0f; + public Texture m_AlphaMask; + + static public CompositionFilter Create(FilterType type) + { + var newFilter = new CompositionFilter(); + newFilter.m_Type = (int)type; + return newFilter; + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs.meta new file mode 100644 index 00000000000..5caa49af7bf --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9352d7542a49cd9498b3cf2accb8f066 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs new file mode 100644 index 00000000000..949f6035c8a --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -0,0 +1,646 @@ +using System.Collections; +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering.HighDefinition.Attributes; +using UnityEngine.Video; + +using UnityEngine.Experimental.Rendering; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + // Defines a single compositor layer and it's runtime properties. These are scene specific and are not saved in the asset file. + [System.Serializable] + internal class CompositorLayer + { + public enum LayerType + { + Camera = 0, + Video = 1, + Image = 2 + }; + + // The graphics format options exposed in the UI + public enum UIColorBufferFormat + { + R11G11B10 = GraphicsFormat.B10G11R11_UFloatPack32, + R16G16B16A16 = GraphicsFormat.R16G16B16A16_UNorm, + R32G32B32A32 = GraphicsFormat.R32G32B32A32_SFloat + }; + + // Specifies if this layer will be used in the compositor or a camera stack + public enum OutputTarget + { + CompositorLayer = 0, + CameraStack + } + + public enum ResolutionScale + { + Full = 1, + Half = 2, + Quarter = 4 + } + public string name + { + get => m_LayerName; + } + [SerializeField] string m_LayerName; + + public OutputTarget outputTarget + { + get => m_OutputTarget; + } + + [SerializeField] OutputTarget m_OutputTarget; // Specifies if this layer will be used in the compositor or a camera stack + [SerializeField] bool m_ClearDepth = false; // Specifies if the depth will be cleared when stacking this camera over the previous one (for overlays) + [SerializeField] bool m_ClearAlpha = true; // Specifies if the Alpha channel will be cleared when stacking this camera over the previous one (for overlays) + [SerializeField] Renderer m_OutputRenderer = null; // Specifies the output surface/renderer + [SerializeField] LayerType m_Type; + [SerializeField] Camera m_Camera; // The source camera for the layer (were we get the default properties). The actual rendering, with overridden properties is done by the m_LayerCamera + [SerializeField] public VideoPlayer m_InputVideo; + [SerializeField] public Texture m_InputTexture; + [SerializeField] public BackgroundFitMode m_BackgroundFit; + [SerializeField] ResolutionScale m_ResolutionScale = ResolutionScale.Full; + [SerializeField] UIColorBufferFormat m_ColorBufferFormat = UIColorBufferFormat.R16G16B16A16; + + // Layer overrides + [SerializeField] bool m_OverrideAntialiasing = false; + [SerializeField] HDAdditionalCameraData.AntialiasingMode m_Antialiasing; + + [SerializeField] bool m_OverrideClearMode = false; + [SerializeField] public HDAdditionalCameraData.ClearColorMode m_ClearMode; + + [SerializeField] bool m_OverrideCullingMask = false; + [SerializeField] LayerMask m_CullingMask; + + [SerializeField] bool m_OverrideVolumeMask = false; + [SerializeField] LayerMask m_VolumeMask; + + [SerializeField] int m_LayerPositionInStack = 0; + + // Layer filters + [SerializeField] List m_InputFilters = new List(); + + // AOVs + [SerializeField] MaterialSharedProperty m_AOVBitmask = 0; + + [SerializeField] Dictionary m_AOVMap; + + List m_AOVHandles; + + [SerializeField] List m_AOVRenderTargets; + + RTHandle m_RTHandle; + + [SerializeField] RenderTexture m_RenderTarget; + + [SerializeField] RTHandle m_AOVTmpRTHandle; + + [SerializeField] bool m_ClearsBackGround = false; + + public bool enabled + { + get => m_Show; + set + { + m_Show = value; + } + } + + [SerializeField] bool m_Show = true; // Used to toggle visibility of layers + + public float aspectRatio + { + get + { + if (m_Camera != null) + { + return (float)m_Camera.pixelWidth / m_Camera.pixelHeight; + } + return 1.0f; + } + } + + public Camera camera + { + get => m_LayerCamera; + } + + [SerializeField] Camera m_LayerCamera; + + private CompositorLayer() + { + } + + public static CompositorLayer CreateStackLayer(LayerType type = CompositorLayer.LayerType.Camera, string layerName = "New Layer") + { + var newLayer = new CompositorLayer(); + newLayer.m_LayerName = layerName; + newLayer.m_Type = type; + newLayer.m_OverrideCullingMask = true; + newLayer.m_CullingMask = 0; //LayerMask.GetMask("None"); + newLayer.m_Camera = CompositionManager.GetSceceCamera(); + newLayer.m_OutputTarget = CompositorLayer.OutputTarget.CameraStack; + newLayer.m_ClearDepth = true; + + if (newLayer.m_Type == LayerType.Image || newLayer.m_Type == LayerType.Video) + { + newLayer.m_OverrideVolumeMask = true; + newLayer.m_VolumeMask = 0; + newLayer.m_ClearAlpha = false; + newLayer.m_OverrideAntialiasing = true; + newLayer.m_Antialiasing = HDAdditionalCameraData.AntialiasingMode.None; + } + + return newLayer; + } + + public static CompositorLayer CreateOutputLayer(string layerName) + { + var newLayer = new CompositorLayer(); + newLayer.m_LayerName = layerName; + newLayer.m_OutputTarget = CompositorLayer.OutputTarget.CompositorLayer; + + return newLayer; + } + + static float EnumToScale(ResolutionScale scale) + { + float resScale = 1.0f;// / (int)m_ResolutionScale; + switch (scale) + { + case ResolutionScale.Half: + resScale = 0.5f; + break; + case ResolutionScale.Quarter: + resScale = 0.25f; + break; + default: + resScale = 1.0f; + break; + } + return resScale; + } + + public int pixelWidth + { + get + { + if (m_Camera) + { + float resScale = EnumToScale(m_ResolutionScale); + return (int)(resScale * m_Camera.pixelWidth); + } + return 0; + } + } + public int pixelHeight + { + get + { + if (m_Camera) + { + float resScale = EnumToScale(m_ResolutionScale); + return (int)(resScale * m_Camera.pixelHeight); + } + return 0; + } + } + public void Init(string layerID = "") + { + if (m_LayerName == "") + { + m_LayerName = layerID; + } + + // Compositor output layers (that allocate the render targets) also need a reference camera, just to get the reference pixel width/height + // Note: Movie & image layers are rendered at the output resolution (and not the movie/image resolution). This is required to have post-processing effects like film grain at full res. + if (m_Camera == null) + { + m_Camera = CompositionManager.GetSceceCamera(); + } + + // Create a new camera if necessary or use the one specified by the user + if (m_LayerCamera == null && m_OutputTarget == OutputTarget.CameraStack) + { + m_LayerCamera = Object.Instantiate(m_Camera); + + // delete any audio listeners from the clone camera + var listener = m_LayerCamera.GetComponent(); + if (listener) + { + CoreUtils.Destroy(listener); + } + m_LayerCamera.name = "Compositor" + layerID; + m_LayerCamera.gameObject.hideFlags = HideFlags.HideInInspector | HideFlags.HideInHierarchy | HideFlags.HideAndDontSave; + if(m_LayerCamera.tag == "MainCamera") + { + m_LayerCamera.tag = "Untagged"; + } + + // Remove the compositor copy (if exists) from the cloned camera. This will happen if the compositor script was attached to the camera we are cloning + var compositionManager = m_LayerCamera.GetComponent(); + if (compositionManager != null) + { + CoreUtils.Destroy(compositionManager); + } + + var cameraData = m_LayerCamera.GetComponent(); + if (cameraData == null) + { + m_LayerCamera.gameObject.AddComponent(typeof(HDAdditionalCameraData)); + } + + } + m_ClearsBackGround = false; + m_LayerPositionInStack = 0; // will be set in SetupLayerCamera + + if (m_OutputTarget != OutputTarget.CameraStack && m_RenderTarget == null) + { + m_RenderTarget = new RenderTexture(pixelWidth, pixelHeight, 24, (GraphicsFormat)m_ColorBufferFormat); + } + + // check and fix RT handle + if (m_OutputTarget != OutputTarget.CameraStack && m_RTHandle == null) + { + m_RTHandle = RTHandles.Alloc(m_RenderTarget); + } + + if (m_OutputTarget != OutputTarget.CameraStack && m_AOVBitmask != MaterialSharedProperty.None) + { + int aovMask = (1 << (int)m_AOVBitmask); + if (aovMask > 1) + { + m_AOVMap = new Dictionary(); + m_AOVRenderTargets = new List(); + m_AOVHandles = new List(); + + var aovNames = System.Enum.GetNames(typeof(MaterialSharedProperty)); + int NUM_AOVs = aovNames.Length; + int outputIndex = 0; + for (int i = 0; i < NUM_AOVs; ++i) + { + if ((aovMask & (1 << i)) != 0) + { + m_AOVMap[aovNames[i]] = outputIndex; + m_AOVRenderTargets.Add(new RenderTexture(pixelWidth, pixelHeight, 24, (GraphicsFormat)m_ColorBufferFormat)); + m_AOVHandles.Add(RTHandles.Alloc(m_AOVRenderTargets[outputIndex])); + outputIndex++; + } + } + } + } + else + { + if (m_AOVRenderTargets != null) + { + foreach (var rt in m_AOVRenderTargets) + { + CoreUtils.Destroy(rt); + } + m_AOVRenderTargets.Clear(); + } + if(m_AOVMap != null) + { + m_AOVMap.Clear(); + m_AOVMap = null; + } + } + + var compositor = CompositionManager.GetInstance(); + if (m_OutputRenderer != null && Application.IsPlaying(compositor.gameObject)) + { + MaterialPropertyBlock propertyBlock = new MaterialPropertyBlock(); + propertyBlock.SetTexture("_BaseColorMap", m_RenderTarget); + m_OutputRenderer.SetPropertyBlock(propertyBlock); + } + + if (m_LayerCamera) + { + m_LayerCamera.enabled = m_Show; + var cameraData = m_LayerCamera.GetComponent(); + var layerData = m_LayerCamera.GetComponent(); + { + // create the component if it is required and does not exist + //bool requiresAdditionalData = (m_AlphaMask || m_ChromaKeying || m_Type == LayerType.Image); + if (layerData == null) + { + layerData = m_LayerCamera.gameObject.AddComponent(); + layerData.hideFlags = HideFlags.HideAndDontSave; + } + // Reset the layer params (in case we cloned a camera which already had AdditionalCompositorData) + if (layerData != null) + { + layerData.Reset(); + } + } + + // layer overrides + SetLayerMaskOverrides(); + + if (m_Type == LayerType.Video && m_InputVideo != null) + { + m_InputVideo.targetCamera = m_LayerCamera; + m_InputVideo.renderMode = VideoRenderMode.CameraNearPlane; + } + else if (m_Type == LayerType.Image && m_InputTexture != null) + { + cameraData.clearColorMode = HDAdditionalCameraData.ClearColorMode.None; + + layerData.m_clearColorTexture = m_InputTexture; + layerData.m_imageFitMode = m_BackgroundFit; + } + + // Custom pass to inject an alpha mask + SetAdditionalLayerData(); + + if (m_InputFilters == null) + { + m_InputFilters = new List(); + } + } + } + + public bool Validate() + { + if ((m_OutputTarget != OutputTarget.CameraStack && m_RenderTarget == null) + || (m_OutputTarget != OutputTarget.CameraStack && m_RTHandle == null)) + { + Init(); + } + + if (m_OutputTarget == OutputTarget.CameraStack && m_LayerCamera == null) + { + Init(); + } + + return true; + } + + public void DestroyRT() + { + if (m_LayerCamera != null) + { + var cameraData = m_LayerCamera.GetComponent(); + if (cameraData) + { + CoreUtils.Destroy(cameraData); + } + m_LayerCamera.targetTexture = null; + CoreUtils.Destroy(m_LayerCamera); + m_LayerCamera = null; + } + + if (m_RTHandle != null) + { + RTHandles.Release(m_RTHandle); + m_RTHandle = null; + } + + if (m_RenderTarget != null) + { + CoreUtils.Destroy(m_RenderTarget); + m_RenderTarget = null; + } + + if (m_AOVHandles != null) + { + foreach (var handle in m_AOVHandles) + { + CoreUtils.Destroy(handle); + } + } + if (m_AOVRenderTargets != null) + { + foreach (var rt in m_AOVRenderTargets) + { + CoreUtils.Destroy(rt); + } + } + m_AOVMap?.Clear(); + m_AOVMap = null; + } + + public void Destroy() + { + DestroyRT(); + } + + public void SetLayerMaskOverrides() + { + if (m_OverrideCullingMask && m_LayerCamera) + { + m_LayerCamera.cullingMask = m_ClearsBackGround ? (LayerMask)0 : m_CullingMask; + } + + if (m_LayerCamera) + { + var cameraData = m_LayerCamera.GetComponent(); + if (cameraData) + { + if (m_OverrideVolumeMask && m_LayerCamera) + { + cameraData.volumeLayerMask = m_VolumeMask; + } + cameraData.volumeLayerMask |= 1 << 31; + + if (m_OverrideAntialiasing) + { + cameraData.antialiasing = m_Antialiasing; + } + + if (m_OverrideClearMode) + { + cameraData.clearColorMode = m_ClearMode; + } + } + } + } + + public void SetAdditionalLayerData() + { + if (m_LayerCamera) + { + var layerData = m_LayerCamera.GetComponent(); + if (layerData != null) + { + layerData.Init(m_InputFilters, m_ClearAlpha); + } + } + } + + public void UpdateOutputCamera() + { + if (m_LayerCamera == null) + { + return; + } + + var compositor = CompositionManager.GetInstance(); + m_LayerCamera.enabled = (m_Show || m_ClearsBackGround) && compositor.enableOutput; + + // Refresh the camera data + m_LayerCamera.CopyFrom(m_Camera); + var cameraDataOrig = m_Camera.GetComponent(); + var cameraData = m_LayerCamera.GetComponent(); + if (cameraDataOrig) + { + cameraDataOrig.CopyTo(cameraData); + } + } + + public void Update() + { + UpdateOutputCamera(); + SetLayerMaskOverrides(); + SetAdditionalLayerData(); + } + + public void SetPriotiry(float priority) + { + if (m_LayerCamera) + { + m_LayerCamera.depth = priority; + } + } + + public RenderTexture GetRenderTarget(bool allowAOV = true, bool alwaysShow = false) + { + if (m_Show || alwaysShow) + { + if (m_AOVMap != null && allowAOV) + { + foreach (var aov in m_AOVMap) + { + return m_AOVRenderTargets[aov.Value]; + } + } + + return m_RenderTarget; + } + return null; + } + + public bool ValidateRTSize(int referenceWidth, int referenceHeight) + { + if (m_RenderTarget == null) + { + return true; + } + + float scale = EnumToScale(m_ResolutionScale); + return ((m_RenderTarget.width == referenceWidth * scale) && (m_RenderTarget.height == referenceHeight * scale)); + } + + public void SetupClearColor() + { + m_LayerCamera.enabled = true; + m_LayerCamera.cullingMask = 0; + var cameraData = m_LayerCamera.GetComponent(); + var cameraDataOrig = m_Camera.GetComponent(); + + cameraData.clearColorMode = cameraDataOrig.clearColorMode; + cameraData.clearDepth = true; + + m_ClearsBackGround = true; + } + + public void AddInputFilter(CompositionFilter filter) + { + // avoid duplicate filters + foreach (var f in m_InputFilters) + { + if (f.m_Type == filter.m_Type) + { + return; + } + } + m_InputFilters.Add(filter); + } + public void SetupLayerCamera(CompositorLayer targetLayer, int layerPositionInStack) + { + if (!m_LayerCamera || (targetLayer == null)) + { + return; + } + + if (targetLayer.GetRenderTarget() == null) + { + m_LayerCamera.enabled = false; + return; + } + + m_LayerPositionInStack = layerPositionInStack; + + var cameraData = m_LayerCamera.GetComponent(); + m_LayerCamera.targetTexture = targetLayer.GetRenderTarget(false); + + if (targetLayer.m_AOVBitmask == 0) + { + if (layerPositionInStack != 0) + { + // The next layer in the stack should clear with the texture of the previous layer: this will copy the content of the target RT to the RTHandle and preserve post process + cameraData.clearColorMode = HDAdditionalCameraData.ClearColorMode.None; + var compositorData = m_LayerCamera.GetComponent(); + if (!compositorData) + { + compositorData = m_LayerCamera.gameObject.AddComponent(); + } + compositorData.m_clearColorTexture = targetLayer.GetRenderTarget(false); + cameraData.volumeLayerMask |= 1 << 31; + } + else + { + m_ClearDepth = true; + } + } + cameraData.clearDepth = m_ClearDepth; + + // The target layer expects AOVs, so this stacked layer should also generate AOVs + int aovMask = (1 << (int)targetLayer.m_AOVBitmask); + if (aovMask > 1) + { + var aovRequestBuilder = new AOVRequestBuilder(); + + var aovNames = System.Enum.GetNames(typeof(MaterialSharedProperty)); + int NUM_AOVs = aovNames.Length; + int outputIndex = 0; + for (int i = 0; i < NUM_AOVs; ++i) + { + if ((aovMask & (1 << i)) != 0) + { + int aovType = i; + + var aovRequest = new AOVRequest(AOVRequest.NewDefault()); + aovRequest.SetFullscreenOutput((MaterialSharedProperty)aovType); + + int indexLocalCopy = outputIndex; //< required to properly capture the variable in the lambda + aovRequestBuilder.Add( + aovRequest, + bufferId => targetLayer.m_AOVTmpRTHandle ?? (targetLayer.m_AOVTmpRTHandle = RTHandles.Alloc(targetLayer.pixelWidth, targetLayer.pixelHeight)), + null, + new[] { AOVBuffers.Color }, + (cmd, textures, properties) => + { + // copy result to the output buffer + cmd.Blit(textures[0], targetLayer.m_AOVRenderTargets[indexLocalCopy]); + } + ); + outputIndex++; + } + } + + cameraData.SetAOVRequests(aovRequestBuilder.Build()); + m_LayerCamera.enabled = true; + } + else + { + cameraData.SetAOVRequests(null); + } + } + + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs.meta new file mode 100644 index 00000000000..9e0bc5352f4 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 286d4ca5d0426934b91c7b6c89e09127 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs new file mode 100644 index 00000000000..16b78b2c109 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -0,0 +1,764 @@ +using System.Collections.Generic; +using System.Reflection; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering.HighDefinition.Attributes; +using UnityEngine.Video; + +using UnityEngine.Experimental.Rendering; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + // The main entry point for the compositing operations. Manages the list of layers, output displays, etc. + [ExecuteAlways] + internal class CompositionManager : MonoBehaviour + { + // These shader graph properties should be properly set when drawing a full screen quad for the compositor output + internal class SGShaderIDs + { + public static readonly int _ViewProjMatrix = Shader.PropertyToID("_ViewProjMatrix"); + public static readonly int _WorldSpaceCameraPos = Shader.PropertyToID("_WorldSpaceCameraPos"); + } + + public enum OutputDisplay + { + Display1 = 0, + Display2, + Display3, + Display4, + Display5, + Display6, + Display7, + Display8 + } + + public enum AlphaChannelSupport + { + None = 0, + Rendering, + RenderingAndPostProcessing + } + + [SerializeField] Material m_Material; + + [SerializeField] OutputDisplay m_OutputDisplay = OutputDisplay.Display1; + + public List layers + { + get => m_InputLayers; + } + + [SerializeField] List m_InputLayers = new List(); + + public AlphaChannelSupport alphaSupport + { + get => m_AlphaSupport; + } + internal AlphaChannelSupport m_AlphaSupport = AlphaChannelSupport.RenderingAndPostProcessing; + + public bool enableOutput + { + get + { + if (m_OutputCamera) + { + return m_OutputCamera.enabled; + } + return false; + } + set + { + if (m_OutputCamera) + { + m_OutputCamera.enabled = value; + + // also change the layers + foreach(var layer in m_InputLayers) + { + if (layer.camera) + { + layer.camera.enabled = value; + } + } + + } + } + } + + public int numLayers + { + get => m_InputLayers.Count; + } + + public Shader shader + { + get => m_Shader; + set + { + m_Shader = value; + } + } + + [SerializeField] Shader m_Shader; + + public CompositionProfile profile + { + get => m_CompositionProfile; + set => m_CompositionProfile = value; + } + + [HideInInspector, SerializeField] CompositionProfile m_CompositionProfile; + public Camera outputCamera + { + get => m_OutputCamera; + set => m_OutputCamera = value; + } + + [SerializeField] Camera m_OutputCamera; + + public float aspectRatio + { + get + { + if (m_InputLayers.Count > 0) + { + return m_InputLayers[0].aspectRatio; + } + return 1.0f; + } + } + + public bool shaderPropertiesAreDirty + { + set + { + m_ShaderPropertiesAreDirty = true; + } + } + + internal bool m_ShaderPropertiesAreDirty = false; + + internal Matrix4x4 m_ViewProjMatrix; + internal Matrix4x4 m_ViewProjMatrixFlipped; + internal GameObject m_CompositorGameObject; + + static private CompositionManager s_CompositorInstance; + + #region Validation + public void ValidateLayerListOrder(int oldIndex, int newIndex) + { + if (m_InputLayers.Count > 1) + { + if (m_InputLayers[0].outputTarget == CompositorLayer.OutputTarget.CameraStack) + { + var tmp = m_InputLayers[newIndex]; + m_InputLayers.RemoveAt(newIndex); + m_InputLayers.Insert(oldIndex, tmp); + } + } + } + + public bool RuntimeCheck() + { + for (int i = 0; i < m_InputLayers.Count; ++i) + { + if (!m_InputLayers[i].Validate()) + { + return false; + } + } + return true; + } + + + // Validates the rendering pipeline and fixes potential issues + bool ValidatePipeline() + { + var hdPipeline = RenderPipelineManager.currentPipeline as HDRenderPipeline; + if (hdPipeline != null) + { + m_AlphaSupport = AlphaChannelSupport.RenderingAndPostProcessing; + if (hdPipeline.asset.currentPlatformRenderPipelineSettings.colorBufferFormat == RenderPipelineSettings.ColorBufferFormat.R11G11B10) + { + m_AlphaSupport = AlphaChannelSupport.None; + } + else if (hdPipeline.asset.currentPlatformRenderPipelineSettings.postProcessSettings.bufferFormat == PostProcessBufferFormat.R11G11B10) + { + m_AlphaSupport = AlphaChannelSupport.Rendering; + } + + int indx = hdPipeline.asset.beforePostProcessCustomPostProcesses.FindIndex(x => x == typeof(ChromaKeying).AssemblyQualifiedName); + if (indx < 0) + { + Debug.Log("Registering chroma keying pass for the HDRP pipeline"); + hdPipeline.asset.beforePostProcessCustomPostProcesses.Add(typeof(ChromaKeying).AssemblyQualifiedName); + } + + indx = hdPipeline.asset.beforePostProcessCustomPostProcesses.FindIndex(x => x == typeof(AlphaInjection).AssemblyQualifiedName); + if (indx < 0) + { + Debug.Log("Registering alpha injection pass for the HDRP pipeline"); + hdPipeline.asset.beforePostProcessCustomPostProcesses.Add(typeof(AlphaInjection).AssemblyQualifiedName); + } + return true; + } + return false; + } + bool ValidateCompositionShader() + { + if (m_Shader == null) + { + return false; + } + + if (m_CompositionProfile == null) + { + Debug.Log("A composition profile was not found. Set the composition graph from the Compositor window to create one."); + return false; + } + + return true; + } + + bool ValidateProfile() + { + if (m_CompositionProfile) + { + return true; + } + else + { + Debug.LogError("No composition profile was found! Use the compositor tool to create one."); + return false; + } + } + + bool ValidateMainCompositorCamera() + { + if (m_OutputCamera == null) + { + return false; + } + + var cameraData = m_OutputCamera.GetComponent(); + if (cameraData == null) + { + m_OutputCamera.gameObject.AddComponent(typeof(HDAdditionalCameraData)); + cameraData = m_OutputCamera.GetComponent(); + } + + // Setup custom rendering (we don't want HDRP to compute anything in this camera) + if (cameraData) + { + cameraData.customRender += CustomRender; + } + else + { + Debug.Log("Null additional data in compositor output"); + } + return true; + } + + bool ValidateAndFixRuntime() + { + if (m_OutputCamera == null) + { + Debug.Log("No camera was found"); + return false; + } + + if (m_Shader == null) + { + Debug.Log("The composition shader graph must be set"); + return false; + } + + if (m_CompositionProfile == null) + { + Debug.Log("The composition profile was not set at runtime"); + return false; + } + + if (m_Material == null) + { + Debug.Log("The composition material was Null"); + SetupCompositionMaterial(); + } + + var cameraData = m_OutputCamera.GetComponent(); + if (cameraData && !cameraData.hasCustomRender) + { + cameraData.customRender += CustomRender; + } + + return true; + } + #endregion + + // This is called when we change camera, to remove the custom draw callback from the old camera before we set the new one + public void DropCompositorCamera() + { + if (m_OutputCamera) + { + var cameraData = m_OutputCamera.GetComponent(); + if (cameraData && cameraData.hasCustomRender) + { + cameraData.customRender -= CustomRender; + } + } + } + + public void Init() + { + if ( ValidateCompositionShader() && ValidateProfile() && ValidateMainCompositorCamera()) + { + UpdateDisplayNumber(); + + SetupCompositionMaterial(); + + SetupCompositorLayers(); + + SetupGlobalCompositorVolume(); + + SetupCompositorConstants(); + + SetupLayerPriorities(); + } + else + { + Debug.LogError("The compositor was disabled due to a validation error in the configuration."); + enabled = false; + } + } + + // Start is called before the first frame update + void Start() + { + Init(); + } + + void OnValidate() + { + + } + + public void OnEnable() + { + enableOutput = true; + s_CompositorInstance = null; +#if UNITY_EDITOR + //This is a work-around, to make edit and continue work when editing source code + UnityEditor.AssemblyReloadEvents.afterAssemblyReload += OnAfterAssemblyReload; +#endif + } + + public void DeleteLayerRTs() + { + // delete the layer from last to first, in order to release first the camera and then the associated RT + for (int i = m_InputLayers.Count - 1; i >= 0; --i) + { + m_InputLayers[i].DestroyRT(); + } + } + + public bool IsOutputLayer(int layerID) + { + if (layerID >= 0 && layerID < m_InputLayers.Count) + { + if (m_InputLayers[layerID].outputTarget == CompositorLayer.OutputTarget.CameraStack) + { + return false; + } + } + return true; + } + + public void UpdateDisplayNumber() + { + if (m_OutputCamera) + { + m_OutputCamera.targetDisplay = (int)m_OutputDisplay; + } + } + + void SetupCompositorLayers() + { + for (int i = 0; i < m_InputLayers.Count; ++i) + { + m_InputLayers[i].Init($"Layer{i}"); + } + + SetLayerRenderTargets(); + } + + public void SetNewCompositionShader() + { + // When we load a new shader, we need to clear the serialized material. + m_Material = null; + SetupCompositionMaterial(); + } + + public void SetupCompositionMaterial() + { + // Create the composition material + if (m_Shader) + { + if (m_Material == null) + { + m_Material = new Material(m_Shader); + } + + m_CompositionProfile.AddPropertiesFromShaderAndMaterial(this, m_Shader, m_Material); + } + else + { + Debug.LogError("Cannot find the default composition graph. Was the installation folder corrupted?"); + m_Material = null; + } + } + + public void SetupLayerPriorities() + { + int count = 0; + foreach (var layer in m_InputLayers) + { + // Set camera priority (camera's at the beginning of the list should be rendered first) + layer.SetPriotiry(count * 1.0f); + count++; + } + } + + public void OnAfterAssemblyReload() + { + // Bug? : After assembly reload, the customRender callback is dropped, so set it again + var cameraData = m_OutputCamera.GetComponent(); + if (cameraData && !cameraData.hasCustomRender) + { + cameraData.customRender += CustomRender; + } + } + + public void OnDisable() + { + enableOutput = false; + } + + // Setup a global volume used for chroma keying, alpha injection etc + void SetupGlobalCompositorVolume() + { + var compositorVolumes = Resources.FindObjectsOfTypeAll(typeof(CustomPassVolume)); + foreach (CustomPassVolume volume in compositorVolumes) + { + if(volume.isGlobal && volume.injectionPoint == CustomPassInjectionPoint.BeforeRendering) + { + Debug.LogWarning($"A custom volume pass with name ${volume.name} was already registered on the BeforeRendering injection point."); + } + } + + // Instead of using one volume per layer/camera, we setup one global volume and we store the data in the camera + // This way the compositor has to use only one layer/volume for N cameras (instead of N). + m_CompositorGameObject = new GameObject("Global Composition Volume") { hideFlags = HideFlags.HideAndDontSave }; + Volume globalPPVolume = m_CompositorGameObject.AddComponent(); + globalPPVolume.gameObject.layer = 31; + AlphaInjection injectAlphaNode = globalPPVolume.profile.Add(); + ChromaKeying chromaKeyingPass = globalPPVolume.profile.Add(); + chromaKeyingPass.activate.Override(true); + + // Custom pass for "Clear to Texture" + CustomPassVolume globalCustomPassVolume = m_CompositorGameObject.AddComponent(); + globalCustomPassVolume.injectionPoint = CustomPassInjectionPoint.BeforeRendering; + globalCustomPassVolume.AddPassOfType(typeof(CustomClear)); + } + + void SetupCompositorConstants() + { + m_ViewProjMatrix = Matrix4x4.Scale(new Vector3(2.0f, 2.0f, 0.0f)) * Matrix4x4.Translate(new Vector3(-0.5f, -0.5f, 0.0f)); + m_ViewProjMatrixFlipped = Matrix4x4.Scale(new Vector3(2.0f, -2.0f, 0.0f)) * Matrix4x4.Translate(new Vector3(-0.5f, -0.5f, 0.0f)); + } + + public void UpdateLayerSetup() + { + SetupCompositorLayers(); + SetupLayerPriorities(); + } + + // Update is called once per frame + void Update() + { + // TODO: move all validation calls to onValidate. Before doing it, this needs some extra testing to ensure nothing breaks + if (ValidatePipeline() == false || ValidateAndFixRuntime() == false || RuntimeCheck() == false) + { + return; + } + + UpdateDisplayNumber(); + +#if UNITY_EDITOR + if (m_ShaderPropertiesAreDirty) + { + SetNewCompositionShader(); + m_ShaderPropertiesAreDirty = false; + SetupCompositorLayers();//< required to allocate RT for the new layers + } + + // Detect runtime resolution change + foreach (var layer in m_InputLayers) + { + if (!layer.ValidateRTSize(m_OutputCamera.pixelWidth, m_OutputCamera.pixelHeight)) + { + DeleteLayerRTs(); + SetupCompositorLayers(); + break; + } + } +#endif + + if (m_CompositionProfile) + { + foreach (var layer in m_InputLayers) + { + layer.Update(); + } + SetLayerRenderTargets(); + } + } + + void OnDestroy() + { + // We need to destroy the layers from last to first, to avoid releasing a RT that is used by a camera + for (int i = m_InputLayers.Count - 1; i >= 0; --i) + { + m_InputLayers[i].Destroy(); + } + + if (m_CompositorGameObject != null) + { + CoreUtils.Destroy(m_CompositorGameObject); + m_CompositorGameObject = null; + } + + var compositorVolumes = Resources.FindObjectsOfTypeAll(typeof(CustomPassVolume)); + foreach (CustomPassVolume volume in compositorVolumes) + { + if (volume.name == "Global Composition Volume" && volume.injectionPoint == CustomPassInjectionPoint.BeforeRendering) + { + CoreUtils.Destroy(volume); + } + } + } + + public void AddInputFilterAtLayer(CompositionFilter filter, int index) + { + m_InputLayers[index].AddInputFilter(filter); + } + + public void AddNewLayer(int index, CompositorLayer.LayerType type = CompositorLayer.LayerType.Camera) + { + var newLayer = CompositorLayer.CreateStackLayer(type, "New SubLayer"); + + if (index >= 0 && index < m_InputLayers.Count) + { + m_InputLayers.Insert(index, newLayer); + } + else + { + m_InputLayers.Add(newLayer); + } + } + + int GetNumChildrenForLayerAtIndex(int indx) + { + if (m_InputLayers[indx].outputTarget == CompositorLayer.OutputTarget.CameraStack) + { + return 0; + } + + int num = 0; + for (int i = indx + 1; i < m_InputLayers.Count; ++i) + { + if (m_InputLayers[i].outputTarget == CompositorLayer.OutputTarget.CameraStack) + { + num++; + } + else + { + break; + } + } + return num; + } + + public void RemoveLayerAtIndex(int indx) + { + Debug.Assert(indx >= 0 && indx < m_InputLayers.Count); + + int numChildren = GetNumChildrenForLayerAtIndex(indx); + for (int i = numChildren; i >= 0; --i) + { + m_InputLayers[indx + i].Destroy(); + m_InputLayers.RemoveAt(indx + i); + } + } + + public void SetLayerRenderTargets() + { + int layerPositionInStack = 0; + CompositorLayer lastLayer = null; + for (int i = 0; i < m_InputLayers.Count; ++i) + { + if (m_InputLayers[i].outputTarget != CompositorLayer.OutputTarget.CameraStack) + { + lastLayer = m_InputLayers[i]; + } + + if (m_InputLayers[i].outputTarget == CompositorLayer.OutputTarget.CameraStack && i > 0) + { + m_InputLayers[i].SetupLayerCamera(lastLayer, layerPositionInStack); + + // Corner case: If the first layer in a camera stack was disabled, then it should still clear the color buffer + if (m_InputLayers[i].enabled == false && layerPositionInStack == 0) + { + m_InputLayers[i].SetupClearColor(); + } + layerPositionInStack++; + } + else + { + layerPositionInStack = 0; + } + } + } + + public void ReorderChildren(int oldIndex, int newIndex) + { + if (m_InputLayers[newIndex].outputTarget == CompositorLayer.OutputTarget.CompositorLayer) + { + if (oldIndex > newIndex) + { + for (int i = 1; oldIndex + i < m_InputLayers.Count; ++i) + { + if (m_InputLayers[oldIndex + i].outputTarget == CompositorLayer.OutputTarget.CameraStack) + { + var tmp = m_InputLayers[oldIndex + i]; + m_InputLayers.RemoveAt(oldIndex + i); + m_InputLayers.Insert(newIndex + i, tmp); + } + else + { + break; + } + } + } + else + { + while (m_InputLayers[oldIndex].outputTarget == CompositorLayer.OutputTarget.CameraStack) + { + var tmp = m_InputLayers[oldIndex]; + m_InputLayers.RemoveAt(oldIndex); + m_InputLayers.Insert(newIndex, tmp); + } + } + } + } + + public RenderTexture GetRenderTarget(int indx) + { + if (indx >= 0 && indx < m_InputLayers.Count) + { + return m_InputLayers[indx].GetRenderTarget(true, true); + } + return null; + } + + void CustomRender(ScriptableRenderContext context, HDCamera camera) + { + if (camera == null || camera.camera == null || m_Material == null) + return; + + // set shader uniforms + + foreach (var prop in m_CompositionProfile.m_ShaderProperties) + { + if (prop.m_Type == ShaderPropertyType.Float) + { + m_Material.SetFloat(prop.m_PropertyName, prop.m_Value.x); + } + else if (prop.m_Type == ShaderPropertyType.Vector) + { + m_Material.SetVector(prop.m_PropertyName, prop.m_Value); + } + else if (prop.m_Type == ShaderPropertyType.Range) + { + m_Material.SetFloat(prop.m_PropertyName, prop.m_Value.x); + } + else if (prop.m_Type == ShaderPropertyType.Color) + { + m_Material.SetColor(prop.m_PropertyName, prop.m_Value); + } + } + + int layerIndex = 0; + foreach (var layer in m_InputLayers) + { + if (layer.outputTarget != CompositorLayer.OutputTarget.CameraStack) // stacked cameras are not exposed as compositor layers + { + m_Material.SetTexture(layer.name, layer.GetRenderTarget(), RenderTextureSubElement.Color); + } + layerIndex++; + } + + // Blit command + var cmd = CommandBufferPool.Get("Compositor Blit"); + { + cmd.SetGlobalVector(SGShaderIDs._WorldSpaceCameraPos, new Vector3(0.0f, 0.0f, 0.0f)); + cmd.SetViewport(new Rect(0, 0, camera.camera.pixelWidth, camera.camera.pixelHeight)); + cmd.ClearRenderTarget(true, false, Color.black); + } + + if (camera.camera.targetTexture) + { + cmd.SetGlobalMatrix(SGShaderIDs._ViewProjMatrix, m_ViewProjMatrixFlipped); + cmd.Blit(null, BuiltinRenderTextureType.CurrentActive, m_Material, m_Material.FindPass("ForwardOnly")); + cmd.Blit(BuiltinRenderTextureType.CurrentActive, camera.camera.targetTexture); + } + else + { + cmd.SetGlobalMatrix(SGShaderIDs._ViewProjMatrix, m_ViewProjMatrix); + cmd.Blit(null, BuiltinRenderTextureType.CurrentActive, m_Material, m_Material.FindPass("ForwardOnly")); + } + + context.ExecuteCommandBuffer(cmd); + CommandBufferPool.Release(cmd); + } + + static public Camera GetSceceCamera() + { + if (Camera.main != null) + { + return Camera.main; + } + foreach (var camera in Camera.allCameras) + { + if (camera.name != "MainCompositorCamera") + { + return camera; + } + } + Debug.LogWarning("Camera not found"); + return null; + } + + static public CompositionManager GetInstance() + { + + if(s_CompositorInstance != null) + { + return s_CompositorInstance; + } + + s_CompositorInstance = GameObject.FindObjectOfType(typeof(CompositionManager), true) as CompositionManager; + return s_CompositorInstance; + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs.meta new file mode 100644 index 00000000000..bba1cba5e78 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 7e46d2393531446428690b5a5f21645d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - m_layerA: {fileID: 8400000, guid: 9aebcc4b6d72f1940b3d497a4a265ccb, type: 2} + - m_layerB: {fileID: 8400000, guid: 0dc4c7115986d6c4aadf84b8ec21dcd5, type: 2} + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs new file mode 100644 index 00000000000..9ca0dccb06f --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs @@ -0,0 +1,86 @@ +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Rendering; +using UnityEngine.Assertions; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + // Holds a list of layers and layer/composition properties. This is serialized and can be shared between projects + internal class CompositionProfile : ScriptableObject + { + public List m_ShaderProperties = new List(); + + public void AddPropertiesFromShaderAndMaterial (CompositionManager compositor, Shader shader, Material material) + { + // reflect the non-texture shader properties + List propertyNames = new List(); + int propCount = shader.GetPropertyCount(); + for (int i = 0; i < propCount; i++) + { + ShaderProperty sp = ShaderProperty.Create(shader, material, i); + AddShaderProperty(compositor, sp); + propertyNames.Add(sp.m_PropertyName); + } + + // remove any left-over properties that do not appear in the shader anymore + for (int j = m_ShaderProperties.Count - 1; j >= 0; --j) + { + int indx = propertyNames.FindIndex(x => x == m_ShaderProperties[j].m_PropertyName); + if (indx < 0) + { + m_ShaderProperties.RemoveAt(j); + } + } + + // Now remove any left-over layers that do not appear in the shader anymore + for (int j = compositor.layers.Count - 1; j >= 0; --j) + { + if (compositor.layers[j].outputTarget != CompositorLayer.OutputTarget.CameraStack) + { + int indx = propertyNames.FindIndex(x => x == compositor.layers[j].name); + if (indx < 0) + { + compositor.RemoveLayerAtIndex(j); + } + } + } + } + + public void AddShaderProperty(CompositionManager compositor, ShaderProperty sp) + { + Assert.IsNotNull(sp); + + // Check if property should be shown in the inspector + bool hide = ((int)sp.m_Flags & (int)ShaderPropertyFlags.NonModifiableTextureData) != 0 + || ((int)sp.m_Flags & (int)ShaderPropertyFlags.HideInInspector) != 0; + + + if (!hide) + { + // Check if property already exists / do not add duplicates + int indx = m_ShaderProperties.FindIndex(s => s.m_PropertyName == sp.m_PropertyName); + if (indx < 0) + { + m_ShaderProperties.Add(sp); + } + } + + // For textures, check if we already have this layer in the layer list. If not, add it. + if (sp.m_Type == ShaderPropertyType.Texture) + { + int indx = compositor.layers.FindIndex(s => s.name == sp.m_PropertyName); + if (indx < 0 && !hide) + { + Debug.Log($"Adding output layer from shader graph: {sp.m_PropertyName}"); + var newLayer = CompositorLayer.CreateOutputLayer(sp.m_PropertyName); + compositor.layers.Add(newLayer); + } + else if (indx >= 0 && hide) + { + // if a layer that was in the list is now hidden, remove it + compositor.RemoveLayerAtIndex(indx); + } + } + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs.meta new file mode 100644 index 00000000000..3f937b69f55 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 84e9807569cd8924fa417ecdee3f8eaf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs new file mode 100644 index 00000000000..aa241208460 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs @@ -0,0 +1,91 @@ +using UnityEngine; +using UnityEngine.Rendering.HighDefinition; +using UnityEngine.Rendering; +using UnityEngine.Experimental.Rendering; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + // A custom clear pass that is used internally in the compositor. The functionality includes: + // - Always clears the stencil buffer + // - Clears the alpha channel if desired + // - Clears the RGB channel to the color of a texture using a specified stretching mode + internal class CustomClear : CustomPass + { + internal class ShaderIDs + { + public static readonly int _BlitScaleBiasRt = Shader.PropertyToID("_BlitScaleBiasRt"); + public static readonly int _BlitScaleBias = Shader.PropertyToID("_BlitScaleBias"); + public static readonly int _BlitTexture = Shader.PropertyToID("_BlitTexture"); + public static readonly int _ClearAlpha = Shader.PropertyToID("_ClearAlpha"); + } + + enum PassType + { + ClearColorAndStencil = 0, + DrawTextureAndClearStencil = 1 + }; + Material fullscreenPassMaterial; + + // It can be used to configure render targets and their clear state. Also to create temporary render target textures. + // When empty this render pass will render to the active camera render target. + // You should never call CommandBuffer.SetRenderTarget. Instead call ConfigureTarget and ConfigureClear. + // The render pipeline will ensure target setup and clearing happens in an performance manner. + protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) + { + // Setup code here + if (name == "") name = "CustomClear"; + + fullscreenPassMaterial = CoreUtils.CreateEngineMaterial("Hidden/HDRP/CustomClear"); + } + + protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera camera, CullingResults cullingResult) + { + // Executed every frame for all the camera inside the pass volume + AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent(); + if (layerData == null || layerData.m_clearColorTexture == false) + { + return; + } + else + { + float cameraAspectRatio = (float)camera.actualWidth / camera.actualHeight; + float imageAspectRatio = (float)layerData.m_clearColorTexture.width / layerData.m_clearColorTexture.height; + + var scaleBiasRt = new Vector4(1.0f, 1.0f, 0.0f, 0.0f); + if (layerData.m_imageFitMode == BackgroundFitMode.FitHorizontally) + { + scaleBiasRt.y = cameraAspectRatio / imageAspectRatio; + scaleBiasRt.w = (1 - scaleBiasRt.y) / 2.0f; + } + else if (layerData.m_imageFitMode == BackgroundFitMode.FitVertically) + { + scaleBiasRt.x = imageAspectRatio / cameraAspectRatio; + scaleBiasRt.z = (1 - scaleBiasRt.x) / 2.0f; + } + //else stretch (nothing to do) + + // The texture might not cover the entire screen (letter boxing), so in this case clear first to the background color (and stencil) + if (scaleBiasRt.x < 1.0f || scaleBiasRt.y < 1.0f) + { + fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBiasRt, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + cmd.DrawProcedural(Matrix4x4.identity, fullscreenPassMaterial, (int)PassType.ClearColorAndStencil, MeshTopology.Quads, 4, 1); + } + + fullscreenPassMaterial.SetTexture(ShaderIDs._BlitTexture, layerData.m_clearColorTexture); + fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBiasRt, scaleBiasRt); + fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + fullscreenPassMaterial.SetInt(ShaderIDs._ClearAlpha, layerData.m_clearAlpha ? 1 : 0); + + // draw a quad (not Triangle), to support letter boxing and stretching + cmd.DrawProcedural(Matrix4x4.identity, fullscreenPassMaterial, (int)PassType.DrawTextureAndClearStencil, MeshTopology.Quads, 4, 1); + } + } + + protected override void Cleanup() + { + // Cleanup code + CoreUtils.Destroy(fullscreenPassMaterial); + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs.meta new file mode 100644 index 00000000000..87b6a06a64c --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4677620e26e08844080193ec315b1ac2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs.meta new file mode 100644 index 00000000000..4be03d8ea7d --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd274f1940882ef44a578e67d840b44c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset new file mode 100644 index 00000000000..cae32bc783b --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 84e9807569cd8924fa417ecdee3f8eaf, type: 3} + m_Name: DefaultCompositionGraph + m_EditorClassIdentifier: + m_ShaderProperties: [] diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset.meta new file mode 100644 index 00000000000..e4810e9a527 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ad2300115b0b5b5478bc1ca0968bc7d9 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph new file mode 100644 index 00000000000..729968583fe --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph @@ -0,0 +1,56 @@ +{ + "m_SerializedProperties": [ + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.Internal.Texture2DShaderProperty" + }, + "JSONnodeData": "{\n \"m_Guid\": {\n \"m_GuidSerialized\": \"4c33e0b4-5bfd-46be-b910-1f72e69cac39\"\n },\n \"m_Name\": \"BaseLayer\",\n \"m_DefaultReferenceName\": \"Texture2D_2D0BA1E8\",\n \"m_OverrideReferenceName\": \"BaseLayer\",\n \"m_GeneratePropertyBlock\": true,\n \"m_Precision\": 0,\n \"m_GPUInstanced\": false,\n \"m_Hidden\": false,\n \"m_Value\": {\n \"m_SerializedTexture\": \"{\\\"texture\\\":{\\\"instanceID\\\":0}}\",\n \"m_Guid\": \"\"\n },\n \"m_Modifiable\": true,\n \"m_DefaultType\": 1\n}" + } + ], + "m_SerializedKeywords": [], + "m_SerializableNodes": [ + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.UnlitMasterNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"c9a5664b-d175-44a6-857f-2a2b21200a82\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Unlit Master\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 267.0000915527344,\n \"y\": -648.0,\n \"width\": 200.00001525878907,\n \"height\": 197.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Vertex Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.NormalMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 10,\\n \\\"m_DisplayName\\\": \\\"Vertex Normal\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Normal\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.TangentMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 11,\\n \\\"m_DisplayName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.6235294342041016,\\n \\\"y\\\": 0.1262933909893036,\\n \\\"z\\\": 0.12156861275434494\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_ColorMode\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.5,\\n \\\"m_DefaultValue\\\": 0.5,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_SerializableSubShaders\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.Rendering.HighDefinition.UnlitSubShader\"\n },\n \"JSONnodeData\": \"{}\"\n }\n ],\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": false,\n \"m_AddPrecomputedVelocity\": false\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.SampleTexture2DNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"d4ae152b-4465-487c-a981-1c65b9b4d706\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Sample Texture 2D\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -180.99998474121095,\n \"y\": -577.0,\n \"width\": 197.0,\n \"height\": 249.00001525878907\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector4MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"RGBA\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"RGBA\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0,\\n \\\"w\\\": 0.0\\n }\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 4,\\n \\\"m_DisplayName\\\": \\\"R\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"R\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 5,\\n \\\"m_DisplayName\\\": \\\"G\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"G\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 6,\\n \\\"m_DisplayName\\\": \\\"B\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"B\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"A\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"A\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.0,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DInputMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 1,\\n \\\"m_DisplayName\\\": \\\"Texture\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Texture\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Texture\\\": {\\n \\\"m_SerializedTexture\\\": \\\"{\\\\\\\"texture\\\\\\\":{\\\\\\\"instanceID\\\\\\\":0}}\\\",\\n \\\"m_Guid\\\": \\\"\\\"\\n },\\n \\\"m_DefaultType\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.UVMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 2,\\n \\\"m_DisplayName\\\": \\\"UV\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"UV\\\",\\n \\\"m_StageCapability\\\": 3,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\"\\n ],\\n \\\"m_Channel\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.SamplerStateMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 3,\\n \\\"m_DisplayName\\\": \\\"Sampler\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Sampler\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": false,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_TextureType\": 0,\n \"m_NormalMapSpace\": 0\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.ShaderGraph.PropertyNode" + }, + "JSONnodeData": "{\n \"m_GuidSerialized\": \"fe0eb085-4a33-4b33-b46d-baebd2d3b66e\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Property\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": -465.0000305175781,\n \"y\": -539.0,\n \"width\": 135.0,\n \"height\": 34.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Texture2DMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"BaseLayer\\\",\\n \\\"m_SlotType\\\": 1,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Out\\\",\\n \\\"m_StageCapability\\\": 3\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_PropertyGuidSerialized\": \"4c33e0b4-5bfd-46be-b910-1f72e69cac39\"\n}" + } + ], + "m_Groups": [], + "m_StickyNotes": [], + "m_SerializableEdges": [ + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"d4ae152b-4465-487c-a981-1c65b9b4d706\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"c9a5664b-d175-44a6-857f-2a2b21200a82\"\n }\n}" + }, + { + "typeInfo": { + "fullName": "UnityEditor.Graphing.Edge" + }, + "JSONnodeData": "{\n \"m_OutputSlot\": {\n \"m_SlotId\": 0,\n \"m_NodeGUIDSerialized\": \"fe0eb085-4a33-4b33-b46d-baebd2d3b66e\"\n },\n \"m_InputSlot\": {\n \"m_SlotId\": 1,\n \"m_NodeGUIDSerialized\": \"d4ae152b-4465-487c-a981-1c65b9b4d706\"\n }\n}" + } + ], + "m_PreviewData": { + "serializedMesh": { + "m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}", + "m_Guid": "" + } + }, + "m_Path": "Shader Graphs", + "m_ConcretePrecision": 0, + "m_ActiveOutputNodeGuidSerialized": "c9a5664b-d175-44a6-857f-2a2b21200a82" +} \ No newline at end of file diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph.meta new file mode 100644 index 00000000000..53a6fcd2f8a --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderGraphs/DefaultCompositionGraph.shadergraph.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9da34bb73883cac4d9a9bc54e8284620 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs new file mode 100644 index 00000000000..4f6c5257f80 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using UnityEngine.Rendering; + +namespace UnityEngine.Rendering.HighDefinition.Compositor +{ + [System.Serializable] + internal class ShaderProperty + { + public string m_PropertyName; + public ShaderPropertyType m_Type; + public Vector4 m_Value; + public Vector2 m_RangeLimits; + public ShaderPropertyFlags m_Flags; + + public static ShaderProperty Create(Shader shader, Material material, int indx) + { + ShaderProperty sp = new ShaderProperty(); + { + sp.m_PropertyName = shader.GetPropertyName(indx); + sp.m_Type = shader.GetPropertyType(indx); + sp.m_Flags = shader.GetPropertyFlags(indx); + sp.m_Value = Vector4.zero; + + if (sp.m_Type == ShaderPropertyType.Range) + { + sp.m_RangeLimits = shader.GetPropertyRangeLimits(indx); + sp.m_Value = new Vector4(material.GetFloat(Shader.PropertyToID(shader.GetPropertyName(indx))), 0.0f, 0.0f, 0.0f); + } + else if (sp.m_Type == ShaderPropertyType.Color) + { + sp.m_Value = material.GetColor(Shader.PropertyToID(shader.GetPropertyName(indx))); + } + else if (sp.m_Type == ShaderPropertyType.Vector) + { + sp.m_Value = material.GetVector(Shader.PropertyToID(shader.GetPropertyName(indx))); + } + } + return sp; + } + } +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs.meta new file mode 100644 index 00000000000..80aba4532ce --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 47fea353b4a13ee4490ffea5d628a8c8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders.meta new file mode 100644 index 00000000000..c50a65dfb3f --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b153c10f54c52a04ea14119f40dbf54b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader new file mode 100644 index 00000000000..0bf49ad90b7 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader @@ -0,0 +1,72 @@ +Shader "Hidden/Shader/AlphaInjection" +{ + HLSLINCLUDE + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/RTUpscale.hlsl" + + struct Attributes + { + uint vertexID : SV_VertexID; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 positionCS : SV_POSITION; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + Varyings Vert(Attributes input) + { + Varyings output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); + output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID); + return output; + } + + // List of properties to control your post process effect + + TEXTURE2D_X(_InputTexture); + TEXTURE2D(_AlphaTexture); + + float4 CustomPostProcess(Varyings input) : SV_Target + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + uint2 positionSS = input.texcoord * _ScreenSize.xy; + float3 color = LOAD_TEXTURE2D_X(_InputTexture, positionSS).xyz; + float outAlpha = LOAD_TEXTURE2D(_AlphaTexture, positionSS).w; + return float4(color, outAlpha); + } + + ENDHLSL + + SubShader + { + Pass + { + Name "AlphaInjection" + + ZWrite Off + ZTest Always + Blend Off + Cull Off + + HLSLPROGRAM + #pragma fragment CustomPostProcess + #pragma vertex Vert + ENDHLSL + } + } + Fallback Off +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader.meta new file mode 100644 index 00000000000..bd542816f76 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 4edd96259a5e8b44c90479928f0cd11e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader new file mode 100644 index 00000000000..5f865aabd74 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader @@ -0,0 +1,124 @@ +Shader "Hidden/Shader/ChromaKeying" +{ + HLSLINCLUDE + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/FXAA.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/RTUpscale.hlsl" + + struct Attributes + { + uint vertexID : SV_VertexID; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 positionCS : SV_POSITION; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + Varyings Vert(Attributes input) + { + Varyings output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); + output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID); + return output; + } + + // List of properties to control your post process effect + float3 _KeyColor; + float4 _KeyParams; + TEXTURE2D_X(_InputTexture); + + // RGB <-> YCgCo color space conversion + float3 RGB2YCgCo(float3 rgb) + { + float3x3 m = { + 0.25, 0.5, 0.25, + -0.25, 0.5, -0.25, + 0.50, 0.0, -0.50 + }; + return mul(m, rgb); + } + + float3 YCgCo2RGB(float3 ycgco) + { + return float3( + ycgco.x - ycgco.y + ycgco.z, + ycgco.x + ycgco.y, + ycgco.x - ycgco.y - ycgco.z + ); + } + + // Adapted from https://github.com/keijiro/ProcAmp + // Main difference is that we do the chroma keying in linear space (not gamma) + float ChromaKeyAt(float3 keyColorYCoCg, float2 uv) + { + float3 rgb = LOAD_TEXTURE2D_X_LOD(_InputTexture, uv, 0).xyz; + float3 inputColor = LinearToSRGB(rgb); + + float d = distance(RGB2YCgCo(inputColor).yz, keyColorYCoCg.yz) * 10 ; + return smoothstep(_KeyParams.x, _KeyParams.x + _KeyParams.y, d); + } + + float4 CustomPostProcess(Varyings input) : SV_Target + { + UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); + + uint2 positionSS = input.texcoord * _ScreenSize.xy; + float3 outColor = LOAD_TEXTURE2D_X_LOD(_InputTexture, positionSS, 0).xyz; + float3 keyColorYCoCg = RGB2YCgCo(_KeyColor); + + // Calculate keys for surrounding four points and get the minima of them. + // This works like a blur and dilate filter. + float4 duv = _ScreenSize.zwzw * float4(-0.5, -0.5, 0.5, 0.5); + float alpha = ChromaKeyAt(keyColorYCoCg, positionSS + duv.xy); + alpha = min(alpha, ChromaKeyAt(keyColorYCoCg, positionSS + duv.zy)); + alpha = min(alpha, ChromaKeyAt(keyColorYCoCg, positionSS + duv.xw)); + alpha = min(alpha, ChromaKeyAt(keyColorYCoCg, positionSS + duv.zw)); + + if (_KeyParams.z > 0) + { + // Spill removal + // What the following lines do is flattening the CgCo chroma values + // so that dot(ycgco, _KeyCgCo) == 0.5. This shifts colors toward + // the anticolor of the key color. + outColor = RGB2YCgCo(LinearToSRGB(outColor)); + float sub = dot(keyColorYCoCg.yz, outColor.yz) / dot(keyColorYCoCg.yz, keyColorYCoCg.yz); + outColor.yz -= keyColorYCoCg.yz * (sub + 0.5) * _KeyParams.z; + outColor = SRGBToLinear(YCgCo2RGB(outColor)); + } + + return float4(outColor, alpha); + } + + ENDHLSL + + SubShader + { + Pass + { + Name "ChromaKeying" + + ZWrite Off + ZTest Always + Blend Off + Cull Off + + HLSLPROGRAM + #pragma fragment CustomPostProcess + #pragma vertex Vert + ENDHLSL + } + } + Fallback Off +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader.meta new file mode 100644 index 00000000000..f86b44265af --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/ChromaKeying.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 49feb6b111e82ec4eb6d3d08e4b6903e +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader new file mode 100644 index 00000000000..38dcf1adf00 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader @@ -0,0 +1,113 @@ +Shader "Hidden/HDRP/CustomClear" +{ + HLSLINCLUDE + + #pragma target 4.5 + #pragma only_renderers d3d11 ps4 xboxone vulkan metal switch + #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" + #include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl" + + TEXTURE2D(_BlitTexture); + SamplerState sampler_PointClamp; + SamplerState sampler_LinearClamp; + uniform float4 _BlitScaleBias; + uniform float4 _BlitScaleBiasRt; + uniform float _BlitMipLevel; + uniform int _ClearAlpha; + + struct Attributes + { + uint vertexID : SV_VertexID; + UNITY_VERTEX_INPUT_INSTANCE_ID + }; + + struct Varyings + { + float4 positionCS : SV_POSITION; + float2 texcoord : TEXCOORD0; + UNITY_VERTEX_OUTPUT_STEREO + }; + + Varyings Vert(Attributes input) + { + Varyings output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = GetFullScreenTriangleVertexPosition(input.vertexID); + output.texcoord = GetFullScreenTriangleTexCoord(input.vertexID) * _BlitScaleBias.xy + _BlitScaleBias.zw; + return output; + } + + Varyings VertQuad(Attributes input) + { + Varyings output; + UNITY_SETUP_INSTANCE_ID(input); + UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); + output.positionCS = GetQuadVertexPosition(input.vertexID) * float4(_BlitScaleBiasRt.x, _BlitScaleBiasRt.y, 1, 1) + float4(_BlitScaleBiasRt.z, _BlitScaleBiasRt.w, 0, 0); + output.positionCS.xy = output.positionCS.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f); //convert to -1..1 + output.texcoord = GetQuadTexCoord(input.vertexID) * _BlitScaleBias.xy + _BlitScaleBias.zw; + return output; + } + + float4 Frag(Varyings input, SamplerState s) + { + float4 color = SAMPLE_TEXTURE2D_LOD(_BlitTexture, s, input.texcoord.xy, _BlitMipLevel); + return float4(color.xyz, _ClearAlpha == 0 ? color.w : 0.0f); + } + + float4 FragNearest(Varyings input) : SV_Target + { + return float4(0.0f, 0.0f, 0.0f, 0.0f); + } + + float4 FragBilinear(Varyings input) : SV_Target + { + return Frag(input, sampler_LinearClamp); + } + + ENDHLSL + + SubShader + { + Tags{ "RenderPipeline" = "HDRenderPipeline" } + + // 0: Nearest + Pass + { + ZWrite Off ZTest Always Blend Off Cull Off + Stencil + { + WriteMask 255 + Ref 0 + Comp Always + Pass Replace + } + + HLSLPROGRAM + #pragma vertex Vert + #pragma fragment FragNearest + ENDHLSL + } + + // 1: Bilinear quad and clear stencil + Pass + { + ZWrite Off ZTest Always Blend Off Cull Off + Stencil + { + WriteMask 255 + Ref 0 + Comp Always + Pass Replace + } + + HLSLPROGRAM + #pragma vertex VertQuad + #pragma fragment FragBilinear + ENDHLSL + } + + } + + Fallback Off +} diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader.meta b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader.meta new file mode 100644 index 00000000000..f5fdafaf733 --- /dev/null +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9cef3686fa32c8840947ed99b561195c +ShaderImporter: + externalObjects: {} + defaultTextures: [] + nonModifiableTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index a10c15aba26..bd092e03104 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -1838,7 +1838,7 @@ void DoMotionBlur(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.MotionBlurKernel))) { cs = m_Resources.shaders.motionBlurCS; - kernel = cs.FindKernel("MotionBlurCS"); + kernel = cs.FindKernel(m_EnableAlpha ? "MotionBlurCSAlpha" : "MotionBlurCS"); cmd.SetComputeVectorParam(cs, HDShaderIDs._TileTargetSize, tileTargetSize); cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._MotionVecAndDepth, preppedMotionVec); cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._OutputTexture, destination); diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute index fb7d8dc3e85..ff7924f20d3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute @@ -1,9 +1,11 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurCommon.hlsl" +#include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" -#pragma kernel MotionBlurCS +#pragma kernel MotionBlurCS MAIN=MotionBlurCS +#pragma kernel MotionBlurCSAlpha MAIN=MotionBlurCSAlpha ENABLE_ALPHA //#pragma enable_d3d11_debug_symbols -RW_TEXTURE2D_X(float3, _OutputTexture); +RW_TEXTURE2D_X(CTYPE, _OutputTexture); TEXTURE2D_X(_InputTexture); TEXTURE2D_X(_TileMaxNeighbourhood); @@ -127,19 +129,19 @@ void MirrorWeights(float depth1, float depth2, float motionVec1, float motionVec // Sample processing // --------------------------------------------- -float3 ProcessSampleFastPath(uint sampleNumber, float2 dir, float invSampleCount, float2 centralUV, float randomVal, float dirSign) +CTYPE ProcessSampleFastPath(uint sampleNumber, float2 dir, float invSampleCount, float2 centralUV, float randomVal, float dirSign) { float2 currDir = dirSign * dir; float offsetLength = (sampleNumber + 0.5) + (dirSign * (randomVal - 0.5)); float2 sampleUV = ClampAndScaleUVForBilinear(centralUV + (offsetLength*invSampleCount) * currDir); - float3 sampleColor = SAMPLE_TEXTURE2D_X_LOD(_InputTexture, s_point_clamp_sampler, sampleUV, 0).xyz; + CTYPE sampleColor = SAMPLE_TEXTURE2D_X_LOD(_InputTexture, s_point_clamp_sampler, sampleUV, 0).CTYPE_SWIZZLE; return sampleColor; } -float4 ProcessSample(uint sampleNumber, float2 dir, float invSampleCount, float2 centralUV, float centralDepth, float centralMotionVecLen, float pixelToSampleScale, float randomVal, float dirSign, out float outDepth, out float outMotionVecLength) +float4 ProcessSample(uint sampleNumber, float2 dir, float invSampleCount, float2 centralUV, float centralDepth, float centralMotionVecLen, float pixelToSampleScale, float randomVal, float dirSign, out float outDepth, out float outMotionVecLength, out float sampleAlpha) { float2 currDir = dirSign * dir; @@ -147,7 +149,7 @@ float4 ProcessSample(uint sampleNumber, float2 dir, float invSampleCount, float2 float2 sampleUV = ClampAndScaleUVForBilinear(centralUV + (offsetLength*invSampleCount) * currDir); float3 sampleMotionVecDepth = SAMPLE_TEXTURE2D_X_LOD(_MotionVecAndDepth, s_point_clamp_sampler, sampleUV, 0).xyz; - float3 sampleColor = SAMPLE_TEXTURE2D_X_LOD(_InputTexture, s_point_clamp_sampler, sampleUV, 0).xyz; + CTYPE sampleColor = SAMPLE_TEXTURE2D_X_LOD(_InputTexture, s_point_clamp_sampler, sampleUV, 0).CTYPE_SWIZZLE; outMotionVecLength = MotionVecLengthInPixelsFromEncoded(sampleMotionVecDepth.xy); outDepth = sampleMotionVecDepth.z; @@ -159,7 +161,12 @@ float4 ProcessSample(uint sampleNumber, float2 dir, float invSampleCount, float2 #endif float sampleWeight = SampleWeight(centralDepth, outDepth, offsetLength, centralMotionVecLen, outMotionVecLength, pixelToSampleScale, _DepthScale, motionVecDiffWeight); - return float4(sampleColor, sampleWeight); +#if ENABLE_ALPHA + sampleAlpha = sampleColor.w; +#else + sampleAlpha = 1.0; +#endif + return float4(sampleColor.xyz, sampleWeight); } @@ -168,14 +175,14 @@ float4 ProcessSample(uint sampleNumber, float2 dir, float invSampleCount, float2 // --------------------------------------------- [numthreads(16, 16, 1)] -void MotionBlurCS(uint3 dispatchThreadId : SV_DispatchThreadID) +void MAIN(uint3 dispatchThreadId : SV_DispatchThreadID) { UNITY_XR_ASSIGN_VIEW_INDEX(dispatchThreadId.z); - float3 debugColor = 1.0f; + CTYPE debugColor = 1.0f; // Get central sample early. - float3 centralColor = _InputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)].xyz; + CTYPE centralColor = _InputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)].CTYPE_SWIZZLE; float2 randomVals = float2(RandomValue(dispatchThreadId.xy, 0), RandomValue(dispatchThreadId.xy, 1)); @@ -206,18 +213,18 @@ void MotionBlurCS(uint3 dispatchThreadId : SV_DispatchThreadID) #if DEBUG_VIEW == TILE_VIS if (earlyOut) { - debugColor = float3(0.0, 1.0, 0.0); + debugColor.xz = 0.0; } else if (fastPath) { - debugColor = float3(1.0, 1.0, 0.0); + debugColor.z = 0.0; } else { - debugColor = float3(1.0, 0.0, 0.0); + debugColor.yz = 0.0; } - _OutputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = 0.25 * centralColor + 0.75 * debugColor.xyz; + _OutputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = 0.25 * centralColor + 0.75 * debugColor; #else @@ -240,7 +247,7 @@ void MotionBlurCS(uint3 dispatchThreadId : SV_DispatchThreadID) float randomVal = randomVals.x; float2 dir = 0.5 * maxMotionVec; - float3 colorAccumulation = 0.0; + CTYPE colorAccumulation = 0.0; if (fastPath) { @@ -271,6 +278,7 @@ void MotionBlurCS(uint3 dispatchThreadId : SV_DispatchThreadID) float centralDepth = motionVecAndDepth.z; float4 accumulation = 0.0; + float alphaAccumulation = 0.0; for (uint i = 0; i < stepCount; ++i) { #if GUERTIN2014_DOUBLE_DIR @@ -278,18 +286,25 @@ void MotionBlurCS(uint3 dispatchThreadId : SV_DispatchThreadID) #endif float fw_Depth, bw_Depth; float fw_MotionVecLen, bw_MotionVecLen; - float4 fw_Sample = ProcessSample(i, dir, invSampleCount, centerSampleUV, centralDepth, centralMotionVecLen, pixelToSampleScale, randomVal, -1, fw_Depth, fw_MotionVecLen); - float4 bw_Sample = ProcessSample(i, dir, invSampleCount, centerSampleUV, centralDepth, centralMotionVecLen, pixelToSampleScale, randomVal, 1, bw_Depth, bw_MotionVecLen); + float fw_Alpha, bw_Alpha; + float4 fw_Sample = ProcessSample(i, dir, invSampleCount, centerSampleUV, centralDepth, centralMotionVecLen, pixelToSampleScale, randomVal, -1, fw_Depth, fw_MotionVecLen, fw_Alpha); + float4 bw_Sample = ProcessSample(i, dir, invSampleCount, centerSampleUV, centralDepth, centralMotionVecLen, pixelToSampleScale, randomVal, 1, bw_Depth, bw_MotionVecLen, bw_Alpha); // Mirror weights #if MIRROR_WEIGHTS MirrorWeights(fw_Depth, bw_Depth, fw_MotionVecLen, bw_MotionVecLen, fw_Sample.w, bw_Sample.w); #endif accumulation += float4(fw_Sample.w * fw_Sample.rgb, fw_Sample.w) + float4(bw_Sample.w * bw_Sample.rgb, bw_Sample.w); +#if ENABLE_ALPHA + alphaAccumulation += fw_Sample.w * fw_Alpha + bw_Sample.w * bw_Alpha; +#endif } accumulation *= invSampleCount; - colorAccumulation = accumulation.rgb + (1.0 - accumulation.w) * centralColor; + colorAccumulation.rgb = accumulation.rgb + (1.0 - accumulation.w) * centralColor.rgb; +#if ENABLE_ALPHA + colorAccumulation.w = accumulation.w + (1.0 - accumulation.w) * centralColor.w; +#endif #if DEBUG_VIEW == WEIGHT_VIS colorAccumulation = accumulation.w; @@ -304,7 +319,7 @@ void MotionBlurCS(uint3 dispatchThreadId : SV_DispatchThreadID) #endif #if DEBUG_VIEW == DEBUG_SAMPLE_COUNT - colorAccumulation = colorAccumulation * 0.25 + 0.75 * lerp(float3(0.0, 1.0, 0.0), float3(1.0, 0.0, 0.0), float(actualSampleCount) / _SampleCount); + colorAccumulation.xyz = colorAccumulation.xyz * 0.25 + 0.75 * lerp(float3(0.0, 1.0, 0.0), float3(1.0, 0.0, 0.0), float(actualSampleCount) / _SampleCount); #endif _OutputTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)] = colorAccumulation; From 686e6c8835a33ec62b81187a396e09b6168f4619 Mon Sep 17 00:00:00 2001 From: "pavlos.mavridis" Date: Fri, 27 Mar 2020 13:10:17 +0100 Subject: [PATCH 02/21] move compositor unit test images --- .../WindowsEditor/Direct3D11/{ => None}/9800_Compositor.png | 0 .../WindowsEditor/Direct3D11/{ => None}/9800_Compositor.png.meta | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/{ => None}/9800_Compositor.png (100%) rename TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/{ => None}/9800_Compositor.png.meta (100%) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9800_Compositor.png similarity index 100% rename from TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png rename to TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9800_Compositor.png diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9800_Compositor.png.meta similarity index 100% rename from TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/9800_Compositor.png.meta rename to TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/9800_Compositor.png.meta From d2be434a15060734acd1738399b8531233f7c877 Mon Sep 17 00:00:00 2001 From: "pavlos.mavridis" Date: Fri, 27 Mar 2020 13:16:33 +0100 Subject: [PATCH 03/21] remove leftover code --- .../Editor/Compositor/CompositionLayerUI.Drawers.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs index 6ce7dd1d006..7aabd8b1e69 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs @@ -130,7 +130,6 @@ public static void DrawOutputLayerProperties(Rect rect, SerializedCompositionLay rect.y += CompositorStyle.k_Spacing; EditorGUI.PropertyField(rect, serializedProperties.AOVBitmask, TextUI.AOVs); - //serializedProperties.AOVBitmask.intValue = EditorGUI.MaskField(rect, TextUI.AOVs, serializedProperties.AOVBitmask.intValue, System.Enum.GetNames(typeof(MaterialSharedProperty))); rect.y += CompositorStyle.k_Spacing; } From 537edfeecddac589f7c4945119039cdd838b8f33 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Fri, 3 Apr 2020 10:54:01 +0200 Subject: [PATCH 04/21] review feedback #1 --- .../Compositor/CompositionLayerUI.Drawers.cs | 32 +++++++++---------- .../CompositionManagerEditor.Styles.cs | 9 ++++++ .../Compositor/CompositionManagerEditor.cs | 1 - .../Editor/Compositor/CompositionUtils.cs | 4 +-- .../Compositor/AdditionalCompositorData.cs | 2 +- .../Runtime/Compositor/AlphaInjection.cs | 2 +- 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs index 7aabd8b1e69..4ea0ddec75a 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs @@ -38,8 +38,9 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ // Compute the desired indentation { - rect.x = isCameraStack ? rect.x + CompositorStyle.k_ListItemStackPading + 2 : rect.x + 2; - rect.width = isCameraStack ? rect.width - CompositorStyle.k_ListItemStackPading : rect.width; + const float listBorder = 2.0f; + rect.x = isCameraStack ? rect.x + CompositorStyle.k_ListItemStackPading + listBorder : rect.x + listBorder; + rect.width = isCameraStack ? rect.width - CompositorStyle.k_ListItemStackPading - listBorder : rect.width - listBorder; rect.y += CompositorStyle.k_ListItemPading; rect.height = EditorGUIUtility.singleLineHeight; } @@ -47,16 +48,16 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ if (thumbnail) { Rect newRect = rect; - newRect.width = 20; + newRect.width = EditorGUIUtility.singleLineHeight; EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none); - rect.x += 20; + rect.x += CompositorStyle.k_CheckboxSpacing; Rect previewRect = rect; previewRect.width = CompositorStyle.k_ThumbnailSize * aspectRatio; previewRect.height = CompositorStyle.k_ThumbnailSize; EditorGUI.DrawPreviewTexture(previewRect, thumbnail); - previewRect.x += previewRect.width + 5; - rect.x += previewRect.width + 12; - rect.width -= previewRect.width + 12; + previewRect.x += previewRect.width + CompositorStyle.k_ThumbnailDivider; + rect.x += previewRect.width + CompositorStyle.k_ThumbnailSpacing; + rect.width -= previewRect.width + CompositorStyle.k_ThumbnailSpacing; if (isAlphaEnbaled && (thumbnail.format == RenderTextureFormat.ARGBHalf @@ -64,25 +65,25 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ || thumbnail.format == RenderTextureFormat.ARGB64)) { EditorGUI.DrawTextureAlpha(previewRect, thumbnail); - rect.x += previewRect.width + 12; - rect.width -= previewRect.width + 12; + rect.x += previewRect.width + CompositorStyle.k_ThumbnailSpacing; + rect.width -= previewRect.width + CompositorStyle.k_ThumbnailSpacing; } - rect.y += 6; + rect.y += CompositorStyle.k_LabelVerticalOffset; EditorGUI.LabelField(rect, serialized.LayerName.stringValue); } else { Rect newRect = rect; - newRect.width = 20; + newRect.width = EditorGUIUtility.singleLineHeight; EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none); - newRect.x += 20; + newRect.x += CompositorStyle.k_CheckboxSpacing; if (isCameraStack) { Rect iconRect = newRect; iconRect.width = CompositorStyle.k_IconSize; iconRect.height = CompositorStyle.k_IconSize; - iconRect.y -= 5; + iconRect.y -= CompositorStyle.k_IconVerticalOffset; switch (serialized.InputLayerType.enumValueIndex) { case (int)CompositorLayer.LayerType.Camera: @@ -99,12 +100,11 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ Debug.Log("Unknown layer type: Please add code here to draw this type of layer."); break; } - newRect.x += CompositorStyle.k_IconSize + 5; + newRect.x += CompositorStyle.k_IconSize + CompositorStyle.k_IconSpacing; } - newRect.width = rect.width - 60 - 20; + newRect.width = rect.width - newRect.x; EditorGUI.LabelField(newRect, serialized.LayerName.stringValue); - rect.y += rect.height; } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs index 85b858bbf67..fb4a5f1afa9 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.Styles.cs @@ -9,6 +9,15 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor static internal class CompositorStyle { internal static readonly int k_ThumbnailSize = 32; + internal static readonly int k_ThumbnailDivider = 5; // the horizontal space in between the thumbnails + internal static readonly int k_ThumbnailSpacing = 10; // the horizontal space after the thumbnail + internal static readonly int k_IconSpacing = 5; // the horizontal space after an icon + internal static readonly int k_CheckboxSpacing = 20; // the horizontal space for a checkbox + + internal static readonly int k_IconVerticalOffset = 5; // used to center the icons vertically + internal static readonly int k_LabelVerticalOffset = 6; // used to center the labels vertically + + internal static readonly int k_IconSize = 28; internal static readonly int k_ListItemPading = 4; internal static readonly int k_ListItemStackPading = 20; diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs index dc3d4d62294..5e37fc6e998 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs @@ -181,7 +181,6 @@ public override void OnInspectorGUI() m_layerList.drawHeaderCallback = (Rect rect) => { - //EditorGUI.LabelField(rect, "Render Schedule", EditorStyles.largeLabel); }; m_layerList.drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs index bb3d5f869e2..32b24fc035c 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionUtils.cs @@ -79,7 +79,7 @@ static public void SetDefaultLayers(CompositionManager compositor) { if (compositor.layers[i].outputTarget == CompositorLayer.OutputTarget.CompositorLayer) { - if ( (i+i < compositor.numLayers - 1) && (compositor.layers[i+1].outputTarget == CompositorLayer.OutputTarget.CameraStack)) + if ((i+i < compositor.numLayers - 1) && (compositor.layers[i+1].outputTarget == CompositorLayer.OutputTarget.CameraStack)) { continue; } @@ -102,7 +102,7 @@ static public void LoadOrCreateCompositionProfileAsset(CompositionManager compos newProfile = ScriptableObject.CreateInstance(); - // path = AssetDatabase.GenerateUniqueAssetPath(path); + //Note: no need to GenerateUniqueAssetPath(path), since we know that LoadAssetAtPath failed at this path AssetDatabase.CreateAsset(newProfile, path); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs index 81e58767a48..893445a8bf7 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs @@ -30,7 +30,7 @@ public void Reset() m_clearAlpha = true; m_imageFitMode = BackgroundFitMode.Stretch; - if (m_layerFilters !=null ) + if (m_layerFilters !=null) { m_layerFilters.Clear(); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs index da2f76f1ef5..c94fc402fda 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs @@ -5,7 +5,7 @@ namespace UnityEngine.Rendering.HighDefinition.Compositor { - [Serializable, VolumeComponentMenu("Post-processing/Custom/AlphaIjection")] + [Serializable, VolumeComponentMenu("Post-processing/Custom/AlphaInjection")] internal sealed class AlphaInjection : CustomPostProcessVolumeComponent, IPostProcessComponent { internal class ShaderIDs From fc3676e6de13ed52a88f78ea1e2c76efabc3a729 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Fri, 3 Apr 2020 11:24:39 +0200 Subject: [PATCH 05/21] review feedback 2 --- .../Runtime/Compositor/CompositionLayer.cs | 16 +--------------- .../Runtime/Compositor/CompositionManager.cs | 3 ++- .../Compositor/Shaders/AlphaInjection.shader | 10 ++++------ 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index 949f6035c8a..987e3bf1bf1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -169,20 +169,7 @@ public static CompositorLayer CreateOutputLayer(string layerName) static float EnumToScale(ResolutionScale scale) { - float resScale = 1.0f;// / (int)m_ResolutionScale; - switch (scale) - { - case ResolutionScale.Half: - resScale = 0.5f; - break; - case ResolutionScale.Quarter: - resScale = 0.25f; - break; - default: - resScale = 1.0f; - break; - } - return resScale; + return 1.0f / (int)scale; } public int pixelWidth @@ -325,7 +312,6 @@ public void Init(string layerID = "") var layerData = m_LayerCamera.GetComponent(); { // create the component if it is required and does not exist - //bool requiresAdditionalData = (m_AlphaMask || m_ChromaKeying || m_Type == LayerType.Image); if (layerData == null) { layerData = m_LayerCamera.gameObject.AddComponent(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index 16b78b2c109..280499e6e53 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -205,6 +205,7 @@ bool ValidatePipeline() } return false; } + bool ValidateCompositionShader() { if (m_Shader == null) @@ -311,7 +312,7 @@ public void DropCompositorCamera() public void Init() { - if ( ValidateCompositionShader() && ValidateProfile() && ValidateMainCompositorCamera()) + if (ValidateCompositionShader() && ValidateProfile() && ValidateMainCompositorCamera()) { UpdateDisplayNumber(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader index 0bf49ad90b7..f91612067df 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/AlphaInjection.shader @@ -34,17 +34,15 @@ return output; } - // List of properties to control your post process effect - - TEXTURE2D_X(_InputTexture); + TEXTURE2D_X(_InputTexture); TEXTURE2D(_AlphaTexture); - + float4 CustomPostProcess(Varyings input) : SV_Target { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input); uint2 positionSS = input.texcoord * _ScreenSize.xy; - float3 color = LOAD_TEXTURE2D_X(_InputTexture, positionSS).xyz; + float3 color = LOAD_TEXTURE2D_X(_InputTexture, positionSS).xyz; float outAlpha = LOAD_TEXTURE2D(_AlphaTexture, positionSS).w; return float4(color, outAlpha); } @@ -59,7 +57,7 @@ ZWrite Off ZTest Always - Blend Off + Blend Off Cull Off HLSLPROGRAM From 458eadde98e30bfca75ed609a63ee0c405d2581a Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Fri, 3 Apr 2020 12:24:24 +0200 Subject: [PATCH 06/21] review feedback - custom clear shader --- .../Compositor/Shaders/CustomClear.shader | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader index 38dcf1adf00..e3c59cc1307 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/Shaders/CustomClear.shader @@ -10,10 +10,10 @@ Shader "Hidden/HDRP/CustomClear" TEXTURE2D(_BlitTexture); SamplerState sampler_PointClamp; SamplerState sampler_LinearClamp; - uniform float4 _BlitScaleBias; - uniform float4 _BlitScaleBiasRt; - uniform float _BlitMipLevel; - uniform int _ClearAlpha; + float4 _BlitScaleBias; + float4 _BlitScaleBiasRt; + float _BlitMipLevel; + int _ClearAlpha; struct Attributes { @@ -45,24 +45,19 @@ Shader "Hidden/HDRP/CustomClear" UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output); output.positionCS = GetQuadVertexPosition(input.vertexID) * float4(_BlitScaleBiasRt.x, _BlitScaleBiasRt.y, 1, 1) + float4(_BlitScaleBiasRt.z, _BlitScaleBiasRt.w, 0, 0); output.positionCS.xy = output.positionCS.xy * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f); //convert to -1..1 - output.texcoord = GetQuadTexCoord(input.vertexID) * _BlitScaleBias.xy + _BlitScaleBias.zw; + output.texcoord = GetQuadTexCoord(input.vertexID) * _BlitScaleBias.xy + _BlitScaleBias.zw; return output; } - float4 Frag(Varyings input, SamplerState s) - { - float4 color = SAMPLE_TEXTURE2D_LOD(_BlitTexture, s, input.texcoord.xy, _BlitMipLevel); - return float4(color.xyz, _ClearAlpha == 0 ? color.w : 0.0f); - } - - float4 FragNearest(Varyings input) : SV_Target + float4 ClearColorAndAlphaToZero(Varyings input) : SV_Target { return float4(0.0f, 0.0f, 0.0f, 0.0f); } - float4 FragBilinear(Varyings input) : SV_Target + float4 ClearUsingTexture(Varyings input) : SV_Target { - return Frag(input, sampler_LinearClamp); + float4 color = SAMPLE_TEXTURE2D_LOD(_BlitTexture, sampler_LinearClamp, input.texcoord.xy, _BlitMipLevel); + return float4(color.xyz, _ClearAlpha == 0 ? color.w : 0.0f); } ENDHLSL @@ -71,7 +66,7 @@ Shader "Hidden/HDRP/CustomClear" { Tags{ "RenderPipeline" = "HDRenderPipeline" } - // 0: Nearest + // 0: Clear color, alpha and stencil to zero Pass { ZWrite Off ZTest Always Blend Off Cull Off @@ -85,11 +80,11 @@ Shader "Hidden/HDRP/CustomClear" HLSLPROGRAM #pragma vertex Vert - #pragma fragment FragNearest + #pragma fragment ClearColorAndAlphaToZero ENDHLSL } - // 1: Bilinear quad and clear stencil + // 1: Clears the color using the input texture and clears stencil to zero Pass { ZWrite Off ZTest Always Blend Off Cull Off @@ -103,7 +98,7 @@ Shader "Hidden/HDRP/CustomClear" HLSLPROGRAM #pragma vertex VertQuad - #pragma fragment FragBilinear + #pragma fragment ClearUsingTexture ENDHLSL } From a3fbc69db1892263edab89b0c6c615d39e830afb Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Tue, 7 Apr 2020 14:08:18 +0200 Subject: [PATCH 07/21] fix variable names that don't affect serialization --- .../Compositor/CompositionFilterUI.Drawer.cs | 38 ++--- .../Compositor/CompositionLayerUI.Drawers.cs | 78 +++++----- .../Compositor/CompositionManagerEditor.cs | 56 ++++---- .../Editor/Compositor/CompositorWindow.cs | 16 +-- .../Compositor/SerializedCompositionFilter.cs | 26 ++-- .../Compositor/SerializedCompositionLayer.cs | 136 +++++++++--------- .../SerializedCompositionManager.cs | 43 +++--- .../Compositor/SeriallizedShaderProperty.cs | 16 +-- .../Compositor/ShaderPropertyUI.Drawers.cs | 30 ++-- .../Compositor/AdditionalCompositorData.cs | 22 +-- .../Runtime/Compositor/AlphaInjection.cs | 16 +-- .../Runtime/Compositor/ChromaKeying.cs | 20 +-- .../Runtime/Compositor/CompositionLayer.cs | 22 +-- .../Runtime/Compositor/CompositionManager.cs | 18 +-- .../Runtime/Compositor/CompositionProfile.cs | 1 - .../Runtime/Compositor/CustomClear.cs | 30 ++-- .../Runtime/Compositor/ShaderProperty.cs | 16 +-- 17 files changed, 281 insertions(+), 303 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs index 0c2c5634f4b..a70a4227ec4 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs @@ -6,43 +6,43 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor { internal class CompositionFilterUI { - static partial class TextUI + static partial class Styles { - static public readonly GUIContent ChromaKeing = EditorGUIUtility.TrTextContent("Chroma Keying", "Performs chroma keying in the input frame before any other composition operations are performed."); - static public readonly GUIContent KeyColor = EditorGUIUtility.TrTextContent("Key Color", "Use this parameter to smooth-out the edges of the generated mask. A value of 0 corresponds to sharp edges."); - static public readonly GUIContent Threshold = EditorGUIUtility.TrTextContent("Key Threshold", "Indicates the areas of the image that will be masked (or in other words, the areas that are transparent."); - static public readonly GUIContent Tolerance = EditorGUIUtility.TrTextContent("Key Tolerance", "Controls the sensitivity of the mask color parameter. Increasing this value will include more pixels (with a value close to the mask color) in the masked areas."); - static public readonly GUIContent SpillRemoval = EditorGUIUtility.TrTextContent("Spill Removal", "Use this parameter to change the tint of non-masked areas."); - static public readonly GUIContent AlphaMask = EditorGUIUtility.TrTextContent("Alpha Mask", "A static texture that overrides the alpha mask of the sub-layer. Post-processing is then applied only on the masked frame regions."); + static public readonly GUIContent k_ChromaKeing = EditorGUIUtility.TrTextContent("Chroma Keying", "Performs chroma keying in the input frame before any other composition operations are performed."); + static public readonly GUIContent k_KeyColor = EditorGUIUtility.TrTextContent("Key Color", "Use this parameter to smooth-out the edges of the generated mask. A value of 0 corresponds to sharp edges."); + static public readonly GUIContent k_Threshold = EditorGUIUtility.TrTextContent("Key Threshold", "Indicates the areas of the image that will be masked (or in other words, the areas that are transparent."); + static public readonly GUIContent k_Tolerance = EditorGUIUtility.TrTextContent("Key Tolerance", "Controls the sensitivity of the mask color parameter. Increasing this value will include more pixels (with a value close to the mask color) in the masked areas."); + static public readonly GUIContent k_SpillRemoval = EditorGUIUtility.TrTextContent("Spill Removal", "Use this parameter to change the tint of non-masked areas."); + static public readonly GUIContent k_AlphaMask = EditorGUIUtility.TrTextContent("Alpha Mask", "A static texture that overrides the alpha mask of the sub-layer. Post-processing is then applied only on the masked frame regions."); } public static void Draw(Rect rect, SerializedCompositionFilter serialized) { rect.height = CompositorStyle.k_SingleLineHeight; float spacing = rect.height * 1.1f; - if (serialized.FilterType.intValue == (int)CompositionFilter.FilterType.CHROMA_KEYING) + if (serialized.filterType.intValue == (int)CompositionFilter.FilterType.CHROMA_KEYING) { - SerializedProperty KeyColor = serialized.MaskColor; - SerializedProperty KeyThreshold = serialized.KeyThreshold; - SerializedProperty KeyTolerance = serialized.KeyTolerance; - SerializedProperty SpillRemoval = serialized.SpillRemoval; + SerializedProperty keyColor = serialized.maskColor; + SerializedProperty keyThreshold = serialized.keyThreshold; + SerializedProperty keyTolerance = serialized.keyTolerance; + SerializedProperty spillRemoval = serialized.spillRemoval; - EditorGUI.LabelField(rect, TextUI.ChromaKeing); + EditorGUI.LabelField(rect, Styles.k_ChromaKeing); rect.y += spacing; rect.x += 20; rect.width -= 20; - EditorGUI.PropertyField(rect, KeyColor, TextUI.KeyColor); + EditorGUI.PropertyField(rect, keyColor, Styles.k_KeyColor); rect.y += spacing; - EditorGUI.PropertyField(rect, KeyThreshold, TextUI.Threshold); + EditorGUI.PropertyField(rect, keyThreshold, Styles.k_Threshold); rect.y += spacing; - EditorGUI.PropertyField(rect, KeyTolerance, TextUI.Tolerance); + EditorGUI.PropertyField(rect, keyTolerance, Styles.k_Tolerance); rect.y += spacing; - EditorGUI.PropertyField(rect, SpillRemoval, TextUI.SpillRemoval); + EditorGUI.PropertyField(rect, spillRemoval, Styles.k_SpillRemoval); } else { - SerializedProperty AlphaMask = serialized.AlphaMask; - EditorGUI.PropertyField(rect, AlphaMask, TextUI.AlphaMask); + SerializedProperty alphaMask = serialized.alphaMask; + EditorGUI.PropertyField(rect, alphaMask, Styles.k_AlphaMask); } } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs index 4ea0ddec75a..533ab72799b 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionLayerUI.Drawers.cs @@ -11,30 +11,30 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor { internal class CompositionLayerUI { - static partial class TextUI + static partial class Styles { // main layer - static public readonly GUIContent Resolution = EditorGUIUtility.TrTextContent("Resolution", "Specifies the resolution of this layer's render target. Lower resolution increases the performance at the expense of visual quality."); - static public readonly GUIContent BufferFormat = EditorGUIUtility.TrTextContent("Format", "Specifies the color buffer format of this layer. "); - static public readonly GUIContent OutputRenderer = EditorGUIUtility.TrTextContent("Output Renderer", "Redirects the output of this layer to the surface which is drawn by the selected mesh renderer. "); - static public readonly GUIContent AOVs = EditorGUIUtility.TrTextContent("AOVs", "Specifies the Arbitrary Output Variable (AOV) that will be drawn on this layer. This option affects all cameras that are stacked on this layer."); + static public readonly GUIContent k_Resolution = EditorGUIUtility.TrTextContent("Resolution", "Specifies the resolution of this layer's render target. Lower resolution increases the performance at the expense of visual quality."); + static public readonly GUIContent k_BufferFormat = EditorGUIUtility.TrTextContent("Format", "Specifies the color buffer format of this layer. "); + static public readonly GUIContent k_OutputRenderer = EditorGUIUtility.TrTextContent("Output Renderer", "Redirects the output of this layer to the surface which is drawn by the selected mesh renderer. "); + static public readonly GUIContent k_AOVs = EditorGUIUtility.TrTextContent("AOVs", "Specifies the Arbitrary Output Variable (AOV) that will be drawn on this layer. This option affects all cameras that are stacked on this layer."); // Sub layer - static public readonly GUIContent NameContent = EditorGUIUtility.TrTextContent("Layer Name", "Specifies the name of this layer."); - static public readonly GUIContent Camera = EditorGUIUtility.TrTextContent("Source Camera", "Specifies the camera of the scene that will provide the content for this layer."); - static public readonly GUIContent Image = EditorGUIUtility.TrTextContent("Source Image", "Specifies the image that will provide the content for this layer."); - static public readonly GUIContent Video = EditorGUIUtility.TrTextContent("Source Video", "Specifies the video that will provide the content for this layer."); - static public readonly GUIContent ClearDepth = EditorGUIUtility.TrTextContent("Clear Depth", "If enabled, the depth buffer will be cleared before rendering this layer."); - static public readonly GUIContent ClearAlpha = EditorGUIUtility.TrTextContent("Clear Alpha", "If enabled, the alpha channel will be cleared before rendering this layer. If enabled, post processing will affect only the objects of this layer"); - static public readonly GUIContent ClearMode = EditorGUIUtility.TrTextContent("Clear Color", "To override the clear mode of this layer, activate the option by clicking on the check-box and then select the desired value."); - static public readonly GUIContent AAMode = EditorGUIUtility.TrTextContent("Anti Aliasing", "To override the anti-aliasing mode, activate the option by clicking on the check-box and then select the desired value."); - static public readonly GUIContent CullingMask = EditorGUIUtility.TrTextContent("Culling Mask", "To override the culling mask, activate the option by clicking on the check-box and then select the desired value."); - static public readonly GUIContent VolumeMask = EditorGUIUtility.TrTextContent("Volume Mask", "To override the volume mask, activate the option by clicking on the check-box and then select the desired value."); + static public readonly GUIContent k_NameContent = EditorGUIUtility.TrTextContent("Layer Name", "Specifies the name of this layer."); + static public readonly GUIContent k_Camera = EditorGUIUtility.TrTextContent("Source Camera", "Specifies the camera of the scene that will provide the content for this layer."); + static public readonly GUIContent k_Image = EditorGUIUtility.TrTextContent("Source Image", "Specifies the image that will provide the content for this layer."); + static public readonly GUIContent k_Video = EditorGUIUtility.TrTextContent("Source Video", "Specifies the video that will provide the content for this layer."); + static public readonly GUIContent k_ClearDepth = EditorGUIUtility.TrTextContent("Clear Depth", "If enabled, the depth buffer will be cleared before rendering this layer."); + static public readonly GUIContent k_ClearAlpha = EditorGUIUtility.TrTextContent("Clear Alpha", "If enabled, the alpha channel will be cleared before rendering this layer. If enabled, post processing will affect only the objects of this layer"); + static public readonly GUIContent k_ClearMode = EditorGUIUtility.TrTextContent("Clear Color", "To override the clear mode of this layer, activate the option by clicking on the check-box and then select the desired value."); + static public readonly GUIContent k_AAMode = EditorGUIUtility.TrTextContent("Anti Aliasing", "To override the anti-aliasing mode, activate the option by clicking on the check-box and then select the desired value."); + static public readonly GUIContent k_CullingMask = EditorGUIUtility.TrTextContent("Culling Mask", "To override the culling mask, activate the option by clicking on the check-box and then select the desired value."); + static public readonly GUIContent k_VolumeMask = EditorGUIUtility.TrTextContent("Volume Mask", "To override the volume mask, activate the option by clicking on the check-box and then select the desired value."); } public static void DrawItemInList(Rect rect, SerializedCompositionLayer serialized, RenderTexture thumbnail, float aspectRatio, bool isAlphaEnbaled) { - bool isCameraStack = serialized.OutTarget.intValue == (int)CompositorLayer.OutputTarget.CameraStack; + bool isCameraStack = serialized.outTarget.intValue == (int)CompositorLayer.OutputTarget.CameraStack; // Compute the desired indentation { @@ -49,7 +49,7 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ { Rect newRect = rect; newRect.width = EditorGUIUtility.singleLineHeight; - EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none); + EditorGUI.PropertyField(newRect, serialized.show, GUIContent.none); rect.x += CompositorStyle.k_CheckboxSpacing; Rect previewRect = rect; previewRect.width = CompositorStyle.k_ThumbnailSize * aspectRatio; @@ -70,13 +70,13 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ } rect.y += CompositorStyle.k_LabelVerticalOffset; - EditorGUI.LabelField(rect, serialized.LayerName.stringValue); + EditorGUI.LabelField(rect, serialized.layerName.stringValue); } else { Rect newRect = rect; newRect.width = EditorGUIUtility.singleLineHeight; - EditorGUI.PropertyField(newRect, serialized.Show, GUIContent.none); + EditorGUI.PropertyField(newRect, serialized.show, GUIContent.none); newRect.x += CompositorStyle.k_CheckboxSpacing; if (isCameraStack) { @@ -84,7 +84,7 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ iconRect.width = CompositorStyle.k_IconSize; iconRect.height = CompositorStyle.k_IconSize; iconRect.y -= CompositorStyle.k_IconVerticalOffset; - switch (serialized.InputLayerType.enumValueIndex) + switch (serialized.inputLayerType.enumValueIndex) { case (int)CompositorLayer.LayerType.Camera: GUI.DrawTexture(iconRect, EditorGUIUtility.ObjectContent(null, typeof(Camera)).image); @@ -104,7 +104,7 @@ public static void DrawItemInList(Rect rect, SerializedCompositionLayer serializ } newRect.width = rect.width - newRect.x; - EditorGUI.LabelField(newRect, serialized.LayerName.stringValue); + EditorGUI.LabelField(newRect, serialized.layerName.stringValue); } } @@ -113,11 +113,11 @@ public static void DrawOutputLayerProperties(Rect rect, SerializedCompositionLay rect.y += CompositorStyle.k_ListItemPading; rect.height = CompositorStyle.k_SingleLineHeight; - EditorGUI.PropertyField(rect, serializedProperties.ColorFormat, TextUI.BufferFormat); + EditorGUI.PropertyField(rect, serializedProperties.colorFormat, Styles.k_BufferFormat); rect.y += CompositorStyle.k_Spacing; EditorGUI.BeginChangeCheck(); - EditorGUI.PropertyField(rect, serializedProperties.ResolutionScale, TextUI.Resolution); + EditorGUI.PropertyField(rect, serializedProperties.resolutionScale, Styles.k_Resolution); if (EditorGUI.EndChangeCheck()) { @@ -126,10 +126,10 @@ public static void DrawOutputLayerProperties(Rect rect, SerializedCompositionLay } rect.y += CompositorStyle.k_Spacing; - EditorGUI.PropertyField(rect, serializedProperties.OutputRenderer, TextUI.OutputRenderer); + EditorGUI.PropertyField(rect, serializedProperties.outputRenderer, Styles.k_OutputRenderer); rect.y += CompositorStyle.k_Spacing; - EditorGUI.PropertyField(rect, serializedProperties.AOVBitmask, TextUI.AOVs); + EditorGUI.PropertyField(rect, serializedProperties.aovBitmask, Styles.k_AOVs); rect.y += CompositorStyle.k_Spacing; } @@ -139,21 +139,21 @@ public static void DrawStackedLayerProperties(Rect rect, SerializedCompositionLa rect.y += CompositorStyle.k_ListItemPading; rect.height = CompositorStyle.k_SingleLineHeight; - EditorGUI.PropertyField(rect, serializedProperties.LayerName, TextUI.NameContent); + EditorGUI.PropertyField(rect, serializedProperties.layerName, Styles.k_NameContent); rect.y += CompositorStyle.k_Spacing; - switch (serializedProperties.InputLayerType.enumValueIndex) + switch (serializedProperties.inputLayerType.enumValueIndex) { case (int)CompositorLayer.LayerType.Camera: - EditorGUI.PropertyField(rect, serializedProperties.InputCamera, TextUI.Camera); + EditorGUI.PropertyField(rect, serializedProperties.inputCamera, Styles.k_Camera); break; case (int)CompositorLayer.LayerType.Video: - EditorGUI.PropertyField(rect, serializedProperties.InputVideo, TextUI.Video); + EditorGUI.PropertyField(rect, serializedProperties.inputVideo, Styles.k_Video); break; case (int)CompositorLayer.LayerType.Image: - EditorGUI.PropertyField(rect, serializedProperties.InputTexture, TextUI.Image); + EditorGUI.PropertyField(rect, serializedProperties.inputTexture, Styles.k_Image); rect.y += CompositorStyle.k_Spacing; - EditorGUI.PropertyField(rect, serializedProperties.FitType); + EditorGUI.PropertyField(rect, serializedProperties.fitType); break; default: // This will happen if someone adds a new layer type and does not update this switch statement @@ -162,26 +162,26 @@ public static void DrawStackedLayerProperties(Rect rect, SerializedCompositionLa } rect.y += 1.5f * CompositorStyle.k_Spacing; - EditorGUI.PropertyField(rect, serializedProperties.ClearDepth, TextUI.ClearDepth); + EditorGUI.PropertyField(rect, serializedProperties.clearDepth, Styles.k_ClearDepth); rect.y += CompositorStyle.k_Spacing; - EditorGUI.PropertyField(rect, serializedProperties.ClearAlpha, TextUI.ClearAlpha); + EditorGUI.PropertyField(rect, serializedProperties.clearAlpha, Styles.k_ClearAlpha); rect.y += 1.5f * CompositorStyle.k_Spacing; // The clear mode should be visible / configurable only for the first layer in the stack. For the other layers we set a camera-stacking specific clear-mode . - if (serializedProperties.PositionInStack.intValue == 0) + if (serializedProperties.positionInStack.intValue == 0) { - DrawPropertyHelper(rect, TextUI.ClearMode, serializedProperties.OverrideClearMode, serializedProperties.ClearMode); + DrawPropertyHelper(rect, Styles.k_ClearMode, serializedProperties.overrideClearMode, serializedProperties.clearMode); rect.y += CompositorStyle.k_Spacing; } - DrawPropertyHelper(rect, TextUI.AAMode, serializedProperties.OverrideAA, serializedProperties.AAMode); + DrawPropertyHelper(rect, Styles.k_AAMode, serializedProperties.overrideAA, serializedProperties.aaMode); rect.y += CompositorStyle.k_Spacing; - DrawPropertyHelper(rect, TextUI.CullingMask, serializedProperties.OverrideCulling, serializedProperties.CullingMaskProperty); + DrawPropertyHelper(rect, Styles.k_CullingMask, serializedProperties.overrideCulling, serializedProperties.cullingMaskProperty); rect.y += CompositorStyle.k_Spacing; - DrawPropertyHelper(rect, TextUI.VolumeMask, serializedProperties.OverrideVolume, serializedProperties.VolumeMask); + DrawPropertyHelper(rect, Styles.k_VolumeMask, serializedProperties.overrideVolume, serializedProperties.volumeMask); rect.y += CompositorStyle.k_Spacing; Rect filterRect = rect; @@ -199,7 +199,7 @@ static void DrawPropertyHelper(Rect rect, GUIContent label, SerializedProperty c rectCopy.width = EditorGUIUtility.labelWidth - EditorGUIUtility.singleLineHeight; EditorGUI.LabelField(rectCopy, label); - using (new EditorGUI.DisabledScope(checkBox.boolValue != true)) + using (new EditorGUI.DisabledScope(!checkBox.boolValue)) { float pad = EditorGUIUtility.labelWidth; rect.x += pad; diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs index 5e37fc6e998..fd8abfefdac 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs @@ -17,16 +17,16 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor [CustomEditor(typeof(CompositionManager))] internal class CompositionManagerEditor : Editor { - static partial class TextUI + static partial class Styles { - static public readonly GUIContent CompositionGraph = EditorGUIUtility.TrTextContent("Composition Graph", "Specifies the Shader Graph that will be used to produce the final composited output."); - static public readonly GUIContent OutputCamera = EditorGUIUtility.TrTextContent("Output Camera", "Specifies the camera that will output the final composited image."); - static public readonly GUIContent EnablePreview = EditorGUIUtility.TrTextContent("Enable Preview", "When enabled, the compositor will generate the final composed frame even in edit mode."); - static public readonly GUIContent InputFilters = EditorGUIUtility.TrTextContent("Input Filters", "A list of color filters that will be executed before composing the frame."); - static public readonly GUIContent Properties = EditorGUIUtility.TrTextContent("Properties", "The properties of a layer or sub-layer."); - static public readonly GUIContent RenderSchedule = EditorGUIUtility.TrTextContent("Render Schedule", "A list of layers and sub-layers in the scene. Layers are drawn from top to bottom."); - static public readonly string AlphaWarningPipeline = "The rendering pipeline was not configured to output an alpha channel. You can select a color buffer format that supports alpha in the HDRP quality settings."; - static public readonly string AlphaWarningPost = "The post processing system was not configured to process the alpha channel. You can select a buffer format that supports alpha in the HDRP quality settings."; + static public readonly GUIContent k_CompositionGraph = EditorGUIUtility.TrTextContent("Composition Graph", "Specifies the Shader Graph that will be used to produce the final composited output."); + static public readonly GUIContent k_OutputCamera = EditorGUIUtility.TrTextContent("Output Camera", "Specifies the camera that will output the final composited image."); + static public readonly GUIContent k_EnablePreview = EditorGUIUtility.TrTextContent("Enable Preview", "When enabled, the compositor will generate the final composed frame even in edit mode."); + static public readonly GUIContent k_InputFilters = EditorGUIUtility.TrTextContent("Input Filters", "A list of color filters that will be executed before composing the frame."); + static public readonly GUIContent k_Properties = EditorGUIUtility.TrTextContent("Properties", "The properties of a layer or sub-layer."); + static public readonly GUIContent k_RenderSchedule = EditorGUIUtility.TrTextContent("Render Schedule", "A list of layers and sub-layers in the scene. Layers are drawn from top to bottom."); + static public readonly string k_AlphaWarningPipeline = "The rendering pipeline was not configured to output an alpha channel. You can select a color buffer format that supports alpha in the HDRP quality settings."; + static public readonly string k_AlphaWarningPost = "The post processing system was not configured to process the alpha channel. You can select a buffer format that supports alpha in the HDRP quality settings."; } ReorderableList m_layerList; @@ -53,14 +53,14 @@ public bool isDirty void AddLayerOfTypeCallback(object type) { m_compositionManager.AddNewLayer(m_layerList.index + 1, (CompositorLayer.LayerType)type); - m_SerializedProperties.LayerList.serializedObject.Update(); + m_SerializedProperties.layerList.serializedObject.Update(); m_compositionManager.UpdateLayerSetup(); } void AddFilterOfTypeCallback(object type) { m_compositionManager.AddInputFilterAtLayer(CompositionFilter.Create((CompositionFilter.FilterType)type), m_layerList.index); - m_SerializedProperties.LayerList.serializedObject.Update(); + m_SerializedProperties.layerList.serializedObject.Update(); CacheSerializedObjects(); } @@ -75,15 +75,15 @@ bool CacheSerializedObjects() m_SerializedLayerProperties = new List(); m_SerializedShaderProperties = new List(); - var serializedLayerList = m_SerializedProperties.LayerList; + var serializedLayerList = m_SerializedProperties.layerList; for (int layerIndex = 0; layerIndex < serializedLayerList.arraySize; layerIndex++) { var serializedLayer = serializedLayerList.GetArrayElementAtIndex(layerIndex); m_SerializedLayerProperties.Add(new SerializedCompositionLayer(serializedLayer)); } - var serializedPropertyList = m_SerializedProperties.ShaderProperties; - if (m_SerializedProperties.ShaderProperties == null) + var serializedPropertyList = m_SerializedProperties.shaderProperties; + if (m_SerializedProperties.shaderProperties == null) { return false; } @@ -129,21 +129,21 @@ public override void OnInspectorGUI() } m_SerializedProperties.Update(); - m_EnablePreview = EditorGUILayout.Toggle(TextUI.EnablePreview, m_compositionManager.enableOutput); + m_EnablePreview = EditorGUILayout.Toggle(Styles.k_EnablePreview, m_compositionManager.enableOutput); { m_compositionManager.enableOutput = m_EnablePreview; } bool cameraChange = false; EditorGUI.BeginChangeCheck(); - EditorGUILayout.PropertyField(m_SerializedProperties.OutputCamera, TextUI.OutputCamera); + EditorGUILayout.PropertyField(m_SerializedProperties.outputCamera, Styles.k_OutputCamera); if (EditorGUI.EndChangeCheck()) { cameraChange = true; } EditorGUI.BeginChangeCheck(); - EditorGUILayout.PropertyField(m_SerializedProperties.CompositionShader, TextUI.CompositionGraph); + EditorGUILayout.PropertyField(m_SerializedProperties.compositionShader, Styles.k_CompositionGraph); bool shaderChange = false; if (EditorGUI.EndChangeCheck()) @@ -153,18 +153,18 @@ public override void OnInspectorGUI() shaderChange = true; } - EditorGUILayout.PropertyField(m_SerializedProperties.DisplayNumber); + EditorGUILayout.PropertyField(m_SerializedProperties.displayNumber); // Draw some warnings in case alpha is not fully supported if (m_compositionManager.alphaSupport == CompositionManager.AlphaChannelSupport.None) { EditorGUILayout.Space(5); - EditorGUILayout.HelpBox(TextUI.AlphaWarningPipeline, MessageType.Warning); + EditorGUILayout.HelpBox(Styles.k_AlphaWarningPipeline, MessageType.Warning); } else if (m_compositionManager.alphaSupport == CompositionManager.AlphaChannelSupport.Rendering) { EditorGUILayout.Space(5); - EditorGUILayout.HelpBox(TextUI.AlphaWarningPost, MessageType.Warning); + EditorGUILayout.HelpBox(Styles.k_AlphaWarningPost, MessageType.Warning); } // Now draw the composition shader properties @@ -176,8 +176,8 @@ public override void OnInspectorGUI() layerListChange = false; if (m_layerList == null) { - var serializedLayerList = m_SerializedProperties.LayerList; - m_layerList = new ReorderableList(m_SerializedProperties.CompositorSO, serializedLayerList, true, false, true, true); + var serializedLayerList = m_SerializedProperties.layerList; + m_layerList = new ReorderableList(m_SerializedProperties.compositorSO, serializedLayerList, true, false, true, true); m_layerList.drawHeaderCallback = (Rect rect) => { @@ -219,7 +219,7 @@ public override void OnInspectorGUI() menu.ShowAsContext(); m_IsEditorDirty = true; - m_SerializedProperties.LayerList.serializedObject.Update(); + m_SerializedProperties.layerList.serializedObject.Update(); EditorUtility.SetDirty(m_compositionManager.profile); }; @@ -248,7 +248,7 @@ public override void OnInspectorGUI() EditorGUI.BeginChangeCheck(); EditorGUILayout.BeginVertical(); - EditorGUILayout.LabelField(TextUI.RenderSchedule, headerStyle); + EditorGUILayout.LabelField(Styles.k_RenderSchedule, headerStyle); m_layerList.DoLayoutList(); EditorGUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) @@ -267,7 +267,7 @@ public override void OnInspectorGUI() EditorGUI.BeginChangeCheck(); if (m_layerList.index >= 0) { - EditorGUILayout.LabelField(TextUI.Properties, headerStyle); + EditorGUILayout.LabelField(Styles.k_Properties, headerStyle); rectagle.y += EditorGUIUtility.singleLineHeight * 1.5f; rectagle.x += 5; @@ -321,7 +321,7 @@ void DrawLayerProperties(Rect rect, SerializedCompositionLayer serializedPropert return; } - if (serializedProperties.OutTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) + if (serializedProperties.outTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) { CompositionLayerUI.DrawOutputLayerProperties(rect, serializedProperties, m_compositionManager.DeleteLayerRTs); } @@ -329,7 +329,7 @@ void DrawLayerProperties(Rect rect, SerializedCompositionLayer serializedPropert { if (m_filterList == null) { - m_filterList = new ReorderableList(serializedProperties.InputFilters.serializedObject, serializedProperties.InputFilters, true, true, true, true); + m_filterList = new ReorderableList(serializedProperties.inputFilters.serializedObject, serializedProperties.inputFilters, true, true, true, true); m_filterList.onAddCallback = (list) => { var menu = new GenericMenu(); @@ -360,7 +360,7 @@ void DrawLayerProperties(Rect rect, SerializedCompositionLayer serializedPropert m_filterList.drawHeaderCallback = (Rect r) => { - EditorGUI.LabelField(r, TextUI.InputFilters, EditorStyles.largeLabel); + EditorGUI.LabelField(r, Styles.k_InputFilters, EditorStyles.largeLabel); }; m_filterList.elementHeightCallback = (index) => diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs index c3e24d6e262..874be1cc974 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs @@ -3,7 +3,6 @@ using UnityEngine.Rendering.HighDefinition; using UnityEngine.Rendering.HighDefinition.Compositor; -#if UNITY_EDITOR using UnityEditor; using UnityEditorInternal; using UnityEditor.ShaderGraph; @@ -13,10 +12,10 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor { internal class CompositorWindow : EditorWindow { - static partial class TextUI + static partial class Styles { - static public readonly GUIContent EnableCompositor = EditorGUIUtility.TrTextContent("Enable Compositor", "Enabled the compositor and creates a default composition profile."); - static public readonly GUIContent RemoveCompositor = EditorGUIUtility.TrTextContent("Remove compositor from scene", "Removes the compositor and any composition settings from the scene."); + static public readonly GUIContent k_EnableCompositor = EditorGUIUtility.TrTextContent("Enable Compositor", "Enabled the compositor and creates a default composition profile."); + static public readonly GUIContent k_RemoveCompositor = EditorGUIUtility.TrTextContent("Remove compositor from scene", "Removes the compositor and any composition settings from the scene."); } static CompositorWindow s_Window; @@ -49,7 +48,7 @@ void OnGUI() } bool enableCompositorCached = enableCompositor; - enableCompositor = EditorGUILayout.Toggle(TextUI.EnableCompositor, enableCompositor); + enableCompositor = EditorGUILayout.Toggle(Styles.k_EnableCompositor, enableCompositor); // Track if the user changed the compositor enable state and mark the scene dirty if necessary if (enableCompositorCached != enableCompositor && compositor != null) @@ -83,9 +82,9 @@ void OnGUI() return; } - if (compositor && compositor.enabled == false) + if (compositor && !compositor.enabled) { - if (GUILayout.Button(new GUIContent("Remove compositor from scene"))) + if (GUILayout.Button(new GUIContent(Styles.k_RemoveCompositor))) { if (compositor.outputCamera) { @@ -128,7 +127,7 @@ void OnGUI() } m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition); - using (new EditorGUI.DisabledScope(compositor.enabled == false)) + using (new EditorGUI.DisabledScope(!compositor.enabled)) { if (m_Editor) { @@ -158,4 +157,3 @@ private void OnDestroy() } } } -#endif diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs index 204b3f39549..b3d9ef48e9c 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs @@ -4,26 +4,26 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor { internal class SerializedCompositionFilter { - public SerializedProperty FilterType; - public SerializedProperty MaskColor; - public SerializedProperty KeyThreshold; - public SerializedProperty KeyTolerance; - public SerializedProperty SpillRemoval; - public SerializedProperty AlphaMask; + public SerializedProperty filterType; + public SerializedProperty maskColor; + public SerializedProperty keyThreshold; + public SerializedProperty keyTolerance; + public SerializedProperty spillRemoval; + public SerializedProperty alphaMask; public SerializedCompositionFilter(SerializedProperty root) { - FilterType = root.FindPropertyRelative("m_Type"); - MaskColor = root.FindPropertyRelative("m_MaskColor"); - KeyThreshold = root.FindPropertyRelative("m_KeyThreshold"); - KeyTolerance = root.FindPropertyRelative("m_KeyTolerance"); - SpillRemoval = root.FindPropertyRelative("m_SpillRemoval"); - AlphaMask = root.FindPropertyRelative("m_AlphaMask"); + filterType = root.FindPropertyRelative("m_Type"); + maskColor = root.FindPropertyRelative("m_MaskColor"); + keyThreshold = root.FindPropertyRelative("m_KeyThreshold"); + keyTolerance = root.FindPropertyRelative("m_KeyTolerance"); + spillRemoval = root.FindPropertyRelative("m_SpillRemoval"); + alphaMask = root.FindPropertyRelative("m_AlphaMask"); } public float GetHeight() { - if (FilterType.intValue == 0) + if (filterType.intValue == 0) { return 5 * CompositorStyle.k_Spacing; } diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs index 7bc8fb96205..84c13137f9a 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs @@ -1,97 +1,95 @@ using System.Collections.Generic; - -using UnityEditor; using UnityEngine.Rendering.HighDefinition.Compositor; namespace UnityEditor.Rendering.HighDefinition.Compositor { internal class SerializedCompositionLayer { - public SerializedProperty LayerName; - public SerializedProperty Show; - public SerializedProperty ResolutionScale; - public SerializedProperty ExpandLayer; - public SerializedProperty OutTarget; - public SerializedProperty OutputRenderer; - public SerializedProperty ClearDepth; - public SerializedProperty ClearAlpha; - public SerializedProperty InputLayerType; - public SerializedProperty InputCamera; - public SerializedProperty InputVideo; - public SerializedProperty InputTexture; - public SerializedProperty FitType; - public SerializedProperty ColorFormat; - public SerializedProperty OverrideAA; - public SerializedProperty AAMode; - public SerializedProperty OverrideClearMode; - public SerializedProperty ClearMode; - public SerializedProperty OverrideCulling; - public SerializedProperty CullingMaskProperty; - public SerializedProperty OverrideVolume; - public SerializedProperty VolumeMask; - public SerializedProperty AOVBitmask; - public SerializedProperty InputFilters; - public SerializedProperty PositionInStack; + public SerializedProperty layerName; + public SerializedProperty show; + public SerializedProperty resolutionScale; + public SerializedProperty expandLayer; + public SerializedProperty outTarget; + public SerializedProperty outputRenderer; + public SerializedProperty clearDepth; + public SerializedProperty clearAlpha; + public SerializedProperty inputLayerType; + public SerializedProperty inputCamera; + public SerializedProperty inputVideo; + public SerializedProperty inputTexture; + public SerializedProperty fitType; + public SerializedProperty colorFormat; + public SerializedProperty overrideAA; + public SerializedProperty aaMode; + public SerializedProperty overrideClearMode; + public SerializedProperty clearMode; + public SerializedProperty overrideCulling; + public SerializedProperty cullingMaskProperty; + public SerializedProperty overrideVolume; + public SerializedProperty volumeMask; + public SerializedProperty aovBitmask; + public SerializedProperty inputFilters; + public SerializedProperty positionInStack; public List FilterList = new List(); public SerializedCompositionLayer(SerializedProperty root) { - LayerName = root.FindPropertyRelative("m_LayerName"); - Show = root.FindPropertyRelative("m_Show"); - ResolutionScale = root.FindPropertyRelative("m_ResolutionScale"); - ExpandLayer = root.FindPropertyRelative("m_ExpandLayer"); - OutTarget = root.FindPropertyRelative("m_OutputTarget"); - ClearDepth = root.FindPropertyRelative("m_ClearDepth"); - ClearAlpha = root.FindPropertyRelative("m_ClearAlpha"); - OutputRenderer = root.FindPropertyRelative("m_OutputRenderer"); - InputLayerType = root.FindPropertyRelative("m_Type"); - InputCamera = root.FindPropertyRelative("m_Camera"); - InputVideo = root.FindPropertyRelative("m_InputVideo"); - InputTexture = root.FindPropertyRelative("m_InputTexture"); - FitType = root.FindPropertyRelative("m_BackgroundFit"); - ColorFormat = root.FindPropertyRelative("m_ColorBufferFormat"); - OverrideClearMode = root.FindPropertyRelative("m_OverrideClearMode"); - ClearMode = root.FindPropertyRelative("m_ClearMode"); - OverrideAA = root.FindPropertyRelative("m_OverrideAntialiasing"); - AAMode = root.FindPropertyRelative("m_Antialiasing"); - OverrideCulling = root.FindPropertyRelative("m_OverrideCullingMask"); - CullingMaskProperty = root.FindPropertyRelative("m_CullingMask"); - OverrideVolume = root.FindPropertyRelative("m_OverrideVolumeMask"); - VolumeMask = root.FindPropertyRelative("m_VolumeMask"); - AOVBitmask = root.FindPropertyRelative("m_AOVBitmask"); - InputFilters = root.FindPropertyRelative("m_InputFilters"); - PositionInStack = root.FindPropertyRelative("m_LayerPositionInStack"); + layerName = root.FindPropertyRelative("m_LayerName"); + show = root.FindPropertyRelative("m_Show"); + resolutionScale = root.FindPropertyRelative("m_ResolutionScale"); + expandLayer = root.FindPropertyRelative("m_ExpandLayer"); + outTarget = root.FindPropertyRelative("m_OutputTarget"); + clearDepth = root.FindPropertyRelative("m_ClearDepth"); + clearAlpha = root.FindPropertyRelative("m_ClearAlpha"); + outputRenderer = root.FindPropertyRelative("m_OutputRenderer"); + inputLayerType = root.FindPropertyRelative("m_Type"); + inputCamera = root.FindPropertyRelative("m_Camera"); + inputVideo = root.FindPropertyRelative("m_InputVideo"); + inputTexture = root.FindPropertyRelative("m_InputTexture"); + fitType = root.FindPropertyRelative("m_BackgroundFit"); + colorFormat = root.FindPropertyRelative("m_ColorBufferFormat"); + overrideClearMode = root.FindPropertyRelative("m_OverrideClearMode"); + clearMode = root.FindPropertyRelative("m_ClearMode"); + overrideAA = root.FindPropertyRelative("m_OverrideAntialiasing"); + aaMode = root.FindPropertyRelative("m_Antialiasing"); + overrideCulling = root.FindPropertyRelative("m_OverrideCullingMask"); + cullingMaskProperty = root.FindPropertyRelative("m_CullingMask"); + overrideVolume = root.FindPropertyRelative("m_OverrideVolumeMask"); + volumeMask = root.FindPropertyRelative("m_VolumeMask"); + aovBitmask = root.FindPropertyRelative("m_AOVBitmask"); + inputFilters = root.FindPropertyRelative("m_InputFilters"); + positionInStack = root.FindPropertyRelative("m_LayerPositionInStack"); - for (int index = 0; index < InputFilters.arraySize; index++) + for (int index = 0; index < inputFilters.arraySize; index++) { - var serializedFilter = InputFilters.GetArrayElementAtIndex(index); + var serializedFilter = inputFilters.GetArrayElementAtIndex(index); FilterList.Add(new SerializedCompositionFilter(serializedFilter)); } } public float GetPropertiesHeight() { - if (OutTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) + if (outTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) { return - EditorGUI.GetPropertyHeight(OutputRenderer, null) + - EditorGUI.GetPropertyHeight(ColorFormat, null) + - EditorGUI.GetPropertyHeight(AOVBitmask, null) + - EditorGUI.GetPropertyHeight(ResolutionScale, null) + + EditorGUI.GetPropertyHeight(outputRenderer, null) + + EditorGUI.GetPropertyHeight(colorFormat, null) + + EditorGUI.GetPropertyHeight(aovBitmask, null) + + EditorGUI.GetPropertyHeight(resolutionScale, null) + 2 * EditorGUIUtility.singleLineHeight; //for the heading and pading } else { - return EditorGUI.GetPropertyHeight(LayerName, null) + - EditorGUI.GetPropertyHeight(InputCamera, null) + - EditorGUI.GetPropertyHeight(ClearDepth, null) + - EditorGUI.GetPropertyHeight(ClearAlpha, null) + - EditorGUI.GetPropertyHeight(ClearMode, null) + - EditorGUI.GetPropertyHeight(AAMode, null) + - EditorGUI.GetPropertyHeight(CullingMaskProperty, null) + - EditorGUI.GetPropertyHeight(VolumeMask, null) + - EditorGUI.GetPropertyHeight(InputFilters, null) + + return EditorGUI.GetPropertyHeight(layerName, null) + + EditorGUI.GetPropertyHeight(inputCamera, null) + + EditorGUI.GetPropertyHeight(clearDepth, null) + + EditorGUI.GetPropertyHeight(clearAlpha, null) + + EditorGUI.GetPropertyHeight(clearMode, null) + + EditorGUI.GetPropertyHeight(aaMode, null) + + EditorGUI.GetPropertyHeight(cullingMaskProperty, null) + + EditorGUI.GetPropertyHeight(volumeMask, null) + + EditorGUI.GetPropertyHeight(inputFilters, null) + 7 * EditorGUIUtility.singleLineHeight; //for the heading and pading } } @@ -99,7 +97,7 @@ public float GetPropertiesHeight() public float GetListItemHeight() { int pading = 10; - if (OutTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) + if (outTarget.intValue != (int)CompositorLayer.OutputTarget.CameraStack) { return CompositorStyle.k_ThumbnailSize + pading; } diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs index 7258cd429c7..b82b729de5b 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionManager.cs @@ -4,48 +4,47 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor { internal class SerializedCompositionManager { - public SerializedProperty CompositionProfile; - public SerializedProperty LayerList; - public SerializedProperty ShaderProperties; - public SerializedProperty DisplayNumber; - public SerializedProperty CompositionShader; - public SerializedProperty OutputCamera; + public SerializedProperty compositionProfile; + public SerializedProperty layerList; + public SerializedProperty shaderProperties; + public SerializedProperty displayNumber; + public SerializedProperty compositionShader; + public SerializedProperty outputCamera; - public SerializedObject CompositionProfileSO; - public SerializedObject CompositorSO; + public SerializedObject compositionProfileSO; + public SerializedObject compositorSO; public SerializedCompositionManager(SerializedObject root) { - CompositorSO = root; + compositorSO = root; { - CompositionProfile = CompositorSO.FindProperty("m_CompositionProfile"); - DisplayNumber = CompositorSO.FindProperty("m_OutputDisplay"); - CompositionShader = CompositorSO.FindProperty("m_Shader"); - OutputCamera = CompositorSO.FindProperty("m_OutputCamera"); + compositionProfile = compositorSO.FindProperty("m_CompositionProfile"); + displayNumber = compositorSO.FindProperty("m_OutputDisplay"); + compositionShader = compositorSO.FindProperty("m_Shader"); + outputCamera = compositorSO.FindProperty("m_OutputCamera"); + layerList = compositorSO.FindProperty("m_InputLayers"); } - LayerList = CompositorSO.FindProperty("m_InputLayers"); - // Work around to find property on scriptable object - if (CompositionProfile.objectReferenceValue) + if (compositionProfile.objectReferenceValue) { - CompositionProfileSO = new SerializedObject(CompositionProfile.objectReferenceValue); + compositionProfileSO = new SerializedObject(compositionProfile.objectReferenceValue); { - ShaderProperties = CompositionProfileSO.FindProperty("m_ShaderProperties"); + shaderProperties = compositionProfileSO.FindProperty("m_ShaderProperties"); } } } public void Update() { - CompositionProfileSO.Update(); - CompositorSO.Update(); + compositionProfileSO.Update(); + compositorSO.Update(); } public void ApplyModifiedProperties() { - CompositionProfileSO.ApplyModifiedProperties(); - CompositorSO.ApplyModifiedProperties(); + compositionProfileSO.ApplyModifiedProperties(); + compositorSO.ApplyModifiedProperties(); } } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs index 56163d41eff..5cad5a739cb 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs @@ -4,17 +4,17 @@ namespace UnityEditor.Rendering.HighDefinition.Compositor { internal class SerializedShaderProperty { - public SerializedProperty PropertyName; - public SerializedProperty PropertyType; - public SerializedProperty PropertyValue; - public SerializedProperty RangeLimits; + public SerializedProperty propertyName; + public SerializedProperty propertyType; + public SerializedProperty propertyValue; + public SerializedProperty rangeLimits; public SerializedShaderProperty(SerializedProperty root) { - PropertyName = root.FindPropertyRelative("m_PropertyName"); - PropertyType = root.FindPropertyRelative("m_Type"); - PropertyValue = root.FindPropertyRelative("m_Value"); - RangeLimits = root.FindPropertyRelative("m_RangeLimits"); + propertyName = root.FindPropertyRelative("m_PropertyName"); + propertyType = root.FindPropertyRelative("m_Type"); + propertyValue = root.FindPropertyRelative("m_Value"); + rangeLimits = root.FindPropertyRelative("m_RangeLimits"); } } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs index b20712307a6..3b3d219c8f8 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs @@ -10,7 +10,7 @@ internal class ShaderPropertyUI { public static void Draw(List propertyList) { - int index = propertyList.FindIndex(x => x.PropertyType.intValue != (int)ShaderPropertyType.Texture); + int index = propertyList.FindIndex(x => x.propertyType.intValue != (int)ShaderPropertyType.Texture); if (index >= 0) { EditorGUILayout.Separator(); @@ -29,43 +29,43 @@ public static void Draw(SerializedShaderProperty prop) { int columnWidth = (int)EditorGUIUtility.labelWidth; // Set a fixed length for all labels, so everything in the UI is nicely aligned - switch ((ShaderPropertyType)prop.PropertyType.intValue) + switch ((ShaderPropertyType)prop.propertyType.intValue) { case ShaderPropertyType.Range: { EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); - Vector2 rangeLimits = prop.RangeLimits.vector2Value; - float val = EditorGUILayout.Slider(prop.PropertyValue.vector4Value.x, rangeLimits.x, rangeLimits.y); - prop.PropertyValue.vector4Value = new Vector4(val, 0, 0, 0); + EditorGUILayout.LabelField(prop.propertyName.stringValue, GUILayout.Width(columnWidth)); + Vector2 rangeLimits = prop.rangeLimits.vector2Value; + float val = EditorGUILayout.Slider(prop.propertyValue.vector4Value.x, rangeLimits.x, rangeLimits.y); + prop.propertyValue.vector4Value = new Vector4(val, 0, 0, 0); EditorGUILayout.EndHorizontal(); } break; case ShaderPropertyType.Float: { EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); - float val = EditorGUILayout.FloatField(prop.PropertyValue.vector4Value.x); - prop.PropertyValue.vector4Value = new Vector4(val, 0, 0, 0); + EditorGUILayout.LabelField(prop.propertyName.stringValue, GUILayout.Width(columnWidth)); + float val = EditorGUILayout.FloatField(prop.propertyValue.vector4Value.x); + prop.propertyValue.vector4Value = new Vector4(val, 0, 0, 0); EditorGUILayout.EndHorizontal(); } break; case ShaderPropertyType.Vector: { EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); - Vector4 val = EditorGUILayout.Vector4Field(GUIContent.none, prop.PropertyValue.vector4Value); - prop.PropertyValue.vector4Value = val; + EditorGUILayout.LabelField(prop.propertyName.stringValue, GUILayout.Width(columnWidth)); + Vector4 val = EditorGUILayout.Vector4Field(GUIContent.none, prop.propertyValue.vector4Value); + prop.propertyValue.vector4Value = val; EditorGUILayout.EndHorizontal(); } break; case ShaderPropertyType.Color: { EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField(prop.PropertyName.stringValue, GUILayout.Width(columnWidth)); - Color val = prop.PropertyValue.vector4Value; + EditorGUILayout.LabelField(prop.propertyName.stringValue, GUILayout.Width(columnWidth)); + Color val = prop.propertyValue.vector4Value; val = EditorGUILayout.ColorField(GUIContent.none, val); - prop.PropertyValue.vector4Value = val; + prop.propertyValue.vector4Value = val; EditorGUILayout.EndHorizontal(); } break; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs index 893445a8bf7..7f3e1d1f728 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs @@ -13,26 +13,26 @@ internal enum BackgroundFitMode // This class store some additional per-camera data (filters, custom clear modes, etc) that are used by the compositor. internal class AdditionalCompositorData : MonoBehaviour { - public Texture m_clearColorTexture = null; - public bool m_clearAlpha = true; // Clearing the alpha allows the post process to run only on the pixels covered by a stacked camera (and not the previous ones). - public BackgroundFitMode m_imageFitMode = BackgroundFitMode.Stretch; - public List m_layerFilters; + public Texture clearColorTexture = null; + public bool clearAlpha = true; // Clearing the alpha allows the post process to run only on the pixels covered by a stacked camera (and not the previous ones). + public BackgroundFitMode imageFitMode = BackgroundFitMode.Stretch; + public List layerFilters; public void Init(List layerFilters, bool clearAlpha) { - m_layerFilters = new List(layerFilters); - m_clearAlpha = clearAlpha; + this.layerFilters = new List(layerFilters); + this.clearAlpha = clearAlpha; } public void Reset() { - m_clearColorTexture = null; - m_clearAlpha = true; - m_imageFitMode = BackgroundFitMode.Stretch; + clearColorTexture = null; + clearAlpha = true; + imageFitMode = BackgroundFitMode.Stretch; - if (m_layerFilters !=null) + if (layerFilters !=null) { - m_layerFilters.Clear(); + layerFilters.Clear(); } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs index c94fc402fda..5e34ddf0830 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs @@ -10,8 +10,8 @@ internal sealed class AlphaInjection : CustomPostProcessVolumeComponent, IPostPr { internal class ShaderIDs { - public static readonly int _AlphaTexture = Shader.PropertyToID("_AlphaTexture"); - public static readonly int _InputTexture = Shader.PropertyToID("_InputTexture"); + public static readonly int k_AlphaTexture = Shader.PropertyToID("_AlphaTexture"); + public static readonly int k_InputTexture = Shader.PropertyToID("_InputTexture"); } Material m_Material; @@ -32,22 +32,22 @@ public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, //TODO: can we detect this before we get here? AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent(); - if (layerData == null || layerData.m_layerFilters == null) + if (layerData == null || layerData.layerFilters == null) { HDUtils.BlitCameraTexture(cmd, source, destination); return; } - int indx = layerData.m_layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.ALPHA_MASK); - if (indx < 0) + int index = layerData.layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.ALPHA_MASK); + if (index < 0) { HDUtils.BlitCameraTexture(cmd, source, destination); return; } - var filter = layerData.m_layerFilters[indx]; - m_Material.SetTexture(ShaderIDs._InputTexture, source); - m_Material.SetTexture(ShaderIDs._AlphaTexture, filter.m_AlphaMask); + var filter = layerData.layerFilters[index]; + m_Material.SetTexture(ShaderIDs.k_InputTexture, source); + m_Material.SetTexture(ShaderIDs.k_AlphaTexture, filter.m_AlphaMask); HDUtils.DrawFullScreen(cmd, m_Material, destination); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs index d7a442d760e..0d1702933a1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs @@ -12,9 +12,9 @@ internal sealed class ChromaKeying : CustomPostProcessVolumeComponent, IPostProc { internal class ShaderIDs { - public static readonly int _KeyColor = Shader.PropertyToID("_KeyColor"); - public static readonly int _KeyParams = Shader.PropertyToID("_KeyParams"); - public static readonly int _InputTexture = Shader.PropertyToID("_InputTexture"); + public static readonly int k_KeyColor = Shader.PropertyToID("_KeyColor"); + public static readonly int k_KeyParams = Shader.PropertyToID("_KeyParams"); + public static readonly int k_InputTexture = Shader.PropertyToID("_InputTexture"); } public BoolParameter activate = new BoolParameter(false); @@ -36,29 +36,29 @@ public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent(); - if (activate.value == false || layerData == null || layerData.m_layerFilters == null) + if (activate.value == false || layerData == null || layerData.layerFilters == null) { HDUtils.BlitCameraTexture(cmd, source, destination); return; } - int indx = layerData.m_layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.CHROMA_KEYING); - if (indx < 0) + int index = layerData.layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.CHROMA_KEYING); + if (index < 0) { HDUtils.BlitCameraTexture(cmd, source, destination); return; } - var filter = layerData.m_layerFilters[indx]; + var filter = layerData.layerFilters[index]; Vector4 keyParams; keyParams.x = filter.m_KeyThreshold; keyParams.y = filter.m_KeyTolerance; keyParams.z = filter.m_SpillRemoval; keyParams.w = 1.0f; - m_Material.SetVector(ShaderIDs._KeyColor, filter.m_MaskColor); - m_Material.SetVector(ShaderIDs._KeyParams, keyParams); - m_Material.SetTexture(ShaderIDs._InputTexture, source); + m_Material.SetVector(ShaderIDs.k_KeyColor, filter.m_MaskColor); + m_Material.SetVector(ShaderIDs.k_KeyParams, keyParams); + m_Material.SetTexture(ShaderIDs.k_InputTexture, source); HDUtils.DrawFullScreen(cmd, m_Material, destination); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index 987e3bf1bf1..de319acce61 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -43,16 +43,11 @@ public enum ResolutionScale Half = 2, Quarter = 4 } - public string name - { - get => m_LayerName; - } + public string name => m_LayerName; + [SerializeField] string m_LayerName; - public OutputTarget outputTarget - { - get => m_OutputTarget; - } + public OutputTarget outputTarget => m_OutputTarget; [SerializeField] OutputTarget m_OutputTarget; // Specifies if this layer will be used in the compositor or a camera stack [SerializeField] bool m_ClearDepth = false; // Specifies if the depth will be cleared when stacking this camera over the previous one (for overlays) @@ -124,10 +119,7 @@ public float aspectRatio } } - public Camera camera - { - get => m_LayerCamera; - } + public Camera camera => m_LayerCamera; [SerializeField] Camera m_LayerCamera; @@ -336,8 +328,8 @@ public void Init(string layerID = "") { cameraData.clearColorMode = HDAdditionalCameraData.ClearColorMode.None; - layerData.m_clearColorTexture = m_InputTexture; - layerData.m_imageFitMode = m_BackgroundFit; + layerData.clearColorTexture = m_InputTexture; + layerData.imageFitMode = m_BackgroundFit; } // Custom pass to inject an alpha mask @@ -575,7 +567,7 @@ public void SetupLayerCamera(CompositorLayer targetLayer, int layerPositionInSta { compositorData = m_LayerCamera.gameObject.AddComponent(); } - compositorData.m_clearColorTexture = targetLayer.GetRenderTarget(false); + compositorData.clearColorTexture = targetLayer.GetRenderTarget(false); cameraData.volumeLayerMask |= 1 << 31; } else diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index 280499e6e53..0a451b0b523 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -44,17 +44,12 @@ public enum AlphaChannelSupport [SerializeField] OutputDisplay m_OutputDisplay = OutputDisplay.Display1; - public List layers - { - get => m_InputLayers; - } + public List layers => m_InputLayers; [SerializeField] List m_InputLayers = new List(); - public AlphaChannelSupport alphaSupport - { - get => m_AlphaSupport; - } + public AlphaChannelSupport alphaSupport => m_AlphaSupport; + internal AlphaChannelSupport m_AlphaSupport = AlphaChannelSupport.RenderingAndPostProcessing; public bool enableOutput @@ -86,10 +81,7 @@ public bool enableOutput } } - public int numLayers - { - get => m_InputLayers.Count; - } + public int numLayers => m_InputLayers.Count; public Shader shader { @@ -618,7 +610,7 @@ public void SetLayerRenderTargets() m_InputLayers[i].SetupLayerCamera(lastLayer, layerPositionInStack); // Corner case: If the first layer in a camera stack was disabled, then it should still clear the color buffer - if (m_InputLayers[i].enabled == false && layerPositionInStack == 0) + if (!m_InputLayers[i].enabled && layerPositionInStack == 0) { m_InputLayers[i].SetupClearColor(); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs index 9ca0dccb06f..d77a916dc51 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs @@ -71,7 +71,6 @@ public void AddShaderProperty(CompositionManager compositor, ShaderProperty sp) int indx = compositor.layers.FindIndex(s => s.name == sp.m_PropertyName); if (indx < 0 && !hide) { - Debug.Log($"Adding output layer from shader graph: {sp.m_PropertyName}"); var newLayer = CompositorLayer.CreateOutputLayer(sp.m_PropertyName); compositor.layers.Add(newLayer); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs index aa241208460..d3be54d3e5d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs @@ -13,10 +13,10 @@ internal class CustomClear : CustomPass { internal class ShaderIDs { - public static readonly int _BlitScaleBiasRt = Shader.PropertyToID("_BlitScaleBiasRt"); - public static readonly int _BlitScaleBias = Shader.PropertyToID("_BlitScaleBias"); - public static readonly int _BlitTexture = Shader.PropertyToID("_BlitTexture"); - public static readonly int _ClearAlpha = Shader.PropertyToID("_ClearAlpha"); + public static readonly int k_BlitScaleBiasRt = Shader.PropertyToID("_BlitScaleBiasRt"); + public static readonly int k_BlitScaleBias = Shader.PropertyToID("_BlitScaleBias"); + public static readonly int k_BlitTexture = Shader.PropertyToID("_BlitTexture"); + public static readonly int k_ClearAlpha = Shader.PropertyToID("_ClearAlpha"); } enum PassType @@ -33,7 +33,7 @@ enum PassType protected override void Setup(ScriptableRenderContext renderContext, CommandBuffer cmd) { // Setup code here - if (name == "") name = "CustomClear"; + if (string.IsNullOrEmpty(name)) name = "CustomClear"; fullscreenPassMaterial = CoreUtils.CreateEngineMaterial("Hidden/HDRP/CustomClear"); } @@ -42,22 +42,22 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu { // Executed every frame for all the camera inside the pass volume AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent(); - if (layerData == null || layerData.m_clearColorTexture == false) + if (layerData == null || layerData.clearColorTexture == false) { return; } else { float cameraAspectRatio = (float)camera.actualWidth / camera.actualHeight; - float imageAspectRatio = (float)layerData.m_clearColorTexture.width / layerData.m_clearColorTexture.height; + float imageAspectRatio = (float)layerData.clearColorTexture.width / layerData.clearColorTexture.height; var scaleBiasRt = new Vector4(1.0f, 1.0f, 0.0f, 0.0f); - if (layerData.m_imageFitMode == BackgroundFitMode.FitHorizontally) + if (layerData.imageFitMode == BackgroundFitMode.FitHorizontally) { scaleBiasRt.y = cameraAspectRatio / imageAspectRatio; scaleBiasRt.w = (1 - scaleBiasRt.y) / 2.0f; } - else if (layerData.m_imageFitMode == BackgroundFitMode.FitVertically) + else if (layerData.imageFitMode == BackgroundFitMode.FitVertically) { scaleBiasRt.x = imageAspectRatio / cameraAspectRatio; scaleBiasRt.z = (1 - scaleBiasRt.x) / 2.0f; @@ -67,15 +67,15 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu // The texture might not cover the entire screen (letter boxing), so in this case clear first to the background color (and stencil) if (scaleBiasRt.x < 1.0f || scaleBiasRt.y < 1.0f) { - fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBiasRt, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); - fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBiasRt, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); cmd.DrawProcedural(Matrix4x4.identity, fullscreenPassMaterial, (int)PassType.ClearColorAndStencil, MeshTopology.Quads, 4, 1); } - fullscreenPassMaterial.SetTexture(ShaderIDs._BlitTexture, layerData.m_clearColorTexture); - fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBiasRt, scaleBiasRt); - fullscreenPassMaterial.SetVector(ShaderIDs._BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); - fullscreenPassMaterial.SetInt(ShaderIDs._ClearAlpha, layerData.m_clearAlpha ? 1 : 0); + fullscreenPassMaterial.SetTexture(ShaderIDs.k_BlitTexture, layerData.clearColorTexture); + fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBiasRt, scaleBiasRt); + fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + fullscreenPassMaterial.SetInt(ShaderIDs.k_ClearAlpha, layerData.clearAlpha ? 1 : 0); // draw a quad (not Triangle), to support letter boxing and stretching cmd.DrawProcedural(Matrix4x4.identity, fullscreenPassMaterial, (int)PassType.DrawTextureAndClearStencil, MeshTopology.Quads, 4, 1); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs index 4f6c5257f80..b8b1cc75349 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs @@ -12,27 +12,27 @@ internal class ShaderProperty public Vector2 m_RangeLimits; public ShaderPropertyFlags m_Flags; - public static ShaderProperty Create(Shader shader, Material material, int indx) + public static ShaderProperty Create(Shader shader, Material material, int index) { ShaderProperty sp = new ShaderProperty(); { - sp.m_PropertyName = shader.GetPropertyName(indx); - sp.m_Type = shader.GetPropertyType(indx); - sp.m_Flags = shader.GetPropertyFlags(indx); + sp.m_PropertyName = shader.GetPropertyName(index); + sp.m_Type = shader.GetPropertyType(index); + sp.m_Flags = shader.GetPropertyFlags(index); sp.m_Value = Vector4.zero; if (sp.m_Type == ShaderPropertyType.Range) { - sp.m_RangeLimits = shader.GetPropertyRangeLimits(indx); - sp.m_Value = new Vector4(material.GetFloat(Shader.PropertyToID(shader.GetPropertyName(indx))), 0.0f, 0.0f, 0.0f); + sp.m_RangeLimits = shader.GetPropertyRangeLimits(index); + sp.m_Value = new Vector4(material.GetFloat(Shader.PropertyToID(shader.GetPropertyName(index))), 0.0f, 0.0f, 0.0f); } else if (sp.m_Type == ShaderPropertyType.Color) { - sp.m_Value = material.GetColor(Shader.PropertyToID(shader.GetPropertyName(indx))); + sp.m_Value = material.GetColor(Shader.PropertyToID(shader.GetPropertyName(index))); } else if (sp.m_Type == ShaderPropertyType.Vector) { - sp.m_Value = material.GetVector(Shader.PropertyToID(shader.GetPropertyName(indx))); + sp.m_Value = material.GetVector(Shader.PropertyToID(shader.GetPropertyName(index))); } } return sp; From 67436fb7b99b334e43787feb28124d66b966c2e3 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Tue, 7 Apr 2020 16:03:35 +0200 Subject: [PATCH 08/21] fix serialized variable names --- .../Scenes/9x_Other/9800_Compositor.unity | 105 +++++++++--------- .../Compositor/CompositionManagerEditor.cs | 16 +-- .../Compositor/SerializedCompositionFilter.cs | 12 +- .../Compositor/SerializedCompositionLayer.cs | 33 ++++-- .../Compositor/SeriallizedShaderProperty.cs | 8 +- .../Runtime/Compositor/AlphaInjection.cs | 4 +- .../Runtime/Compositor/ChromaKeying.cs | 10 +- .../Runtime/Compositor/CompositionFilter.cs | 17 +-- .../Runtime/Compositor/CompositionLayer.cs | 3 +- .../Runtime/Compositor/CompositionManager.cs | 28 ++--- .../Runtime/Compositor/CompositionProfile.cs | 16 +-- .../Runtime/Compositor/CustomClear.cs | 2 +- .../Runtime/Compositor/ShaderProperty.cs | 32 +++--- 13 files changed, 142 insertions(+), 144 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity index 699b3b29119..ad80798f82b 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity @@ -124,7 +124,7 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!84 &29952411 +--- !u!84 &8062103 RenderTexture: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -431,19 +431,19 @@ Material: serializedVersion: 3 m_TexEnvs: - GreenScreen: - m_Texture: {fileID: 1851699743} + m_Texture: {fileID: 1847047563} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - Layer0: - m_Texture: {fileID: 29952411} + m_Texture: {fileID: 707328070} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - Layer1: - m_Texture: {fileID: 1749440052} + m_Texture: {fileID: 1416341668} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - Logo: - m_Texture: {fileID: 1169955371} + m_Texture: {fileID: 8062103} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} m_Floats: [] @@ -626,6 +626,41 @@ MonoBehaviour: blendDistance: 0 weight: 1 sharedProfile: {fileID: 11400000, guid: b6e11bd621edeeb43a64506cf2cac8c5, type: 2} +--- !u!84 &707328070 +RenderTexture: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_ImageContentsHash: + serializedVersion: 2 + Hash: 00000000000000000000000000000000 + m_ForcedFallbackFormat: 4 + m_DownscaleFallback: 0 + serializedVersion: 3 + m_Width: 640 + m_Height: 360 + m_AntiAliasing: 1 + m_MipCount: -1 + m_DepthFormat: 2 + m_ColorFormat: 24 + m_MipMap: 0 + m_GenerateMips: 1 + m_SRGB: 0 + m_UseDynamicScale: 0 + m_BindMS: 0 + m_EnableCompatibleFormat: 1 + m_TextureSettings: + serializedVersion: 2 + m_FilterMode: 1 + m_Aniso: 1 + m_MipBias: 0 + m_WrapU: 1 + m_WrapV: 1 + m_WrapW: 1 + m_Dimension: 2 + m_VolumeDepth: 1 --- !u!1 &775050991 GameObject: m_ObjectHideFlags: 0 @@ -674,41 +709,6 @@ MonoBehaviour: blendDistance: 0 weight: 1 sharedProfile: {fileID: 11400000, guid: f702b32cef038544a92000621a19b27f, type: 2} ---- !u!84 &1169955371 -RenderTexture: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: - m_ImageContentsHash: - serializedVersion: 2 - Hash: 00000000000000000000000000000000 - m_ForcedFallbackFormat: 4 - m_DownscaleFallback: 0 - serializedVersion: 3 - m_Width: 640 - m_Height: 360 - m_AntiAliasing: 1 - m_MipCount: -1 - m_DepthFormat: 2 - m_ColorFormat: 24 - m_MipMap: 0 - m_GenerateMips: 1 - m_SRGB: 0 - m_UseDynamicScale: 0 - m_BindMS: 0 - m_EnableCompatibleFormat: 1 - m_TextureSettings: - serializedVersion: 2 - m_FilterMode: 1 - m_Aniso: 1 - m_MipBias: 0 - m_WrapU: 1 - m_WrapV: 1 - m_WrapW: 1 - m_Dimension: 2 - m_VolumeDepth: 1 --- !u!1 &1323211074 GameObject: m_ObjectHideFlags: 0 @@ -957,6 +957,7 @@ MonoBehaviour: m_LightShadowRadius: 0.5 m_SemiTransparentShadow: 0 m_ColorShadow: 1 + m_DistanceBasedFiltering: 0 m_EvsmExponent: 15 m_EvsmLightLeakBias: 0 m_EvsmVarianceBias: 0.00001 @@ -1007,7 +1008,7 @@ MonoBehaviour: showAdditionalSettings: 0 m_AreaLightEmissiveMeshShadowCastingMode: 0 m_AreaLightEmissiveMeshMotionVectorGenerationMode: 0 ---- !u!84 &1749440052 +--- !u!84 &1416341668 RenderTexture: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1137,7 +1138,7 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 22.476002, z: 0} ---- !u!84 &1851699743 +--- !u!84 &1847047563 RenderTexture: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -1356,7 +1357,7 @@ MonoBehaviour: m_InputFilters: [] m_AOVBitmask: 0 m_AOVRenderTargets: [] - m_RenderTarget: {fileID: 29952411} + m_RenderTarget: {fileID: 707328070} m_ClearsBackGround: 0 m_Show: 1 m_LayerCamera: {fileID: 0} @@ -1484,7 +1485,7 @@ MonoBehaviour: m_InputFilters: [] m_AOVBitmask: 0 m_AOVRenderTargets: [] - m_RenderTarget: {fileID: 1749440052} + m_RenderTarget: {fileID: 1416341668} m_ClearsBackGround: 0 m_Show: 1 m_LayerCamera: {fileID: 0} @@ -1548,7 +1549,7 @@ MonoBehaviour: m_InputFilters: [] m_AOVBitmask: 0 m_AOVRenderTargets: [] - m_RenderTarget: {fileID: 1169955371} + m_RenderTarget: {fileID: 8062103} m_ClearsBackGround: 0 m_Show: 1 m_LayerCamera: {fileID: 0} @@ -1612,7 +1613,7 @@ MonoBehaviour: m_InputFilters: [] m_AOVBitmask: 0 m_AOVRenderTargets: [] - m_RenderTarget: {fileID: 1851699743} + m_RenderTarget: {fileID: 1847047563} m_ClearsBackGround: 0 m_Show: 1 m_LayerCamera: {fileID: 0} @@ -1642,12 +1643,12 @@ MonoBehaviour: m_Bits: 0 m_LayerPositionInStack: 0 m_InputFilters: - - m_Type: 0 - m_MaskColor: {r: 0.09431517, g: 1, b: 0, a: 0} - m_KeyThreshold: 2.67 - m_KeyTolerance: 1.31 - m_SpillRemoval: 0 - m_AlphaMask: {fileID: 0} + - filterType: 0 + maskColor: {r: 0.09411765, g: 1, b: 0, a: 0} + keyThreshold: 2.67 + keyTolerance: 1.31 + spillRemoval: 0 + alphaMask: {fileID: 0} m_AOVBitmask: 0 m_AOVRenderTargets: [] m_RenderTarget: {fileID: 0} diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs index fd8abfefdac..c243d9efbe7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs @@ -42,13 +42,7 @@ static partial class Styles bool layerListChange; CompositionManager m_compositionManager; - public bool isDirty - { - get - { - return m_IsEditorDirty; - } - } + public bool isDirty => m_IsEditorDirty; void AddLayerOfTypeCallback(object type) { @@ -343,9 +337,9 @@ void DrawLayerProperties(Rect rect, SerializedCompositionLayer serializedPropert m_filterList.drawElementCallback = (Rect r, int index, bool isActive, bool isFocused) => { - if (index < m_SerializedLayerProperties[m_layerList.index].FilterList.Count) + if (index < m_SerializedLayerProperties[m_layerList.index].filterList.Count) { - var serializedFilter = m_SerializedLayerProperties[m_layerList.index].FilterList[index]; + var serializedFilter = m_SerializedLayerProperties[m_layerList.index].filterList[index]; CompositionFilterUI.Draw(r, serializedFilter); } }; @@ -365,9 +359,9 @@ void DrawLayerProperties(Rect rect, SerializedCompositionLayer serializedPropert m_filterList.elementHeightCallback = (index) => { - if (index < m_SerializedLayerProperties[m_layerList.index].FilterList.Count) + if (index < m_SerializedLayerProperties[m_layerList.index].filterList.Count) { - var filter = m_SerializedLayerProperties[m_layerList.index].FilterList[index]; + var filter = m_SerializedLayerProperties[m_layerList.index].filterList[index]; return filter.GetHeight(); } return 0; diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs index b3d9ef48e9c..3316ffb34b3 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionFilter.cs @@ -13,12 +13,12 @@ internal class SerializedCompositionFilter public SerializedCompositionFilter(SerializedProperty root) { - filterType = root.FindPropertyRelative("m_Type"); - maskColor = root.FindPropertyRelative("m_MaskColor"); - keyThreshold = root.FindPropertyRelative("m_KeyThreshold"); - keyTolerance = root.FindPropertyRelative("m_KeyTolerance"); - spillRemoval = root.FindPropertyRelative("m_SpillRemoval"); - alphaMask = root.FindPropertyRelative("m_AlphaMask"); + filterType = root.FindPropertyRelative("filterType"); + maskColor = root.FindPropertyRelative("maskColor"); + keyThreshold = root.FindPropertyRelative("keyThreshold"); + keyTolerance = root.FindPropertyRelative("keyTolerance"); + spillRemoval = root.FindPropertyRelative("spillRemoval"); + alphaMask = root.FindPropertyRelative("alphaMask"); } public float GetHeight() diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs index 84c13137f9a..9a88b20f6dd 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SerializedCompositionLayer.cs @@ -31,7 +31,7 @@ internal class SerializedCompositionLayer public SerializedProperty inputFilters; public SerializedProperty positionInStack; - public List FilterList = new List(); + public List filterList = new List(); public SerializedCompositionLayer(SerializedProperty root) { @@ -64,7 +64,7 @@ public SerializedCompositionLayer(SerializedProperty root) for (int index = 0; index < inputFilters.arraySize; index++) { var serializedFilter = inputFilters.GetArrayElementAtIndex(index); - FilterList.Add(new SerializedCompositionFilter(serializedFilter)); + filterList.Add(new SerializedCompositionFilter(serializedFilter)); } } @@ -81,16 +81,25 @@ public float GetPropertiesHeight() } else { - return EditorGUI.GetPropertyHeight(layerName, null) + - EditorGUI.GetPropertyHeight(inputCamera, null) + - EditorGUI.GetPropertyHeight(clearDepth, null) + - EditorGUI.GetPropertyHeight(clearAlpha, null) + - EditorGUI.GetPropertyHeight(clearMode, null) + - EditorGUI.GetPropertyHeight(aaMode, null) + - EditorGUI.GetPropertyHeight(cullingMaskProperty, null) + - EditorGUI.GetPropertyHeight(volumeMask, null) + - EditorGUI.GetPropertyHeight(inputFilters, null) + - 7 * EditorGUIUtility.singleLineHeight; //for the heading and pading + float height = + EditorGUI.GetPropertyHeight(layerName, null) + + EditorGUI.GetPropertyHeight(inputCamera, null) + + EditorGUI.GetPropertyHeight(clearDepth, null) + + EditorGUI.GetPropertyHeight(clearAlpha, null) + + EditorGUI.GetPropertyHeight(clearMode, null) + + EditorGUI.GetPropertyHeight(aaMode, null) + + EditorGUI.GetPropertyHeight(cullingMaskProperty, null) + + EditorGUI.GetPropertyHeight(volumeMask, null) + + EditorGUI.GetPropertyHeight(inputFilters, null) + + EditorGUIUtility.singleLineHeight * 7; //for the heading and pading + + if (inputFilters.arraySize > 0) + { + // add extra height for the list of filters + height += inputFilters.arraySize * EditorGUIUtility.singleLineHeight * 5; + } + + return height; } } diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs index 5cad5a739cb..18377776184 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/SeriallizedShaderProperty.cs @@ -11,10 +11,10 @@ internal class SerializedShaderProperty public SerializedShaderProperty(SerializedProperty root) { - propertyName = root.FindPropertyRelative("m_PropertyName"); - propertyType = root.FindPropertyRelative("m_Type"); - propertyValue = root.FindPropertyRelative("m_Value"); - rangeLimits = root.FindPropertyRelative("m_RangeLimits"); + propertyName = root.FindPropertyRelative("propertyName"); + propertyType = root.FindPropertyRelative("propertyType"); + propertyValue = root.FindPropertyRelative("value"); + rangeLimits = root.FindPropertyRelative("rangeLimits"); } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs index 5e34ddf0830..9993d7fc74f 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs @@ -38,7 +38,7 @@ public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, return; } - int index = layerData.layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.ALPHA_MASK); + int index = layerData.layerFilters.FindIndex(x => x.filterType == CompositionFilter.FilterType.ALPHA_MASK); if (index < 0) { HDUtils.BlitCameraTexture(cmd, source, destination); @@ -47,7 +47,7 @@ public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, var filter = layerData.layerFilters[index]; m_Material.SetTexture(ShaderIDs.k_InputTexture, source); - m_Material.SetTexture(ShaderIDs.k_AlphaTexture, filter.m_AlphaMask); + m_Material.SetTexture(ShaderIDs.k_AlphaTexture, filter.alphaMask); HDUtils.DrawFullScreen(cmd, m_Material, destination); } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs index 0d1702933a1..89ed767619d 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs @@ -42,7 +42,7 @@ public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, return; } - int index = layerData.layerFilters.FindIndex(x => x.m_Type == (int)CompositionFilter.FilterType.CHROMA_KEYING); + int index = layerData.layerFilters.FindIndex(x => x.filterType == CompositionFilter.FilterType.CHROMA_KEYING); if (index < 0) { HDUtils.BlitCameraTexture(cmd, source, destination); @@ -51,12 +51,12 @@ public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, var filter = layerData.layerFilters[index]; Vector4 keyParams; - keyParams.x = filter.m_KeyThreshold; - keyParams.y = filter.m_KeyTolerance; - keyParams.z = filter.m_SpillRemoval; + keyParams.x = filter.keyThreshold; + keyParams.y = filter.keyTolerance; + keyParams.z = filter.spillRemoval; keyParams.w = 1.0f; - m_Material.SetVector(ShaderIDs.k_KeyColor, filter.m_MaskColor); + m_Material.SetVector(ShaderIDs.k_KeyColor, filter.maskColor); m_Material.SetVector(ShaderIDs.k_KeyParams, keyParams); m_Material.SetTexture(ShaderIDs.k_InputTexture, source); HDUtils.DrawFullScreen(cmd, m_Material, destination); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs index 664e8f3957e..c84fb524782 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionFilter.cs @@ -11,18 +11,19 @@ public enum FilterType ALPHA_MASK } - //TODO: inheritance? - public int m_Type; - public Color m_MaskColor; - public float m_KeyThreshold = 0.8f; - public float m_KeyTolerance = 0.5f; - public float m_SpillRemoval = 0.0f; - public Texture m_AlphaMask; + // TODO: idealy we should allow the use of arbitrary custom passes instead of hand-picked filters. + + public FilterType filterType; + public Color maskColor; + public float keyThreshold = 0.8f; + public float keyTolerance = 0.5f; + public float spillRemoval = 0.0f; + public Texture alphaMask; static public CompositionFilter Create(FilterType type) { var newFilter = new CompositionFilter(); - newFilter.m_Type = (int)type; + newFilter.filterType = type; return newFilter; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index de319acce61..9b08e3609c8 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -531,13 +531,14 @@ public void AddInputFilter(CompositionFilter filter) // avoid duplicate filters foreach (var f in m_InputFilters) { - if (f.m_Type == filter.m_Type) + if (f.filterType == filter.filterType) { return; } } m_InputFilters.Add(filter); } + public void SetupLayerCamera(CompositorLayer targetLayer, int layerPositionInStack) { if (!m_LayerCamera || (targetLayer == null)) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index 0a451b0b523..0348f7424c5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -673,21 +673,21 @@ void CustomRender(ScriptableRenderContext context, HDCamera camera) foreach (var prop in m_CompositionProfile.m_ShaderProperties) { - if (prop.m_Type == ShaderPropertyType.Float) + if (prop.propertyType == ShaderPropertyType.Float) { - m_Material.SetFloat(prop.m_PropertyName, prop.m_Value.x); + m_Material.SetFloat(prop.propertyName, prop.value.x); } - else if (prop.m_Type == ShaderPropertyType.Vector) + else if (prop.propertyType == ShaderPropertyType.Vector) { - m_Material.SetVector(prop.m_PropertyName, prop.m_Value); + m_Material.SetVector(prop.propertyName, prop.value); } - else if (prop.m_Type == ShaderPropertyType.Range) + else if (prop.propertyType == ShaderPropertyType.Range) { - m_Material.SetFloat(prop.m_PropertyName, prop.m_Value.x); + m_Material.SetFloat(prop.propertyName, prop.value.x); } - else if (prop.m_Type == ShaderPropertyType.Color) + else if (prop.propertyType == ShaderPropertyType.Color) { - m_Material.SetColor(prop.m_PropertyName, prop.m_Value); + m_Material.SetColor(prop.propertyName, prop.value); } } @@ -742,16 +742,8 @@ static public Camera GetSceceCamera() return null; } - static public CompositionManager GetInstance() - { + static public CompositionManager GetInstance() => + s_CompositorInstance ?? (s_CompositorInstance = GameObject.FindObjectOfType(typeof(CompositionManager), true) as CompositionManager); - if(s_CompositorInstance != null) - { - return s_CompositorInstance; - } - - s_CompositorInstance = GameObject.FindObjectOfType(typeof(CompositionManager), true) as CompositionManager; - return s_CompositorInstance; - } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs index d77a916dc51..c454035ad4c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs @@ -19,13 +19,13 @@ public void AddPropertiesFromShaderAndMaterial (CompositionManager compositor, S { ShaderProperty sp = ShaderProperty.Create(shader, material, i); AddShaderProperty(compositor, sp); - propertyNames.Add(sp.m_PropertyName); + propertyNames.Add(sp.propertyName); } // remove any left-over properties that do not appear in the shader anymore for (int j = m_ShaderProperties.Count - 1; j >= 0; --j) { - int indx = propertyNames.FindIndex(x => x == m_ShaderProperties[j].m_PropertyName); + int indx = propertyNames.FindIndex(x => x == m_ShaderProperties[j].propertyName); if (indx < 0) { m_ShaderProperties.RemoveAt(j); @@ -51,14 +51,14 @@ public void AddShaderProperty(CompositionManager compositor, ShaderProperty sp) Assert.IsNotNull(sp); // Check if property should be shown in the inspector - bool hide = ((int)sp.m_Flags & (int)ShaderPropertyFlags.NonModifiableTextureData) != 0 - || ((int)sp.m_Flags & (int)ShaderPropertyFlags.HideInInspector) != 0; + bool hide = ((int)sp.flags & (int)ShaderPropertyFlags.NonModifiableTextureData) != 0 + || ((int)sp.flags & (int)ShaderPropertyFlags.HideInInspector) != 0; if (!hide) { // Check if property already exists / do not add duplicates - int indx = m_ShaderProperties.FindIndex(s => s.m_PropertyName == sp.m_PropertyName); + int indx = m_ShaderProperties.FindIndex(s => s.propertyName == sp.propertyName); if (indx < 0) { m_ShaderProperties.Add(sp); @@ -66,12 +66,12 @@ public void AddShaderProperty(CompositionManager compositor, ShaderProperty sp) } // For textures, check if we already have this layer in the layer list. If not, add it. - if (sp.m_Type == ShaderPropertyType.Texture) + if (sp.propertyType == ShaderPropertyType.Texture) { - int indx = compositor.layers.FindIndex(s => s.name == sp.m_PropertyName); + int indx = compositor.layers.FindIndex(s => s.name == sp.propertyName); if (indx < 0 && !hide) { - var newLayer = CompositorLayer.CreateOutputLayer(sp.m_PropertyName); + var newLayer = CompositorLayer.CreateOutputLayer(sp.propertyName); compositor.layers.Add(newLayer); } else if (indx >= 0 && hide) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs index d3be54d3e5d..6d977525efd 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs @@ -42,7 +42,7 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu { // Executed every frame for all the camera inside the pass volume AdditionalCompositorData layerData = camera.camera.gameObject.GetComponent(); - if (layerData == null || layerData.clearColorTexture == false) + if (layerData == null || layerData.clearColorTexture == null) { return; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs index b8b1cc75349..21c517ca276 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ShaderProperty.cs @@ -6,33 +6,33 @@ namespace UnityEngine.Rendering.HighDefinition.Compositor [System.Serializable] internal class ShaderProperty { - public string m_PropertyName; - public ShaderPropertyType m_Type; - public Vector4 m_Value; - public Vector2 m_RangeLimits; - public ShaderPropertyFlags m_Flags; + public string propertyName; + public ShaderPropertyType propertyType; + public Vector4 value; + public Vector2 rangeLimits; + public ShaderPropertyFlags flags; public static ShaderProperty Create(Shader shader, Material material, int index) { ShaderProperty sp = new ShaderProperty(); { - sp.m_PropertyName = shader.GetPropertyName(index); - sp.m_Type = shader.GetPropertyType(index); - sp.m_Flags = shader.GetPropertyFlags(index); - sp.m_Value = Vector4.zero; + sp.propertyName = shader.GetPropertyName(index); + sp.propertyType = shader.GetPropertyType(index); + sp.flags = shader.GetPropertyFlags(index); + sp.value = Vector4.zero; - if (sp.m_Type == ShaderPropertyType.Range) + if (sp.propertyType == ShaderPropertyType.Range) { - sp.m_RangeLimits = shader.GetPropertyRangeLimits(index); - sp.m_Value = new Vector4(material.GetFloat(Shader.PropertyToID(shader.GetPropertyName(index))), 0.0f, 0.0f, 0.0f); + sp.rangeLimits = shader.GetPropertyRangeLimits(index); + sp.value = new Vector4(material.GetFloat(Shader.PropertyToID(shader.GetPropertyName(index))), 0.0f, 0.0f, 0.0f); } - else if (sp.m_Type == ShaderPropertyType.Color) + else if (sp.propertyType == ShaderPropertyType.Color) { - sp.m_Value = material.GetColor(Shader.PropertyToID(shader.GetPropertyName(index))); + sp.value = material.GetColor(Shader.PropertyToID(shader.GetPropertyName(index))); } - else if (sp.m_Type == ShaderPropertyType.Vector) + else if (sp.propertyType == ShaderPropertyType.Vector) { - sp.m_Value = material.GetVector(Shader.PropertyToID(shader.GetPropertyName(index))); + sp.value = material.GetVector(Shader.PropertyToID(shader.GetPropertyName(index))); } } return sp; From 3325dfad0e2e7e7b3e11b6206a664ca3ef8c3a01 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Tue, 7 Apr 2020 16:04:13 +0200 Subject: [PATCH 09/21] bugfix: image layers and camera stacking --- .../Runtime/Compositor/CompositionLayer.cs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index 9b08e3609c8..bf5f7e5e9e2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -460,14 +460,25 @@ public void UpdateOutputCamera() var compositor = CompositionManager.GetInstance(); m_LayerCamera.enabled = (m_Show || m_ClearsBackGround) && compositor.enableOutput; - // Refresh the camera data - m_LayerCamera.CopyFrom(m_Camera); - var cameraDataOrig = m_Camera.GetComponent(); - var cameraData = m_LayerCamera.GetComponent(); - if (cameraDataOrig) + if (m_Type == LayerType.Image) { - cameraDataOrig.CopyTo(cameraData); + var compositorData = m_LayerCamera.GetComponent(); + if(compositorData) + compositorData.clearColorTexture = m_Show ? m_InputTexture : Texture2D.blackTexture; } + + if (m_LayerCamera.enabled) + { + // Refresh the camera data + m_LayerCamera.CopyFrom(m_Camera); + var cameraDataOrig = m_Camera.GetComponent(); + var cameraData = m_LayerCamera.GetComponent(); + if (cameraDataOrig) + { + cameraDataOrig.CopyTo(cameraData); + } + } + } public void Update() @@ -568,7 +579,10 @@ public void SetupLayerCamera(CompositorLayer targetLayer, int layerPositionInSta { compositorData = m_LayerCamera.gameObject.AddComponent(); } - compositorData.clearColorTexture = targetLayer.GetRenderTarget(false); + if (m_Type != LayerType.Image) + { + compositorData.clearColorTexture = targetLayer.GetRenderTarget(false); + } cameraData.volumeLayerMask |= 1 << 31; } else From a8fab2cc76cc60ee8421651d926c5f5b6ab61107 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Tue, 7 Apr 2020 16:25:01 +0200 Subject: [PATCH 10/21] use enum utility functions --- .../Shader Graphs/TestCompositionGraph.asset | 40 +++++++++---------- .../Compositor/CompositionFilterUI.Drawer.cs | 2 +- .../Compositor/ShaderPropertyUI.Drawers.cs | 2 +- .../Runtime/Compositor/CompositionLayer.cs | 6 +-- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset index 86b1ff566d8..94cd453edc2 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.asset @@ -13,23 +13,23 @@ MonoBehaviour: m_Name: TestCompositionGraph m_EditorClassIdentifier: m_ShaderProperties: - - m_PropertyName: Layer0 - m_Type: 4 - m_Value: {x: 0, y: 0, z: 0, w: 0} - m_RangeLimits: {x: 0, y: 0} - m_Flags: 0 - - m_PropertyName: Layer1 - m_Type: 4 - m_Value: {x: 0, y: 0, z: 0, w: 0} - m_RangeLimits: {x: 0, y: 0} - m_Flags: 0 - - m_PropertyName: Logo - m_Type: 4 - m_Value: {x: 0, y: 0, z: 0, w: 0} - m_RangeLimits: {x: 0, y: 0} - m_Flags: 0 - - m_PropertyName: GreenScreen - m_Type: 4 - m_Value: {x: 0, y: 0, z: 0, w: 0} - m_RangeLimits: {x: 0, y: 0} - m_Flags: 0 + - propertyName: Layer0 + propertyType: 4 + value: {x: 0, y: 0, z: 0, w: 0} + rangeLimits: {x: 0, y: 0} + flags: 4 + - propertyName: Layer1 + propertyType: 4 + value: {x: 0, y: 0, z: 0, w: 0} + rangeLimits: {x: 0, y: 0} + flags: 4 + - propertyName: Logo + propertyType: 4 + value: {x: 0, y: 0, z: 0, w: 0} + rangeLimits: {x: 0, y: 0} + flags: 4 + - propertyName: GreenScreen + propertyType: 4 + value: {x: 0, y: 0, z: 0, w: 0} + rangeLimits: {x: 0, y: 0} + flags: 4 diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs index a70a4227ec4..2dd751cbb54 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionFilterUI.Drawer.cs @@ -20,7 +20,7 @@ public static void Draw(Rect rect, SerializedCompositionFilter serialized) rect.height = CompositorStyle.k_SingleLineHeight; float spacing = rect.height * 1.1f; - if (serialized.filterType.intValue == (int)CompositionFilter.FilterType.CHROMA_KEYING) + if (serialized.filterType.GetEnumValue() == CompositionFilter.FilterType.CHROMA_KEYING) { SerializedProperty keyColor = serialized.maskColor; SerializedProperty keyThreshold = serialized.keyThreshold; diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs index 3b3d219c8f8..bbfe379b784 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/ShaderPropertyUI.Drawers.cs @@ -10,7 +10,7 @@ internal class ShaderPropertyUI { public static void Draw(List propertyList) { - int index = propertyList.FindIndex(x => x.propertyType.intValue != (int)ShaderPropertyType.Texture); + int index = propertyList.FindIndex(x => x.propertyType.GetEnumValue() != ShaderPropertyType.Texture); if (index >= 0) { EditorGUILayout.Separator(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index bf5f7e5e9e2..39db580d532 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -96,6 +96,8 @@ public enum ResolutionScale [SerializeField] bool m_ClearsBackGround = false; + static readonly string[] k_AOVNames = System.Enum.GetNames(typeof(MaterialSharedProperty)); + public bool enabled { get => m_Show; @@ -598,10 +600,8 @@ public void SetupLayerCamera(CompositorLayer targetLayer, int layerPositionInSta { var aovRequestBuilder = new AOVRequestBuilder(); - var aovNames = System.Enum.GetNames(typeof(MaterialSharedProperty)); - int NUM_AOVs = aovNames.Length; int outputIndex = 0; - for (int i = 0; i < NUM_AOVs; ++i) + for (int i = 0; i < k_AOVNames.Length; ++i) { if ((aovMask & (1 << i)) != 0) { From e146ee243583452c55c8f39ff405c5fa90d7405d Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Tue, 7 Apr 2020 23:16:44 +0200 Subject: [PATCH 11/21] Use multicompile in motion blur + bug fix --- .../Runtime/Compositor/AdditionalCompositorData.cs | 3 ++- .../Runtime/Compositor/CompositionLayer.cs | 2 +- .../Runtime/PostProcessing/PostProcessSystem.cs | 9 ++++++++- .../Runtime/PostProcessing/Shaders/MotionBlur.compute | 10 ++++++---- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs index 7f3e1d1f728..972c946cb10 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AdditionalCompositorData.cs @@ -24,7 +24,7 @@ public void Init(List layerFilters, bool clearAlpha) this.clearAlpha = clearAlpha; } - public void Reset() + public void ResetData() { clearColorTexture = null; clearAlpha = true; @@ -33,6 +33,7 @@ public void Reset() if (layerFilters !=null) { layerFilters.Clear(); + layerFilters = null; } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index 39db580d532..94cbea36da5 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -314,7 +314,7 @@ public void Init(string layerID = "") // Reset the layer params (in case we cloned a camera which already had AdditionalCompositorData) if (layerData != null) { - layerData.Reset(); + layerData.ResetData(); } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index bd092e03104..ac1d6732f6c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -1838,7 +1838,14 @@ void DoMotionBlur(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.MotionBlurKernel))) { cs = m_Resources.shaders.motionBlurCS; - kernel = cs.FindKernel(m_EnableAlpha ? "MotionBlurCSAlpha" : "MotionBlurCS"); + + if (m_EnableAlpha) + { + cs.EnableKeyword("ENABLE_ALPHA"); + } + + kernel = cs.FindKernel("MotionBlurCS"); + cmd.SetComputeVectorParam(cs, HDShaderIDs._TileTargetSize, tileTargetSize); cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._MotionVecAndDepth, preppedMotionVec); cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._OutputTexture, destination); diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute index ff7924f20d3..63dff744cde 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute @@ -1,10 +1,12 @@ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlurCommon.hlsl" #include "Packages/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/PostProcessDefines.hlsl" -#pragma kernel MotionBlurCS MAIN=MotionBlurCS -#pragma kernel MotionBlurCSAlpha MAIN=MotionBlurCSAlpha ENABLE_ALPHA +#pragma kernel MotionBlurCS + //#pragma enable_d3d11_debug_symbols +#pragma multi_compile ENABLE_ALPHA + RW_TEXTURE2D_X(CTYPE, _OutputTexture); TEXTURE2D_X(_InputTexture); TEXTURE2D_X(_TileMaxNeighbourhood); @@ -175,7 +177,7 @@ float4 ProcessSample(uint sampleNumber, float2 dir, float invSampleCount, float2 // --------------------------------------------- [numthreads(16, 16, 1)] -void MAIN(uint3 dispatchThreadId : SV_DispatchThreadID) +void MotionBlurCS(uint3 dispatchThreadId : SV_DispatchThreadID) { UNITY_XR_ASSIGN_VIEW_INDEX(dispatchThreadId.z); @@ -303,7 +305,7 @@ void MAIN(uint3 dispatchThreadId : SV_DispatchThreadID) colorAccumulation.rgb = accumulation.rgb + (1.0 - accumulation.w) * centralColor.rgb; #if ENABLE_ALPHA - colorAccumulation.w = accumulation.w + (1.0 - accumulation.w) * centralColor.w; + colorAccumulation.w = alphaAccumulation + (1.0 - accumulation.w) * centralColor.w; #endif #if DEBUG_VIEW == WEIGHT_VIS From 5399d29eb01c377443e3084469ecd440172f33c7 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Wed, 8 Apr 2020 16:43:15 +0200 Subject: [PATCH 12/21] Make some variables private --- .../Runtime/Compositor/CompositionLayer.cs | 10 +++---- .../Runtime/Compositor/CompositionManager.cs | 21 +-------------- .../Runtime/Compositor/CompositionProfile.cs | 26 +++++++++++++++++-- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs index 94cbea36da5..19211c933a3 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionLayer.cs @@ -54,10 +54,10 @@ public enum ResolutionScale [SerializeField] bool m_ClearAlpha = true; // Specifies if the Alpha channel will be cleared when stacking this camera over the previous one (for overlays) [SerializeField] Renderer m_OutputRenderer = null; // Specifies the output surface/renderer [SerializeField] LayerType m_Type; - [SerializeField] Camera m_Camera; // The source camera for the layer (were we get the default properties). The actual rendering, with overridden properties is done by the m_LayerCamera - [SerializeField] public VideoPlayer m_InputVideo; - [SerializeField] public Texture m_InputTexture; - [SerializeField] public BackgroundFitMode m_BackgroundFit; + [SerializeField] Camera m_Camera = null; // The source camera for the layer (were we get the default properties). The actual rendering, with overridden properties is done by the m_LayerCamera + [SerializeField] VideoPlayer m_InputVideo = null; + [SerializeField] Texture m_InputTexture = null; + [SerializeField] BackgroundFitMode m_BackgroundFit = BackgroundFitMode.Stretch; [SerializeField] ResolutionScale m_ResolutionScale = ResolutionScale.Full; [SerializeField] UIColorBufferFormat m_ColorBufferFormat = UIColorBufferFormat.R16G16B16A16; @@ -66,7 +66,7 @@ public enum ResolutionScale [SerializeField] HDAdditionalCameraData.AntialiasingMode m_Antialiasing; [SerializeField] bool m_OverrideClearMode = false; - [SerializeField] public HDAdditionalCameraData.ClearColorMode m_ClearMode; + [SerializeField] HDAdditionalCameraData.ClearColorMode m_ClearMode = HDAdditionalCameraData.ClearColorMode.Color; [SerializeField] bool m_OverrideCullingMask = false; [SerializeField] LayerMask m_CullingMask; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index 0348f7424c5..db9c4380dfd 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -670,26 +670,7 @@ void CustomRender(ScriptableRenderContext context, HDCamera camera) return; // set shader uniforms - - foreach (var prop in m_CompositionProfile.m_ShaderProperties) - { - if (prop.propertyType == ShaderPropertyType.Float) - { - m_Material.SetFloat(prop.propertyName, prop.value.x); - } - else if (prop.propertyType == ShaderPropertyType.Vector) - { - m_Material.SetVector(prop.propertyName, prop.value); - } - else if (prop.propertyType == ShaderPropertyType.Range) - { - m_Material.SetFloat(prop.propertyName, prop.value.x); - } - else if (prop.propertyType == ShaderPropertyType.Color) - { - m_Material.SetColor(prop.propertyName, prop.value); - } - } + m_CompositionProfile.CopyPropertiesToMaterial(m_Material); int layerIndex = 0; foreach (var layer in m_InputLayers) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs index c454035ad4c..5a32271f2c2 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionProfile.cs @@ -8,7 +8,7 @@ namespace UnityEngine.Rendering.HighDefinition.Compositor // Holds a list of layers and layer/composition properties. This is serialized and can be shared between projects internal class CompositionProfile : ScriptableObject { - public List m_ShaderProperties = new List(); + [SerializeField] List m_ShaderProperties = new List(); public void AddPropertiesFromShaderAndMaterial (CompositionManager compositor, Shader shader, Material material) { @@ -54,7 +54,6 @@ public void AddShaderProperty(CompositionManager compositor, ShaderProperty sp) bool hide = ((int)sp.flags & (int)ShaderPropertyFlags.NonModifiableTextureData) != 0 || ((int)sp.flags & (int)ShaderPropertyFlags.HideInInspector) != 0; - if (!hide) { // Check if property already exists / do not add duplicates @@ -81,5 +80,28 @@ public void AddShaderProperty(CompositionManager compositor, ShaderProperty sp) } } } + + public void CopyPropertiesToMaterial(Material material) + { + foreach (var prop in m_ShaderProperties) + { + if (prop.propertyType == ShaderPropertyType.Float) + { + material.SetFloat(prop.propertyName, prop.value.x); + } + else if (prop.propertyType == ShaderPropertyType.Vector) + { + material.SetVector(prop.propertyName, prop.value); + } + else if (prop.propertyType == ShaderPropertyType.Range) + { + material.SetFloat(prop.propertyName, prop.value.x); + } + else if (prop.propertyType == ShaderPropertyType.Color) + { + material.SetColor(prop.propertyName, prop.value); + } + } + } } } From bffeee5919c3364750e6d3f71a4f9b3d98b286eb Mon Sep 17 00:00:00 2001 From: Lewis Jordan Date: Thu, 9 Apr 2020 14:23:27 +0100 Subject: [PATCH 13/21] Update Compositor-User-Guide.md --- .../Documentation~/Compositor-User-Guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md index 251500c8010..0f211fb54cf 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Compositor-User-Guide.md @@ -15,7 +15,7 @@ To specify the output image, the Compositor uses a graph of compositing operatio When you create a Composition Graph, there are two main types of input property you can expose: - **Composition Layer**: Any **Texture2D** properties act as Composition Layers which correspond to a layer the graph composites to generate the final frame. These properties appear automatically as Composition Layers in the [Render Schedule](#render-schedule) section of the Compositor window. The **Mode** option for them in Shader Graph corresponds to the default value the Shader uses when you toggle off the visibility of the layer in the Render Schedule list.
**Note**: By default, this value is set to white, but for many compositing operations and behaviors, you may want to set this to black instead. -- **Composition Parameters**: This refers to any exposed property that is not a Texture2D. Composition Parameters can control various aspects of the composition. Examples of Composition Parameters include a Vector1 input to control brightness or a Color input to tint a Texture2D. These properties appear automatically in the [Composition Parameters](#composition-parameters) section of the Compositor window. +- **Composition Parameters**: This refers to any exposed property that is not a Texture2D. Composition Parameters can control various aspects of the composition. Examples of Composition Parameters include a Vector1 input to control the overall brightness or a Color input to tint a Texture2D. These properties appear automatically in the [Composition Parameters](#composition-parameters) section of the Compositor window. The following graph contains examples of the property types described above. The **Logo** property is an example of a Composition Layer and the **Opacity** property is an example of an input property to control an aspect of the composition: @@ -47,5 +47,5 @@ The [Sub-layer Properties](Compositor-User-Options.md#Sub-layer-properties) sect The Render Schedule is a re-orderable list of Composition Layers and Sub-layers. Sub-layers appear indented below their corresponding parent Composition Layer, which makes it easier to see the hierarchical relationship. When multiple Sub-layers appear below a parent layer, they form a camera stack. Unity renders layers at the top first. To re-order the list, you can click and move both Composition Layers and Sub-layers. You can use this to change the rendering order in a camera stack or move a Sub-layer from one parent Composition Layer to another. ## Composition Parameters -This sections shows every exposed property that is not an input Composition Layer (for example, a Vector1 to control the brightness of the final composition or a Color to tint a Texture2D). In this section, the window allows you to edit each property value outside of the Composition Graph. It is good practice to expose properties from the graph to the Compositor window, instead of hard-coding their values. This helps you to share composition profiles between Projects because those you do not need to open the Composition Graph to edit any values. +This section shows every exposed property that is not an input Composition Layer (for example, a Vector1 to control the brightness of the final composition or a Color to tint a Texture2D). In this section, the window allows you to edit each property value outside of the Composition Graph. It is good practice to expose properties from the graph to the Compositor window, instead of hard-coding their values. This helps you to share composition profiles between Projects because those you do not need to open the Composition Graph to edit any values. From 49d519f8109b3d34c8be4cf235d27d88a88ef8a3 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Thu, 9 Apr 2020 16:10:07 +0200 Subject: [PATCH 14/21] Review feedback --- .../Runtime/Utilities/CoreUtils.cs | 14 ++ .../Runtime/Compositor/AlphaInjection.cs | 7 +- .../Runtime/Compositor/ChromaKeying.cs | 7 +- .../Runtime/Compositor/CustomClear.cs | 24 +- .../PostProcessing/PostProcessSystem.cs | 6 +- .../RenderPipeline/RenderPipelineResources.cs | 8 + .../HDRenderPipelineResources.asset | 216 ++++++------------ 7 files changed, 118 insertions(+), 164 deletions(-) diff --git a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs index 0f16e604818..a24697661d2 100644 --- a/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs +++ b/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs @@ -879,6 +879,20 @@ public static void SetKeyword(Material material, string keyword, bool state) material.DisableKeyword(keyword); } + /// + /// Set a keyword to a compute shader + /// + /// ComputeShader on which to set the keyword. + /// Keyword to be set. + /// Value of the keyword to be set. + public static void SetKeyword(ComputeShader cs, string keyword, bool state) + { + if (state) + cs.EnableKeyword(keyword); + else + cs.DisableKeyword(keyword); + } + /// /// Destroys a UnityObject safely. /// diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs index 9993d7fc74f..0b1e98db01e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/AlphaInjection.cs @@ -5,7 +5,7 @@ namespace UnityEngine.Rendering.HighDefinition.Compositor { - [Serializable, VolumeComponentMenu("Post-processing/Custom/AlphaInjection")] + [Serializable] internal sealed class AlphaInjection : CustomPostProcessVolumeComponent, IPostProcessComponent { internal class ShaderIDs @@ -22,8 +22,9 @@ internal class ShaderIDs public override void Setup() { - if (Shader.Find("Hidden/Shader/AlphaInjection") != null) - m_Material = new Material(Shader.Find("Hidden/Shader/AlphaInjection")); + var hdrpAsset = HDRenderPipeline.defaultAsset; + if (hdrpAsset != null) + m_Material = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.alphaInjectionPS); } public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs index 89ed767619d..667c21728c0 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/ChromaKeying.cs @@ -7,7 +7,7 @@ namespace UnityEngine.Rendering.HighDefinition.Compositor { // Custom post-processing pass that performs chroma keying // Shader adapted from: https://github.com/keijiro/ProcAmp - [Serializable, VolumeComponentMenu("Post-processing/Custom/ChromaKeying")] + [Serializable] internal sealed class ChromaKeying : CustomPostProcessVolumeComponent, IPostProcessComponent { internal class ShaderIDs @@ -26,8 +26,9 @@ internal class ShaderIDs public override void Setup() { - if (Shader.Find("Hidden/Shader/ChromaKeying") != null) - m_Material = new Material(Shader.Find("Hidden/Shader/ChromaKeying")); + var hdrpAsset = HDRenderPipeline.defaultAsset; + if (hdrpAsset != null) + m_Material = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.chromaKeyingPS); } public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs index 6d977525efd..fb4a2784813 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CustomClear.cs @@ -24,7 +24,7 @@ enum PassType ClearColorAndStencil = 0, DrawTextureAndClearStencil = 1 }; - Material fullscreenPassMaterial; + Material m_FullscreenPassMaterial; // It can be used to configure render targets and their clear state. Also to create temporary render target textures. // When empty this render pass will render to the active camera render target. @@ -35,7 +35,9 @@ protected override void Setup(ScriptableRenderContext renderContext, CommandBuff // Setup code here if (string.IsNullOrEmpty(name)) name = "CustomClear"; - fullscreenPassMaterial = CoreUtils.CreateEngineMaterial("Hidden/HDRP/CustomClear"); + var hdrpAsset = HDRenderPipeline.defaultAsset; + if (hdrpAsset != null) + m_FullscreenPassMaterial = CoreUtils.CreateEngineMaterial(hdrpAsset.renderPipelineResources.shaders.customClearPS); } protected override void Execute(ScriptableRenderContext renderContext, CommandBuffer cmd, HDCamera camera, CullingResults cullingResult) @@ -67,25 +69,25 @@ protected override void Execute(ScriptableRenderContext renderContext, CommandBu // The texture might not cover the entire screen (letter boxing), so in this case clear first to the background color (and stencil) if (scaleBiasRt.x < 1.0f || scaleBiasRt.y < 1.0f) { - fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBiasRt, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); - fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); - cmd.DrawProcedural(Matrix4x4.identity, fullscreenPassMaterial, (int)PassType.ClearColorAndStencil, MeshTopology.Quads, 4, 1); + m_FullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBiasRt, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + m_FullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + cmd.DrawProcedural(Matrix4x4.identity, m_FullscreenPassMaterial, (int)PassType.ClearColorAndStencil, MeshTopology.Quads, 4, 1); } - fullscreenPassMaterial.SetTexture(ShaderIDs.k_BlitTexture, layerData.clearColorTexture); - fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBiasRt, scaleBiasRt); - fullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); - fullscreenPassMaterial.SetInt(ShaderIDs.k_ClearAlpha, layerData.clearAlpha ? 1 : 0); + m_FullscreenPassMaterial.SetTexture(ShaderIDs.k_BlitTexture, layerData.clearColorTexture); + m_FullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBiasRt, scaleBiasRt); + m_FullscreenPassMaterial.SetVector(ShaderIDs.k_BlitScaleBias, new Vector4(1.0f, 1.0f, 0.0f, 0.0f)); + m_FullscreenPassMaterial.SetInt(ShaderIDs.k_ClearAlpha, layerData.clearAlpha ? 1 : 0); // draw a quad (not Triangle), to support letter boxing and stretching - cmd.DrawProcedural(Matrix4x4.identity, fullscreenPassMaterial, (int)PassType.DrawTextureAndClearStencil, MeshTopology.Quads, 4, 1); + cmd.DrawProcedural(Matrix4x4.identity, m_FullscreenPassMaterial, (int)PassType.DrawTextureAndClearStencil, MeshTopology.Quads, 4, 1); } } protected override void Cleanup() { // Cleanup code - CoreUtils.Destroy(fullscreenPassMaterial); + CoreUtils.Destroy(m_FullscreenPassMaterial); } } } diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index ac1d6732f6c..ce21c2dad68 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -1839,11 +1839,7 @@ void DoMotionBlur(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle { cs = m_Resources.shaders.motionBlurCS; - if (m_EnableAlpha) - { - cs.EnableKeyword("ENABLE_ALPHA"); - } - + CoreUtils.SetKeyword(cs, "ENABLE_ALPHA", m_EnableAlpha); kernel = cs.FindKernel("MotionBlurCS"); cmd.SetComputeVectorParam(cs, HDShaderIDs._TileTargetSize, tileTargetSize); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs index c6ed498e656..1adb07ae3df 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPipelineResources.cs @@ -279,6 +279,14 @@ public sealed class ShaderResources [Reload("Runtime/RenderPipeline/Accumulation/Shaders/Accumulation.compute")] public ComputeShader accumulationCS; + // Compositor + [Reload("Runtime/Compositor/Shaders/AlphaInjection.shader")] + public Shader alphaInjectionPS; + [Reload("Runtime/Compositor/Shaders/ChromaKeying.shader")] + public Shader chromaKeyingPS; + [Reload("Runtime/Compositor/Shaders/CustomClear.shader")] + public Shader customClearPS; + // Iterator to retrieve all compute shaders in reflection so we don't have to keep a list of // used compute shaders up to date (prefer editor-only usage) public IEnumerable GetAllComputeShaders() diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset b/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset index 5d7fab79d0f..57616a47365 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineResources.asset @@ -15,133 +15,86 @@ MonoBehaviour: m_Version: 4 shaders: defaultPS: {fileID: 4800000, guid: 6e4ae4064600d784cac1e41a9e6f2e59, type: 3} - debugDisplayLatlongPS: {fileID: 4800000, guid: c1d1d149a043a5349ba367da6c2051ba, - type: 3} - debugViewMaterialGBufferPS: {fileID: 4800000, guid: 439949ea1bfa91b4ba0d04269fcde33d, - type: 3} + debugDisplayLatlongPS: {fileID: 4800000, guid: c1d1d149a043a5349ba367da6c2051ba, type: 3} + debugViewMaterialGBufferPS: {fileID: 4800000, guid: 439949ea1bfa91b4ba0d04269fcde33d, type: 3} debugViewTilesPS: {fileID: 4800000, guid: c7c2bd17b06ceb4468e14081aaf1b96f, type: 3} debugFullScreenPS: {fileID: 4800000, guid: e874aca2df8300a488258738c31f85cf, type: 3} - debugColorPickerPS: {fileID: 4800000, guid: 8137b807709e178498f22ed710864bb0, - type: 3} - debugLightVolumePS: {fileID: 4800000, guid: 8e706c0e71fcec34a8f5c9713e5e2943, - type: 3} - debugLightVolumeCS: {fileID: 7200000, guid: f5d5d21faef5cf445ac2c5d8ff9c4184, - type: 3} + debugColorPickerPS: {fileID: 4800000, guid: 8137b807709e178498f22ed710864bb0, type: 3} + debugLightVolumePS: {fileID: 4800000, guid: 8e706c0e71fcec34a8f5c9713e5e2943, type: 3} + debugLightVolumeCS: {fileID: 7200000, guid: f5d5d21faef5cf445ac2c5d8ff9c4184, type: 3} debugBlitQuad: {fileID: 4800000, guid: cf5ca5b6ef18b3f429ed707ee9ceac9f, type: 3} deferredPS: {fileID: 4800000, guid: 00dd221e34a6ab349a1196b0f2fab693, type: 3} colorPyramidPS: {fileID: 4800000, guid: 2fcfb8d92f45e4549b3f0bad5d0654bf, type: 3} depthPyramidCS: {fileID: 7200000, guid: 64a553bb564274041906f78ffba955e4, type: 3} copyChannelCS: {fileID: 7200000, guid: a4d45eda75e8e474dbe24a31f741f3b4, type: 3} - screenSpaceReflectionsCS: {fileID: 7200000, guid: d1de9ac7d9016204da289affe9677942, - type: 3} + screenSpaceReflectionsCS: {fileID: 7200000, guid: d1de9ac7d9016204da289affe9677942, type: 3} applyDistortionPS: {fileID: 4800000, guid: 02ae56f4306413c4a96dcf005cde1971, type: 3} - clearDispatchIndirectCS: {fileID: 7200000, guid: fc1f553acb80a6446a32d33e403d0656, - type: 3} + clearDispatchIndirectCS: {fileID: 7200000, guid: fc1f553acb80a6446a32d33e403d0656, type: 3} clearLightListsCS: {fileID: 7200000, guid: 743eb3491795b9545955695d591195a1, type: 3} - buildDispatchIndirectCS: {fileID: 7200000, guid: 4eb1b418be7044c40bb5200496c50f14, - type: 3} + buildDispatchIndirectCS: {fileID: 7200000, guid: 4eb1b418be7044c40bb5200496c50f14, type: 3} buildScreenAABBCS: {fileID: 7200000, guid: 728dce960f8a9c44bbc3abb3b851d8f6, type: 3} - buildPerTileLightListCS: {fileID: 7200000, guid: 65af3444cbf4b3747a4dead7ee00cfee, - type: 3} - buildPerBigTileLightListCS: {fileID: 7200000, guid: 5ee1f9d6e09abe045b2f5e0b784b9072, - type: 3} - buildPerVoxelLightListCS: {fileID: 7200000, guid: 0bb1b7e0ddcd5c44baf3ddc7456eb196, - type: 3} - lightListClusterClearAtomicIndexCS: {fileID: 7200000, guid: 1e3472a94b14a334a93230bbc700d7b2, - type: 3} - buildMaterialFlagsCS: {fileID: 7200000, guid: fb3eda953cd6e634e877fb777be2cd08, - type: 3} + buildPerTileLightListCS: {fileID: 7200000, guid: 65af3444cbf4b3747a4dead7ee00cfee, type: 3} + buildPerBigTileLightListCS: {fileID: 7200000, guid: 5ee1f9d6e09abe045b2f5e0b784b9072, type: 3} + buildPerVoxelLightListCS: {fileID: 7200000, guid: 0bb1b7e0ddcd5c44baf3ddc7456eb196, type: 3} + lightListClusterClearAtomicIndexCS: {fileID: 7200000, guid: 1e3472a94b14a334a93230bbc700d7b2, type: 3} + buildMaterialFlagsCS: {fileID: 7200000, guid: fb3eda953cd6e634e877fb777be2cd08, type: 3} deferredCS: {fileID: 7200000, guid: 0b64f79746d2daf4198eaf6eab9af259, type: 3} contactShadowCS: {fileID: 7200000, guid: 3e6900e06dc185a4380af4dacb4db0a4, type: 3} - volumeVoxelizationCS: {fileID: 7200000, guid: c20b371db720da244b73830ec74a343a, - type: 3} - volumetricLightingCS: {fileID: 7200000, guid: b4901a10df2d1e24282725e9fbc77c97, - type: 3} - volumetricLightingFilteringCS: {fileID: 7200000, guid: ef9a910d0ec6ebb41ae3f5c7a69daf46, - type: 3} + volumeVoxelizationCS: {fileID: 7200000, guid: c20b371db720da244b73830ec74a343a, type: 3} + volumetricLightingCS: {fileID: 7200000, guid: b4901a10df2d1e24282725e9fbc77c97, type: 3} + volumetricLightingFilteringCS: {fileID: 7200000, guid: ef9a910d0ec6ebb41ae3f5c7a69daf46, type: 3} deferredTilePS: {fileID: 4800000, guid: dedaf4ea0d134ca4aad1d95a558c46e5, type: 3} - screenSpaceShadowPS: {fileID: 4800000, guid: bfa43a48695613b4ea19c58858ae1a61, - type: 3} - probeVolumeAtlasBlitCS: {fileID: 7200000, guid: 07f429bf534edb44eb5a0e4b2c65b108, - type: 3} - probeVolumeAtlasOctahedralDepthBlitCS: {fileID: 7200000, guid: f60c895d3a3061848844b36ccf9e44a9, - type: 3} - probeVolumeAtlasOctahedralDepthConvolveCS: {fileID: 7200000, guid: 7ef71ce05401a4c4081039b475d3b9ee, - type: 3} - debugDisplayProbeVolumePS: {fileID: 4800000, guid: e7c19cfee7a88394fbb53652b9644cc0, - type: 3} - subsurfaceScatteringCS: {fileID: 7200000, guid: b06a7993621def248addd55d0fe931b1, - type: 3} + screenSpaceShadowPS: {fileID: 4800000, guid: bfa43a48695613b4ea19c58858ae1a61, type: 3} + probeVolumeAtlasBlitCS: {fileID: 7200000, guid: 07f429bf534edb44eb5a0e4b2c65b108, type: 3} + probeVolumeAtlasOctahedralDepthBlitCS: {fileID: 7200000, guid: f60c895d3a3061848844b36ccf9e44a9, type: 3} + probeVolumeAtlasOctahedralDepthConvolveCS: {fileID: 7200000, guid: 7ef71ce05401a4c4081039b475d3b9ee, type: 3} + debugDisplayProbeVolumePS: {fileID: 4800000, guid: e7c19cfee7a88394fbb53652b9644cc0, type: 3} + subsurfaceScatteringCS: {fileID: 7200000, guid: b06a7993621def248addd55d0fe931b1, type: 3} combineLightingPS: {fileID: 4800000, guid: 2e37131331fbdca449b1a2bc47a639ca, type: 3} - cameraMotionVectorsPS: {fileID: 4800000, guid: 035941b63024d1943af48811c1db20d9, - type: 3} - clearStencilBufferPS: {fileID: 4800000, guid: 8ea49ef16606acd489439e676ab84040, - type: 3} - copyStencilBufferPS: {fileID: 4800000, guid: 3d1574f1cdfa0ce4995f9bc79ed7f8ec, - type: 3} + cameraMotionVectorsPS: {fileID: 4800000, guid: 035941b63024d1943af48811c1db20d9, type: 3} + clearStencilBufferPS: {fileID: 4800000, guid: 8ea49ef16606acd489439e676ab84040, type: 3} + copyStencilBufferPS: {fileID: 4800000, guid: 3d1574f1cdfa0ce4995f9bc79ed7f8ec, type: 3} copyDepthBufferPS: {fileID: 4800000, guid: 42dfcc8fe803ece4096c58630689982f, type: 3} blitPS: {fileID: 4800000, guid: 370f7a9cc4e362d488af024d371091e8, type: 3} downsampleDepthPS: {fileID: 4800000, guid: 67d6171b0acc6554aad48c845ec7e67f, type: 3} - upsampleTransparentPS: {fileID: 4800000, guid: 2ad7ce40f0dbaf64dadef1f58d8524d3, - type: 3} + upsampleTransparentPS: {fileID: 4800000, guid: 2ad7ce40f0dbaf64dadef1f58d8524d3, type: 3} resolveStencilCS: {fileID: 7200000, guid: 65b89cac5f286b043a31bf8041776ee7, type: 3} blitCubemapPS: {fileID: 4800000, guid: d05913e251bed7a4992c921c62e1b647, type: 3} - buildProbabilityTablesCS: {fileID: 7200000, guid: b9f26cf340afe9145a699753531b2a4c, - type: 3} - computeGgxIblSampleDataCS: {fileID: 7200000, guid: 764a24bb47ef5ba4781d9ae82ca07445, - type: 3} + buildProbabilityTablesCS: {fileID: 7200000, guid: b9f26cf340afe9145a699753531b2a4c, type: 3} + computeGgxIblSampleDataCS: {fileID: 7200000, guid: 764a24bb47ef5ba4781d9ae82ca07445, type: 3} GGXConvolvePS: {fileID: 4800000, guid: 123ed592ad5c2494b8aed301fd609e7b, type: 3} charlieConvolvePS: {fileID: 4800000, guid: 5685fd17e71045e4ca9fefca38a7c177, type: 3} - opaqueAtmosphericScatteringPS: {fileID: 4800000, guid: 32f724728cf19904291226f239ec16f0, - type: 3} + opaqueAtmosphericScatteringPS: {fileID: 4800000, guid: 32f724728cf19904291226f239ec16f0, type: 3} hdriSkyPS: {fileID: 4800000, guid: 9bd32a6ece529fd4f9408b8d7e00c10d, type: 3} - integrateHdriSkyPS: {fileID: 4800000, guid: 48db2705cf2856d4e893eb30a6892d1b, - type: 3} + integrateHdriSkyPS: {fileID: 4800000, guid: 48db2705cf2856d4e893eb30a6892d1b, type: 3} skyboxCubemapPS: {fileID: 103, guid: 0000000000000000f000000000000000, type: 0} gradientSkyPS: {fileID: 4800000, guid: 2b5d4f1b26f03dc4a873b093e0c4adb1, type: 3} - ambientProbeConvolutionCS: {fileID: 7200000, guid: 6d048f7b1bd45e840b4e79ec92639fa8, - type: 3} - groundIrradiancePrecomputationCS: {fileID: 7200000, guid: eb6ae6f326207ee4d987a3e5adddf63a, - type: 3} - inScatteredRadiancePrecomputationCS: {fileID: 7200000, guid: 70c69d514688f8545855680760d77418, - type: 3} - physicallyBasedSkyPS: {fileID: 4800000, guid: a06934a4863e778498be65d8f865b7a4, - type: 3} - preIntegratedFGD_GGXDisneyDiffusePS: {fileID: 4800000, guid: 123f13d52852ef547b2962de4bd9eaad, - type: 3} - preIntegratedFGD_CharlieFabricLambertPS: {fileID: 4800000, guid: 3b3bf235775cf8b4baae7f3306787ab0, - type: 3} - preIntegratedFGD_WardPS: {fileID: 4800000, guid: d279c46a545b0af4f9f0c4fa82cd489e, - type: 3} - preIntegratedFGD_CookTorrancePS: {fileID: 4800000, guid: a6402c19b020b4a4fb7073aaa2e26aba, - type: 3} + ambientProbeConvolutionCS: {fileID: 7200000, guid: 6d048f7b1bd45e840b4e79ec92639fa8, type: 3} + groundIrradiancePrecomputationCS: {fileID: 7200000, guid: eb6ae6f326207ee4d987a3e5adddf63a, type: 3} + inScatteredRadiancePrecomputationCS: {fileID: 7200000, guid: 70c69d514688f8545855680760d77418, type: 3} + physicallyBasedSkyPS: {fileID: 4800000, guid: a06934a4863e778498be65d8f865b7a4, type: 3} + preIntegratedFGD_GGXDisneyDiffusePS: {fileID: 4800000, guid: 123f13d52852ef547b2962de4bd9eaad, type: 3} + preIntegratedFGD_CharlieFabricLambertPS: {fileID: 4800000, guid: 3b3bf235775cf8b4baae7f3306787ab0, type: 3} + preIntegratedFGD_WardPS: {fileID: 4800000, guid: d279c46a545b0af4f9f0c4fa82cd489e, type: 3} + preIntegratedFGD_CookTorrancePS: {fileID: 4800000, guid: a6402c19b020b4a4fb7073aaa2e26aba, type: 3} encodeBC6HCS: {fileID: 7200000, guid: aa922d239de60304f964e24488559eeb, type: 3} cubeToPanoPS: {fileID: 4800000, guid: 595434cc3b6405246b6cd3086d0b6f7d, type: 3} - blitCubeTextureFacePS: {fileID: 4800000, guid: d850d0a2481878d4bbf17e5126b04163, - type: 3} - filterAreaLightCookiesPS: {fileID: 4800000, guid: c243aac96dda5fa40bed693ed5ba02c4, - type: 3} - clearUIntTextureCS: {fileID: 7200000, guid: d067ad4b88af51c498875426894aef76, - type: 3} + blitCubeTextureFacePS: {fileID: 4800000, guid: d850d0a2481878d4bbf17e5126b04163, type: 3} + filterAreaLightCookiesPS: {fileID: 4800000, guid: c243aac96dda5fa40bed693ed5ba02c4, type: 3} + clearUIntTextureCS: {fileID: 7200000, guid: d067ad4b88af51c498875426894aef76, type: 3} xrMirrorViewPS: {fileID: 4800000, guid: e6255f98cf405eb45ab6f9006cf11e1f, type: 3} xrOcclusionMeshPS: {fileID: 4800000, guid: 46a45b32bb110604fb36216b63bcdb81, type: 3} shadowClearPS: {fileID: 4800000, guid: e3cab24f27741f44d8af1e94d006267c, type: 3} evsmBlurCS: {fileID: 7200000, guid: fb36979473602464fa32deacb9630c08, type: 3} - debugHDShadowMapPS: {fileID: 4800000, guid: 93d40cc9a6e13994f86f576a624efa18, - type: 3} + debugHDShadowMapPS: {fileID: 4800000, guid: 93d40cc9a6e13994f86f576a624efa18, type: 3} momentShadowsCS: {fileID: 7200000, guid: 4dea53e2ff15ed0448817c2aa4246e53, type: 3} - decalNormalBufferPS: {fileID: 4800000, guid: fd532bf1795188c4daaa66ea798b8b0a, - type: 3} - decalClearPropertyMaskBufferCS: {fileID: 7200000, guid: 1076a08965d4a91479b72599724f7fd6, - type: 3} + decalNormalBufferPS: {fileID: 4800000, guid: fd532bf1795188c4daaa66ea798b8b0a, type: 3} + decalClearPropertyMaskBufferCS: {fileID: 7200000, guid: 1076a08965d4a91479b72599724f7fd6, type: 3} GTAOCS: {fileID: 7200000, guid: 6710b06492bd58c4bb8aec0fdc1fced3, type: 3} - GTAOSpatialDenoiseCS: {fileID: 7200000, guid: 2cb33c21587d12b4388d7866ab6c65f6, - type: 3} - GTAOTemporalDenoiseCS: {fileID: 7200000, guid: 31e0ca4c210f97c468037d11a5b832bb, - type: 3} + GTAOSpatialDenoiseCS: {fileID: 7200000, guid: 2cb33c21587d12b4388d7866ab6c65f6, type: 3} + GTAOTemporalDenoiseCS: {fileID: 7200000, guid: 31e0ca4c210f97c468037d11a5b832bb, type: 3} GTAOCopyHistoryCS: {fileID: 7200000, guid: 7f43be57ffd12ff469d4fc175c00c4b4, type: 3} - GTAOBlurAndUpsample: {fileID: 7200000, guid: 9eb1abde882538a4ea46fa23e49ab9fa, - type: 3} + GTAOBlurAndUpsample: {fileID: 7200000, guid: 9eb1abde882538a4ea46fa23e49ab9fa, type: 3} depthValuesPS: {fileID: 4800000, guid: 6e6a4a3dbb788234594aa74f2d6aeb6f, type: 3} colorResolvePS: {fileID: 4800000, guid: dd7047092f3c82b40b3a07868f9c4de2, type: 3} copyAlphaCS: {fileID: 7200000, guid: c2c7eb6611725264187721ef9df0354b, type: 3} @@ -150,38 +103,23 @@ MonoBehaviour: applyExposureCS: {fileID: 7200000, guid: 1a6fea1dc099b984d8f2b27d504dc096, type: 3} uberPostCS: {fileID: 7200000, guid: f1bf52f7c71bffd4f91e6cd90d12a4f7, type: 3} lutBuilder3DCS: {fileID: 7200000, guid: 37f2b1b0ecd6f1c439e4c1b4f2fdb524, type: 3} - depthOfFieldKernelCS: {fileID: 7200000, guid: 7869415cc3e4eaa4d82ac21a752a2780, - type: 3} + depthOfFieldKernelCS: {fileID: 7200000, guid: 7869415cc3e4eaa4d82ac21a752a2780, type: 3} depthOfFieldCoCCS: {fileID: 7200000, guid: 048b235b54fbfaa4d80ec85ea847d4f8, type: 3} - depthOfFieldCoCReprojectCS: {fileID: 7200000, guid: 4980decaa3878d6448569489f5fc7931, - type: 3} - depthOfFieldDilateCS: {fileID: 7200000, guid: 1c93af4338c0c1b42b92464992eebc10, - type: 3} + depthOfFieldCoCReprojectCS: {fileID: 7200000, guid: 4980decaa3878d6448569489f5fc7931, type: 3} + depthOfFieldDilateCS: {fileID: 7200000, guid: 1c93af4338c0c1b42b92464992eebc10, type: 3} depthOfFieldMipCS: {fileID: 7200000, guid: d3ef53de069ded64e8377cba6eb951fa, type: 3} - depthOfFieldMipSafeCS: {fileID: 7200000, guid: 2d24ee7b2c804d947a5c371c12ed46bd, - type: 3} - depthOfFieldPrefilterCS: {fileID: 7200000, guid: f2b89d19910854346b792fe7177ce634, - type: 3} - depthOfFieldTileMaxCS: {fileID: 7200000, guid: 84f84585ea8a7a849bea4a581adb93a7, - type: 3} - depthOfFieldGatherCS: {fileID: 7200000, guid: 486be52dddc4e054fb10a7b9b78788c2, - type: 3} - depthOfFieldCombineCS: {fileID: 7200000, guid: c8049ca85c4c7d047ba28f34d800c663, - type: 3} - depthOfFieldPreCombineFarCS: {fileID: 7200000, guid: 3b4a2acd03d1ce2438d93c325d588735, - type: 3} - depthOfFieldClearIndirectArgsCS: {fileID: 7200000, guid: 69905045e1d0a65458b205d6ab55502b, - type: 3} - paniniProjectionCS: {fileID: 7200000, guid: 0ddbf72c8fbb6e44b983f470c8384ef6, - type: 3} - motionBlurMotionVecPrepCS: {fileID: 7200000, guid: ed9438fa777911d48933402087203b15, - type: 3} - motionBlurGenTileCS: {fileID: 7200000, guid: 336e1fdbb3a1b8647b06208415f87804, - type: 3} - motionBlurMergeTileCS: {fileID: 7200000, guid: cd14ddf849edeed43b0e3ccf66023038, - type: 3} - motionBlurNeighborhoodTileCS: {fileID: 7200000, guid: 5ea9865df3e53b448856785b88f8e7b9, - type: 3} + depthOfFieldMipSafeCS: {fileID: 7200000, guid: 2d24ee7b2c804d947a5c371c12ed46bd, type: 3} + depthOfFieldPrefilterCS: {fileID: 7200000, guid: f2b89d19910854346b792fe7177ce634, type: 3} + depthOfFieldTileMaxCS: {fileID: 7200000, guid: 84f84585ea8a7a849bea4a581adb93a7, type: 3} + depthOfFieldGatherCS: {fileID: 7200000, guid: 486be52dddc4e054fb10a7b9b78788c2, type: 3} + depthOfFieldCombineCS: {fileID: 7200000, guid: c8049ca85c4c7d047ba28f34d800c663, type: 3} + depthOfFieldPreCombineFarCS: {fileID: 7200000, guid: 3b4a2acd03d1ce2438d93c325d588735, type: 3} + depthOfFieldClearIndirectArgsCS: {fileID: 7200000, guid: 69905045e1d0a65458b205d6ab55502b, type: 3} + paniniProjectionCS: {fileID: 7200000, guid: 0ddbf72c8fbb6e44b983f470c8384ef6, type: 3} + motionBlurMotionVecPrepCS: {fileID: 7200000, guid: ed9438fa777911d48933402087203b15, type: 3} + motionBlurGenTileCS: {fileID: 7200000, guid: 336e1fdbb3a1b8647b06208415f87804, type: 3} + motionBlurMergeTileCS: {fileID: 7200000, guid: cd14ddf849edeed43b0e3ccf66023038, type: 3} + motionBlurNeighborhoodTileCS: {fileID: 7200000, guid: 5ea9865df3e53b448856785b88f8e7b9, type: 3} motionBlurCS: {fileID: 7200000, guid: 2af5c49c7865edb4b823826970ec176a, type: 3} bloomPrefilterCS: {fileID: 7200000, guid: 243b24008041aaa4a91800690f63c684, type: 3} bloomBlurCS: {fileID: 7200000, guid: 133a68380d324de4ea8d3ff8657b02d8, type: 3} @@ -190,11 +128,12 @@ MonoBehaviour: finalPassPS: {fileID: 4800000, guid: 5ac9ef0c50282754b93c7692488e7ee7, type: 3} clearBlackPS: {fileID: 4800000, guid: 3330c1503ea8c6d4d9408df3f64227eb, type: 3} SMAAPS: {fileID: 4800000, guid: 9655f4aa89a469c49aceaceabf9bc77b, type: 3} - temporalAntialiasingPS: {fileID: 4800000, guid: 3dd9fd928fdb83743b1f27d15df22179, - type: 3} - contrastAdaptiveSharpenCS: {fileID: 7200000, guid: 560896aec2f412c48995be35551a4ac6, - type: 3} + temporalAntialiasingPS: {fileID: 4800000, guid: 3dd9fd928fdb83743b1f27d15df22179, type: 3} + contrastAdaptiveSharpenCS: {fileID: 7200000, guid: 560896aec2f412c48995be35551a4ac6, type: 3} accumulationCS: {fileID: 7200000, guid: ed80add7a217efa468d137d6f7c668f3, type: 3} + alphaInjectionPS: {fileID: 4800000, guid: 4edd96259a5e8b44c90479928f0cd11e, type: 3} + chromaKeyingPS: {fileID: 4800000, guid: 49feb6b111e82ec4eb6d3d08e4b6903e, type: 3} + customClearPS: {fileID: 4800000, guid: 9cef3686fa32c8840947ed99b561195c, type: 3} textures: debugFontTex: {fileID: 2800000, guid: a3ad2df0e49aaa341a3b3a80f93b3f66, type: 3} colorGradient: {fileID: 2800000, guid: 4ea52e665573c1644bf05dd9b11fd2a4, type: 3} @@ -265,20 +204,15 @@ MonoBehaviour: - {fileID: 2800000, guid: 7641a2b116fafd64d9c3d6459fdfe801, type: 3} - {fileID: 2800000, guid: c6a5e40e6746fef4fa486e8f620ee8d4, type: 3} - {fileID: 2800000, guid: fd4189357c6dfb94fa2d36afbce72086, type: 3} - owenScrambledRGBATex: {fileID: 2800000, guid: b0fe077c1ee7d80428f3d8dfa28a027d, - type: 3} - owenScrambled256Tex: {fileID: 2800000, guid: 2a205358e67aa9e4a94a128ac9362f4e, - type: 3} + owenScrambledRGBATex: {fileID: 2800000, guid: b0fe077c1ee7d80428f3d8dfa28a027d, type: 3} + owenScrambled256Tex: {fileID: 2800000, guid: 2a205358e67aa9e4a94a128ac9362f4e, type: 3} scramblingTex: {fileID: 2800000, guid: bf25cd6288e2c8d43854a61a8496a830, type: 3} rankingTile1SPP: {fileID: 2800000, guid: f2fe0251f704c4c478a8063775cffedb, type: 3} - scramblingTile1SPP: {fileID: 2800000, guid: 6185473f62ad3e74da4acac5d482917a, - type: 3} + scramblingTile1SPP: {fileID: 2800000, guid: 6185473f62ad3e74da4acac5d482917a, type: 3} rankingTile8SPP: {fileID: 2800000, guid: af4bd638a4b3eb14781e6441adcdfbb9, type: 3} - scramblingTile8SPP: {fileID: 2800000, guid: 152f8b933250a7b448fc2d4d301b9944, - type: 3} + scramblingTile8SPP: {fileID: 2800000, guid: 152f8b933250a7b448fc2d4d301b9944, type: 3} rankingTile256SPP: {fileID: 2800000, guid: 1e604a266c415cd46b36d97cd9220aa8, type: 3} - scramblingTile256SPP: {fileID: 2800000, guid: 882fb55d7b3e7c94598a318df9376e32, - type: 3} + scramblingTile256SPP: {fileID: 2800000, guid: 882fb55d7b3e7c94598a318df9376e32, type: 3} filmGrainTex: - {fileID: 2800000, guid: 284a1ac236869fa4eacf377d73c7dff8, type: 3} - {fileID: 2800000, guid: bd74961b009b93145a998ae93a5fc186, type: 3} @@ -294,8 +228,6 @@ MonoBehaviour: SMAAAreaTex: {fileID: 2800000, guid: 92e0d85ab4eca874098e7fcf6f8f674e, type: 3} defaultHDRISky: {fileID: 8900000, guid: 8253d41e6e8b11a4cbe77a4f8f82934d, type: 3} assets: - defaultDiffusionProfile: {fileID: 11400000, guid: 2b7005ba3a4d8474b8cdc34141ad766e, - type: 2} - emissiveCylinderMesh: {fileID: 2534964839176971238, guid: accb6d90f0d50fe4ca0f68159b4323de, - type: 3} + defaultDiffusionProfile: {fileID: 11400000, guid: 2b7005ba3a4d8474b8cdc34141ad766e, type: 2} + emissiveCylinderMesh: {fileID: 2534964839176971238, guid: accb6d90f0d50fe4ca0f68159b4323de, type: 3} emissiveQuadMesh: {fileID: 4300000, guid: 1d5a8595286f94f4bb54171d49f473c3, type: 3} From 7fa01f066eff0c68d5a5b17910d551694bb8bffa Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Thu, 9 Apr 2020 18:37:31 +0200 Subject: [PATCH 15/21] fix muticompile for motion blur without alpha --- .../Editor/Compositor/CompositorWindow.cs | 2 +- .../Runtime/PostProcessing/PostProcessSystem.cs | 1 + .../Runtime/PostProcessing/Shaders/MotionBlur.compute | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs index 874be1cc974..d9e8e9555c7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositorWindow.cs @@ -150,7 +150,7 @@ void MarkShaderAsDirty(Shader shader, object context) private void OnDestroy() { CompositionManager compositor = CompositionManager.GetInstance(); - if (compositor.shader != null) + if (compositor && compositor.shader != null) { GraphData.onSaveGraph -= MarkShaderAsDirty; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index ce21c2dad68..5eb9ffa42f1 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -1838,6 +1838,7 @@ void DoMotionBlur(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.MotionBlurKernel))) { cs = m_Resources.shaders.motionBlurCS; + cs.shaderKeywords = null; CoreUtils.SetKeyword(cs, "ENABLE_ALPHA", m_EnableAlpha); kernel = cs.FindKernel("MotionBlurCS"); diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute index 63dff744cde..0dcd86fbf5c 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/MotionBlur.compute @@ -5,7 +5,7 @@ //#pragma enable_d3d11_debug_symbols -#pragma multi_compile ENABLE_ALPHA +#pragma multi_compile _ ENABLE_ALPHA RW_TEXTURE2D_X(CTYPE, _OutputTexture); TEXTURE2D_X(_InputTexture); From 8b807684828fe8709288c1b243fc1f83bb8eb1d4 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Fri, 10 Apr 2020 01:10:02 +0200 Subject: [PATCH 16/21] Update to new constant buffer / shadergraph api --- .../TestCompositionGraph.shadergraph | 2 +- .../Runtime/Compositor/CompositionManager.cs | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph index 3e194bcfb50..ad450358834 100644 --- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph +++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9800_Compositor/Shader Graphs/TestCompositionGraph.shadergraph @@ -49,7 +49,7 @@ "typeInfo": { "fullName": "UnityEditor.ShaderGraph.UnlitMasterNode" }, - "JSONnodeData": "{\n \"m_GuidSerialized\": \"6ab590f0-4789-46ad-b3b5-4ec43a4583bf\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Unlit Master\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 759.0000610351563,\n \"y\": 168.0,\n \"width\": 200.0,\n \"height\": 197.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Vertex Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.NormalMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 10,\\n \\\"m_DisplayName\\\": \\\"Vertex Normal\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Normal\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.TangentMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 11,\\n \\\"m_DisplayName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.7353569269180298,\\n \\\"y\\\": 0.7353569269180298,\\n \\\"z\\\": 0.7353569269180298\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_ColorMode\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.5,\\n \\\"m_DefaultValue\\\": 0.5,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_DOTSInstancing\": false,\n \"m_SerializableSubShaders\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.Rendering.HighDefinition.UnlitSubShader\"\n },\n \"JSONnodeData\": \"{}\"\n }\n ],\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": true,\n \"m_AddPrecomputedVelocity\": false\n}" + "JSONnodeData": "{\n \"m_GuidSerialized\": \"6ab590f0-4789-46ad-b3b5-4ec43a4583bf\",\n \"m_GroupGuidSerialized\": \"00000000-0000-0000-0000-000000000000\",\n \"m_Name\": \"Unlit Master\",\n \"m_NodeVersion\": 0,\n \"m_DrawState\": {\n \"m_Expanded\": true,\n \"m_Position\": {\n \"serializedVersion\": \"2\",\n \"x\": 759.0000610351563,\n \"y\": 168.0,\n \"width\": 200.0,\n \"height\": 197.0\n }\n },\n \"m_SerializableSlots\": [\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.PositionMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 9,\\n \\\"m_DisplayName\\\": \\\"Vertex Position\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Position\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.NormalMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 10,\\n \\\"m_DisplayName\\\": \\\"Vertex Normal\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Normal\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.TangentMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 11,\\n \\\"m_DisplayName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Vertex Tangent\\\",\\n \\\"m_StageCapability\\\": 1,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_Space\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.ColorRGBMaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 0,\\n \\\"m_DisplayName\\\": \\\"Color\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Color\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": {\\n \\\"x\\\": 0.7353569269180298,\\n \\\"y\\\": 0.7353569269180298,\\n \\\"z\\\": 0.7353569269180298\\n },\\n \\\"m_DefaultValue\\\": {\\n \\\"x\\\": 0.0,\\n \\\"y\\\": 0.0,\\n \\\"z\\\": 0.0\\n },\\n \\\"m_Labels\\\": [\\n \\\"X\\\",\\n \\\"Y\\\",\\n \\\"Z\\\"\\n ],\\n \\\"m_ColorMode\\\": 0\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 7,\\n \\\"m_DisplayName\\\": \\\"Alpha\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"Alpha\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 1.0,\\n \\\"m_DefaultValue\\\": 1.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n },\n {\n \"typeInfo\": {\n \"fullName\": \"UnityEditor.ShaderGraph.Vector1MaterialSlot\"\n },\n \"JSONnodeData\": \"{\\n \\\"m_Id\\\": 8,\\n \\\"m_DisplayName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_SlotType\\\": 0,\\n \\\"m_Priority\\\": 2147483647,\\n \\\"m_Hidden\\\": false,\\n \\\"m_ShaderOutputName\\\": \\\"AlphaClipThreshold\\\",\\n \\\"m_StageCapability\\\": 2,\\n \\\"m_Value\\\": 0.5,\\n \\\"m_DefaultValue\\\": 0.0,\\n \\\"m_Labels\\\": [\\n \\\"X\\\"\\n ]\\n}\"\n }\n ],\n \"m_Precision\": 0,\n \"m_PreviewExpanded\": true,\n \"m_CustomColors\": {\n \"m_SerializableColors\": []\n },\n \"m_SurfaceType\": 0,\n \"m_AlphaMode\": 0,\n \"m_TwoSided\": true,\n \"m_AddPrecomputedVelocity\": false,\n \"m_DOTSInstancing\": false,\n \"m_ShaderGUIOverride\": \"\",\n \"m_OverrideEnabled\": false\n}" }, { "typeInfo": { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index db9c4380dfd..a7ccbb7b2de 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -14,13 +14,6 @@ namespace UnityEngine.Rendering.HighDefinition.Compositor [ExecuteAlways] internal class CompositionManager : MonoBehaviour { - // These shader graph properties should be properly set when drawing a full screen quad for the compositor output - internal class SGShaderIDs - { - public static readonly int _ViewProjMatrix = Shader.PropertyToID("_ViewProjMatrix"); - public static readonly int _WorldSpaceCameraPos = Shader.PropertyToID("_WorldSpaceCameraPos"); - } - public enum OutputDisplay { Display1 = 0, @@ -135,6 +128,8 @@ public bool shaderPropertiesAreDirty internal Matrix4x4 m_ViewProjMatrixFlipped; internal GameObject m_CompositorGameObject; + ShaderVariablesGlobal m_ShaderVariablesGlobalCB = new ShaderVariablesGlobal(); + static private CompositionManager s_CompositorInstance; #region Validation @@ -685,20 +680,22 @@ void CustomRender(ScriptableRenderContext context, HDCamera camera) // Blit command var cmd = CommandBufferPool.Get("Compositor Blit"); { - cmd.SetGlobalVector(SGShaderIDs._WorldSpaceCameraPos, new Vector3(0.0f, 0.0f, 0.0f)); + m_ShaderVariablesGlobalCB._WorldSpaceCameraPos_Internal = new Vector3(0.0f, 0.0f, 0.0f); cmd.SetViewport(new Rect(0, 0, camera.camera.pixelWidth, camera.camera.pixelHeight)); cmd.ClearRenderTarget(true, false, Color.black); } if (camera.camera.targetTexture) { - cmd.SetGlobalMatrix(SGShaderIDs._ViewProjMatrix, m_ViewProjMatrixFlipped); + m_ShaderVariablesGlobalCB._ViewProjMatrix = m_ViewProjMatrixFlipped; + ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesGlobalCB, HDShaderIDs._ShaderVariablesGlobal); cmd.Blit(null, BuiltinRenderTextureType.CurrentActive, m_Material, m_Material.FindPass("ForwardOnly")); cmd.Blit(BuiltinRenderTextureType.CurrentActive, camera.camera.targetTexture); } else { - cmd.SetGlobalMatrix(SGShaderIDs._ViewProjMatrix, m_ViewProjMatrix); + m_ShaderVariablesGlobalCB._ViewProjMatrix = m_ViewProjMatrix; + ConstantBuffer.PushGlobal(cmd, m_ShaderVariablesGlobalCB, HDShaderIDs._ShaderVariablesGlobal); cmd.Blit(null, BuiltinRenderTextureType.CurrentActive, m_Material, m_Material.FindPass("ForwardOnly")); } From a40e96953fbc0c10fa819abeb76cc8e62b146d57 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Fri, 10 Apr 2020 12:33:25 +0200 Subject: [PATCH 17/21] Player test image for the compositor --- .../Direct3D11/None/9800_Compositor.png | 3 + .../Direct3D11/None/9800_Compositor.png.meta | 94 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png create mode 100644 TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png.meta diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png new file mode 100644 index 00000000000..fc259c48949 --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ed8165abcf51091cb4c1cff00de0ebba8752c981b77627de0403ca68e9e7e92 +size 105224 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png.meta b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png.meta new file mode 100644 index 00000000000..4804f15dcca --- /dev/null +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsPlayer/Direct3D11/None/9800_Compositor.png.meta @@ -0,0 +1,94 @@ +fileFormatVersion: 2 +guid: 9f6eba2655f63174bbd33740416bf473 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 1 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: -1 + wrapV: -1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: From c8c0f46fa476bfdb6ac1ee93936f3f46615f5d0e Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Tue, 14 Apr 2020 09:58:52 +0200 Subject: [PATCH 18/21] Properly fill camera entries for global constant buffer --- .../Runtime/Compositor/CompositionManager.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index a7ccbb7b2de..e8b7ee6b208 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -680,6 +680,10 @@ void CustomRender(ScriptableRenderContext context, HDCamera camera) // Blit command var cmd = CommandBufferPool.Get("Compositor Blit"); { + // fill the camera-related entries in the global constant buffer + // (Note: we later patch the position/_ViewProjMatrix values in order to perform a full screen blit with a SG Unlit material) + camera.UpdateShaderVariableGlobalCB(ref m_ShaderVariablesGlobalCB, 0); + m_ShaderVariablesGlobalCB._WorldSpaceCameraPos_Internal = new Vector3(0.0f, 0.0f, 0.0f); cmd.SetViewport(new Rect(0, 0, camera.camera.pixelWidth, camera.camera.pixelHeight)); cmd.ClearRenderTarget(true, false, Color.black); From 327f273d36e40ad1c70bd29e07493891c59c0c78 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Thu, 16 Apr 2020 20:34:55 +0200 Subject: [PATCH 19/21] Fix after rebase / function rename --- .../Runtime/Compositor/CompositionManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index e8b7ee6b208..2416dcb9122 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -682,7 +682,7 @@ void CustomRender(ScriptableRenderContext context, HDCamera camera) { // fill the camera-related entries in the global constant buffer // (Note: we later patch the position/_ViewProjMatrix values in order to perform a full screen blit with a SG Unlit material) - camera.UpdateShaderVariableGlobalCB(ref m_ShaderVariablesGlobalCB, 0); + camera.UpdateShaderVariablesGlobalCB(ref m_ShaderVariablesGlobalCB, 0); m_ShaderVariablesGlobalCB._WorldSpaceCameraPos_Internal = new Vector3(0.0f, 0.0f, 0.0f); cmd.SetViewport(new Rect(0, 0, camera.camera.pixelWidth, camera.camera.pixelHeight)); From be66456b76ac13d11d28db586555795890e48d90 Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Fri, 17 Apr 2020 10:48:56 +0200 Subject: [PATCH 20/21] Make bg red for better debugging qnd cqtch unity exception --- .../Editor/Compositor/CompositionManagerEditor.cs | 11 ++++++++++- .../Runtime/Compositor/CompositionManager.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs index c243d9efbe7..7a72583c2da 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Compositor/CompositionManagerEditor.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Reflection; using UnityEngine; @@ -65,7 +66,15 @@ void DrawCompositionParameters() bool CacheSerializedObjects() { - m_SerializedProperties = new SerializedCompositionManager(serializedObject); + try + { + m_SerializedProperties = new SerializedCompositionManager(serializedObject); + } + catch (Exception) + { + return false; + } + m_SerializedLayerProperties = new List(); m_SerializedShaderProperties = new List(); diff --git a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs index 2416dcb9122..aa18eec73a9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositionManager.cs @@ -686,7 +686,7 @@ void CustomRender(ScriptableRenderContext context, HDCamera camera) m_ShaderVariablesGlobalCB._WorldSpaceCameraPos_Internal = new Vector3(0.0f, 0.0f, 0.0f); cmd.SetViewport(new Rect(0, 0, camera.camera.pixelWidth, camera.camera.pixelHeight)); - cmd.ClearRenderTarget(true, false, Color.black); + cmd.ClearRenderTarget(true, false, Color.red); } if (camera.camera.targetTexture) From 05753a842cc0fd0468b2b3126c25b0f6b2ba80ae Mon Sep 17 00:00:00 2001 From: Pavlos Mavridis Date: Fri, 17 Apr 2020 14:21:46 +0200 Subject: [PATCH 21/21] Disable compositor test until we fix it on yamato --- .../HDRP_Tests/ProjectSettings/EditorBuildSettings.asset | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset index 5f9a86492d8..661bcc22407 100644 --- a/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset +++ b/TestProjects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset @@ -560,9 +560,9 @@ EditorBuildSettings: - enabled: 1 path: Assets/GraphicTests/Scenes/9x_Other/9700_CustomPass_FullScreen.unity guid: 86f8f2a99d6720b48abc19c684103d74 - - enabled: 1 + - enabled: 0 path: Assets/GraphicTests/Scenes/9x_Other/9800_Compositor.unity - guid: 708bd21bc204d2342bc1702a5a6de1d3 + guid: 708bd21bc204d2342bc1702a5a6de1d3 - enabled: 1 path: Assets/GraphicTests/Scenes/9x_Other/9801_ShurikenLightModule.unity guid: d50ee167e49a2d74988347d7888c3613