diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs index cdbb2051128..1a77920e3d5 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs @@ -46,7 +46,7 @@ static class Styles public static readonly GUIContent iconEnableAll = new GUIContent("", CoreEditorStyles.GetMessageTypeIcon(MessageType.Info), "The Scene is loaded but is currently not enabled for Baking. It will therefore not be considered when generating lighting data."); public static readonly GUIContent iconLoadForBake = new GUIContent("", CoreEditorStyles.GetMessageTypeIcon(MessageType.Warning), "The Scene is currently enabled for baking but is unloaded in the Hierarchy. This may result in incomplete lighting data being generated.\nLoad the Scene in the Hierarchy, or use the shortcuts below to fix the issue."); - public static readonly string msgEnableAll = "Scenes which are currently loaded are not enabled for baking.\nNo probe will be baked for these scenes when generating lighting."; + public static readonly string msgEnableAll = "Some loaded Scenes are disabled by this Baking Set. These Scenes will not contribute to the generation of probe data."; public static readonly string msgUnloadOther = "Scene(s) not belonging to this Baking Set are currently loaded in the Hierarchy. This might result in incorrect lighting."; public static readonly string msgLoadForBake = "Some scene(s) in this Baking Set are not currently loaded in the Hierarchy. This might result in missing or incomplete lighting."; @@ -959,9 +959,16 @@ internal bool PrepareAPVBake() } bool createPV = m_SingleSceneMode ? !ActiveSceneHasProbeVolume() : NoSceneHasProbeVolume(); - if (createPV && EditorUtility.DisplayDialog("No Probe Volume in Scene", "Probe Volumes are enabled for this Project, but none exist in the Scene.\n\n" + + if (createPV) + { + if(!activeSet.DialogNoProbeVolumeInSetShown()) + { + if(EditorUtility.DisplayDialog("No Probe Volume in Scene", "Probe Volumes are enabled for this Project, but none exist in the Scene.\n\n" + "Do you wish to add a Probe Volume to the Active Scene?", "Yes", "No")) - CreateProbeVolume(); + CreateProbeVolume(); + activeSet.SetDialogNoProbeVolumeInSetShown(true); + } + } if (m_SingleSceneMode) { if (GetFirstProbeVolumeInNonActiveScene() != null) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Common/ConstantBuffer.cs b/Packages/com.unity.render-pipelines.core/Runtime/Common/ConstantBuffer.cs index b5b6b1b527c..cab7543932d 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Common/ConstantBuffer.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Common/ConstantBuffer.cs @@ -323,6 +323,16 @@ public void Set(Material mat, int shaderId) mat.SetConstantBuffer(shaderId, m_GPUConstantBuffer, 0, m_GPUConstantBuffer.stride); } + /// + /// Bind the constant buffer to a material property block. + /// + /// Material property block to which the constant buffer should be bound. + /// Shader porperty id to bind the constant buffer to. + public void Set(MaterialPropertyBlock mpb, int shaderId) + { + mpb.SetConstantBuffer(shaderId, m_GPUConstantBuffer, 0, m_GPUConstantBuffer.stride); + } + /// /// Update the GPU data of the constant buffer and bind it globally via a command buffer. /// diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs index f1919f81a07..cd7783992b0 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs @@ -384,16 +384,53 @@ void RefreshDebug(DebugUI.Field field, T value) var widgetList = new List(); - var subdivContainer = new DebugUI.Container() { displayName = "Subdivision Visualization" }; - subdivContainer.children.Add(new DebugUI.BoolField { displayName = "Display Cells", tooltip = "Draw Cells used for loading and streaming.", getter = () => probeVolumeDebug.drawCells, setter = value => probeVolumeDebug.drawCells = value, onValueChanged = RefreshDebug }); - subdivContainer.children.Add(new DebugUI.BoolField { displayName = "Display Bricks", tooltip = "Display Subdivision bricks.", getter = () => probeVolumeDebug.drawBricks, setter = value => probeVolumeDebug.drawBricks = value, onValueChanged = RefreshDebug }); + var subdivContainer = new DebugUI.Container() + { + displayName = "Subdivision Visualization", + isHiddenCallback = () => + { +#if UNITY_EDITOR + return false; +#else + return false; // Cells / Bricks visualization is not implemented in a runtime compatible way atm. +#endif + } + }; + subdivContainer.children.Add(new DebugUI.BoolField + { + displayName = "Display Cells", + tooltip = "Draw Cells used for loading and streaming.", + getter = () => probeVolumeDebug.drawCells, + setter = value => probeVolumeDebug.drawCells = value, + onValueChanged = RefreshDebug + }); + subdivContainer.children.Add(new DebugUI.BoolField + { + displayName = "Display Bricks", + tooltip = "Display Subdivision bricks.", + getter = () => probeVolumeDebug.drawBricks, + setter = value => probeVolumeDebug.drawBricks = value, + onValueChanged = RefreshDebug + }); + #if UNITY_EDITOR - subdivContainer.children.Add(new DebugUI.BoolField { displayName = "Live Subdivision Preview", tooltip = "Enable a preview of Probe Volume data in the Scene without baking. Can impact Editor performance.", getter = () => probeVolumeDebug.realtimeSubdivision, setter = value => probeVolumeDebug.realtimeSubdivision = value, onValueChanged = RefreshDebug }); - if (probeVolumeDebug.realtimeSubdivision) + if (probeVolumeDebug.drawCells || probeVolumeDebug.drawBricks) { - var cellUpdatePerFrame = new DebugUI.IntField { displayName = "Cell Updates Per Frame", tooltip = "The number of Cells, bricks, and probe positions updated per frame. Higher numbers can impact Editor performance.", getter = () => probeVolumeDebug.subdivisionCellUpdatePerFrame, setter = value => probeVolumeDebug.subdivisionCellUpdatePerFrame = value, min = () => 1, max = () => 100 }; - var delayBetweenUpdates = new DebugUI.FloatField { displayName = "Update Frequency", tooltip = "Delay in seconds between updates to Cell, Brick, and Probe positions if Live Subdivision Preview is enabled.", getter = () => probeVolumeDebug.subdivisionDelayInSeconds, setter = value => probeVolumeDebug.subdivisionDelayInSeconds = value, min = () => 0.1f, max = () => 10 }; - subdivContainer.children.Add(new DebugUI.Container { children = { cellUpdatePerFrame, delayBetweenUpdates } }); + subdivContainer.children.Add(new DebugUI.BoolField + { + displayName = "Live Subdivision Preview", + tooltip = "Enable a preview of Probe Volume data in the Scene without baking. Can impact Editor performance.", + getter = () => probeVolumeDebug.realtimeSubdivision, + setter = value => probeVolumeDebug.realtimeSubdivision = value, + }); + + var realtimeSubdivisonChildContainer = new DebugUI.Container() + { + isHiddenCallback = () => !probeVolumeDebug.realtimeSubdivision + }; + realtimeSubdivisonChildContainer.children.Add(new DebugUI.IntField { displayName = "Cell Updates Per Frame", tooltip = "The number of Cells, bricks, and probe positions updated per frame. Higher numbers can impact Editor performance.", getter = () => probeVolumeDebug.subdivisionCellUpdatePerFrame, setter = value => probeVolumeDebug.subdivisionCellUpdatePerFrame = value, min = () => 1, max = () => 100 }); + realtimeSubdivisonChildContainer.children.Add(new DebugUI.FloatField { displayName = "Update Frequency", tooltip = "Delay in seconds between updates to Cell, Brick, and Probe positions if Live Subdivision Preview is enabled.", getter = () => probeVolumeDebug.subdivisionDelayInSeconds, setter = value => probeVolumeDebug.subdivisionDelayInSeconds = value, min = () => 0.1f, max = () => 10 }); + subdivContainer.children.Add(realtimeSubdivisonChildContainer); } #endif diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl index 4965e6b9adc..5220f4f2dc1 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolume.hlsl @@ -289,7 +289,7 @@ uint GetIndexData(APVResources apvRes, float3 posWS) float3 entryPos = floor(posWS / _GlobalIndirectionEntryDim); float3 topLeftEntryWS = entryPos * _GlobalIndirectionEntryDim; - bool isALoadedCell = all(entryPos >= _MinLoadedCellInEntries && entryPos <= _MaxLoadedCellInEntries); + bool isALoadedCell = all(entryPos >= _MinLoadedCellInEntries) && all(entryPos <= _MaxLoadedCellInEntries); // Make sure we start from 0 int3 entryPosInt = (int3)(entryPos - _MinEntryPosition); @@ -311,7 +311,7 @@ uint GetIndexData(APVResources apvRes, float3 posWS) int3 localBrickIndex = floor(residualPosWS / (_MinBrickSize * stepSize)); // Out of bounds. - isValidBrick = all(localBrickIndex >= minRelativeIdx && localBrickIndex < maxRelativeIdxPlusOne); + isValidBrick = all(localBrickIndex >= minRelativeIdx) && all(localBrickIndex < maxRelativeIdxPlusOne); int3 sizeOfValid = maxRelativeIdxPlusOne - minRelativeIdx; // Relative to valid region diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs index 9e398032c80..5b1dbf5fccc 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs @@ -73,6 +73,7 @@ public void Add(CellCounts o) // Baking Set Data [SerializeField] internal bool singleSceneMode = true; + [SerializeField] internal bool dialogNoProbeVolumeInSetShown = false; [SerializeField] internal ProbeVolumeBakingProcessSettings settings; [SerializeField] private List m_SceneGUIDs = new List(); @@ -1137,6 +1138,16 @@ public static string GetDirectory(string scenePath, string sceneName) return assetPath; } + + public bool DialogNoProbeVolumeInSetShown() + { + return dialogNoProbeVolumeInSetShown; + } + + public void SetDialogNoProbeVolumeInSetShown(bool value) + { + dialogNoProbeVolumeInSetShown = value; + } #endif } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PostProcessing/Shaders/ffx/ffx_a.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/PostProcessing/Shaders/ffx/ffx_a.hlsl index 510fdf0cb7a..268a2cad55e 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PostProcessing/Shaders/ffx/ffx_a.hlsl +++ b/Packages/com.unity.render-pipelines.core/Runtime/PostProcessing/Shaders/ffx/ffx_a.hlsl @@ -2043,9 +2043,9 @@ AF4 AZolSignedF4(AF4 x){return ASatF4(x*AF4_(A_INFN_F));} //------------------------------------------------------------------------------------------------------------------------------ AF1 AZolZeroPassF1(AF1 x,AF1 y){return AF1_AU1((AU1_AF1(x)!=AU1_(0))?AU1_(0):AU1_AF1(y));} - AF2 AZolZeroPassF2(AF2 x,AF2 y){return AF2_AU2((AU2_AF2(x)!=AU2_(0))?AU2_(0):AU2_AF2(y));} - AF3 AZolZeroPassF3(AF3 x,AF3 y){return AF3_AU3((AU3_AF3(x)!=AU3_(0))?AU3_(0):AU3_AF3(y));} - AF4 AZolZeroPassF4(AF4 x,AF4 y){return AF4_AU4((AU4_AF4(x)!=AU4_(0))?AU4_(0):AU4_AF4(y));} + AF2 AZolZeroPassF2(AF2 x,AF2 y){return AF2(AZolZeroPassF1(x.x, y.x), AZolZeroPassF1(x.y, y.y)); } + AF3 AZolZeroPassF3(AF3 x,AF3 y){return AF3(AZolZeroPassF1(x.x, y.x), AZolZeroPassF1(x.y, y.y), AZolZeroPassF1(x.z, y.z)); } + AF4 AZolZeroPassF4(AF4 x,AF4 y){return AF4(AZolZeroPassF1(x.x, y.x), AZolZeroPassF1(x.y, y.y), AZolZeroPassF1(x.z, y.z), AZolZeroPassF1(x.w, y.w)); } #endif //============================================================================================================================== #ifdef A_HALF diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs index 9132e519d07..cbf955d7a25 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs @@ -210,6 +210,23 @@ public static RenderTexture emptyUAV } } + static GraphicsBuffer m_EmptyBuffer; + /// + /// Empty 4-Byte buffer resource usable as a dummy. + /// + public static GraphicsBuffer emptyBuffer + { + get + { + if (m_EmptyBuffer == null || !m_EmptyBuffer.IsValid()) + { + m_EmptyBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Raw, 1, sizeof(uint)); + } + + return m_EmptyBuffer; + } + } + static Texture3D m_BlackVolumeTexture; /// /// Black 3D texture. diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/GPUSort/GPUSort.cs b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/GPUSort/GPUSort.cs index 30a54636e42..e34f969f0de 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/GPUSort/GPUSort.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/GPUSort/GPUSort.cs @@ -1,6 +1,8 @@ using System; using UnityEngine.Assertions; +// Ref: https://poniesandlight.co.uk/reflect/bitonic_merge_sort/ + namespace UnityEngine.Rendering { /// @@ -10,7 +12,6 @@ public partial struct GPUSort { private const uint kWorkGroupSize = 1024; - private string[] m_StageNames; private LocalKeyword[] m_Keywords; enum Stage @@ -38,14 +39,6 @@ public GPUSort(SystemResources resources) new(resources.computeAsset, "STAGE_BIG_FLIP"), new(resources.computeAsset, "STAGE_BIG_DISPERSE") }; - - m_StageNames = new[] - { - Enum.GetName(typeof(Stage), Stage.BigDisperse), - Enum.GetName(typeof(Stage), Stage.BigFlip), - Enum.GetName(typeof(Stage), Stage.LocalDisperse), - Enum.GetName(typeof(Stage), Stage.LocalBMS) - }; } void DispatchStage(CommandBuffer cmd, Args args, uint h, Stage stage) @@ -54,7 +47,7 @@ void DispatchStage(CommandBuffer cmd, Args args, uint h, Stage stage) Assert.IsNotNull(resources.computeAsset); // When the is no geometry, instead of computing the distance field, we clear it with a big value. - using (new ProfilingScope(cmd, new ProfilingSampler(m_StageNames[(int) stage]))) + using (new ProfilingScope(cmd, ProfilingSampler.Get(stage))) { #if false m_SortCS.enabledKeywords = new[] { keywords[(int)stage] }; @@ -66,6 +59,7 @@ void DispatchStage(CommandBuffer cmd, Args args, uint h, Stage stage) #endif cmd.SetComputeIntParam(resources.computeAsset, "_H", (int) h); + cmd.SetComputeIntParam(resources.computeAsset, "_Total", (int) args.count); cmd.SetComputeBufferParam(resources.computeAsset, 0, "_KeyBuffer", args.resources.sortBufferKeys); cmd.SetComputeBufferParam(resources.computeAsset, 0, "_ValueBuffer", args.resources.sortBufferValues); cmd.DispatchCompute(resources.computeAsset, 0, args.workGroupCount, 1, 1); diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl index 9f1fc32653c..f0a5d895f45 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/ACES.hlsl @@ -231,12 +231,22 @@ half ACES_to_ACEScc(half x) return (log2(x) + 9.72) / 17.52; } +half ACES_to_ACEScc_fast(half x) +{ + // x is clamped to [0, HALF_MAX], skip the <= 0 check + return (x < 0.00003051757) ? (log2(0.00001525878 + x * 0.5) + 9.72) / 17.52 : (log2(x) + 9.72) / 17.52; +} + half3 ACES_to_ACEScc(half3 x) { x = clamp(x, 0.0, HALF_MAX); // x is clamped to [0, HALF_MAX], skip the <= 0 check - return (x < 0.00003051757) ? (log2(0.00001525878 + x * 0.5) + 9.72) / 17.52 : (log2(x) + 9.72) / 17.52; + return half3( + ACES_to_ACEScc_fast(x.r), + ACES_to_ACEScc_fast(x.g), + ACES_to_ACEScc_fast(x.b) + ); /* return half3( @@ -782,11 +792,6 @@ half roll_white_fwd( return o; } -half3 linear_to_sRGB(half3 x) -{ - return (x <= 0.0031308 ? (x * 12.9232102) : 1.055 * pow(x, 1.0 / 2.4) - 0.055); -} - half3 linear_to_bt1886(half3 x, half gamma, half Lw, half Lb) { // Good enough approximation for now, may consider using the exact formula instead diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/BC6H.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/BC6H.hlsl index d5b88e4b155..62de1eb32a1 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/BC6H.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/BC6H.hlsl @@ -83,13 +83,25 @@ void EncodeMode11( inout uint4 block, inout float blockMSLE, float3 texels[ 16 ] blockMax = max( blockMax, texels[ i ] ); } - // refine endpoints in log2 RGB space + // refine endpoints in log2 RGB space - find the second mix and max value float3 refinedBlockMin = blockMax; float3 refinedBlockMax = blockMin; for (i = 0; i < 16; ++i ) { - refinedBlockMin = min( refinedBlockMin, texels[ i ] == blockMin ? refinedBlockMin : texels[ i ] ); - refinedBlockMax = max( refinedBlockMax, texels[ i ] == blockMax ? refinedBlockMax : texels[ i ] ); + float3 minTexel = float3( + (texels[i].x == blockMin.x) ? refinedBlockMin.x : texels[i].x, + (texels[i].y == blockMin.y) ? refinedBlockMin.y : texels[i].y, + (texels[i].z == blockMin.z) ? refinedBlockMin.z : texels[i].z + ); + + float3 maxTexel = float3( + (texels[i].x == blockMax.x) ? refinedBlockMax.x : texels[i].x, + (texels[i].y == blockMax.y) ? refinedBlockMax.y : texels[i].y, + (texels[i].z == blockMax.z) ? refinedBlockMax.z : texels[i].z + ); + + refinedBlockMin = min(refinedBlockMin, minTexel); + refinedBlockMax = max(refinedBlockMax, maxTexel); } float3 logBlockMax = log2( blockMax + 1.0 ); diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl index 9e23e1445f0..9832014aec2 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl @@ -87,58 +87,37 @@ real SRGBToLinear(real c) real2 SRGBToLinear(real2 c) { -#if defined(UNITY_COLORSPACE_GAMMA) && REAL_IS_HALF - c = min(c, 100.0); // Make sure not to exceed HALF_MAX after the pow() below -#endif - real2 linearRGBLo = c / 12.92; - real2 linearRGBHi = PositivePow((c + 0.055) / 1.055, real2(2.4, 2.4)); - real2 linearRGB = (c <= 0.04045) ? linearRGBLo : linearRGBHi; - return linearRGB; + return real2(SRGBToLinear(c.r), SRGBToLinear(c.g)); } real3 SRGBToLinear(real3 c) { -#if defined(UNITY_COLORSPACE_GAMMA) && REAL_IS_HALF - c = min(c, 100.0); // Make sure not to exceed HALF_MAX after the pow() below -#endif - real3 linearRGBLo = c / 12.92; - real3 linearRGBHi = PositivePow((c + 0.055) / 1.055, real3(2.4, 2.4, 2.4)); - real3 linearRGB = (c <= 0.04045) ? linearRGBLo : linearRGBHi; - return linearRGB; + return real3(SRGBToLinear(c.r), SRGBToLinear(c.g), SRGBToLinear(c.b)); } real4 SRGBToLinear(real4 c) { - return real4(SRGBToLinear(c.rgb), c.a); + return real4(SRGBToLinear(c.r), SRGBToLinear(c.g), SRGBToLinear(c.b), c.a); } real LinearToSRGB(real c) { - real sRGBLo = c * 12.92; - real sRGBHi = (PositivePow(c, real(1.0/2.4)) * 1.055) - 0.055; - real sRGB = (c <= 0.0031308) ? sRGBLo : sRGBHi; - return sRGB; + return (c <= 0.0031308) ? (c * 12.9232102) : 1.055 * PositivePow(c, 1.0 / 2.4) - 0.055; } real2 LinearToSRGB(real2 c) { - real2 sRGBLo = c * 12.92; - real2 sRGBHi = (PositivePow(c, real2(1.0/2.4, 1.0/2.4)) * 1.055) - 0.055; - real2 sRGB = (c <= 0.0031308) ? sRGBLo : sRGBHi; - return sRGB; + return real2(LinearToSRGB(c.r), LinearToSRGB(c.g)); } real3 LinearToSRGB(real3 c) { - real3 sRGBLo = c * 12.92; - real3 sRGBHi = (PositivePow(c, real3(1.0/2.4, 1.0/2.4, 1.0/2.4)) * 1.055) - 0.055; - real3 sRGB = (c <= 0.0031308) ? sRGBLo : sRGBHi; - return sRGB; + return real3(LinearToSRGB(c.r), LinearToSRGB(c.g), LinearToSRGB(c.b)); } real4 LinearToSRGB(real4 c) { - return real4(LinearToSRGB(c.rgb), c.a); + return real4(LinearToSRGB(c.r), LinearToSRGB(c.g), LinearToSRGB(c.b), c.a); } // TODO: Seb - To verify and refit! diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Coverage.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Coverage.hlsl index eb3ac1c45a5..09fcc0db7c7 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Coverage.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Coverage.hlsl @@ -363,12 +363,17 @@ uint2 CreateCoverageMask(in LineArea lineArea) //Case were we have flipped axis / transpose. We generate top and bottom part int2 tOffsets = clamp(offsets, -31, 31); uint2 workMask = leftSideMask << clamp(offsets, 0, 4); - uint2 topDownMasks = (tOffsets > 0 ? - ((halfSamples << min(4,tOffsets)) & leftSideMask) | ((halfSamples << min(8,tOffsets)) & ~leftSideMask) - : (((halfSamples << 4) >> min(4,-tOffsets) & ~leftSideMask) >> 4)); + uint2 topDownMasks = uint2( tOffsets.x > 0 ? + ((halfSamples.x << min(4,tOffsets.x)) & leftSideMask) | ((halfSamples.x << min(8,tOffsets.x)) & ~leftSideMask) + : ((halfSamples.x << 4) >> min(4,-tOffsets.x) & ~leftSideMask) >> 4, + tOffsets.y > 0 ? + ((halfSamples.y << min(4, tOffsets.y)) & leftSideMask) | ((halfSamples.y << min(8, tOffsets.y)) & ~leftSideMask) + : ((halfSamples.y << 4) >> min(4, -tOffsets.y) & ~leftSideMask) >> 4); + ; int2 backMaskShift = lineArea.flipX ? clamp(tOffsets + 4, -31, 31) : tOffsets; - uint2 backMaskOp = ((backMaskShift > 0 ? 1u << backMaskShift : 1u >> -backMaskShift) - 1u); - uint2 backBite = backMaskShift <= 0 ? (lineArea.flipX ? ~0x0 : 0x0) : (lineArea.flipX ? (0xFF & ~backMaskOp) : (0xFFFF & backMaskOp)); + uint2 backMaskOp = int2((backMaskShift.x > 0 ? 1u << backMaskShift.x : 1u >> -backMaskShift.x) - 1u, (backMaskShift.y > 0 ? 1u << backMaskShift.y : 1u >> -backMaskShift.y) - 1u); + uint2 backBite = uint2( backMaskShift.x <= 0 ? (lineArea.flipX ? ~0x0 : 0x0) : (lineArea.flipX ? (0xFF & ~backMaskOp.x) : (0xFFFF & backMaskOp.x)), + backMaskShift.y <= 0 ? (lineArea.flipX ? ~0x0 : 0x0) : (lineArea.flipX ? (0xFF & ~backMaskOp.y) : (0xFFFF & backMaskOp.y))); result = backBite | (backBite << 8) | (backBite << 16) | (backBite << 24) | (topDownMasks & workMask); } else @@ -376,7 +381,10 @@ uint2 CreateCoverageMask(in LineArea lineArea) //Case were the masks are positioned horizontally. We generate 4 quads uint2 sideMasks = uint2(halfSamples.x, (halfSamples.y << 4)); int4 tOffsets = clamp((offsets.xyxy - int4(0,0,4,4)) << 3, -31, 31); - uint4 halfMasks = (tOffsets > 0 ? (~sideMasks.xyxy & horizontalMask.xyxy) << tOffsets : ~(sideMasks.xyxy >> -tOffsets)) & horizontalMask.xyxy; + uint4 halfMasks = uint4( tOffsets.x > 0 ? (~sideMasks.x & horizontalMask.x) << tOffsets.x : ~(sideMasks.x >> -tOffsets.x), + tOffsets.y > 0 ? (~sideMasks.y & horizontalMask.y) << tOffsets.y : ~(sideMasks.y >> -tOffsets.y), + tOffsets.z > 0 ? (~sideMasks.x & horizontalMask.x) << tOffsets.z : ~(sideMasks.x >> -tOffsets.z), + tOffsets.w > 0 ? (~sideMasks.y & horizontalMask.y) << tOffsets.w : ~(sideMasks.y >> -tOffsets.w)) & horizontalMask.xyxy; result = uint2(halfMasks.x | halfMasks.y, halfMasks.z | halfMasks.w); } diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl index 9335799273d..507461d22ce 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/GeometricTools.hlsl @@ -83,7 +83,7 @@ float IntersectRayAABBSimple(float3 start, float3 dir, float3 boxMin, float3 box float3 rbmin = (boxMin - start) * invDir; float3 rbmax = (boxMax - start) * invDir; - float3 rbminmax = (dir > 0.0) ? rbmax : rbmin; + float3 rbminmax = float3((dir.x > 0.0) ? rbmax.x : rbmin.x, (dir.y > 0.0) ? rbmax.y : rbmin.y, (dir.z > 0.0) ? rbmax.z : rbmin.z); return min(min(rbminmax.x, rbminmax.y), rbminmax.z); } @@ -266,7 +266,10 @@ bool4 CullFullTriangleAndEdgesFrustum(float3 p0, float3 p1, float3 p2, float eps edgesOutside.y = pointsOutside.x && pointsOutside.z; edgesOutside.z = pointsOutside.x && pointsOutside.y; - edgesOutsideXYZ_triangleOutsideW = edgesOutsideXYZ_triangleOutsideW || bool4(edgesOutside.xyz, all(pointsOutside)); + edgesOutsideXYZ_triangleOutsideW = bool4(edgesOutsideXYZ_triangleOutsideW.x || edgesOutside.x, + edgesOutsideXYZ_triangleOutsideW.y || edgesOutside.y, + edgesOutsideXYZ_triangleOutsideW.z || edgesOutside.z, + all(pointsOutside)); } return edgesOutsideXYZ_triangleOutsideW; diff --git a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl index 8b280972c3b..c765aa1d391 100644 --- a/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl +++ b/Packages/com.unity.render-pipelines.core/ShaderLibrary/Packing.hlsl @@ -65,7 +65,7 @@ float2 PackNormalOctQuadEncode(float3 n) // Optimized version of above code: n *= rcp(max(dot(abs(n), 1.0), 1e-6)); float t = saturate(-n.z); - return n.xy + (n.xy >= 0.0 ? t : -t); + return n.xy + float2(n.x >= 0.0 ? t : -t, n.y >= 0.0 ? t : -t); } float3 UnpackNormalOctQuadEncode(float2 f) @@ -77,7 +77,7 @@ float3 UnpackNormalOctQuadEncode(float2 f) // Optimized version of above code: float t = max(-n.z, 0.0); - n.xy += n.xy >= 0.0 ? -t.xx : t.xx; + n.xy += float2(n.x >= 0.0 ? -t : t, n.y >= 0.0 ? -t : t); return normalize(n); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Building-For-Consoles.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Building-For-Consoles.md deleted file mode 100644 index ca2f97ae6de..00000000000 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Building-For-Consoles.md +++ /dev/null @@ -1,16 +0,0 @@ -# Building your Project for consoles [[TODO: DELETE]] - -To build a Project for the **PlayStation 4**, **PlayStation 5**, **Game Core Xbox Series**, **Game Core Xbox One** or **Xbox One**, you need to install an additional package for each platform you want to support. The packages for each platform are: - -- **PlayStation 4**: com.unity.render-pipelines.ps4 -- **PlayStation 5**: com.unity.render-pipelines.ps5 -- **Xbox One**: com.unity.render-pipelines.xboxone -- **Game Core Xbox Series**: com.unity.render-pipelines.gamecore -- **Game Core Xbox One**: com.unity.render-pipelines.gamecore - -## Platform package installation - -To install a platform package, download it from the relevant platform developer forum (you cannot get these packages from the package registry or Package Manager). To do this: - -1. Download the package for the platform that your Project targets. You can find each package on its respective platform developer forum. The download link is in the same location as the Unity installer for that platform. -2. Use the Package Manager to install the package locally. For information on how to install local packages, see[ Installing a local package](https://docs.unity3d.com/Manual/upm-ui-local.html). diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Scripting.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Scripting.md index 49a507c5a9a..93d71b71f3d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Scripting.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Custom-Pass-Scripting.md @@ -179,7 +179,12 @@ Shader "Hidden/Outline" color = float4(CustomPassSampleCameraColor(posInput.positionNDC.xy, 0), 1); // When sampling RTHandle texture, always use _RTHandleScale.xy to scale your UVs first. - float2 uv = posInput.positionNDC.xy * _RTHandleScale.xy; + float2 scaling = _RTHandleScale.xy; + if (_CustomPassInjectionPoint == CUSTOMPASSINJECTIONPOINT_AFTER_POST_PROCESS) + scaling *= rcp(_DynamicResolutionFullscreenScale.xy); + + // When sampling RTHandle texture, always use _RTHandleScale.xy to scale your UVs first. + float2 uv = posInput.positionNDC.xy * scaling; float4 outline = SAMPLE_TEXTURE2D_X_LOD(_OutlineBuffer, s_linear_clamp_sampler, uv, 0); outline.a = 0; @@ -189,7 +194,7 @@ Shader "Hidden/Outline" // Search neighbors for (int i = 0; i < MAXSAMPLES; i++) { - float2 uvN = uv + _ScreenSize.zw * _RTHandleScale.xy * samplingPositions[i]; + float2 uvN = uv + _ScreenSize.zw * scaling * samplingPositions[i]; float4 neighbour = SAMPLE_TEXTURE2D_X_LOD(_OutlineBuffer, s_linear_clamp_sampler, uvN, 0); if (Luminance(neighbour) > luminanceThreshold) diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md index add0d682c4c..481c9c96ae7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md @@ -520,6 +520,10 @@ In HDRP, you can use [Custom Render Textures](https://docs.unity3d.com/Manual/cl You can also create complex effects like dynamic ripples and snow deformation wne you enable **Double Buffered**. +### Canvas Shader Graph + +Use the [Canvas ShaderGraph](canvas-material.md) to create custom [UGUI user interface elements](https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/UICanvas.html). + ### Graphics Compositor ![](Images/Compositor-HDRPTemplateWithLogo_Feature.png) diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md index 96d3a445749..3556ea09c70 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md @@ -52,7 +52,6 @@ The [Lens Flare](shared/lens-flare/lens-flare-component.md) samples include the ## Volumetric samples -![Volumetric Samples](Images/VolumetricSamples.png) The volumetric samples include a scene that contains multiple examples of [volumetric fog](create-a-local-fog-effect.md). This scene includes the following: - 3D textures. diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Projects.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Projects.md index d5813cb5508..b804920dc43 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Projects.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Projects.md @@ -14,7 +14,7 @@ https://github.com/Unity-Technologies/FontainebleauDemo This Project demonstrates how to use Photogrammetry to create game ready Assets. From Unity 2020.1, Fontainebleau will no longer receive updates; Unity 2019.4 is the last supported version. -Graphics Features used : +Graphics Features used: * Shader Graph (Wind animation) * Contact Shadows @@ -29,16 +29,15 @@ Relevant links : * [Siggraph 2017 - Photogrammetry workflow and the tech behind the de-lighting tool](https://www.youtube.com/watch?v=Ny9ZXt_2v2Y) - ## Spaceship https://github.com/Unity-Technologies/SpaceshipDemo ![Spaceship](Images/HDRPDemos-Spaceship.png) -This Project demonstrates how to use the Visual Effect Graph to create interactive AAA grade Visual Effects. +This project demonstrates how to use the Visual Effect Graph to create interactive AAA grade Visual Effects. -Graphics features used : +Graphics features used: * Visual Effect Graph * Volumetric fog @@ -59,9 +58,7 @@ https://github.com/Unity-Technologies/VRAlchemyLab ![VR Alchemy Lab](Images/HDRPDemos-VRAlchemyLab.png) -This Project shows the use of HDRP rendering features in the context of a VR interactive demo. - -Graphics features used : +This project demonstrates the following HDRP rendering features in the context of a VR interactive demo: * Visual Effect Graph * Shader Graph @@ -70,3 +67,17 @@ Graphics features used : * Custom Pass * Object Motion Blur * Decals + +## Water scenes + +https://github.com/Unity-Technologies/WaterScenes + +![Water Scenes](Images/HDRPDemos-Water.png) + +This project demonstrates the following HDRP Water System features: + +* Water System +* Visual Effect Graph +* Shader Graph +* Custom Render Texture +* Decals diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/CinematicHairShadingComparison.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/CinematicHairShadingComparison.png new file mode 100644 index 00000000000..8b6683b4be3 Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/CinematicHairShadingComparison.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRPDemos-Water.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRPDemos-Water.png new file mode 100644 index 00000000000..068a683886b Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRPDemos-Water.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRP_PathtracingAnisotropicFogAfter.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRP_PathtracingAnisotropicFogAfter.png new file mode 100644 index 00000000000..3f18d2f601d Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRP_PathtracingAnisotropicFogAfter.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRP_PathtracingAnisotropicFogBefore.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRP_PathtracingAnisotropicFogBefore.png new file mode 100644 index 00000000000..db0eb21de08 Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/HDRP_PathtracingAnisotropicFogBefore.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/LightPlacementTool.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/LightPlacementTool.png new file mode 100644 index 00000000000..cf1e19c037b Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/LightPlacementTool.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/SpeedTreeMotionVector-1.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/SpeedTreeMotionVector-1.png new file mode 100644 index 00000000000..a67997f8e5e Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/SpeedTreeMotionVector-1.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/SpeedTreeMotionVector-2.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/SpeedTreeMotionVector-2.png new file mode 100644 index 00000000000..f020ffefa9a Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/SpeedTreeMotionVector-2.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WaterSamples.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WaterSamples.png new file mode 100644 index 00000000000..6a0e6222e3e Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WaterSamples.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_LensFlareDataDriven_XR.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_LensFlareDataDriven_XR.png new file mode 100644 index 00000000000..25ca8ba249f Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_LensFlareDataDriven_XR.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_VolumetricFogDebug.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_VolumetricFogDebug.png new file mode 100644 index 00000000000..3f499c7853e Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_VolumetricFogDebug.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_pathtraceddecals.PNG b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_pathtraceddecals.PNG new file mode 100644 index 00000000000..8e524fc3e1e Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/WhatsNew16_pathtraceddecals.PNG differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/beer-shadow-maps.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/beer-shadow-maps.png new file mode 100644 index 00000000000..894802f1f4f Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/beer-shadow-maps.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/colorchecker.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/colorchecker.png new file mode 100644 index 00000000000..4949fcc89cb Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/colorchecker.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/colored_translucency.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/colored_translucency.png new file mode 100644 index 00000000000..4fd824b5d79 Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/colored_translucency.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/directional_pcss_after.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/directional_pcss_after.png new file mode 100644 index 00000000000..6fe908dafa7 Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/directional_pcss_after.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/directional_pcss_before.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/directional_pcss_before.png new file mode 100644 index 00000000000..e72ccd0d9a4 Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/directional_pcss_before.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/night-sky.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/night-sky.png new file mode 100644 index 00000000000..c047fda079c Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/night-sky.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/shader-graph-canvas.png b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/shader-graph-canvas.png new file mode 100644 index 00000000000..1a580510e3b Binary files /dev/null and b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Images/shader-graph-canvas.png differ diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2023.1-to-2023.2.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2023.1-to-2023.2.md index a7b7f1ec461..df88e53bba4 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2023.1-to-2023.2.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2023.1-to-2023.2.md @@ -4,8 +4,27 @@ In the High Definition Render Pipeline (HDRP), some features work differently be ## Adaptive Probe Volume -Starting from 2023.2, Probe Volume is the default choice for light probe system. +HDRP version 16 uses Probe Volumes for light probe systems by default. + +## LOD dithering + +HDRP 16 deprecates the `supportDitheringCrossFade` setting in the HDRP Asset. Instead, use the Quality Settings property `enableLODCrossFade`. +When you upgrade to 2023.2 HDRP automatically sets the Quality Settings property `enableLODCrossFade` to `True` if you enabled it in the HDRP Asset. + +## Decals in HDRP Path Tracer + +HDRP 16 includes path tracer decal rendering, which means you might need to increase the [Maximum Lights per Cell (Ray Tracing)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/HDRP-Asset.html#Lights) value and the size of the [decal atlas](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/HDRP-Asset.html#Decals) to render decals correctly. + +## Default Volume Profile + +The HDRP Default Volume defines the default values for the Default layer and all other volume layers. ## Light Baking -Starting from 2023.2, APV and lightmap bakes containing lights that are of type "Mixed" will now consider the "intensity multiplier" property, which was not taken into account previously. +From version 16, baked probe volumes and lightmaps that contain lights that use the **Mixed** mode take the **Intensity multiplier** property into account. + +## Volume Framework + +When you create a custom Volume component class that overrides the `VolumeComponent.Override(VolumeComponent state, float interpFactor)` method, your implementation must set the `VolumeParameter.overrideState` property to `true` whenever the `VolumeParameter` value is changed. This ensures that the Volume framework resets the parameters to their correct default values. This lets the framework to use fewer resources every frame which improves performance. + +For an example, refer to the [Override(VolumeComponent, float)](xref:UnityEngine.Rendering.VolumeParameter.overrideState) description. diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/reference-path-tracing.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/reference-path-tracing.md index 06f775a929b..d797c78927a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/reference-path-tracing.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/reference-path-tracing.md @@ -11,6 +11,7 @@ | **Maximum Depth** | Set the maximum number of light bounces in each path. You can not set this to be lower than Minimum Depth.
**Note**: You can set this and Minimum Depth to 1 if you only want to direct lighting. You can set them both to 2 if you only want to visualize indirect lighting (which is only visible on the second bounce). | | **Maximum Intensity** | Set a value to clamp the intensity of the light value each bounce returns. This avoids bright, isolated pixels in the final result.
**Note**: This property can make the final image dimmer, so if the result looks dark, increase the value of this property. | | **Sky Importance Sampling** | Set the sky sampling mode. Importance sampling favors the brightest directions, which is beneficial when using a sky model with high contrast and intense spots (like a sun, or street lights). On the other hand, it can be slightly detrimental when using a smooth, uniform sky. It's active by default for HDRI skies only, but can also be turned On and Off, regardless of the type of sky in use. | +| **Seed Mode** | Set how the path tracer generates random numbers. The seed is the pattern the noise has. When accumulating samples, every frame needs a different seed. Otherwise, the same noisy image gets accumulated over and over. **Seed Mode** has the following options:
• **Non Repeating**: The seed is chosen based on the camera frame count. When the accumulation resets, it is not reset to zero.
• **Repeating**: The seed is reset every time the accumulation is reset. Rendering of every image is done using the same random numbers. This is the default option.| | **Denoising** | Denoises the output of the the path tracer. This setting is only available when you install the **Unity Denoising** Package. **Denoising** has the following options:
• **None**: Does not denoise (this is the default option).
• **Intel Open Image Denoise** : Uses the Intel Open Image Denoise library to denoise the frame.
• **NVIDIA OptiX** : Uses NVIDIA OptiX to denoise the frame.

You can also enable the following additional settings:
• **Use AOVs** (Arbitrary Output Variables): Increases the amount of detail kept in the frame after HDRP denoises it.
• **Temporal**: Improves the temporal consistency of denoised frame sequences. | ![](Images/RayTracingPathTracing4.png) diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/whats-new-16.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/whats-new-16.md index b8d16645f02..ece08232328 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/whats-new-16.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/whats-new-16.md @@ -1,18 +1,177 @@ +> **Note**: This page contains information about HDRP’s 23.2 beta features which might change. + # What's new in HDRP version 16 / Unity 2023.2 This page contains an overview of new features, improvements, and issues resolved in version 16 of the High Definition Render Pipeline (HDRP), embedded in Unity 2023.2. ## Added +### Global Custom Pass API + +HDRP 16 adds new [Custom Pass Volume](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/api/UnityEngine.Rendering.HighDefinition.CustomPassVolume.html) scripting API. Use this API to register a custom pass without instantiating it in the scene. This new API is useful to make an effect active all the time or to control an effect using settings in a separate window. +To learn more about the new Global Custom Pass API, refer to [Global Custom Pass API](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/Global-Custom-Pass-API.html) documentation page. + +### Dynamic Resolution +HDRP 16 adds a [Dynamic Resolution](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/Dynamic-Resolution.html) component. + +### Colored translucent material Type + +![](Images/colored_translucency.png) + +HDRP 16 adds the Colored Translucent material type in Shader Graph. Use this material for thin, double-sided geometry. +This material supports a colored transmission mask and doesn't require a diffusion profile. + +### Cinematic Hair Shading + +HDRP 16 adds a cinematic mode for the physically-based hair shader. Enable this mode to trade performance for high-quality environment and area lighting with multiple scattering that closely matches a path-traced reference. + +![](Images/CinematicHairShadingComparison.png) + +This image shows hair with a single environment light without cinematic shading (left) and with cinematic shading (right). + +This feature requires the [Unity hair system](https://github.com/Unity-Technologies/com.unity.demoteam.hair). + + +### ShaderGraph + +HDRP 16 adds the [Canvas Master Node](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/master-stack-canvas.md) to Shader Graph that you can use to create UI shaders for a Canvas. + +![](Images/shader-graph-canvas.png) + +### Path tracer + +#### Decals in HDRP Path Tracer + +From version 16, the [HDRP Path Tracer](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual//Ray-Tracing-Path-Tracing.html) supports [Decals](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definitio@16.0/manual/manual/Decal.html). HDRP renders decals automatically when you enable path tracing. + +To support the decals with path tracing, HDRP regards all decals as clustered decals. This means that HDRP adds them to the [Ray Tracing Light Cluster](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/Ray-Tracing-Light-Cluster.html). If a scene includes many decals in a small volume, you might need to increase the following values: +- [Maximum Lights per Cell (Ray Tracing)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/HDRP-Asset.html#Lights). Futhermore, - The size of the [decal atlas](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/HDRP-Asset.html#Decals). + +The HDRP Path Tracer does not support emissive decals. + +![](Images/WhatsNew16_pathtraceddecals.PNG) +This image displays a puddle and checkerboard decal in a path-traced scene. + +#### Henyey-Greenstein Anisotropic Fog + +HDRP 16 supports path-traced anisotropic fog. The path tracer uses the Henyey-Greenstein phase function evaluation and sampling. This phase function has an anisotropy parameter that controls the behaviour of the scattering. You can set this parameter between -1 and 1. A negative value corresponds to backward scattering and a positive value corresponds to forward scattering. A value of 0 corresponds to the regular isotropic behavior. +Isotropic scattering (anisotropy=0) +![](Images/HDRP_PathtracingAnisotropicFogBefore.png) + +Anisotropic forward scattering (anisotropy=0.75) +![](Images/HDRP_PathtracingAnisotropicFogAfter.png) + +### Volumetric fog output + +In version 16, the [Volumetric fog shader graph](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/master-stack-fog-volume.html) supports Arbitrary output variable (AOV) output. + +### Color Checker Tool + +![](Images/colorchecker.png) + +Use the Color Checker tool to check the calibration of lighting and post processing. To open the color checker tool, go to **GameObject** > **Rendering** > **Color Checker Tool**. HDRP doesn't save any changes you make in the color checker. + +### Light Placement Tool + +![](Images/LightPlacementTool.png) + +Use the Light Placement Tool to look through a light and use the camera movement controls to move the light around the scene. +To enter this mode select a light GameObject and select the Light Placement Tool button in the Tools Panel. For more information, refer to [Light placement tool](lights-placement-tool.md). + +### HDRI Sky Sun Lock + +HDRP 16 adds the **lock sun** property to the HDRI Sky component. When you enable this property the sun automatically adjusts its rotation when you rotate the sky in the HDRI Sky Volume Override. If you change the sun rotation value in its transform component, the HDRI Sky also updates its rotation as well. + ## Updated -### Ray-Traced Reflections ReBLUR denoiser +### Night Sky + +HDRP 16 updates the Physically Based Sky in the following ways to make it easier to create a night sky: +- Added the PBRSky material type in Shader Graph to allow effects like procedural stars. +- Added an option to mark celestial bodies as moons which makes them receive lighting from the main directional light. + +![](Images/night-sky.png) + +### SpeedTrees + +HDRP 16 adds motion vector support for SpeedTrees. To do this, SpeedTree shader graphs use the Transmission Mask input of the Lit master node. This means that speedtrees with a single draw can also recieve vector transmission in the bark and branches. + +![](Images/SpeedTreeMotionVector-1.png) +![](Images/SpeedTreeMotionVector-2.png) + +### Shadows + +#### Percentage-Closer Soft Shadow (PCSS) +HDRP 16 improves Percentage-Closer Soft Shadow (PCSS) quality for directional. To do this, the shadow samples along a cone instead of a disk. This makes PCSS shadows appear softer. + +![](Images/directional_pcss_before.png) +PCSS shadows that sample a disc. +![](Images/directional_pcss_after.png) +PCSS shadows that sample a cone. + +#### Shadow quality +HDRP 16 adds a 0 Resolution option to shadows. Use this option to disable shadows based on quality level. + +Version 16 also splits the **Shadow Filtering Quality** property in the [HDRP Asset](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/HDRP-Asset.html) into the following properties: +- **Punctual Shadow Filtering Quality**. +- **Directional Shadow Filtering Quality**. + +#### Volumetric Clouds Shadows + +HDRP 16 updates the algorithm that it uses to render the volumetric clouds shadows. This fixes an issue where clouds cast shadows on objects above the clouds, and softens the shadows that clouds cast. + +![](Images/beer-shadow-maps.png) + +### Ray-Traced reflections ReBLUR denoiser + ![](Images/WhatsNew16_ReBLUR_Denoiser.png) -Starting from HDRP 16, the Ray-Traced Reflections denoiser has been updated based on the ReBLUR implementation. This new algorithm now includes an anti-flickering setting that improves temporal stability and renders more coherent results from rough to smooth objects. -This new denoiser is used in Raytracing Mode and Mixed Mode and completely replace the previous version. +HDRP 16 replaces the Ray-Traced Reflections denoiser with the ReBLUR algorithm. This algorithm includes an anti-flickering setting that improves temporal stability and gives a more even result on rough and smooth objects. +Ray-Traced Reflections uses this denoiser in **Raytracing** mode and **Mixed** mode. + +### Disable Planar Probe reflection + +In HDRP 16 Reflection, the Planar Probe **Resolution** property has a 0 Resolution option. When you select this property for a quality level, the probe doesn't render reflections on that quality level. + +### Probe Volume + +From version 16ayou can stream probe volume data directly from a disk. To use disk streaming, enable GPU streaming to be enabled. This reduces the amount of CPU memory probe volumes use. + +For more information, refer to [Probe volume streaming](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/probevolumes-streaming.html). + +### Water System +![](Images/WaterSamples.png) + +HDRP 16.0 makes the following improvements to the water system: +* Improves performance for rendering surfaces with Instanced Quads. +* Adds an option to disable tessellation. +* Improves interactions between refractive and non-refractive transparent materials. This means that you can see transparent materials that are below a water surface in the pre-refraction pass. +* Fixes how Transparent surfaces receive underwater absorption. +* Adds a set of sample scenes to the [package manager](HDRP-Sample-Content.html#water-samples). +* Adds the [Water Scenes](https://github.com/Unity-Technologies/WaterScenes) [sample project](HDRP-Sample-Projects.html#water-scenes). + +### Data Driven Lens Flare XR support + +![](Images/WhatsNew16_LensFlareDataDriven_XR.png) + +HDRP 16 adds [XR](https://docs.unity3d.com/Manual/xr-graphics.html) support to the data-driven Lens Flare component. This includes single pass instancing and multipass support. + +### Volumetric fog fullscreen debug mode + +HDRP 16 adds a Volumetric Fog fullscreen debug mode to the [rendering debugger](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/Render-Pipeline-Debug-Window.html). This mode displays the fog that affects the opaque geometry. You can control how the fog appears in the debug mode's **Exposure** property. t. + +![](Images/WhatsNew16_VolumetricFogDebug.png) + +### Render Graph Viewer + +Version 16 adds a checkbox to display dependencies between asynchronous passes. When you enable this property, hover over a pass to highlight the last pass on which it depends and the first pass that depends on it. + +### HDR screen + +HDRP 16 updates its [HDR display](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@16.0/manual/HDR-Output.html) support to include XR devices that have a HDR display. ### Decals -HDRP 16.0 adds support for [Decal Master Stack](decal-master-stack-reference.md) to affect transparent objects. The result of the shader graph is stored within the same decal atlas as [Decal Shader](decal-material-inspector-reference.md) materials. -In addition through the **Transparent Dynamic Update** setting within the decal shader graphs it is now possible to animate the decal within the atlas. +In HDRP 16.0, the [Decal Master Stack](master-stack-decal.md) can affect transparent objects. The result of a decal shader graph exists in the same decal atlas as [Decal Shader](Decal-Shader.md) materials. +You can also use the **Transparent Dynamic Update** setting in a decal shader graph to animate a decal inside the decal atlas. + diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs index 8168a3ba43e..f62b84767f2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs @@ -169,9 +169,10 @@ static HDLightUI() CED.AdditionalPropertiesFoldoutGroup(LightUI.Styles.shadowHeader, Expandable.Shadows, k_ExpandedState, AdditionalProperties.Shadow, k_AdditionalPropertiesState, CED.Group( CED.Group( - CED.AdditionalPropertiesFoldoutGroup(s_Styles.shadowMapSubHeader, Expandable.ShadowMap, k_ExpandedState, AdditionalProperties.Shadow, k_AdditionalPropertiesState, - DrawShadowMapContent, DrawShadowMapAdditionalContent, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd)), - CED.space, + + CED.AdditionalPropertiesFoldoutGroup(s_Styles.shadowMapSubHeader, Expandable.ShadowMap, k_ExpandedState, AdditionalProperties.Shadow, k_AdditionalPropertiesState, + DrawShadowMapContent, DrawShadowMapAdditionalContent, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd)), + CED.Conditional((serialized, owner) => !isArea(serialized) && k_AdditionalPropertiesState[AdditionalProperties.Shadow] && HasPunctualShadowQualitySettingsUI(HDShadowFilteringQuality.High, serialized, owner), CED.FoldoutGroup(s_Styles.highShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawHighShadowSettingsContent)), CED.Conditional((serialized, owner) => !isArea(serialized) && HasPunctualShadowQualitySettingsUI(HDShadowFilteringQuality.Medium, serialized, owner), @@ -190,9 +191,9 @@ static HDLightUI() CED.FoldoutGroup(s_Styles.highShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawHighShadowSettingsContent)), CED.Conditional((serialized, owner) => isArea(serialized) && HasAreaShadowQualitySettingsUI(HDAreaShadowFilteringQuality.Medium, serialized, owner), CED.FoldoutGroup(s_Styles.mediumShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawMediumShadowSettingsContent)), + CED.Conditional((serialized, owner) => !isArea(serialized), - CED.FoldoutGroup(s_Styles.contactShadowsSubHeader, Expandable.ContactShadow, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd, DrawContactShadowsContent) - ) + CED.FoldoutGroup(s_Styles.contactShadowsSubHeader, Expandable.ContactShadow, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd, DrawContactShadowsContent)) ), CED.noop //will only add parameter in first sub header ), @@ -1632,12 +1633,13 @@ static void DrawBakedShadowsContent(SerializedHDLight serialized, Editor owner) static bool HasPunctualShadowQualitySettingsUI(HDShadowFilteringQuality quality, SerializedHDLight serialized, Editor owner) { - // Handle quality where there is nothing to draw directly here - // No PCSS for now with directional light - if (quality == HDShadowFilteringQuality.Medium || quality == HDShadowFilteringQuality.Low) + var lightType = serialized.settings.lightType.GetEnumValue(); + if (lightType != LightType.Point && lightType != LightType.Spot && lightType != LightType.Pyramid && lightType != LightType.Box) return false; - // Draw shadow settings using the current shadow algorithm + // Need to test quality here to not display an empty foldout + if (quality == HDShadowFilteringQuality.Medium || quality == HDShadowFilteringQuality.Low) + return false; HDShadowInitParameters hdShadowInitParameters = HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams; return hdShadowInitParameters.punctualShadowFilteringQuality == quality; @@ -1645,12 +1647,12 @@ static bool HasPunctualShadowQualitySettingsUI(HDShadowFilteringQuality quality, static bool HasDirectionalShadowQualitySettingsUI(HDShadowFilteringQuality quality, SerializedHDLight serialized, Editor owner) { - // Handle quality where there is nothing to draw directly here - // No PCSS for now with directional light - if (quality == HDShadowFilteringQuality.Medium || quality == HDShadowFilteringQuality.Low) + if (serialized.settings.lightType.GetEnumValue() != LightType.Directional) return false; - // Draw shadow settings using the current shadow algorithm + // Need to test quality here to not display an empty foldout + if (quality == HDShadowFilteringQuality.Medium || quality == HDShadowFilteringQuality.Low) + return false; HDShadowInitParameters hdShadowInitParameters = HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams; return hdShadowInitParameters.directionalShadowFilteringQuality == quality; @@ -1658,12 +1660,12 @@ static bool HasDirectionalShadowQualitySettingsUI(HDShadowFilteringQuality quali static bool HasAreaShadowQualitySettingsUI(HDAreaShadowFilteringQuality quality, SerializedHDLight serialized, Editor owner) { - // Handle quality where there is nothing to draw directly here - // No PCSS for now with directional light - if (quality == HDAreaShadowFilteringQuality.Medium) + if (!serialized.settings.lightType.GetEnumValue().IsArea()) return false; - // Draw shadow settings using the current shadow algorithm + // Need to test quality here to not display an empty foldout + if (quality == HDAreaShadowFilteringQuality.Medium) + return false; HDShadowInitParameters hdShadowInitParameters = HDRenderPipeline.currentAsset.currentPlatformRenderPipelineSettings.hdShadowInitParams; return hdShadowInitParameters.areaShadowFilteringQuality == quality; @@ -1672,13 +1674,13 @@ static bool HasAreaShadowQualitySettingsUI(HDAreaShadowFilteringQuality quality, static void DrawLowShadowSettingsContent(SerializedHDLight serialized, Editor owner) { // Currently there is nothing to display here - // when adding something, update IsShadowSettings + // when adding something, update HasDirectionalShadowQualitySettingsUI, HasPunctualShadowQualitySettingsUI and HasAreaShadowQualitySettingsUI } static void DrawMediumShadowSettingsContent(SerializedHDLight serialized, Editor owner) { // Currently there is nothing to display here - // when adding something, update IsShadowSettings + // when adding something, update HasDirectionalShadowQualitySettingsUI, HasPunctualShadowQualitySettingsUI and HasAreaShadowQualitySettingsUI } static void DrawHighShadowSettingsContent(SerializedHDLight serialized, Editor owner) diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs index 99d3ddf2ade..709f3e610c0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDProbeUI.Drawers.cs @@ -519,20 +519,20 @@ static internal bool IsHighestSettingForCubeResolution() CubeReflectionResolution highestResolution = highestTierInCurrent; //Iterate over every quality setting to check their settings for the cubemap resolution - QualitySettings.ForEach(() => + for (int i = 0; i < QualitySettings.count; ++i) { - HDRenderPipelineAsset asset = QualitySettings.renderPipeline as HDRenderPipelineAsset; - if(asset != null) + var asset = QualitySettings.GetRenderPipelineAssetAt(i) as HDRenderPipelineAsset; + if (asset != null) { //Iterate through reflection cube map quality tiers CubeReflectionResolution highestInTier = GetHighestCubemapResolutionSetting(asset.currentPlatformRenderPipelineSettings); - if(highestInTier > highestResolution) + if (highestInTier > highestResolution) { highestResolution = highestInTier; } } - }); + } return highestResolution == highestTierInCurrent; } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitSubTarget.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitSubTarget.cs index 277e42f1e9d..0caba78de86 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitSubTarget.cs @@ -290,7 +290,9 @@ protected override int ComputeMaterialNeedsUpdateHash() unchecked { - hash = hash * 23 + litData.materialTypeMask.GetHashCode(); + // hash must be 0 by default when we create a ShaderGraph, otherwise it's dirty when opened for the first time. + int h = (int)litData.materialTypeMask - (int)HDLitData.MaterialTypeMask.Standard; + hash = hash * 23 + h; } return hash; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs index ba07d67e6db..539051442e8 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDBlockFields.cs @@ -14,6 +14,8 @@ public struct VertexDescription public static BlockFieldDescriptor CustomVelocity = new BlockFieldDescriptor(VertexDescription.name, "CustomVelocity", "Velocity", "VERTEXDESCRIPTION_CUSTOMVELOCITY", new Vector3Control(new Vector3(0.0f, 0.0f, 0.0f)), ShaderStage.Vertex); + public static BlockFieldDescriptor Width = new BlockFieldDescriptor(VertexDescription.name, "Width", "Width", "VERTEXDESCRIPTION_WIDTH", new FloatControl(0.08f), ShaderStage.Vertex); + // TODO: In the future we may have proper ShaderStage for tessellation, this will need to be revisit then public static BlockFieldDescriptor TessellationFactor = new BlockFieldDescriptor(VertexDescription.name, "TessellationFactor", "Tessellation Factor", "VERTEXDESCRIPTION_TESSELLATIONFACTOR", new FloatControl(1.0f), ShaderStage.Vertex); @@ -198,12 +200,6 @@ public partial struct SurfaceDescription new FloatControl(0.0f), ShaderStage.Fragment); public static BlockFieldDescriptor IridescenceCoatFixupTIRClamp = new BlockFieldDescriptor(SurfaceDescription.name, "IridescenceCoatFixupTIRClamp", "Iridescence Coat Fixup TIR Clamp", "SURFACEDESCRIPTION_IRIDESCENCECOATFIXUPTIRCLAMP", new FloatControl(0.0f), ShaderStage.Fragment); - - // -------------------------------------------------- - // Line Rendering - - public static BlockFieldDescriptor LineWidth = new BlockFieldDescriptor(SurfaceDescription.name, "LineWidth", - "Width", "SURFACEDESCRIPTION_WIDTH", new FloatControl(1.0f), ShaderStage.Fragment); } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDFields.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDFields.cs index b7bd7c11861..5bb404cee68 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDFields.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/HDFields.cs @@ -74,9 +74,6 @@ static class HDFields public static FieldDescriptor TessellationDisplacement = new FieldDescriptor(string.Empty, "TessellationDisplacement", "_TESSELLATION_DISPLACEMENT 1"); public static FieldDescriptor GraphTessellation = new FieldDescriptor(kFeatures, "graphTessellation", "FEATURES_GRAPH_TESSELLATION"); - // Line Rendering - public static FieldDescriptor LineWidth = new FieldDescriptor(string.Empty, "LineWidth", string.Empty); - #endregion } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/LightingSubTarget.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/LightingSubTarget.cs index f116e133624..5ae28ac0a79 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/LightingSubTarget.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/LightingSubTarget.cs @@ -62,7 +62,7 @@ protected override int ComputeMaterialNeedsUpdateHash() unchecked { hash = hash * 23 + builtinData.alphaTestShadow.GetHashCode(); - hash = hash * 23 + lightingData.receiveSSR.GetHashCode(); + hash = hash * 23 + (!lightingData.receiveSSR).GetHashCode(); hash = hash * 23 + lightingData.receiveSSRTransparent.GetHashCode(); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceSubTarget.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceSubTarget.cs index 83783aec5ac..a91a3a7be77 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceSubTarget.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/SurfaceSubTarget.cs @@ -255,7 +255,6 @@ public override void GetFields(ref TargetFieldContext context) context.AddField(HDFields.TessellationFactor, systemData.tessellation); context.AddField(HDFields.TessellationDisplacement, systemData.tessellation); - context.AddField(HDFields.LineWidth, target.supportLineRendering); } protected void AddDistortionFields(ref TargetFieldContext context) @@ -298,7 +297,7 @@ public override void GetActiveBlocks(ref TargetActiveBlockContext context) context.AddBlock(HDBlockFields.VertexDescription.TessellationFactor, systemData.tessellation); context.AddBlock(HDBlockFields.VertexDescription.TessellationDisplacement, systemData.tessellation); - context.AddBlock(HDBlockFields.SurfaceDescription.LineWidth, target.supportLineRendering); + context.AddBlock(HDBlockFields.VertexDescription.Width, target.supportLineRendering); } protected void AddDistortionBlocks(ref TargetActiveBlockContext context) diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/Kernels/VertexSetup.template b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/Kernels/VertexSetup.template index 048904343a3..c2af6eee7c2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/Kernels/VertexSetup.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/Kernels/VertexSetup.template @@ -1,7 +1,5 @@ $splice(PassPragmas) -#pragma multi_compile _FORCE_DISABLE_TANGENT_STREAM - // TODO: Keywords (shader_feature) incompatible with compute $splice(GraphKeywords) @@ -151,18 +149,98 @@ RWByteAddressBuffer _CounterBuffer; void BuildStrandBasis(uint i, float3 positionOS, out float3 normalOS, out float4 tangentOS) { -#if !defined(_FORCE_DISABLE_TANGENT_STREAM) - // TODO: Handle tangent flip float3 vertexBitangentOS = normalize(LOAD_ATTRIBUTE_FLOAT4(Tangent, i).xyz); tangentOS = float4(normalize(cross(vertexBitangentOS, GetWorldSpaceNormalizeViewDir(positionOS))), 0); normalOS = cross(tangentOS.xyz, vertexBitangentOS); +} + +float2 ClipSpaceToScreenSpace(float4 positionCS) +{ + return _ScreenParams.xy * (0.5 + 0.5 * (positionCS.xy / positionCS.w)); +} + +// Bound by the rasterizer. +float _LOD; + +// Light-weight VertMesh since we need to process a dilated world space position to compute screen-space width. +VaryingsMeshType SimpleVertMesh(AttributesMesh input, out float screenSpaceWidth) +{ + VaryingsMeshType output; + + // Deduce the actual instance ID of the current instance (it is then stored in unity_InstanceID) + UNITY_SETUP_INSTANCE_ID(input); + + // Transfer the unprocessed instance ID to the next stage + UNITY_TRANSFER_INSTANCE_ID(input, output); + +#ifdef HAVE_MESH_MODIFICATION + input = ApplyMeshModification(input, _TimeParameters.xyz); +#endif + + float3 positionRWS = TransformObjectToWorld(input.positionOS); +#ifdef ATTRIBUTES_NEED_NORMAL + float3 normalWS = TransformObjectToWorldNormal(input.normalOS); #else - // Force disable attribute loading for streams that do not exist in the mesh. - // We need to do it like this instead of #undef ATTRIBUTE_TANGENT etc. because the user shader graph might later override - // the tangent or normal. - tangentOS = float4(1, 0, 0, 0); - normalOS = float3(0, 0, 1); + float3 normalWS = float3(0.0, 0.0, 0.0); +#endif + +#ifdef ATTRIBUTES_NEED_TANGENT + float4 tangentWS = float4(TransformObjectToWorldDir(input.tangentOS.xyz), input.tangentOS.w); +#endif + +#ifdef VARYINGS_NEED_POSITION_WS + output.positionRWS = positionRWS; +#endif +#ifdef VARYINGS_NEED_POSITIONPREDISPLACEMENT_WS + output.positionPredisplacementRWS = positionRWS; +#endif + + output.positionCS = TransformWorldToHClip(positionRWS); +#ifdef VARYINGS_NEED_TANGENT_TO_WORLD + output.normalWS = normalWS; + output.tangentWS = tangentWS; +#endif +#if !defined(SHADER_API_METAL) && defined(SHADERPASS) && (SHADERPASS == SHADERPASS_FULL_SCREEN_DEBUG) + if (_DebugFullScreenMode == FULLSCREENDEBUGMODE_VERTEX_DENSITY) + IncrementVertexDensityCounter(output.positionCS); +#endif + +#if defined(VARYINGS_NEED_TEXCOORD0) || defined(VARYINGS_DS_NEED_TEXCOORD0) + output.texCoord0 = input.uv0; +#endif +#if defined(VARYINGS_NEED_TEXCOORD1) || defined(VARYINGS_DS_NEED_TEXCOORD1) + output.texCoord1 = input.uv1; +#endif +#if defined(VARYINGS_NEED_TEXCOORD2) || defined(VARYINGS_DS_NEED_TEXCOORD2) + output.texCoord2 = input.uv2; #endif +#if defined(VARYINGS_NEED_TEXCOORD3) || defined(VARYINGS_DS_NEED_TEXCOORD3) + output.texCoord3 = input.uv3; +#endif +#if defined(VARYINGS_NEED_COLOR) || defined(VARYINGS_DS_NEED_COLOR) + output.color = input.color; +#endif + + // Compute screen-space width. + { + // Lazily re-evaluate the graph. Will the compiler optimize this? + VertexDescription vertexDescription = GetVertexDescription(input, _TimeParameters.xyz); + + // Extract the world space up direction from the view matrix. + const float3 cameraUpWS = UNITY_MATRIX_V._21_22_23; + + // Produce a dilated world space position using the vertice's specified width (in cm). + float3 dilatedPositionWS = positionRWS + (METERS_PER_CENTIMETER * vertexDescription.Width) * cameraUpWS; + + // Clip -> Screen Space + const float2 positionSS0 = ClipSpaceToScreenSpace(output.positionCS); + const float2 positionSS1 = ClipSpaceToScreenSpace(TransformWorldToHClip(dilatedPositionWS)); + + // Compute the length of the derivative between position SS and postion + width SS + screenSpaceWidth = distance(positionSS0, positionSS1); + } + + return output; } int _VertexOffset; @@ -177,42 +255,28 @@ void VertexSetup (uint3 dispatchThreadID : SV_DispatchThreadID) // Construct the input vertex. AttributesMesh inputMesh; - { - ZERO_INITIALIZE(AttributesMesh, inputMesh); - inputMesh.positionOS = LOAD_ATTRIBUTE_FLOAT3(Position, i); + ZERO_INITIALIZE(AttributesMesh, inputMesh); + inputMesh.positionOS = LOAD_ATTRIBUTE_FLOAT3(Position, i); + #if defined(ATTRIBUTES_NEED_NORMAL) || defined(ATTRIBUTES_NEED_TANGENT) - BuildStrandBasis(i, inputMesh.positionOS, inputMesh.normalOS, inputMesh.tangentOS); + BuildStrandBasis(i, inputMesh.positionOS, inputMesh.normalOS, inputMesh.tangentOS); #endif -#ifdef ATTRIBUTES_NEED_TEXCOORD0 - inputMesh.uv0 = LOAD_ATTRIBUTE_FLOAT(TexCoord0, i); -#endif -#ifdef ATTRIBUTES_NEED_TEXCOORD1 - // Demo team hair package stores the UV in the upper 16 bits. - const uint mask = 0xFFFF << 16; - - // Manually decode the UNORM value back into a float. - uint texCoord1 = LOAD_ATTRIBUTE_UINT(TexCoord1, i); - - // Mask out the lower bits. - texCoord1 &= mask; - // Retrieve a decimal value. - inputMesh.uv1 = texCoord1 / float(mask); -#endif -#ifdef ATTRIBUTES_NEED_TEXCOORD2 - // TODO -#endif -#ifdef ATTRIBUTES_NEED_TEXCOORD3 - // TODO -#endif -#ifdef ATTRIBUTES_NEED_COLOR - // TODO +#ifdef ATTRIBUTES_NEED_TEXCOORD0 + const uint unnormalizedPackedID = LOAD_ATTRIBUTE_UINT(TexCoord0, i); + + inputMesh.uv0 = float4 + ( + ((unnormalizedPackedID >> 0) & 0xFF) / 255.0, + ((unnormalizedPackedID >> 8) & 0xFF) / 255.0, + ((unnormalizedPackedID >> 16) & 0xFF) / 255.0, + ((unnormalizedPackedID >> 24) & 0xFF) / 255.0 + ); #endif - } #if UNITY_ANY_INSTANCING_ENABLED // See: [NOTE-HQ-LINES-SINGLE-PASS-STEREO] - inputMesh.instanceID = _ViewIndex; // TODO: View index. + inputMesh.instanceID = _ViewIndex; #endif AttributesPass inputPass; @@ -221,10 +285,11 @@ void VertexSetup (uint3 dispatchThreadID : SV_DispatchThreadID) VaryingsType output; ZERO_INITIALIZE(VaryingsType, output); - output.vmesh = VertMesh(inputMesh); + float screenSpaceWidth; + output.vmesh = SimpleVertMesh(inputMesh, screenSpaceWidth); + output = MotionVectorVS_Internal(output, inputMesh, inputPass); - // Store the clip space position for now (should be every interpolator). VertexRecord vertexRecord; ZERO_INITIALIZE(VertexRecord, vertexRecord); { @@ -237,11 +302,9 @@ void VertexSetup (uint3 dispatchThreadID : SV_DispatchThreadID) vertexRecord.previousPositionCS = output.vpass.previousPositionCS; #ifdef VARYINGS_NEED_TEXCOORD0 - vertexRecord.texCoord0 = output.vmesh.texCoord0.x; -#endif -#ifdef VARYINGS_NEED_TEXCOORD1 - vertexRecord.texCoord1 = output.vmesh.texCoord1.y; + vertexRecord.texCoord0 = unnormalizedPackedID; #endif + #ifdef VARYINGS_NEED_TANGENT_TO_WORLD vertexRecord.normalWS = output.vmesh.normalWS; vertexRecord.tangentWS = output.vmesh.tangentWS.xyz; @@ -250,7 +313,10 @@ void VertexSetup (uint3 dispatchThreadID : SV_DispatchThreadID) const uint offset = _VertexOffset + i; _Vertex0RecordBuffer.Store4(offset << 4, asuint(vertexRecord.positionCS)); - _Vertex1RecordBuffer.Store4(offset << 4, asuint(vertexRecord.previousPositionCS)); + + // Perspective divide the previous position here since we dont need it for clipping and it frees up space for the line width attribute. + const float3 previousPosition = vertexRecord.previousPositionCS.xyz * rcp(vertexRecord.previousPositionCS.w); + _Vertex1RecordBuffer.Store4(offset << 4, asuint(float4(previousPosition, screenSpaceWidth))); #ifdef VARYINGS_NEED_TANGENT_TO_WORLD const uint2 encodedN = asuint(PackNormalOctQuadEncode(vertexRecord.normalWS)); @@ -258,7 +324,7 @@ void VertexSetup (uint3 dispatchThreadID : SV_DispatchThreadID) _Vertex2RecordBuffer.Store4(offset << 4, uint4(encodedN, encodedT)); #endif -#if defined(VARYINGS_NEED_TEXCOORD0) || defined(VARYINGS_NEED_TEXCOORD1) - _Vertex3RecordBuffer.Store2(8 * offset, asuint(float2(vertexRecord.texCoord0, vertexRecord.texCoord1))); +#if defined(VARYINGS_NEED_TEXCOORD0) + _Vertex3RecordBuffer.Store2(8 * offset, uint2(vertexRecord.texCoord0, 0)); #endif } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/ShaderPass.template b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/ShaderPass.template index 69c0138f5c2..3276ff76269 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/ShaderPass.template +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Material/ShaderGraph/Templates/ShaderPass.template @@ -350,10 +350,6 @@ Pass $SurfaceDescription.VTPackedFeedback: builtinData.vtPackedFeedback = surfaceDescription.VTPackedFeedback; #endif - #ifdef LINE_RENDERING_OFFSCREEN_SHADING - $SurfaceDescription.LineWidth: builtinData.lineWidth = surfaceDescription.LineWidth; - #endif - #if _DEPTHOFFSET_ON builtinData.depthOffset = surfaceDescription.DepthOffset; #endif diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsEditor.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsEditor.cs index 1a6d54f179d..15990daf032 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsEditor.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsEditor.cs @@ -32,6 +32,7 @@ internal class SerializedHDAdditionalMeshRendererSettings public SerializedProperty rendererLODMode; public SerializedProperty rendererLODFixed; public SerializedProperty rendererLODCameraDistanceCurve; + public SerializedProperty rendererLODScreenCoverageCurve; public SerializedProperty shadingSampleFraction; public SerializedHDAdditionalMeshRendererSettings(SerializedObject serializedObject) @@ -42,6 +43,7 @@ public SerializedHDAdditionalMeshRendererSettings(SerializedObject serializedObj rendererLODFixed = serializedObject.Find((HDAdditionalMeshRendererSettings d) => d.rendererLODFixed); rendererGroup = serializedObject.Find((HDAdditionalMeshRendererSettings d) => d.rendererGroup); rendererLODCameraDistanceCurve = serializedObject.Find((HDAdditionalMeshRendererSettings d) => d.rendererLODCameraDistanceCurve); + rendererLODScreenCoverageCurve = serializedObject.Find((HDAdditionalMeshRendererSettings d) => d.rendererLODScreenCoverageCurve); shadingSampleFraction = serializedObject.Find((HDAdditionalMeshRendererSettings d) => d.shadingSampleFraction); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsUI.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsUI.cs index 9c134e50553..4599ba85b49 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsUI.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/HDAdditionalMeshRendererSettingsUI.cs @@ -15,7 +15,10 @@ public static class Styles public static GUIContent lineRenderingGroup { get; } = EditorGUIUtility.TrTextContent("Group"); public static GUIContent lineRenderingLODMode { get; } = EditorGUIUtility.TrTextContent("LOD Mode"); public static GUIContent lineRenderingLODFixed { get; } = EditorGUIUtility.TrTextContent("Fixed LOD"); - public static GUIContent lineRenderingLODCurve { get; } = EditorGUIUtility.TrTextContent("Camera Distance LOD"); + + public static GUIContent lineRenderingCameraDistanceLODCurve { get; } = EditorGUIUtility.TrTextContent("Camera Distance LOD"); + + public static GUIContent lineRenderingScreenCoverageLODCurve { get; } = EditorGUIUtility.TrTextContent("Screen Coverage LOD"); public static GUIContent lineRenderingShadingSampleFraction { get; } = EditorGUIUtility.TrTextContent("Shading Fraction"); } @@ -85,10 +88,18 @@ internal static void Drawer_LineRendering(SerializedHDAdditionalMeshRendererSett { using (new EditorGUI.IndentLevelScope()) { - if (serialized.rendererLODMode.enumValueIndex == (int)LineRendering.RendererLODMode.Fixed) - EditorGUILayout.PropertyField(serialized.rendererLODFixed, Styles.lineRenderingLODFixed); - else - EditorGUILayout.PropertyField(serialized.rendererLODCameraDistanceCurve, Styles.lineRenderingLODCurve); + switch (serialized.rendererLODMode.enumValueIndex) + { + case (int)LineRendering.RendererLODMode.Fixed: + EditorGUILayout.PropertyField(serialized.rendererLODFixed, Styles.lineRenderingLODFixed); + break; + case (int)LineRendering.RendererLODMode.CameraDistance: + EditorGUILayout.PropertyField(serialized.rendererLODCameraDistanceCurve, Styles.lineRenderingCameraDistanceLODCurve); + break; + case (int)LineRendering.RendererLODMode.ScreenCoverage: + EditorGUILayout.PropertyField(serialized.rendererLODScreenCoverageCurve, Styles.lineRenderingScreenCoverageLODCurve); + break; + } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs index 94b705dc4df..993059dd5d1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/PathTracing/PathTracingEditor.cs @@ -24,6 +24,7 @@ class PathTracingEditor : VolumeComponentEditor SerializedDataParameter m_MaxDepth; SerializedDataParameter m_MaxIntensity; SerializedDataParameter m_SkyImportanceSampling; + SerializedDataParameter m_SeedMode; SerializedDataParameter m_Denoising; SerializedDataParameter m_UseAOV; SerializedDataParameter m_Temporal; @@ -44,6 +45,7 @@ public override void OnEnable() m_MaxDepth = Unpack(o.Find(x => x.maximumDepth)); m_MaxIntensity = Unpack(o.Find(x => x.maximumIntensity)); m_SkyImportanceSampling = Unpack(o.Find(x => x.skyImportanceSampling)); + m_SeedMode = Unpack(o.Find(x => x.seedMode)); #if UNITY_64 && ENABLE_UNITY_DENOISING_PLUGIN && UNITY_EDITOR_WIN m_Denoising = Unpack(o.Find(x => x.denoising)); @@ -80,6 +82,7 @@ public override void OnInspectorGUI() PropertyField(m_MaxDepth); PropertyField(m_MaxIntensity); PropertyField(m_SkyImportanceSampling); + PropertyField(m_SeedMode); #if UNITY_64 && ENABLE_UNITY_DENOISING_PLUGIN && UNITY_EDITOR_WIN PropertyField(m_Denoising); var denoiserType = m_Denoising.value.GetEnumValue(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/DefaultSettingsVolumeProfile.asset b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/DefaultSettingsVolumeProfile.asset index ea529d24610..f3e29f69302 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/DefaultSettingsVolumeProfile.asset +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipelineResources/DefaultSettingsVolumeProfile.asset @@ -159,6 +159,7 @@ MonoBehaviour: - {fileID: -7089757308646879465} - {fileID: -8770122170507510650} - {fileID: 4981354747274665315} + - {fileID: 5305602202033311358} --- !u!114 &448115243408767295 MonoBehaviour: m_ObjectHideFlags: 3 @@ -415,18 +416,6 @@ MonoBehaviour: material: m_OverrideState: 1 m_Value: {fileID: -876546973899608171, guid: 02532cbb810fb404db49da84f1efe41e, type: 3} - sphericalMode: - m_OverrideState: 0 - m_Value: 1 - seaLevel: - m_OverrideState: 0 - m_Value: 0 - planetaryRadius: - m_OverrideState: 0 - m_Value: 6378100 - planetCenterPosition: - m_OverrideState: 0 - m_Value: {x: 0, y: -6378100, z: 0} airDensityR: m_OverrideState: 0 m_Value: 0.04534 @@ -503,6 +492,46 @@ MonoBehaviour: m_ObsoleteEarthPreset: m_OverrideState: 0 m_Value: 1 + sphericalMode: + m_OverrideState: 0 + m_Value: 1 + seaLevel: + m_OverrideState: 0 + m_Value: 0 + planetaryRadius: + m_OverrideState: 0 + m_Value: 6378100 + planetCenterPosition: + m_OverrideState: 0 + m_Value: {x: 0, y: -6378100, z: 0} +--- !u!114 &5305602202033311358 +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: 8c604242b4dd4c8caa4d1944b94189e0, type: 3} + m_Name: HighQualityLineRenderingVolumeComponent + m_EditorClassIdentifier: + active: 1 + enable: + m_OverrideState: 1 + m_Value: 1 + compositionMode: + m_OverrideState: 1 + m_Value: 0 + clusterCount: + m_OverrideState: 1 + m_Value: 24 + sortingQuality: + m_OverrideState: 1 + m_Value: 1 + tileOpacityThreshold: + m_OverrideState: 1 + m_Value: 0.95 --- !u!114 &5315503232242033309 MonoBehaviour: m_ObjectHideFlags: 3 diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/ColorCheckerToolEditor.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/ColorCheckerToolEditor.cs index 4011355550a..14e4a5a8efc 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/ColorCheckerToolEditor.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Tools/ColorCheckerToolEditor.cs @@ -15,10 +15,12 @@ ///
public class ColorCheckerToolEditor : Editor { - - private static readonly string UXMLPath = "ColorCheckerUI"; - List Modes = new List() { "Color Palette", "Cross Polarized Grayscale", "Middle Gray","Reflection","Stepped Luminance", "Material Palette", "External Texture" };//Displayed names for the color checker modes + + private void OnEnable() + { + var self = (ColorCheckerTool)target; + } public override VisualElement CreateInspectorGUI() { @@ -31,24 +33,34 @@ public override VisualElement CreateInspectorGUI() //Mode Dropdown var dropdownMode = root.Q("ModesDropdown"); - dropdownMode.choices = Modes; - int currentModeIndex = (int)self.Mode; - if ( currentModeIndex >= 0 && currentModeIndex <= Modes.Count ) - { - dropdownMode.index = currentModeIndex; - dropdownMode.RegisterValueChangedCallback(v => - { - self.Mode = (ColorCheckerTool.ColorCheckerModes)dropdownMode.index; - onChange(self, root); - }); - } + dropdownMode.RegisterValueChangedCallback(v => onChange(self, root)); //Field counts sliders root.Q("fieldCount").RegisterValueChangedCallback(v => onChange(self, root)); root.Q("fieldsPerRow").RegisterValueChangedCallback(v => onChange(self, root)); root.Q("materialFieldsCount").RegisterValueChangedCallback(v => onChange(self, root)); + + //Sphere Mode Toggle needs to update geometry + root.Q("sphereModeToggle").RegisterValueChangedCallback(v=> self.UpdateGeometry()); + //fields margin regenerates the spheres if sphere mode is used + root.Q("fieldsMargin").RegisterValueChangedCallback(v=> {if(self.sphereModeToDisplay == true) {self.UpdateGeometry();}}); - //Prepare Color Fields + //callback for face view + root.Q
+ [Serializable] + public sealed class SeedModeParameter : VolumeParameter + { + /// + /// Creates a new instance. + /// + /// The initial value to store in the parameter. + /// The initial override state for the parameter. + public SeedModeParameter(SeedMode value, bool overrideState = false) : base(value, overrideState) { } + } + /// /// A volume component that holds settings for the Path Tracing effect. /// @@ -159,6 +191,13 @@ public sealed class PathTracing : VolumeComponent [Tooltip("Defines the number of tiles (X: width, Y: height) and the indices of the current tile (Z: i in [0, width[, W: j in [0, height[) for interleaved tiled rendering.")] public Vector4Parameter tilingParameters = new Vector4Parameter(new Vector4(1, 1, 0, 0)); + + /// + /// Defines the mode used to calculate the noise index. + /// + [Tooltip("Defines the mode used to calculate the noise index used per path tracing sample.")] + public SeedModeParameter seedMode = new SeedModeParameter(SeedMode.Repeating); + /// /// Default constructor for the path tracing volume component. /// @@ -540,7 +579,8 @@ void RenderPathTracingFrame(RenderGraph renderGraph, HDCamera hdCamera, in Camer passData.shaderVariablesRaytracingCB._RaytracingMaxRecursion = m_PathTracingSettings.maximumDepth.value; #endif passData.shaderVariablesRaytracingCB._RaytracingIntensityClamp = m_PathTracingSettings.maximumIntensity.value; - passData.shaderVariablesRaytracingCB._RaytracingSampleIndex = (int)cameraData.currentIteration; + int seed = m_PathTracingSettings.seedMode == SeedMode.Repeating ? (int)cameraData.currentIteration : (((int)hdCamera.GetCameraFrameCount() - 1) % m_PathTracingSettings.maximumSamples.max); + passData.shaderVariablesRaytracingCB._RaytracingSampleIndex = seed; passData.skyReflection = m_SkyManager.GetSkyReflection(hdCamera); passData.skyBG = builder.ReadTexture(m_SkyBGTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsDefaults.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsDefaults.cs index 0f3b7ce0c0e..a316a187fba 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsDefaults.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsDefaults.cs @@ -65,6 +65,7 @@ static class FrameSettingsDefaults (uint)FrameSettingsField.SSAOAsync, (uint)FrameSettingsField.ContactShadowsAsync, (uint)FrameSettingsField.VolumeVoxelizationsAsync, + (uint)FrameSettingsField.HighQualityLineRendering, (uint)FrameSettingsField.HighQualityLinesAsync, (uint)FrameSettingsField.DeferredTile, (uint)FrameSettingsField.ComputeLightEvaluation, @@ -188,6 +189,7 @@ static class FrameSettingsDefaults (uint)FrameSettingsField.SSAOAsync, (uint)FrameSettingsField.ContactShadowsAsync, (uint)FrameSettingsField.VolumeVoxelizationsAsync, + (uint)FrameSettingsField.HighQualityLineRendering, (uint)FrameSettingsField.HighQualityLinesAsync, (uint)FrameSettingsField.DeferredTile, (uint)FrameSettingsField.ComputeLightEvaluation, diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.asset b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.asset new file mode 100644 index 00000000000..b9b2644f170 --- /dev/null +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.asset @@ -0,0 +1,17 @@ +%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: 041122990f534c38885360da7b438072, type: 3} + m_Name: ComputeMaterialLibrary + m_EditorClassIdentifier: + m_Library: + m_Keys: + m_Values: [] diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.asset.meta b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.asset.meta new file mode 100644 index 00000000000..99742c9376f --- /dev/null +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 833ab0ec618db411699ea8cb1a221d0d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.cs new file mode 100644 index 00000000000..18f4a9bf06f --- /dev/null +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.cs @@ -0,0 +1,107 @@ +using System; + +#if UNITY_EDITOR + using UnityEditor; + using UnityEditor.Build; + using UnityEditor.Build.Reporting; +#endif + +namespace UnityEngine.Rendering.HighDefinition +{ + [Serializable] + sealed class ComputeMaterialDictionary : SerializedDictionary< /* Shader Hash Code */ int, ComputeShader> { } + + // This is a runtime utility for recovering compute kernels that correlate to a normal shader asset. + [Serializable] + internal class ComputeMaterialLibrary : ScriptableObject + { + [SerializeField] + private ComputeMaterialDictionary m_Library; + + private int ComputeRuntimeHash(Shader shader) + { + // This hash needs to be consistent between editor and standalone builds. + // Shader.GetHashCode is unusable since in-editor it's just an instance ID. + // Unfortunately the only consistent state that a Shader object seems to have + // between editor and standalone is the name itself. We deal with this limitation + // by failing the build if the user attempts to make one with two compute materials + // of the same name. + return shader.name.GetHashCode(); + } + + public void Clear() + { + m_Library.Clear(); + } + + public bool Add(Shader shader, ComputeShader computeShader) + { + return m_Library.TryAdd(ComputeRuntimeHash(shader), computeShader); + } + + public bool Get(Shader shader, out ComputeShader computeShader) + { + return m_Library.TryGetValue(ComputeRuntimeHash(shader), out computeShader); + } + } + +#if UNITY_EDITOR + class ComputeMaterialLibraryBuilder : IPreprocessBuildWithReport, IPostprocessBuildWithReport + { + public int callbackOrder { get { return 0; } } + + // This is guaranteed to be the identifier since it is what the sub target will emit. + private const string kComputeMaterialIdentifier = "VertexSetup"; + + public void OnPreprocessBuild(BuildReport report) + { + ref readonly var library = ref HDRenderPipelineGlobalSettings.instance.renderPipelineResources.assets.computeMaterialLibrary; + + if (!library) + return; + + // Wipe the library before building. + library.Clear(); + + // Gather all shader-graph assets (Currently only these can currently have a compute material.) + var shaderGraphAssetGUIDs = AssetDatabase.FindAssets($"t:{nameof(Shader)} glob:\"**/*.shadergraph\""); + + foreach (var shaderGUID in shaderGraphAssetGUIDs) + { + var shaderPath = AssetDatabase.GUIDToAssetPath(shaderGUID); + + var baseShader = (Shader)AssetDatabase.LoadMainAssetAtPath(shaderPath); + + foreach (var asset in AssetDatabase.LoadAllAssetsAtPath(shaderPath)) + { + if (asset is not ComputeShader computeMaterialShader) + continue; + + if (!computeMaterialShader.name.Contains(kComputeMaterialIdentifier)) + continue; + + if (!library.Add(baseShader, computeMaterialShader)) + throw new BuildFailedException($"Failed to create Compute Material resource for Shader [${baseShader.name}]: More than one shader with the same name."); + } + } + + EditorUtility.SetDirty(library); + AssetDatabase.SaveAssets(); + } + + public void OnPostprocessBuild(BuildReport report) + { + ref readonly var library = ref HDRenderPipelineGlobalSettings.instance.renderPipelineResources.assets.computeMaterialLibrary; + + if (!library) + return; + + // Wipe the library after building. + library.Clear(); + + EditorUtility.SetDirty(library); + AssetDatabase.SaveAssets(); + } + } +#endif +} diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.cs.meta b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.cs.meta new file mode 100644 index 00000000000..21271046211 --- /dev/null +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/ComputeMaterialLibrary.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 041122990f534c38885360da7b438072 +timeCreated: 1698862181 \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineRuntimeResources.asset b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineRuntimeResources.asset index a6ecc2dee32..776cef05558 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineRuntimeResources.asset +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipelineResources/HDRenderPipelineRuntimeResources.asset @@ -450,6 +450,8 @@ MonoBehaviour: assets: defaultDiffusionProfile: {fileID: 11400000, guid: 2b7005ba3a4d8474b8cdc34141ad766e, type: 2} + computeMaterialLibrary: {fileID: 11400000, guid: 833ab0ec618db411699ea8cb1a221d0d, + type: 2} emissiveCylinderMesh: {fileID: 2534964839176971238, guid: accb6d90f0d50fe4ca0f68159b4323de, type: 3} emissiveQuadMesh: {fileID: 4300000, guid: 1d5a8595286f94f4bb54171d49f473c3, type: 3} diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl index c513683d023..ae5d95c9578 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl @@ -210,6 +210,14 @@ StructuredBuffer _ThicknessReindexMap; #endif //SAMPLE_TEXTURE2D_ARRAY_BIAS #endif //PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS + #ifdef PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD + #ifdef SAMPLE_TEXTURE2D_ARRAY_GRAD + #undef SAMPLE_TEXTURE2D_ARRAY_GRAD + #define SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, dpdx, dpdy)\ + PLATFORM_SAMPLE_TEXTURE2D_ARRAY_GRAD(textureName, samplerName, coord2, index, (dpdx * _GlobalMipBiasPow2), (dpdy * _GlobalMipBiasPow2)) + #endif + #endif //PLATFORM_SAMPLE_TEXTURE2D_ARRAY_BIAS + //2d texture cube arrays bias manipulation #ifdef PLATFORM_SAMPLE_TEXTURECUBE_BIAS #ifdef SAMPLE_TEXTURECUBE diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs index 7487248987e..a9dfc5131de 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs @@ -285,5 +285,7 @@ unsafe struct ShaderVariablesGlobal public uint _EnableComputeThickness; public float _VolumetricCloudsFallBackValue; public Vector4 _VolumetricCloudsShadowOriginToggle; + + public Vector4 _ColorPyramidUvScaleAndLimitPrevFrame; } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs.hlsl b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs.hlsl index 38e4c1b1f50..bbb5a70e7a2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs.hlsl +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariablesGlobal.cs.hlsl @@ -168,6 +168,7 @@ GLOBAL_CBUFFER_START(ShaderVariablesGlobal, b0) uint _EnableComputeThickness; float _VolumetricCloudsFallBackValue; float4 _VolumetricCloudsShadowOriginToggle; + float4 _ColorPyramidUvScaleAndLimitPrevFrame; CBUFFER_END diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Tools/ColorCheckerTool.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Tools/ColorCheckerTool.cs index 96138ab8f61..fb9cd9ea978 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Tools/ColorCheckerTool.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Tools/ColorCheckerTool.cs @@ -6,29 +6,27 @@ [ExecuteInEditMode] -[RequireComponent(typeof(MeshRenderer))] -[RequireComponent(typeof(MeshFilter))] +[SelectionBaseAttribute] /// -/// This component generates a procedural color checker. It will overwrite the mesh renderer and the mesh filter. +/// This component generates a procedural color checker. /// public class ColorCheckerTool : MonoBehaviour { /// /// Enum of the color checker mode. - /// Colors : Color Palette, possibility to color pick each field. - /// Grayscale : Fixed preset. Those value have been probed without specular lighting using a cross polarized filter. - /// MiddleGray : Fixed preset. Gray value. - /// Stepped Luminance : Fixed preset. To check on contrast. - /// Materials : Material palette, possibility to color pick the basecolor for each field. Displayed in a smoothness gradient, using metallic workflow. - /// Texture : possibility to just feed texture for lit and unlit (as a source of comparison). + /// Colors : This procedural color checker can be used for color and lighting calibration. Color fields are customizable and persistent, with up to 64 values. + /// Grayscale : These values have been measured without specular lighting using a cross-polarized filter, making it more accurate for light calibration in PBR. + /// MiddleGray : This is the mid-gray value. + /// Reflection : Useful for checking local reflections. + /// Stepped Luminance : Stepped luminance is a good way to check gamma calibration. + /// Materials :Each row represents a material with varying smoothness. Material fields are customizable and persistent, with up to 12 values. + /// Texture : Useful for calibration using captured data. Use the slicer to compare lit values to unlit, raw values. Pre-exposure can be disabled. /// /// - public enum ColorCheckerModes { Colors, Grayscale, MiddleGray, Reflection, SteppedLuminance, Materials, Texture }; + public enum ColorCheckerModes {[InspectorName("Color Palette")]Colors, [InspectorName("Cross Polarized Grayscale")]Grayscale, MiddleGray, Reflection, SteppedLuminance, [InspectorName("Material Palette")]Materials,[InspectorName("External Texture")] Texture }; /// /// Current mode of the color checker. /// public ColorCheckerModes Mode = ColorCheckerModes.Colors; - Renderer ColorCheckerRenderer; - MeshFilter ColorCheckerFilter; /// /// Add the gradient field to the color checker. /// @@ -38,13 +36,9 @@ public enum ColorCheckerModes { Colors, Grayscale, MiddleGray, Reflection, Stepp /// public bool unlitCompare = false; /// - /// Each field will have spherical pixel normals. The geometry will stay flat. + /// Instantiates spheres for each fields /// - public bool spherical = false; - /// - /// Makes the checker always face view. This is performed in the vertex shader, and thus is not supported in Path tracing. - /// - public bool faceCamera; + public bool sphereMode = false; /// related to UI [SerializeField] int fieldCount = 24; @@ -54,6 +48,14 @@ public enum ColorCheckerModes { Colors, Grayscale, MiddleGray, Reflection, Stepp [SerializeField] float fieldSize = 0.1f; [SerializeField] float gradientPower = 2.2f; + //related to material and geometry update + int fieldsToDisplay; + int fieldsPerRowToDisplay; + float sizeToDisplay; + internal bool sphereModeToDisplay; + bool gradientToDisplay; + float gridToDisplay; + /// /// First color used by the gradient field. /// @@ -88,31 +90,31 @@ public enum ColorCheckerModes { Colors, Grayscale, MiddleGray, Reflection, Stepp static readonly Color32[] colorPalette = //This is use to initialize and reset the color palette { - //Color Checker - new Color32(243, 243, 242, 255), //White - new Color32(200, 200, 200, 255), //Neutral 8 - new Color32(160, 160, 160, 255), //Neutral 6.5 - new Color32(122, 122, 121, 255), //Neutral 5 - new Color32(85, 85, 85, 255), //Neutral 3.5 - new Color32(52, 52, 52, 255), //Black - new Color32(56, 61, 150, 255), //Blue - new Color32(70, 148, 73, 255), //Green - new Color32(175, 54, 60, 255), //Red - new Color32(231, 199, 31, 255), //Yellow - new Color32(187, 86, 149, 255), //Magenta - new Color32(8, 133, 161, 255), //Cyan - new Color32(214, 126, 44, 255), //Orange - new Color32(80, 91, 166, 255), //Purplish Blue - new Color32(193, 90, 99, 255), //Moderate Red - new Color32(94, 60, 108, 255), //Purple - new Color32(157, 188, 64, 255), //Yellow Green - new Color32(224, 163, 46, 255), //Orange Yellow + //Color Checker BabelColor Avg + new Color32(245, 245, 240, 255), //White + new Color32(201, 202, 201, 255), //Neutral 8 + new Color32(161, 162, 162, 255), //Neutral 6.5 + new Color32(120, 121, 121, 255), //Neutral 5 + new Color32(83, 85, 85, 255), //Neutral 3.5 + new Color32(50, 50, 51, 255), //Black + new Color32(42, 63, 147, 255), //Blue + new Color32(72, 149, 72, 255), //Green + new Color32(175, 50, 57, 255), //Red + new Color32(238, 200, 22, 255), //Yellow + new Color32(188, 84, 150, 255), //Magenta + new Color32(0, 137, 166, 255), //Cyan + new Color32(220, 123, 46, 255), //Orange + new Color32(72, 92, 168, 255), //Purplish Blue + new Color32(194, 84, 97, 255), //Moderate Red + new Color32(91, 59, 104, 255), //Purple + new Color32(161, 189, 62, 255), //Yellow Green + new Color32(229, 161, 40, 255), //Orange Yellow new Color32(115, 82, 68, 255), //Dark Skin - new Color32(194, 150, 130, 255), //Light Skin - new Color32(98, 122, 157, 255), //Blue Sky - new Color32(87, 108, 67, 255), //Foliage - new Color32(133, 128, 177, 255), //Blue Flower - new Color32(103, 189, 170, 255), //Bluish Green + new Color32(194, 149, 128, 255), //Light Skin + new Color32(93, 123, 157, 255), //Blue Sky + new Color32(91, 108, 65, 255), //Foliage + new Color32(130, 129, 175, 255), //Blue Flower + new Color32(99, 191, 171, 255), //Bluish Green //PBR values example new Color32(50, 50, 50, 255), //Coal new Color32(243, 243, 243, 255), //Snow @@ -192,7 +194,7 @@ public enum ColorCheckerModes { Colors, Grayscale, MiddleGray, Reflection, Stepp /// Color Array used for the "Middle Gray" mode. /// /// - public Color32[] MiddleGray = {new Color32(118,118,118,255)}; + public Color32[] MiddleGray = {new Color32(120, 121, 121, 255)}; /// /// Color Array used for the "Stepped Luminance" mode. /// @@ -200,18 +202,18 @@ public enum ColorCheckerModes { Colors, Grayscale, MiddleGray, Reflection, Stepp static readonly Color32[] materialPalette = //This is use to initialize and reset the material palette, the Alpha value is used to say if it is a metal or not. { - new Color32(232,232,232,0), //Snow - new Color32(40,40,40,0), //Charcoal - new Color32(135,131,126,255), //Iron - new Color32(236,184,129,255), //Copper - new Color32(245,242,235,255),//Silver - new Color32(241,198,95,255),//Gold + new Color32(237,237,237,0), //Snow + new Color32(39,39,39,0), //Charcoal + new Color32(193,190,187,255), //Iron + new Color32(247,221,188,255), //Copper + new Color32(251,249,246,255),//Silver + new Color32(249,228,164,255),//Gold new Color32(175, 54, 60, 0), //Red new Color32(177, 167, 132, 0), //Sand new Color32(87, 108, 67, 0), //Foliage new Color32(98, 122, 157, 0), //Blue Sky - new Color32(233,233,235,255),//Aluminium - new Color32(226,201,111,255),//Brass + new Color32(245,245,246,255),//Aluminium + new Color32(242,230,176,255),//Brass }; /// @@ -220,36 +222,46 @@ public enum ColorCheckerModes { Colors, Grayscale, MiddleGray, Reflection, Stepp /// public Color32[] customMaterials = materialPalette.Clone() as Color32[]; public bool[] isMetalBools = {false,false,true,true,true,true,false,false,false,false,true,true}; - + //not used right now, can be useful for URP implementation later. internal bool isHDRP; - - void GenerateGeometry() - { - hideFlags = HideFlags.DontSaveInBuild; - ColorCheckerRenderer = GetComponent(); - ColorCheckerFilter = GetComponent(); - tag = "EditorOnly"; //This Tool should not be used in build. - ColorCheckerRenderer.hideFlags = HideFlags.HideInInspector; - ColorCheckerFilter.hideFlags = HideFlags.HideInInspector; - ColorCheckerFilter.sharedMesh = Resources.GetBuiltinResource("Cube.fbx"); - ColorCheckerRenderer.sharedMaterial = Resources.Load("ColorCheckerMaterial"); - ColorCheckerRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; - } - void GenerateTexture() - { - colorCheckerTexture = new Texture2D(8, 8, TextureFormat.RGBA32, 0, false); - colorCheckerTexture.name = "ProceduralColorcheckerTexture"; - colorCheckerTexture.filterMode = FilterMode.Point; - colorCheckerTexture.hideFlags = HideFlags.HideAndDontSave; - UpdateMaterial(); - } + //Users can customize colors and materials, we use booleans to save the texture colors in next update. + bool saveCustomColors = false; + bool saveCustomMaterials = false; + + //Geometry is instanciated as child + [SerializeField] GameObject ColorCheckerObject; + Renderer ColorCheckerRenderer; + MeshFilter ColorCheckerFilter; + void Awake() { - CheckPipeline(); - GenerateGeometry(); + if (ColorCheckerObject == null) + { + ColorCheckerObject = new GameObject("Colorchecker Geometry"); + ColorCheckerObject.transform.position = transform.position; + ColorCheckerObject.transform.rotation= transform.rotation; + ColorCheckerObject.transform.localScale = transform.localScale; + ColorCheckerObject.tag = "EditorOnly"; + ColorCheckerObject.transform.parent = transform; + ColorCheckerRenderer = ColorCheckerObject.AddComponent(); + ColorCheckerFilter = ColorCheckerObject.AddComponent(); + ColorCheckerFilter.hideFlags = HideFlags.NotEditable; + ColorCheckerRenderer.sharedMaterial = Resources.Load("ColorCheckerMaterial"); + ColorCheckerRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; + } + else + { + ColorCheckerRenderer = ColorCheckerObject.GetComponent(); + ColorCheckerFilter = ColorCheckerObject.GetComponent(); + } + + + tag = "EditorOnly"; //This Tool should not be used in build. GenerateTexture(); + UpdateGeometry(); + UpdateMaterial(); //SteppedLuminance array setup for (int i = 0; i < 16; i++) @@ -257,46 +269,60 @@ void Awake() byte luminance = (byte)(17 * i); steppedLuminance[i] = new Color32(luminance,luminance,luminance,255); } - } - void Update() - { - ColorCheckerRenderer.hideFlags = HideFlags.HideInInspector; - ColorCheckerFilter.hideFlags = HideFlags.HideInInspector; - tag = "EditorOnly"; //This Tool should not be used in build. } - void OnValidate() + + void OnValidate() { UpdateMaterial(); //to make sure every binded properties in UI builder update the material. - } + } - internal void UpdateMaterial() - { - int fieldsToDisplay = fieldCount; - int fieldsPerRowToDisplay = fieldsPerRow; - float gridToDisplay = gridThickness; - float sizeToDisplay = fieldSize; - bool sphericalToDisplay = spherical; - bool unlitToDisplay = unlitCompare; - bool gradientToDisplay = addGradient; - Texture2D textureToDisplay = Texture2D.blackTexture; - if (colorCheckerTexture != null) + void Update() + { + if (saveCustomColors) { - textureToDisplay = colorCheckerTexture; + saveTextureColors(customColors); + saveCustomColors = false; } - else + + if (saveCustomMaterials) { - GenerateTexture(); + saveTextureColors(customMaterials); + saveCustomMaterials = false; } + } + + void GenerateTexture() + { + colorCheckerTexture = new Texture2D(8, 8, TextureFormat.RGBA32, 0, false); + colorCheckerTexture.name = "ProceduralColorcheckerTexture"; + colorCheckerTexture.filterMode = FilterMode.Point; + colorCheckerTexture.hideFlags = HideFlags.HideAndDontSave; + UpdateTexture(textureColors); + } + + internal void UpdateMaterial() + { + fieldsToDisplay = fieldCount; + fieldsPerRowToDisplay = fieldsPerRow; + sizeToDisplay = fieldSize; + sphereModeToDisplay = sphereMode; + gradientToDisplay = addGradient; + gridToDisplay = gridThickness; + + bool unlitToDisplay = unlitCompare; + + if (colorCheckerTexture==null) GenerateTexture(); + Texture2D textureToDisplay = colorCheckerTexture; switch (Mode) { case ColorCheckerModes.Colors: UpdateTexture(textureColors); - saveCustomColors(customColors); + saveCustomColors = true; break; case ColorCheckerModes.Grayscale: UpdateTexture(textureColors); @@ -317,22 +343,22 @@ internal void UpdateMaterial() colorCheckerTexture.SetPixel(0, 0, Color.white); colorCheckerTexture.Apply(); sizeToDisplay *= 4f; - sphericalToDisplay = true; + sphereModeToDisplay = true; gradientToDisplay = false; break; case ColorCheckerModes.SteppedLuminance: fieldsToDisplay = 16; fieldsPerRowToDisplay = 16; gridToDisplay = 0f; - sphericalToDisplay = false; + sphereModeToDisplay = false; UpdateTexture(textureColors); break; case ColorCheckerModes.Materials: UpdateTexture(textureColors); - saveCustomColors(customMaterials); + saveCustomMaterials = true; fieldsToDisplay = materialFieldsCount*6; fieldsPerRowToDisplay = 6; - sphericalToDisplay = true; + sphereModeToDisplay = true; unlitToDisplay = false; gradientToDisplay = false; break; @@ -340,7 +366,7 @@ internal void UpdateMaterial() fieldsToDisplay = 1; fieldsPerRowToDisplay = 1; sizeToDisplay *= 6f; - sphericalToDisplay = false; + sphereModeToDisplay = false; unlitToDisplay = true; gradientToDisplay = false; gridToDisplay = 0f; @@ -355,38 +381,85 @@ internal void UpdateMaterial() break; } - CheckPipeline(); - //Update properties - ColorCheckerRenderer = GetComponent(); var propertyBlock = new MaterialPropertyBlock(); + if(ColorCheckerRenderer==null) return; ColorCheckerRenderer.GetPropertyBlock(propertyBlock); - propertyBlock.SetInt("_Compare_to_Unlit", unlitToDisplay ? 1 : 0); - propertyBlock.SetInt("_Face_Camera", faceCamera ? 1 : 0); - propertyBlock.SetInt("_NumberOfFields", fieldsToDisplay); - propertyBlock.SetInt("_FieldsPerRow", fieldsPerRowToDisplay); - propertyBlock.SetFloat("_gridThickness", gridToDisplay * 0.5f); - propertyBlock.SetFloat("_SquareSize", sizeToDisplay); - propertyBlock.SetInt("_Add_Gradient", gradientToDisplay ? 1 : 0); - propertyBlock.SetColor("_Gradient_Color_A",gradientA); - propertyBlock.SetColor("_Gradient_Color_B",gradientB); - propertyBlock.SetFloat("_gradient_power", gradientPower); - propertyBlock.SetInt("_Spherical",sphericalToDisplay? 1 :0); - propertyBlock.SetInt("_material_mode", Mode == ColorCheckerModes.Materials? 1 :0 ); - propertyBlock.SetTexture("_CheckerTexture", textureToDisplay); - propertyBlock.SetInt("_texture_mode", Mode == ColorCheckerModes.Texture? 1 :0 ); - propertyBlock.SetInt("_reflection_mode", Mode == ColorCheckerModes.Reflection? 1 :0 ); - if (userTextureRaw!=null){propertyBlock.SetTexture("_rawTexture", userTextureRaw);} - propertyBlock.SetInt("_rawTexturePreExposure",unlitTextureExposure? 1 :0); - propertyBlock.SetFloat("_textureSlice", textureSlice); - propertyBlock.SetInt("_isHDRP", isHDRP ? 1 : 0); - ColorCheckerRenderer.SetPropertyBlock(propertyBlock); - - //resize Geometry to have even squares + if (propertyBlock!=null) + { + propertyBlock.SetInt("_Compare_to_Unlit", unlitToDisplay ? 1 : 0); + propertyBlock.SetInt("_NumberOfFields", fieldsToDisplay); + propertyBlock.SetInt("_FieldsPerRow", fieldsPerRowToDisplay); + propertyBlock.SetFloat("_gridThickness", gridToDisplay * 0.5f); + propertyBlock.SetFloat("_SquareSize", sizeToDisplay); + propertyBlock.SetInt("_Add_Gradient", gradientToDisplay ? 1 : 0); + propertyBlock.SetColor("_Gradient_Color_A",gradientA); + propertyBlock.SetColor("_Gradient_Color_B",gradientB); + propertyBlock.SetFloat("_gradient_power", gradientPower); + propertyBlock.SetInt("_sphereMode",sphereModeToDisplay? 1 :0); + propertyBlock.SetInt("_material_mode", Mode == ColorCheckerModes.Materials? 1 :0 ); + propertyBlock.SetTexture("_CheckerTexture", textureToDisplay); + propertyBlock.SetInt("_texture_mode", Mode == ColorCheckerModes.Texture? 1 :0 ); + propertyBlock.SetInt("_reflection_mode", Mode == ColorCheckerModes.Reflection? 1 :0 ); + if (userTextureRaw!=null){propertyBlock.SetTexture("_rawTexture", userTextureRaw);} + propertyBlock.SetInt("_rawTexturePreExposure",unlitTextureExposure? 1 :0); + propertyBlock.SetFloat("_textureSlice", textureSlice); + ColorCheckerRenderer.SetPropertyBlock(propertyBlock); + } + + } + + internal void UpdateGeometry() + { + CombineInstance[] combine = new CombineInstance[1]; + Mesh colorcheckerMesh = new Mesh(); + colorcheckerMesh.hideFlags = HideFlags.HideAndDontSave; int numberOfRows = Mathf.CeilToInt((float)fieldsToDisplay/(float)fieldsPerRowToDisplay); - numberOfRows = gradientToDisplay ? numberOfRows + 1 : numberOfRows; - Vector3 checkerSize = new Vector3(sizeToDisplay * fieldsPerRowToDisplay, sizeToDisplay*numberOfRows, 0.02f); - transform.localScale = checkerSize; + + if(sphereModeToDisplay) + { + combine = new CombineInstance[gradientToDisplay?fieldsToDisplay+1:fieldsToDisplay]; + for (int i=0;i("Sphere.fbx"); + float unit = sizeToDisplay; + float scale = Mathf.Lerp(1,0.01f,gridToDisplay)*sizeToDisplay*0.5f; //field margin resize the spheres. + int lastFullRow = fieldsToDisplay - (fieldsToDisplay-((numberOfRows-1)*fieldsPerRowToDisplay)); + float posx = i%fieldsPerRowToDisplay*sizeToDisplay+sizeToDisplay*0.5f; + int fieldsModulo = fieldsToDisplay%fieldsPerRowToDisplay; + if (i+1 > lastFullRow && fieldsModulo!=0) //checks if last row is incomplete to better center the spheres + { + int spaces = fieldsModulo*2; + int missing = fieldsPerRow - fieldsModulo; + float spacing = (float)missing/spaces; + posx += sizeToDisplay*spacing+(i-lastFullRow)*sizeToDisplay*spacing*2; + } + + float posy = (i/fieldsPerRowToDisplay)*unit+unit*0.5f; + Vector3 pos = new Vector3(posx,posy,0f); + combine[i].transform = Matrix4x4.TRS(pos, Quaternion.identity,new Vector3(scale,scale,scale)); + } + if (gradientToDisplay) //if gradient is enabled, we instanciate it + { + combine[fieldsToDisplay].mesh=Resources.GetBuiltinResource("Cube.fbx"); + Vector3 scale = new Vector3(sizeToDisplay * fieldsPerRowToDisplay, sizeToDisplay, 0.02f); + Vector3 pos = new Vector3(scale.x*0.5f,scale.y*0.5f-sizeToDisplay,0); + combine[fieldsToDisplay].transform = Matrix4x4.TRS(pos, Quaternion.identity,scale); + } + colorcheckerMesh.CombineMeshes(combine); + } + else + { + numberOfRows = gradientToDisplay ? numberOfRows + 1 : numberOfRows; + combine[0].mesh=Resources.GetBuiltinResource("Cube.fbx"); + Vector3 scale = new Vector3(sizeToDisplay * fieldsPerRowToDisplay, sizeToDisplay*numberOfRows, 0.02f); + Vector3 pos = new Vector3(scale.x*0.5f,scale.y*0.5f,0); + pos.y -= gradientToDisplay ? sizeToDisplay : 0; + combine[0].transform = Matrix4x4.TRS(pos, Quaternion.identity,scale); + colorcheckerMesh.CombineMeshes(combine); + } + + ColorCheckerFilter.mesh = colorcheckerMesh; } @@ -401,7 +474,6 @@ internal void UpdateTexture(Color32[] newColors) for (int x = 0; x < 8; x++) { int pixel = x + y * 8; - colorCheckerTexture.SetPixel(x, y, pixel 1 ; h /= 2 ) { GroupMemoryBarrierWithGroupSync(); @@ -155,10 +160,20 @@ void Kernel(Semantics s) uint offset = 2 * LOCAL_SIZE * s_Semantics.groupID.x; #if defined(STAGE_BMS) || defined(STAGE_LOCAL_DISPERSE) - gs_Keys [t * 2 + 0] = _KeyBuffer.Load ((offset + t * 2 + 0) << 2); - gs_Keys [t * 2 + 1] = _KeyBuffer.Load ((offset + t * 2 + 1) << 2); - gs_Values[t * 2 + 0] = _ValueBuffer.Load ((offset + t * 2 + 0) << 2); - gs_Values[t * 2 + 1] = _ValueBuffer.Load ((offset + t * 2 + 1) << 2); + if (t * 2 + 1 < _Total) + { + gs_Keys [t * 2 + 0] = _KeyBuffer.Load ((offset + t * 2 + 0) << 2); + gs_Keys [t * 2 + 1] = _KeyBuffer.Load ((offset + t * 2 + 1) << 2); + gs_Values[t * 2 + 0] = _ValueBuffer.Load ((offset + t * 2 + 0) << 2); + gs_Values[t * 2 + 1] = _ValueBuffer.Load ((offset + t * 2 + 1) << 2); + } + else + { + gs_Keys [t * 2 + 0] = 0; + gs_Keys [t * 2 + 1] = 0; + gs_Values[t * 2 + 0] = 0; + gs_Values[t * 2 + 1] = 0; + } #endif #ifdef STAGE_BMS @@ -173,10 +188,13 @@ void Kernel(Semantics s) #if defined(STAGE_BMS) || defined(STAGE_LOCAL_DISPERSE) GroupMemoryBarrierWithGroupSync(); - _KeyBuffer.Store ((offset + t * 2 + 0) << 2, gs_Keys [t * 2 + 0]); - _KeyBuffer.Store ((offset + t * 2 + 1) << 2, gs_Keys [t * 2 + 1]); - _ValueBuffer.Store((offset + t * 2 + 0) << 2, gs_Values[t * 2 + 0]); - _ValueBuffer.Store((offset + t * 2 + 1) << 2, gs_Values[t * 2 + 1]); + if (t * 2 + 1 < _Total) + { + _KeyBuffer.Store ((offset + t * 2 + 0) << 2, gs_Keys [t * 2 + 0]); + _KeyBuffer.Store ((offset + t * 2 + 1) << 2, gs_Keys [t * 2 + 1]); + _ValueBuffer.Store((offset + t * 2 + 0) << 2, gs_Values[t * 2 + 0]); + _ValueBuffer.Store((offset + t * 2 + 1) << 2, gs_Values[t * 2 + 1]); + } #endif } diff --git a/Packages/com.unity.render-pipelines.universal/CHANGELOG.md b/Packages/com.unity.render-pipelines.universal/CHANGELOG.md index 06dcbaa5c30..b0771d35d4b 100644 --- a/Packages/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/Packages/com.unity.render-pipelines.universal/CHANGELOG.md @@ -965,7 +965,7 @@ This version is compatible with Unity 2022.2.0a8. - Fixed an issue where Terrain hole Shader changes were missing. [Case 1179808](https://issuetracker.unity3d.com/issues/terrain-brush-tool-is-not-drawing-when-paint-holes-is-selected). - Fixed an issue where the Shader Graph `SceneDepth` node didn't work with XR single-pass (double-wide) rendering. See [case 1123069](https://issuetracker.unity3d.com/issues/lwrp-vr-shadergraph-scenedepth-doesnt-work-in-single-pass-rendering). - Fixed Unlit and BakedLit shader compilations in the meta pass. -- Fixed an issue where the Bokeh Depth of Field shader would fail to compile on PS4. +- Fixed an issue where the Bokeh Depth of Field shader would fail to compile on a console platform. - Fixed an issue where the Scene lighting button didn't work when you used the 2D Renderer. - Fixed a performance regression when you used the 2D Renderer. - Fixed an issue where the Freeform 2D Light gizmo didn't correctly show the Falloff offset. @@ -1556,7 +1556,7 @@ Read/write XRGraphicsConfig -> Read-only XRGraphics interface to XRSettings. ### Fixed - Post-processing now works with VR on PC. -- PS4 compiler error +- Console platform compiler error - Fixed VR multiview rendering by forcing MSAA to be off. There's a current issue in engine that breaks MSAA and Texture2DArray. - Fixed UnityPerDraw CB layout - GLCore compute buffer compiler error diff --git a/Packages/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md b/Packages/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md index f55cbb219e4..bf4804bd5df 100644 --- a/Packages/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md +++ b/Packages/com.unity.render-pipelines.universal/Documentation~/universalrp-asset.md @@ -48,7 +48,7 @@ The **Rendering** settings control the core part of the pipeline rendered frame. | **Opaque Texture** | Enable this to create a `_CameraOpaqueTexture` as default for all cameras in your scene. This works like the [GrabPass](https://docs.unity3d.com/Manual/SL-GrabPass.html) in the built-in render pipeline. The **Opaque Texture** provides a snapshot of the scene right before URP renders any transparent meshes. You can use this in transparent Shaders to create effects like frosted glass, water refraction, or heat waves. You can override this for individual cameras in the [Camera Inspector](camera-component-reference.md). | | **Opaque Downsampling** | Set the sampling mode on the opaque texture to one of the following:
**None**: Produces a copy of the opaque pass in the same resolution as the camera.
**2x Bilinear**: Produces a half-resolution image with bilinear filtering.
**4x Box**: Produces a quarter-resolution image with box filtering. This produces a softly blurred copy.
**4x Bilinear**: Produces a quarter-resolution image with bi-linear filtering. | | **Terrain Holes** | If you disable this option, the URP removes all Terrain hole Shader variants when you build for the Unity Player, which decreases build time. | -| **SRP Batcher** | Check this box to enable the SRP Batcher. This is useful if you have many different Materials that use the same Shader. The SRP Batcher is an inner loop that speeds up CPU rendering without affecting GPU performance. When you use the SRP Batcher, it replaces the SRP rendering code inner loop. | +| **SRP Batcher** | Check this box to enable the SRP Batcher. This is useful if you have many different Materials that use the same Shader. The SRP Batcher is an inner loop that speeds up CPU rendering without affecting GPU performance. When you use the SRP Batcher, it replaces the SRP rendering code inner loop. If both **SRP Batcher** and **Dynamic Batching** are enabled, SRP Batcher will take precedence over dynamic batching as long as the shader is SRP Batcher compatible. | | **Dynamic Batching** | Enable [Dynamic Batching](https://docs.unity3d.com/Manual/DrawCallBatching.html), to make the render pipeline automatically batch small dynamic objects that share the same Material. This is useful for platforms and graphics APIs that do not support GPU instancing. If your targeted hardware does support GPU instancing, disable **Dynamic Batching**. You can change this at run time. | | **Debug Level** | Set the level of debug information that the render pipeline generates. The values are:
**Disabled**: Debugging is disabled. This is the default.
**Profiling**: Makes the render pipeline provide detailed information tags, which you can see in the FrameDebugger. | | **Shader Variant Log Level** | Set the level of information about Shader Stripping and Shader Variants you want to display when Unity finishes a build. Values are:
**Disabled**: Unity doesn’t log anything.
**Only Universal**: Unity logs information for all of the [URP Shaders](shaders-in-universalrp.md).
**All**: Unity logs information for all Shaders in your build.
You can see the information in Console panel when your build has finished. | diff --git a/Packages/com.unity.render-pipelines.universal/Documentation~/upgrade-guide-2023-2.md b/Packages/com.unity.render-pipelines.universal/Documentation~/upgrade-guide-2023-2.md index 516c740b4a1..6c66fb45422 100644 --- a/Packages/com.unity.render-pipelines.universal/Documentation~/upgrade-guide-2023-2.md +++ b/Packages/com.unity.render-pipelines.universal/Documentation~/upgrade-guide-2023-2.md @@ -4,6 +4,14 @@ This page describes how to upgrade from an older version of the Universal Render For information on converting assets made for a Built-in Render Pipeline project to assets compatible with URP, see the page [Render Pipeline Converter](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@14.0/manual/features/rp-converter.html). +## Upgrading from URP 15 (Unity 2023.1) + +### Volume Framework + +When you create a custom Volume component class that overrides the `VolumeComponent.Override(VolumeComponent state, float interpFactor)` method, your implementation must set the `VolumeParameter.overrideState` property to `true` whenever the `VolumeParameter` value is changed. This ensures that the Volume framework resets the parameters to their correct default values. This lets the framework to use fewer resources every frame which improves performance. + +For an example, refer to the [Override(VolumeComponent, float)](xref:UnityEngine.Rendering.VolumeParameter.overrideState) description. + ## Upgrading from URP 13 (Unity 2022.1) ### Two shader defines were removed diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl index e309d453869..0b9b2a69f33 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/MotionVectorPass.hlsl @@ -119,6 +119,13 @@ void vert( #endif #endif +#if defined(UNITY_DOTS_INSTANCING_ENABLED) && defined(DOTS_DEFORMED) + // Deformed vertices in DOTS are not cumulative with built-in Unity skinning/blend shapes + // Needs to be called after vertex modification has been applied otherwise it will be + // overwritten by Compute Deform node + ApplyPreviousFrameDeformedVertexPosition(input.vertexID, previousPositionOS); +#endif + #if defined (_ADD_PRECOMPUTED_VELOCITY) previousPositionOS -= passInput.alembicMotionVectorOS; #endif diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl index af810458b73..957739f405b 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Includes/ShaderPassDecal.hlsl @@ -328,6 +328,12 @@ void Frag(PackedVaryings packedInput, outColor = color; #elif defined(DECAL_GBUFFER) + // Need to reconstruct normal here for inputData.bakedGI, but also save off surfaceData.normalWS for correct GBuffer blending + half3 normalToPack = surfaceData.normalWS.xyz; +#ifdef DECAL_RECONSTRUCT_NORMAL + surfaceData.normalWS.xyz = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w)); +#endif + InputData inputData; InitializeInputData(input, positionWS, surfaceData.normalWS.xyz, viewDirectionWS, inputData); @@ -339,21 +345,15 @@ void Frag(PackedVaryings packedInput, // Skip GI if there is no abledo #ifdef _MATERIAL_AFFECTS_ALBEDO - - // GI needs blended normal -#ifdef DECAL_RECONSTRUCT_NORMAL - half3 normalGI = normalize(lerp(normalWS.xyz, surfaceData.normalWS.xyz, surfaceData.normalWS.w)); -#endif - Light mainLight = GetMainLight(inputData.shadowCoord, inputData.positionWS, inputData.shadowMask); - MixRealtimeAndBakedGI(mainLight, normalGI, inputData.bakedGI, inputData.shadowMask); - half3 color = GlobalIllumination(brdfData, inputData.bakedGI, surface.occlusion, normalGI, inputData.viewDirectionWS); + MixRealtimeAndBakedGI(mainLight, surfaceData.normalWS.xyz, inputData.bakedGI, inputData.shadowMask); + half3 color = GlobalIllumination(brdfData, inputData.bakedGI, surface.occlusion, surfaceData.normalWS.xyz, inputData.viewDirectionWS); #else half3 color = 0; #endif // We can not use usual GBuffer functions (etc. BRDFDataToGbuffer) as we use alpha for blending - half3 packedNormalWS = PackNormal(surfaceData.normalWS.xyz); + half3 packedNormalWS = PackNormal(normalToPack); fragmentOutput.GBuffer0 = half4(surfaceData.baseColor.rgb, surfaceData.baseColor.a); fragmentOutput.GBuffer1 = 0; fragmentOutput.GBuffer2 = half4(packedNormalWS, surfaceData.normalWS.a); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs index 2a3b852b9f0..81bc3baca62 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalLitSubTarget.cs @@ -849,6 +849,8 @@ static class LitKeywords { CoreKeywordDescriptors.DebugDisplay }, { CoreKeywordDescriptors.LightCookies }, { CoreKeywordDescriptors.ForwardPlus }, + { CoreKeywordDescriptors.EvaluateShVertex }, + { CoreKeywordDescriptors.EvaluateShMixed }, }; public static readonly KeywordCollection GBuffer = new KeywordCollection diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs index 05784dc28f5..8086efe4a88 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalTarget.cs @@ -1768,6 +1768,7 @@ static class CoreIncludes // Pre-graph { CorePregraph }, { ShaderGraphPregraph }, + { DOTSPregraph }, // Post-graph { CorePostgraph }, @@ -1779,6 +1780,7 @@ static class CoreIncludes // Pre-graph { CorePregraph }, { ShaderGraphPregraph }, + { DOTSPregraph }, // Post-graph { CorePostgraph }, @@ -1896,6 +1898,24 @@ static class CoreKeywordDescriptors stages = KeywordShaderStage.Fragment, }; + public static readonly KeywordDescriptor EvaluateShMixed = new KeywordDescriptor() + { + displayName = ShaderKeywordStrings.EVALUATE_SH_MIXED, + referenceName = ShaderKeywordStrings.EVALUATE_SH_MIXED, + type = KeywordType.Boolean, + definition = KeywordDefinition.MultiCompile, + scope = KeywordScope.Global, + }; + + public static readonly KeywordDescriptor EvaluateShVertex = new KeywordDescriptor() + { + displayName = ShaderKeywordStrings.EVALUATE_SH_VERTEX, + referenceName = ShaderKeywordStrings.EVALUATE_SH_VERTEX, + type = KeywordType.Boolean, + definition = KeywordDefinition.MultiCompile, + scope = KeywordScope.Global, + }; + public static readonly KeywordDescriptor MainLightShadows = new KeywordDescriptor() { displayName = "Main Light Shadows", diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/PostProcessUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/PostProcessUtils.cs index 50981973134..d022c2c5455 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/PostProcessUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/PostProcessUtils.cs @@ -45,9 +45,11 @@ public static int ConfigureDithering(PostProcessData data, int index, int camera if (++index >= blueNoise.Length) index = 0; + var oldState = Random.state; Random.InitState(Time.frameCount); float rndOffsetX = Random.value; float rndOffsetY = Random.value; + Random.state = oldState; #endif // Ideally we would be sending a texture array once and an index to the slice to use @@ -94,17 +96,19 @@ public static void ConfigureFilmGrain(PostProcessData data, FilmGrain settings, texture = data.textures.filmGrainTex[(int)settings.type.value]; #if LWRP_DEBUG_STATIC_POSTFX - float offsetX = 0f; - float offsetY = 0f; + float rndOffsetX = 0f; + float rndOffsetY = 0f; #else + var oldState = Random.state; Random.InitState(Time.frameCount); - float offsetX = Random.value; - float offsetY = Random.value; + float rndOffsetX = Random.value; + float rndOffsetY = Random.value; + Random.state = oldState; #endif var tilingParams = texture == null ? Vector4.zero - : new Vector4(cameraPixelWidth / (float)texture.width, cameraPixelHeight / (float)texture.height, offsetX, offsetY); + : new Vector4(cameraPixelWidth / (float)texture.width, cameraPixelHeight / (float)texture.height, rndOffsetX, rndOffsetY); material.SetTexture(ShaderConstants._Grain_Texture, texture); material.SetVector(ShaderConstants._Grain_Params, new Vector2(settings.intensity.value * 4f, settings.response.value)); diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/BakedLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/BakedLit.shader index 7f06499f30f..e4d121fa673 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/BakedLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/BakedLit.shader @@ -76,6 +76,7 @@ Shader "Universal Render Pipeline/Baked Lit" // Universal Pipeline keywords #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION #pragma multi_compile_fragment _ _DBUFFER_MRT1 _DBUFFER_MRT2 _DBUFFER_MRT3 + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/RenderingLayers.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader index e461bc0735b..3e76890a761 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/ComplexLit.shader @@ -161,6 +161,7 @@ Shader "Universal Render Pipeline/Complex Lit" #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE #pragma multi_compile_fog #pragma multi_compile_fragment _ DEBUG_DISPLAY + #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" //-------------------------------------- // GPU Instancing diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeDebug.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeDebug.shader index 083934b5817..a601f9a841a 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeDebug.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeDebug.shader @@ -1,8 +1,8 @@ -Shader "Hidden/Core/ProbeVolumeDebug" +Shader "Hidden/Universal Render Pipeline/ProbeVolumeDebug" { SubShader { - Tags{ "RenderType" = "Opaque" } + Tags{ "RenderPipeline" = "UniversalPipeline" "RenderType" = "Opaque" } LOD 100 HLSLINCLUDE diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeFragmentationDebug.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeFragmentationDebug.shader index 814f7d80552..32292290a84 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeFragmentationDebug.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeFragmentationDebug.shader @@ -1,8 +1,8 @@ -Shader "Hidden/Core/ProbeVolumeFragmentationDebug" +Shader "Hidden/Universal Render Pipeline/ProbeVolumeFragmentationDebug" { SubShader { - Tags { "Queue" = "Transparent" } + Tags { "RenderPipeline" = "UniversalPipeline" "Queue" = "Transparent" } Pass { ZWrite On diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeOffsetDebug.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeOffsetDebug.shader index 25295cac3c9..7fe77e54317 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeOffsetDebug.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeOffsetDebug.shader @@ -1,8 +1,8 @@ -Shader "Hidden/HDRP/ProbeVolumeOffsetDebug" +Shader "Hidden/Universal Render Pipeline/ProbeVolumeOffsetDebug" { SubShader { - Tags{ "RenderType" = "Opaque" } + Tags{ "RenderPipeline" = "UniversalPipeline" "RenderType" = "Opaque" } LOD 100 HLSLINCLUDE diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeSamplingDebug.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeSamplingDebug.shader index cf8c4e12567..0435a6c1cff 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeSamplingDebug.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Debug/ProbeVolumeSamplingDebug.shader @@ -1,8 +1,8 @@ -Shader "Hidden/HDRP/ProbeVolumeSamplingDebug" +Shader "Hidden/Universal Render Pipeline/ProbeVolumeSamplingDebug" { SubShader { - Tags{ "RenderType" = "Opaque" } + Tags{ "RenderPipeline" = "UniversalPipeline" "RenderType" = "Opaque" } LOD 100 diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader index b2fbe43dfff..327b8db1f79 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree7.shader @@ -49,6 +49,7 @@ Shader "Universal Render Pipeline/Nature/SpeedTree7" #pragma multi_compile_fragment _ _LIGHT_COOKIES #pragma multi_compile _ _LIGHT_LAYERS #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader index 6effb83ba1b..42184a2fcb5 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Nature/SpeedTree8.shader @@ -65,6 +65,7 @@ Shader "Universal Render Pipeline/Nature/SpeedTree8" #pragma multi_compile_fragment _ LOD_FADE_CROSSFADE #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION #pragma multi_compile_fragment _ _LIGHT_COOKIES + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader index ba36b999538..b813903ee6b 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesLit.shader @@ -143,6 +143,7 @@ Shader "Universal Render Pipeline/Particles/Lit" #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION #pragma multi_compile_fragment _ _LIGHT_COOKIES #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader index 3b74e3630e6..e97e616cd57 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesSimpleLit.shader @@ -144,6 +144,7 @@ Shader "Universal Render Pipeline/Particles/Simple Lit" #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION #pragma multi_compile_fragment _ _LIGHT_COOKIES #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #include_with_pragmas "Packages/com.unity.render-pipelines.core/ShaderLibrary/FoveatedRenderingKeywords.hlsl" #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl" diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader index eab45adba74..6c03062459b 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/TerrainLit.shader @@ -71,6 +71,7 @@ Shader "Universal Render Pipeline/Terrain/Lit" #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ _LIGHT_LAYERS #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile_fragment _ _REFLECTION_PROBE_BLENDING #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader index dbef1b20429..3480116f920 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/Terrain/WavingGrass.shader @@ -30,6 +30,7 @@ Shader "Hidden/TerrainEngine/Details/UniversalPipeline/WavingDoublePass" #pragma multi_compile _ SHADOWS_SHADOWMASK #pragma multi_compile _ _LIGHT_LAYERS #pragma multi_compile _ _FORWARD_PLUS + #pragma multi_compile _ EVALUATE_SH_MIXED EVALUATE_SH_VERTEX #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS #pragma multi_compile_fragment _ _SHADOWS_SOFT _SHADOWS_SOFT_LOW _SHADOWS_SOFT_MEDIUM _SHADOWS_SOFT_HIGH #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION diff --git a/Packages/com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs b/Packages/com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs index 624604286a0..b72980df4e5 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Util/GraphUtil.cs @@ -120,6 +120,7 @@ public override void Action(int instanceId, string pathName, string resourceFile var graph = new GraphData(); graph.AddContexts(); graph.InitializeOutputs(m_Targets, m_Blocks); + graph.AddCategory(CategoryData.DefaultCategory()); graph.path = "Shader Graphs"; FileUtilities.WriteShaderGraphToDisk(pathName, graph); diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/ObjectPropertyRM.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/ObjectPropertyRM.cs index ee2ffb50e54..b15aef7ffb5 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/ObjectPropertyRM.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Properties/ObjectPropertyRM.cs @@ -1,4 +1,5 @@ using System; +using UnityEditor.SearchService; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; @@ -14,9 +15,16 @@ public ObjectPropertyRM(IPropertyRMProvider controller, float labelWidth) : base { styleSheets.Add(VFXView.LoadStyleSheet("ObjectPropertyRM")); + if (m_Provider.portType.IsSubclassOf(typeof(Texture))) + { + m_ObjectField = new ObjectField { objectType = typeof(Texture), allowSceneObjects = false }; + m_ObjectField.onObjectSelectorShow += OnShowObjectSelector; + } + else + { + m_ObjectField = new ObjectField { objectType = m_Provider.portType, allowSceneObjects = false }; + } - m_ObjectField = new ObjectField { objectType = m_Provider.portType }; - m_ObjectField.allowSceneObjects = false; m_ObjectField.RegisterCallback>(OnValueChanged); Add(m_ObjectField); } @@ -50,8 +58,29 @@ public override void SetValue(object obj) private void OnValueChanged(ChangeEvent evt) { - SetValue(evt.newValue); - NotifyValueChanged(); + var newValueType = evt.newValue != null ? evt.newValue.GetType() : null; + if (newValueType != null && newValueType != m_Provider.portType && (newValueType != typeof(RenderTexture) || m_Provider.portType == typeof(CubemapArray))) + { + m_ObjectField.SetValueWithoutNotify(evt.previousValue); + } + else + { + SetValue(evt.newValue); + NotifyValueChanged(); + } + } + + private void OnShowObjectSelector() + { + var searchFilter = $"t:{m_Provider.portType.Name}"; + if (m_Provider.portType != typeof(CubemapArray)) + { + searchFilter += ObjectSelectorSearch.HasEngineOverride() + ? " or t:RenderTexture" + : " t:RenderTexture"; + } + + ObjectSelector.get.searchFilter = searchFilter; } } } diff --git a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Scenes/011-HighQualityLines.unity b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Scenes/011-HighQualityLines.unity index 9462fed4303..760345d6e45 100644 --- a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Scenes/011-HighQualityLines.unity +++ b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Scenes/011-HighQualityLines.unity @@ -13,7 +13,7 @@ OcclusionCullingSettings: --- !u!104 &2 RenderSettings: m_ObjectHideFlags: 0 - serializedVersion: 9 + serializedVersion: 10 m_Fog: 0 m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} m_FogMode: 3 @@ -44,7 +44,6 @@ RenderSettings: LightmapSettings: m_ObjectHideFlags: 0 serializedVersion: 12 - m_GIWorkflowMode: 1 m_GISettings: serializedVersion: 2 m_BounceScale: 1 @@ -206,13 +205,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 235661756} + serializedVersion: 2 m_LocalRotation: {x: -0.03358266, y: 0.9004021, z: -0.07065463, w: -0.42796752} m_LocalPosition: {x: 1.8118136, y: 0.767552, z: 1.7499995} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 90, y: 180, z: 0} --- !u!114 &235661760 MonoBehaviour: @@ -296,7 +295,7 @@ MonoBehaviour: materialQuality: 0 renderingPathCustomFrameSettingsOverrideMask: mask: - data1: 4503599627370496 + data1: 4503599627370512 data2: 0 defaultFrameSettings: 0 m_Version: 9 @@ -446,6 +445,30 @@ MonoBehaviour: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 + m_RendererLODScreenCoverageCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.01 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 m_ShadingSampleFraction: 1 m_IndexCount: 152344 m_SegmentsPerLine: 4 @@ -469,6 +492,8 @@ MeshRenderer: m_ReflectionProbeUsage: 1 m_RayTracingMode: 2 m_RayTraceProcedural: 0 + m_RayTracingAccelStructBuildFlagsOverride: 0 + m_RayTracingAccelStructBuildFlags: 1 m_RenderingLayerMask: 257 m_RendererPriority: 0 m_Materials: @@ -509,13 +534,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 363154989} + serializedVersion: 2 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &399818633 GameObject: @@ -603,13 +628,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 399818633} + serializedVersion: 2 m_LocalRotation: {x: 0.27165377, y: -0.6942721, z: 0.32374436, w: 0.58256346} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -100, z: 0} --- !u!114 &399818636 MonoBehaviour: @@ -657,11 +682,22 @@ MonoBehaviour: m_UseScreenSpaceShadows: 0 m_InteractsWithSky: 1 m_AngularDiameter: 0.5 - m_FlareSize: 2 - m_FlareTint: {r: 1, g: 1, b: 1, a: 1} - m_FlareFalloff: 4 - m_SurfaceTexture: {fileID: 0} - m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} + diameterMultiplerMode: 0 + diameterMultiplier: 1 + diameterOverride: 0.5 + celestialBodyShadingSource: 1 + sunLightOverride: {fileID: 0} + sunColor: {r: 1, g: 1, b: 1, a: 1} + sunIntensity: 130000 + moonPhase: 0.2 + moonPhaseRotation: 0 + earthshine: 1 + flareSize: 2 + flareTint: {r: 1, g: 1, b: 1, a: 1} + flareFalloff: 4 + flareMultiplier: 1 + surfaceTexture: {fileID: 0} + surfaceTint: {r: 1, g: 1, b: 1, a: 1} m_Distance: 1.5e+11 m_UseRayTracedShadows: 0 m_NumRayTracingSamples: 4 @@ -682,6 +718,14 @@ MonoBehaviour: m_BlockerSampleCount: 24 m_FilterSampleCount: 16 m_MinFilterSize: 0.1 + m_DirLightPCSSBlockerSampleCount: 24 + m_DirLightPCSSFilterSampleCount: 16 + m_DirLightPCSSMaxPenumbraSize: 0.56 + m_DirLightPCSSMaxSamplingDistance: 0.5 + m_DirLightPCSSMinFilterSizeTexels: 1.5 + m_DirLightPCSSMinFilterMaxAngularDiameter: 10 + m_DirLightPCSSBlockerSearchAngularDiameter: 12 + m_DirLightPCSSBlockerSamplingClumpExponent: 2 m_KernelSize: 5 m_LightAngle: 1 m_MaxDepthBias: 0.001 @@ -774,11 +818,19 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1046837959} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: -0.15094548, y: 0.36784643, z: 0.15172982} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 235661759} + - {fileID: 399818635} + - {fileID: 1046837961} + - {fileID: 363154993} diff --git a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/ShaderVariantLists/Default.shadervariantlist b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/ShaderVariantLists/Default.shadervariantlist index 3b368cca507..f29f194cbaa 100644 --- a/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/ShaderVariantLists/Default.shadervariantlist +++ b/Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/ShaderVariantLists/Default.shadervariantlist @@ -501,7 +501,8 @@ Compiled compute shader: ClearLightLists, kernel: ClearList, keywords Compiled compute shader: ClearUIntTextureArray, kernel: ClearUIntTextureArray, keywords Compiled compute shader: ComputeGgxIblSampleData, kernel: ComputeGgxIblSampleData, keywords -Compiled compute shader: ComputeShader-VertexSetup, kernel: VertexSetup, keywords _FORCE_DISABLE_TANGENT_STREAM +Compiled compute shader: ComputeShader-VertexSetup, kernel: VertexSetup, keywords +Compiled compute shader: Deferred, kernel: Deferred_Indirect_Fptl_Variant0, keywords AREA_SHADOW_MEDIUM DIRECTIONAL_SHADOW_HIGH PROBE_VOLUMES_L1 PUNCTUAL_SHADOW_HIGH SCREEN_SPACE_SHADOWS_OFF Compiled compute shader: Deferred, kernel: Deferred_Indirect_Fptl_Variant0, keywords AREA_SHADOW_MEDIUM DIRECTIONAL_SHADOW_HIGH PUNCTUAL_SHADOW_HIGH SCREEN_SPACE_SHADOWS_OFF Compiled compute shader: Deferred, kernel: Deferred_Indirect_Fptl_Variant0, keywords AREA_SHADOW_MEDIUM DIRECTIONAL_SHADOW_LOW PUNCTUAL_SHADOW_LOW SCREEN_SPACE_SHADOWS_OFF Compiled compute shader: Deferred, kernel: Deferred_Indirect_Fptl_Variant0, keywords AREA_SHADOW_MEDIUM DIRECTIONAL_SHADOW_MEDIUM PROBE_VOLUMES_L1 PUNCTUAL_SHADOW_MEDIUM SCREEN_SPACE_SHADOWS_OFF @@ -884,11 +885,12 @@ Compiled compute shader: StagePrepare, kernel: UpdateOffsets, keywords Compiled compute shader: StageRasterBin, kernel: MainArgs, keywords Compiled compute shader: StageRasterFine, kernel: Main, keywords -Compiled compute shader: StageSetupSegment, kernel: Main, keywords +Compiled compute shader: StageSetupSegment, kernel: Main, keywords INDEX_FORMAT_UINT_32 Compiled compute shader: StageShadingSetup, kernel: ClearShadingCompactionBuffer, keywords Compiled compute shader: StageShadingSetup, kernel: ClearShadingSampleVisibilityBuffer, keywords Compiled compute shader: StageShadingSetup, kernel: CreateCompactedShadingSamplesMapping, keywords Compiled compute shader: StageShadingSetup, kernel: ReplicateShadedSamplesToShadingAtlas, keywords +Compiled compute shader: StageWorkQueue, kernel: BuildFineRasterArgs, keywords Compiled compute shader: StageWorkQueue, kernel: WorkQueueActiveBins, keywords Compiled compute shader: StageWorkQueue, kernel: WorkQueueActiveClusters, keywords Compiled compute shader: StageWorkQueue, kernel: WorkQueueBuild, keywords @@ -2162,13 +2164,18 @@ Compiled shader: Shader Graphs/HQLinesShader, pass: ForwardOnly, stage: all, key Compiled shader: Shader Graphs/HQLinesShader, pass: ForwardOnly, stage: pixel, keywords STEREO_INSTANCING_ON Compiled shader: Shader Graphs/HQLinesShader, pass: ForwardOnly, stage: vertex, keywords STEREO_INSTANCING_ON Compiled shader: Shader Graphs/HQLinesShader, pass: LineRenderingOffscreenShading, stage: all, keywords +Compiled shader: Shader Graphs/HQLinesShader, pass: LineRenderingOffscreenShading, stage: pixel, keywords Compiled shader: Shader Graphs/HQLinesShader, pass: LineRenderingOffscreenShading, stage: pixel, keywords STEREO_INSTANCING_ON +Compiled shader: Shader Graphs/HQLinesShader, pass: LineRenderingOffscreenShading, stage: vertex, keywords Compiled shader: Shader Graphs/HQLinesShader, pass: LineRenderingOffscreenShading, stage: vertex, keywords STEREO_INSTANCING_ON Compiled shader: Shader Graphs/HQLinesShader, pass: MotionVectors, stage: all, keywords WRITE_MSAA_DEPTH +Compiled shader: Shader Graphs/HQLinesShader, pass: MotionVectors, stage: pixel, keywords Compiled shader: Shader Graphs/HQLinesShader, pass: MotionVectors, stage: pixel, keywords STEREO_INSTANCING_ON WRITE_MSAA_DEPTH Compiled shader: Shader Graphs/HQLinesShader, pass: MotionVectors, stage: vertex, keywords Compiled shader: Shader Graphs/HQLinesShader, pass: MotionVectors, stage: vertex, keywords STEREO_INSTANCING_ON Compiled shader: Shader Graphs/HQLinesShader, pass: ShadowCaster, stage: all, keywords +Compiled shader: Shader Graphs/HQLinesShader, pass: ShadowCaster, stage: pixel, keywords +Compiled shader: Shader Graphs/HQLinesShader, pass: ShadowCaster, stage: vertex, keywords Compiled shader: Shader Graphs/KeywordGraph, pass: DepthForwardOnly, stage: all, keywords TESTKEYWORD_ONESTACK Compiled shader: Shader Graphs/KeywordGraph, pass: DepthForwardOnly, stage: all, keywords TESTKEYWORD_ONESTACK WRITE_MSAA_DEPTH Compiled shader: Shader Graphs/KeywordGraph, pass: DepthForwardOnly, stage: all, keywords TESTKEYWORD_TWOSTACKS diff --git a/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering.unity b/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering.unity index d11ee734af0..1d62a774737 100644 --- a/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering.unity +++ b/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering.unity @@ -196,6 +196,7 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 + m_ForceVisible: 0 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!4 &396877726 @@ -259,19 +260,22 @@ MonoBehaviour: m_UseScreenSpaceShadows: 0 m_InteractsWithSky: 1 m_AngularDiameter: 0.5 - m_DiameterMultiplerMode: 1 - m_DiameterMultiplier: 1 - m_DiameterOverride: 0.5 - m_EmissiveLightSource: 1 - m_FlareSize: 2 - m_FlareTint: {r: 1, g: 1, b: 1, a: 1} - m_FlareFalloff: 4 - m_AutomaticMoonPhase: 1 - m_MoonPhase: 0.2 - m_MoonPhaseRotation: 0 - m_Earthshine: 1 - m_SurfaceTexture: {fileID: 0} - m_SurfaceTint: {r: 1, g: 1, b: 1, a: 1} + diameterMultiplerMode: 1 + diameterMultiplier: 1 + diameterOverride: 0.5 + celestialBodyShadingSource: 1 + sunLightOverride: {fileID: 0} + sunColor: {r: 1, g: 1, b: 1, a: 1} + sunIntensity: 130000 + moonPhase: 0.2 + moonPhaseRotation: 0 + earthshine: 1 + flareSize: 2 + flareTint: {r: 1, g: 1, b: 1, a: 1} + flareFalloff: 4 + flareMultiplier: 1 + surfaceTexture: {fileID: 0} + surfaceTint: {r: 1, g: 1, b: 1, a: 1} m_Distance: 1.5e+11 m_UseRayTracedShadows: 0 m_NumRayTracingSamples: 4 @@ -294,7 +298,7 @@ MonoBehaviour: m_MinFilterSize: 0.1 m_DirLightPCSSBlockerSampleCount: 24 m_DirLightPCSSFilterSampleCount: 16 - m_DirLightPCSSMaxBlockerDistance: 64 + m_DirLightPCSSMaxPenumbraSize: 0.56 m_DirLightPCSSMaxSamplingDistance: 0.5 m_DirLightPCSSMinFilterSizeTexels: 1.5 m_DirLightPCSSMinFilterMaxAngularDiameter: 10 @@ -412,10 +416,6 @@ PrefabInstance: propertyPath: m_Name value: HDRP_Test_Camera objectReference: {fileID: 0} - - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - target: {fileID: 4209882255362944, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: m_LocalPosition.x value: 1.2360274 @@ -461,31 +461,6 @@ PrefabInstance: propertyPath: m_Version value: 9 objectReference: {fileID: 0} - - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: customRenderingSettings - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: m_RenderingPathCustomFrameSettings.bitDatas.data2 - value: 4539628974145273856 - objectReference: {fileID: 0} - - target: {fileID: 114777190906822814, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: renderingPathCustomFrameSettingsOverrideMask.mask.data2 - value: 549755813888 - objectReference: {fileID: 0} - - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: waitFrames - value: 120 - objectReference: {fileID: 0} - - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, - type: 3} - propertyPath: xrCompatible - value: 1 - objectReference: {fileID: 0} - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, type: 3} propertyPath: renderPipelineAsset @@ -497,6 +472,11 @@ PrefabInstance: propertyPath: checkMemoryAllocation value: 0 objectReference: {fileID: 0} + - target: {fileID: 114995348509370400, guid: c07ace9ab142ca9469fa377877c2f1e7, + type: 3} + propertyPath: ImageComparisonSettings.AverageCorrectnessThreshold + value: 0.0002 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -575,6 +555,11 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 3745766622892267668, guid: 9660eb41c4b4bc74081aa484abc94bfe, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4735645399225585330, guid: 9660eb41c4b4bc74081aa484abc94bfe, type: 3} propertyPath: m_LocalScale.x @@ -737,6 +722,30 @@ MonoBehaviour: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 + m_RendererLODScreenCoverageCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.01 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 m_ShadingSampleFraction: 1 m_IndexCount: 1603168 m_SegmentsPerLine: 8 diff --git a/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRendererShader.shadergraph b/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRendererShader.shadergraph index 364d4dab904..5e3fb6411be 100644 --- a/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRendererShader.shadergraph +++ b/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRendererShader.shadergraph @@ -30,10 +30,10 @@ "m_Id": "d83c84c8d81048749f9a34b90edf0b7e" }, { - "m_Id": "d2f6ffaf329d45c68c725a7b613c4167" + "m_Id": "cda98a9fe19a4f348da1e612c759142a" }, { - "m_Id": "cda98a9fe19a4f348da1e612c759142a" + "m_Id": "caf0187ebb314b50a11d8662e543d3a3" } ], "m_GroupDatas": [], @@ -57,7 +57,7 @@ "m_VertexContext": { "m_Position": { "x": 0.0, - "y": 0.0 + "y": -68.0 }, "m_Blocks": [ { @@ -68,6 +68,9 @@ }, { "m_Id": "20134c5d470a40c0af6a6170eb373c52" + }, + { + "m_Id": "caf0187ebb314b50a11d8662e543d3a3" } ] }, @@ -85,9 +88,6 @@ }, { "m_Id": "d83c84c8d81048749f9a34b90edf0b7e" - }, - { - "m_Id": "d2f6ffaf329d45c68c725a7b613c4167" } ] }, @@ -356,21 +356,6 @@ "m_Space": 0 } -{ - "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", - "m_ObjectId": "8ce95636a71a42858c7e4bceaa8c5cfe", - "m_Id": 0, - "m_DisplayName": "Width", - "m_SlotType": 0, - "m_Hidden": false, - "m_ShaderOutputName": "LineWidth", - "m_StageCapability": 2, - "m_Value": 1.5, - "m_DefaultValue": 1.0, - "m_Labels": [] -} - { "m_SGVersion": 0, "m_Type": "UnityEditor.ShaderGraph.BlockNode", @@ -419,6 +404,40 @@ "m_DistortionOnly": false } +{ + "m_SGVersion": 0, + "m_Type": "UnityEditor.ShaderGraph.BlockNode", + "m_ObjectId": "caf0187ebb314b50a11d8662e543d3a3", + "m_Group": { + "m_Id": "" + }, + "m_Name": "VertexDescription.Width", + "m_DrawState": { + "m_Expanded": true, + "m_Position": { + "serializedVersion": "2", + "x": 0.0, + "y": 0.0, + "width": 0.0, + "height": 0.0 + } + }, + "m_Slots": [ + { + "m_Id": "d46e7c73127e43878a425ee7acaf6f40" + } + ], + "synonyms": [], + "m_Precision": 0, + "m_PreviewExpanded": true, + "m_DismissedVersion": 0, + "m_PreviewMode": 0, + "m_CustomColors": { + "m_SerializableColors": [] + }, + "m_SerializedDescriptor": "VertexDescription.Width" +} + { "m_SGVersion": 1, "m_Type": "UnityEditor.ShaderGraph.PositionNode", @@ -472,6 +491,7 @@ "m_BackThenFrontRendering": false, "m_TransparentDepthPrepass": false, "m_TransparentDepthPostpass": false, + "m_TransparentPerPixelSorting": false, "m_SupportLodCrossFade": false } @@ -507,36 +527,17 @@ { "m_SGVersion": 0, - "m_Type": "UnityEditor.ShaderGraph.BlockNode", - "m_ObjectId": "d2f6ffaf329d45c68c725a7b613c4167", - "m_Group": { - "m_Id": "" - }, - "m_Name": "SurfaceDescription.LineWidth", - "m_DrawState": { - "m_Expanded": true, - "m_Position": { - "serializedVersion": "2", - "x": 0.0, - "y": 0.0, - "width": 0.0, - "height": 0.0 - } - }, - "m_Slots": [ - { - "m_Id": "8ce95636a71a42858c7e4bceaa8c5cfe" - } - ], - "synonyms": [], - "m_Precision": 0, - "m_PreviewExpanded": true, - "m_DismissedVersion": 0, - "m_PreviewMode": 0, - "m_CustomColors": { - "m_SerializableColors": [] - }, - "m_SerializedDescriptor": "SurfaceDescription.LineWidth" + "m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot", + "m_ObjectId": "d46e7c73127e43878a425ee7acaf6f40", + "m_Id": 0, + "m_DisplayName": "Width", + "m_SlotType": 0, + "m_Hidden": false, + "m_ShaderOutputName": "Width", + "m_StageCapability": 1, + "m_Value": 0.07999999821186066, + "m_DefaultValue": 0.07999999821186066, + "m_Labels": [] } { @@ -597,7 +598,8 @@ "m_TessellationShapeFactor": 0.75, "m_TessellationBackFaceCullEpsilon": -0.25, "m_TessellationMaxDisplacement": 0.009999999776482582, - "m_Version": 1, + "m_DebugSymbols": false, + "m_Version": 2, "inspectorFoldoutMask": 0 } diff --git a/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRenderingVolume.asset b/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRenderingVolume.asset index 8f8d26a816c..10b3785b73f 100644 --- a/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRenderingVolume.asset +++ b/Tests/SRPTests/Projects/HDRP_Tests/Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering/LineRenderingVolume.asset @@ -23,8 +23,8 @@ MonoBehaviour: m_OverrideState: 0 m_Value: 24 sortingQuality: - m_OverrideState: 0 - m_Value: 0 + m_OverrideState: 1 + m_Value: 2 tileOpacityThreshold: m_OverrideState: 0 m_Value: 1 diff --git a/Tests/SRPTests/Projects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset b/Tests/SRPTests/Projects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset index fa7301d083b..67957cbdd46 100644 --- a/Tests/SRPTests/Projects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset +++ b/Tests/SRPTests/Projects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset @@ -19,6 +19,7 @@ MonoBehaviour: ColorSpace: 1 BuildPlatform: -2 GraphicsDevice: 16 + Architecture: 0 XrSdk: StereoModes: 0 Reason: Disable this test as we disable the feature for Yamto on Mac @@ -28,6 +29,7 @@ MonoBehaviour: ColorSpace: -1 BuildPlatform: -2 GraphicsDevice: 16 + Architecture: 0 XrSdk: StereoModes: 0 Reason: fail on yamato @@ -37,6 +39,7 @@ MonoBehaviour: ColorSpace: -1 BuildPlatform: -2 GraphicsDevice: 16 + Architecture: 0 XrSdk: StereoModes: 0 Reason: incorrect on metal @@ -46,6 +49,7 @@ MonoBehaviour: ColorSpace: -1 BuildPlatform: -2 GraphicsDevice: 16 + Architecture: 0 XrSdk: StereoModes: 0 Reason: incorrect on metal @@ -55,6 +59,7 @@ MonoBehaviour: ColorSpace: -1 BuildPlatform: -2 GraphicsDevice: 16 + Architecture: 0 XrSdk: StereoModes: 0 Reason: incorrect on metal @@ -64,6 +69,7 @@ MonoBehaviour: ColorSpace: -1 BuildPlatform: -2 GraphicsDevice: 16 + Architecture: 0 XrSdk: StereoModes: 0 Reason: corrupt on yamato @@ -73,6 +79,7 @@ MonoBehaviour: ColorSpace: -1 BuildPlatform: -2 GraphicsDevice: 16 + Architecture: 0 XrSdk: StereoModes: 0 Reason: corrupt on yamato diff --git a/Tests/SRPTests/Projects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset b/Tests/SRPTests/Projects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset index 00d36758239..ab6834dbe5d 100644 --- a/Tests/SRPTests/Projects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset +++ b/Tests/SRPTests/Projects/HDRP_Tests/ProjectSettings/EditorBuildSettings.asset @@ -896,6 +896,7 @@ EditorBuildSettings: - enabled: 1 path: Assets/GraphicTests/Scenes/9x_Other/9950-LineRendering.unity guid: 65ec8013d474e1a4e85d97b29e7302f0 + m_configObjects: {} - enabled: 1 path: Assets/GraphicTests/Scenes/8x_ShaderGraph/8301_Canvas.unity guid: 6fbea5cb60d394329b2ac2b4a3788d12 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Assets/Test/TestFilters/TestCaseFilters.asset b/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Assets/Test/TestFilters/TestCaseFilters.asset index 0ae58df07df..951d6cfb914 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Assets/Test/TestFilters/TestCaseFilters.asset +++ b/Tests/SRPTests/Projects/UniversalGraphicsTest_Terrain/Assets/Test/TestFilters/TestCaseFilters.asset @@ -79,15 +79,6 @@ MonoBehaviour: XrSdk: None StereoModes: 0 Reason: https://fogbugz.unity3d.com/f/cases/1305639/ - - FilteredScene: {fileID: 0} - FilteredScenes: - - {fileID: 102900000, guid: e04a7c287e4c08242a5511645a045ed4, type: 3} - ColorSpace: -1 - BuildPlatform: 44 - GraphicsDevice: 4 - XrSdk: - StereoModes: 0 - Reason: https://jira.unity3d.com/browse/UUM-40681 - FilteredScene: {fileID: 0} FilteredScenes: - {fileID: 102900000, guid: e04a7c287e4c08242a5511645a045ed4, type: 3} @@ -130,7 +121,7 @@ MonoBehaviour: ColorSpace: -1 BuildPlatform: 44 GraphicsDevice: 4 - XrSdk: + XrSdk: StereoModes: 0 Reason: https://jira.unity3d.com/browse/UUM-40684 - FilteredScene: {fileID: 0} diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITestHelper.cs b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITestHelper.cs new file mode 100644 index 00000000000..06434267252 --- /dev/null +++ b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITestHelper.cs @@ -0,0 +1,50 @@ +using System.Collections; +using System.Reflection; + +using NUnit.Framework; +using UnityEngine; +using UnityEngine.UIElements; + +namespace UnityEditor.VFX.Test +{ + public static class VFXGUITestHelper + { + public static void SendDoubleClick(VisualElement element, int clickCount) + { + var clickEvent = MouseDownEvent.GetPooled(); + var clickCountProperty = clickEvent.GetType().GetProperty(nameof(clickEvent.clickCount), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.NotNull(clickCountProperty); + clickCountProperty.SetValue(clickEvent, clickCount); + + var buttonProperty = clickEvent.GetType().GetProperty(nameof(clickEvent.button), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.NotNull(buttonProperty); + buttonProperty.SetValue(clickEvent, (int)MouseButton.LeftMouse); + + var targetProperty = clickEvent.GetType().GetProperty(nameof(clickEvent.target), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.NotNull(targetProperty); + targetProperty.SetValue(clickEvent, element); + + var currentTargetProperty = clickEvent.GetType().GetProperty(nameof(clickEvent.currentTarget), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.NotNull(currentTargetProperty); + currentTargetProperty.SetValue(clickEvent, element); + + element.SendEvent(clickEvent); + } + + public static void SendKeyDown(VisualElement element, KeyCode keyCode) + { + var keyDownEvent = KeyDownEvent.GetPooled((char)keyCode, keyCode, EventModifiers.None); + element.SendEvent(keyDownEvent); + } + + public static IEnumerator SendKeyDown(VisualElement element, string text) + { + foreach (var character in text) + { + var keyDownEvent = KeyDownEvent.GetPooled(character, (KeyCode)character, EventModifiers.None); + element.SendEvent(keyDownEvent); + yield return null; + } + } + } +} diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITestHelper.cs.meta b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITestHelper.cs.meta new file mode 100644 index 00000000000..ee9de7304e7 --- /dev/null +++ b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITestHelper.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e8d52c4f0c8408c4da47e448296f22b0 \ No newline at end of file diff --git a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITests.cs b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITests.cs index bebb9e01b00..8b8c55e9430 100644 --- a/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITests.cs +++ b/Tests/SRPTests/Projects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXGUITests.cs @@ -11,6 +11,8 @@ using UnityEngine; using UnityEngine.TestTools; using Moq; +using UnityEditor.Search; +using UnityEditor.SearchService; using UnityEditor.VFX.UI; using UnityEditor.VFX.Block.Test; using UnityEngine.UIElements; @@ -896,6 +898,51 @@ public void Check_NumericPropertyRM_UInt_RangeAttribute() CheckNumericPropertyRM(x => new UintPropertyRM(x, 60f), new MinMaxAttribute(1f, 100f), 1U, new List<(uint, uint)> { (0, 1), (105, 100 )}); } + [UnityTest] + public IEnumerator Check_ObjectPropertyRMTextureSearch() + { + try + { + var viewController = VFXTestCommon.StartEditTestAsset(); + var texture2DDesc = VFXLibrary.GetOperators().Single(x => x.name == "Texture2D"); + viewController.AddVFXOperator(Vector2.zero, texture2DDesc); + viewController.ApplyChanges(); + yield return null; + + var window = VFXViewWindow.GetWindow(viewController.graph.GetResource(), true, true); + var texture2DNodeUI = window.graphView.Q(); + var button = texture2DNodeUI.Q(null, "unity-object-field__selector"); + + VFXGUITestHelper.SendDoubleClick(button, 1); + yield return null; + + Assert.IsTrue(EditorWindow.HasOpenInstances()); + + if (ObjectSelectorSearch.HasEngineOverride()) + { + // Work around a bug in ObjectSelector which property searchFilter do not return correct value when the search mode is advanced + var searchWindow = EditorWindow.GetWindowDontShow(); + Assert.AreEqual("t:Texture2D or t:RenderTexture", searchWindow.context.searchText); + } + else + { + Assert.AreEqual("t:Texture2D t:RenderTexture", ObjectSelector.get.searchFilter); + } + } + finally + { + if (EditorWindow.HasOpenInstances()) + { + EditorWindow.GetWindow().Close(); + } + + if (EditorWindow.HasOpenInstances()) + { + EditorWindow.GetWindow().Close(); + } + } + } + private void CheckNumericPropertyRM(Func> creator, UnityEngine.PropertyAttribute attribute, T initialValue, List<(T, T)> testCases) { // Arrange