Skip to content

Commit 7dea519

Browse files
authored
Merge pull request #8261 from Unity-Technologies/internal/6000.3/staging
Mirror Internal/6000.3/staging
2 parents 594725a + 5a5cddd commit 7dea519

File tree

50 files changed

+1877
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1877
-238
lines changed

Packages/com.unity.render-pipelines.core/Editor/SampleDependencyImportSystem/SampleDependencyImporter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ VisualElement panelRoot
4848
{
4949
get
5050
{
51-
_panelRoot ??= injectingElement.panel.visualTree;
51+
_panelRoot ??= injectingElement?.panel?.visualTree;
5252
return _panelRoot;
5353
}
5454
}
@@ -82,11 +82,11 @@ VisualElement IPackageManagerExtension.CreateExtensionUI()
8282

8383
void RefreshSampleButtons()
8484
{
85-
if (injectingElement == null || m_PackageInfo == null || m_SampleList == null)
85+
if (injectingElement == null || m_PackageInfo == null || m_SampleList == null || panelRoot == null)
8686
return;
8787

8888
// Call refresh of samples and button injection when switching to the "Samples" tab.
89-
if (samplesButton == null )
89+
if (samplesButton == null)
9090
{
9191
samplesButton = panelRoot.Q<Button>(name: samplesButtonName);
9292
if (samplesButton != null)

Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ private void Reset()
3232
/// <param name="settings"><see cref="IDebugDisplaySettings"/> to be registered</param>
3333
public void RegisterDebug(IDebugDisplaySettings settings)
3434
{
35-
#if UNITY_EDITOR
36-
if (UnityEditor.BuildPipeline.isBuildingPlayer)
37-
return;
38-
#endif
3935
DebugManager debugManager = DebugManager.instance;
4036
List<IDebugDisplaySettingsPanelDisposable> panels = new List<IDebugDisplaySettingsPanelDisposable>();
4137

Packages/com.unity.render-pipelines.core/Samples~/Common/Scripts/InstallPackage.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using UnityEditor;
2-
using UnityEditor.PackageManager;
3-
using UnityEditor.PackageManager.Requests;
41
using UnityEngine;
52

63
public class InstallPackage : MonoBehaviour

Packages/com.unity.render-pipelines.high-definition/Documentation~/water-vfx-interaction.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ However there are several simulations that are important to be aware of.
66
As the water surface gameobject is saved inside a scene, and the VFX graph is an asset on disk, it is not possible to directly reference the surface from within the graph. This means data of the water surface need to be set globally by the user before the VFX can sample the water.
77
As a result, only a single surface can be sampled from any VFX Graph at any given time.
88

9-
Additionally, the settings on the Sample node in the VFX Graph needs to be set according to what water surfaces will be bound globally at runtime. This inclues setting the proper **Surface Type** and enabling **Include Current** if a current map is assigned on the water surface.
9+
Additionally, the settings on the Sample node in the VFX Graph needs to be set according to what water surfaces will be bound globally at runtime. This includes setting the proper **Surface Type** and enabling **Include Current** if a current map is assigned on the water surface.
1010
The **Evaluate Ripples** needs to be disabled if the surface doesn't have ripples, but can be disabled on purpose for performance reasons even if the surface has ripplies, at the cost of slighly lower precision in the results. The same applies to the **Include Deformation** option.
11+
Finally, to ensure proper masking is applied, the option **Use Mask and Current Water Decals Workflow** must be set to match the **Enable Mask And Current Water Decals** setting in the Graphics settings.
12+
1113

1214
The following script can be used to bind the relevant textures in the global scope, so that the VFX Graph can access them.
15+
Alternatively, can also use the more complete script WaterSurfaceBindVFXEditor.cs, located in the HDRP Package Manager Water samples.
1316
```
17+
using UnityEngine;
18+
using UnityEngine.Rendering.HighDefinition;
19+
1420
public class WaterSurfaceBinder : MonoBehaviour
1521
{
1622
public WaterSurface waterSurface;

Packages/com.unity.render-pipelines.high-definition/Editor/Water/WaterSurface/VFX/SampleWaterSurface.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class SampleWaterSurface : VFXOperator
4646
[VFXSetting(VFXSettingAttribute.VisibleFlags.Default)]
4747
[Tooltip("Specifies if the search should sample the current map.")]
4848
protected bool includeCurrent = false;
49+
[VFXSetting(VFXSettingAttribute.VisibleFlags.Default)]
50+
[Tooltip("Specifies if the system use mask and current water decal workflow. This has to be set in accordance with the same checkbox in the Graphics Settings.")]
51+
protected bool useMaskAndCurrentWaterDecalsWorkflow = false;
4952

5053
public class InputProperties
5154
{
@@ -107,6 +110,9 @@ protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputE
107110
if (!includeDeformation) baseCode += "#define IGNORE_WATER_DEFORMATION\n";
108111
if (includeCurrent) baseCode += "#define WATER_LOCAL_CURRENT\n";
109112

113+
// We need this because water decals can attenuate frequency bands using a water mask when Mask and Current Water Decals workflow is enabled.
114+
if (useMaskAndCurrentWaterDecalsWorkflow) baseCode += "#define WATER_DECAL_COMPLETE\n";
115+
110116
baseCode += $"#include \"{m_SampleWaterSurface}\"\n";
111117

112118
string FindVerticalDisplacements = $"float error; int steps; float3 normal; float2 current; float height = FindVerticalDisplacement(positionWS, {maxIterations}, {error.ToString("0.00", System.Globalization.CultureInfo.InvariantCulture)}, steps, error, normal, current);";

Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2125,11 +2125,6 @@ void UnregisterRenderingDebug()
21252125

21262126
internal void RegisterDebug()
21272127
{
2128-
#if UNITY_EDITOR
2129-
if (UnityEditor.BuildPipeline.isBuildingPlayer)
2130-
return;
2131-
#endif
2132-
21332128
RegisterMaterialDebug();
21342129
RegisterLightingDebug();
21352130
RegisterRenderingDebug();
@@ -2149,7 +2144,7 @@ void UnregisterDebugItems(string panelName, DebugUI.Widget[] items)
21492144
{
21502145
if (items == null || items.Length == 0)
21512146
return;
2152-
2147+
21532148
var panel = DebugManager.instance.GetPanel(panelName);
21542149
if (panel != null)
21552150
panel.children.Remove(items);

Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.SimulationCPU.Search.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static WaterSimulationTapData EvaluateDisplacementData(WaterSimSearchData wsd, f
343343
EvaluateSimulationDisplacement(wsd, currentLocation, includeSimulation, out data.horizontalDisplacement, out data.direction, out data.verticalDisplacements);
344344

345345
// Evaluate the distance to the reference point
346-
data.offset = (currentLocation.xz + data.horizontalDisplacement) - referencePosition.xz;
346+
data.offset = currentLocation.xz - referencePosition.xz;
347347
data.distance = length(data.offset);
348348

349349
return data;

Packages/com.unity.render-pipelines.high-definition/Runtime/Water/Shaders/SampleWaterSurface.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ TapData EvaluateDisplacementData(float3 currentLocation, float3 referencePositio
579579
EvaluateSimulationDisplacement(currentLocation, data.horizontalDisplacement, data.verticalDisplacements);
580580

581581
// Evaluate the distance to the reference point
582-
data.offset = (currentLocation.xz + data.horizontalDisplacement) - referencePosition.xz;
582+
data.offset = currentLocation.xz - referencePosition.xz;
583583
data.distance = length(data.offset);
584584

585585
return data;

Packages/com.unity.render-pipelines.high-definition/Samples~/WaterSamples/Scripts/CurrentWithSplines/SplineToTexture.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
using UnityEditor;
44
using UnityEngine;
55
using UnityEngine.Rendering.HighDefinition;
6-
using UnityEditor.PackageManager.Requests;
7-
using UnityEditor.PackageManager;
86
#if SPLINE_PACKAGE_INSTALLED
9-
using UnityEditor.Splines;
10-
using UnityEngine.Splines;
7+
#if UNITY_EDITOR
8+
using UnityEditor.Splines;
9+
#endif
10+
using UnityEngine.Splines;
1111
#endif
1212

1313
[ExecuteInEditMode]
@@ -51,7 +51,7 @@ void OnEnable()
5151

5252
void HookCallbacks()
5353
{
54-
#if SPLINE_PACKAGE_INSTALLED
54+
#if SPLINE_PACKAGE_INSTALLED && UNITY_EDITOR
5555
if (splineContainer != null)
5656
foreach (Spline spline in splineContainer.Splines)
5757
EditorSplineUtility.AfterSplineWasModified += OnAfterSplineWasModified;
@@ -60,7 +60,7 @@ void HookCallbacks()
6060

6161
void UnhookCallbacks()
6262
{
63-
#if SPLINE_PACKAGE_INSTALLED
63+
#if SPLINE_PACKAGE_INSTALLED && UNITY_EDITOR
6464
if (splineContainer != null)
6565
foreach (Spline spline in splineContainer.Splines)
6666
EditorSplineUtility.AfterSplineWasModified -= OnAfterSplineWasModified;
@@ -308,6 +308,8 @@ public void RunCompute()
308308
#endif
309309
}
310310
}
311+
312+
#if UNITY_EDITOR
311313
public void OpenDialogAndSaveCurrentMap()
312314
{
313315
var path = EditorUtility.SaveFilePanel("Save current map", "","currentMap","png");
@@ -329,6 +331,7 @@ public static void SaveTextureOnDisk(RenderTexture renderTexture, string path)
329331
File.WriteAllBytes(path, bytesHeight);
330332
AssetDatabase.Refresh();
331333
}
334+
#endif
332335

333336
public static Texture2D ToTexture2D(RenderTexture rTex)
334337
{

0 commit comments

Comments
 (0)