Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal/6000.0/staging #8111

Merged
merged 39 commits into from
Dec 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f02b78b
[Port] [6000.0] [HDRP] Fix shaders warning in console when building
svc-reach-platform-support Nov 2, 2024
390f197
[Port] [6000.0] Minor docs fixes from feedback tickets
svc-reach-platform-support Nov 2, 2024
ae28f6a
[Port] [6000.0] Remove #if preprocessor wrapping the UniversalRenderP…
svc-reach-platform-support Nov 5, 2024
9b1adee
[Port] [6000.0] [UUM-84431] Fix Lens Flare not rendering properly in …
svc-reach-platform-support Nov 6, 2024
a76c212
[Port] [6000.0] [HDRP] Improve water decal workflow for older shapes …
svc-reach-platform-support Nov 6, 2024
7ddc45a
[Port] [6000.0] [VFX] Two Custom hlsl bug fixes
svc-reach-platform-support Nov 6, 2024
89d1bb1
[Port] [6000.0] Prevent eviction of light with preserveCachedShadow f…
svc-reach-platform-support Nov 6, 2024
13a0ba1
[Port] [6000.0] [Fix] Fix the GBuffer pass to write in RT4 in Render …
svc-reach-platform-support Nov 7, 2024
a384e3a
[Port] [6000.0] Fix for HDRP entity water excluders
svc-reach-platform-support Nov 8, 2024
648df8f
[6000.0] Fix for glclientwaitsync errors in PowerVR devices
Nov 11, 2024
3652a13
[UUM-85648] Disabling test 270 for 6000.0
christian-sasseville Nov 11, 2024
bfc0cf4
[Port] [6000.0] [WebGPU] Test Updates and Bugfixes
svc-reach-platform-support Nov 11, 2024
82f6123
[Port] [6000.0] [VFX] Custom attribute with same name as built-in att…
svc-reach-platform-support Nov 12, 2024
4322132
[Port] [6000.0] Add dynamic resolution / upscaling docs page
svc-reach-platform-support Nov 12, 2024
ac3054e
[Port] [6000.0] [HDRP] Assertion printed when Maximum Reflection Prob…
svc-reach-platform-support Nov 13, 2024
f629d18
[Port] [6000.0] RenderGraph.AddBlitPass doesn't work correctly with t…
svc-reach-platform-support Nov 13, 2024
4c766ed
[Port] [6000.0] Fix Vulkan URP 2D crash on some android devices
svc-reach-platform-support Nov 13, 2024
455c43d
[Port] [6000.0] [HDRP] Better material creation for PBR Sky Custom Ma…
svc-reach-platform-support Nov 13, 2024
155b9d5
[Unity 6.0][URP] Fixing an issue where Transparent Receive Shadows to…
ellioman Nov 13, 2024
ef49573
[Port] [6000.0] [HDRP] Empty template starts with incorrect Physicall…
svc-reach-platform-support Nov 13, 2024
a003347
[6000.0] Fix picking and outline for all BatchRendererGroup draw types
JussiKnuuttila Nov 15, 2024
e0776ba
[Port] [6000.0] [VFX] Fix subgraph block nesting
svc-reach-platform-support Nov 18, 2024
0121c5d
[Port] [6000.0] Graphics/SRP/RPF - [UUM-87121] - STP is disabled when…
svc-reach-platform-support Nov 19, 2024
fd33269
[Port] [6000.0] UUM-86959: Fix environement lighting not updated when…
svc-reach-platform-support Nov 20, 2024
57c45aa
[Port] [6000.0] Added custom render texture documentation
svc-reach-platform-support Nov 20, 2024
fe6722c
[Port] [6000.0] [HDRP] Fix decal projector material creation
svc-reach-platform-support Nov 21, 2024
f92c6ae
[6000.0] Fix Depth attachment texture for DX11
Nov 21, 2024
75aeba7
[Port] [6000.0] Bind dummy depth texture for MRT in Volumetric Clouds…
svc-reach-platform-support Nov 21, 2024
31a26ae
[Port] [6000.0] [HDRP] Fix errors when building XR player with Water …
svc-reach-platform-support Nov 21, 2024
cca6426
[Port] [6000.0] Graphics/SRP/RPF - [UUM-87865] Make SetViewAndProject…
svc-reach-platform-support Nov 21, 2024
12c69f5
[Port] [6000.0] Add documentation for shadow matte interaction with s…
svc-reach-platform-support Nov 22, 2024
90e1f1c
[Port] [6000.0] [Render Graph Viewer]Minor fixes on side panels
svc-reach-platform-support Nov 22, 2024
93d354e
Nov 25, 2024
40deb52
[Port] [6000.0] Fixed compute shader for baking probe volumes
svc-reach-platform-support Nov 25, 2024
474a9a1
[Port] [6000.0] [VFX] Label are not visible when node is collapsed
svc-reach-platform-support Nov 25, 2024
67946e9
[Port] [6000.0] [Render Graph Viewer]Properly show the values for cle…
svc-reach-platform-support Nov 26, 2024
a7fe74d
[Port] [6000.0] Fix Final Depth Copy Parameters & Unnecessary Scene V…
svc-reach-platform-support Nov 26, 2024
bfe6926
[Backport 6000.0] Revert Changes from UUM-29958
RoseHirigoyen Nov 28, 2024
bff5f11
[6.0/editor] Fixed scene filtering with rendergraph not working on metal
alexey-unity Nov 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Port] [6000.0] [HDRP] Improve water decal workflow for older shapes …
…(box, sphere, bow.. etc) as Foam Generator and Water Deformers

Following the Water Decal improvement in Unity 6, we handled the migration of old foam generators and water deformers properly by converting them to a shader graph. However, users starting in Unity 6 don't have this possibility (to start from the migration shader graph), so following the pattern in the custom pass material added by this PR (#46391), I improved the workflow allowing users to either create a new blank water decal or start from the deformer and foam migration shader graph to get the default shapes that was there before U6 (box, sphere, bow.. etc)

Before: 

https://media.github.cds.internal.unity3d.com/user/1764/files/fe721506-6342-4e21-a7f1-5b515873db12


After: 
(Empty water decal is the same path as the "new" button before)
https://media.github.cds.internal.unity3d.com/user/1764/files/de95d1b1-9dfc-47d0-9ef9-e1dacbbf5eb2
  • Loading branch information
svc-reach-platform-support authored and Evergreen committed Nov 6, 2024
commit a76c21229c660df2330b4cf95c1fdec0ed21c725
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;

namespace UnityEditor.Rendering.HighDefinition
@@ -26,6 +27,12 @@ partial class WaterDecalEditor : Editor

HierarchicalBox m_BoxHandle;

internal enum DefaultWaterDecal
{
Empty,
DeformerAndFoam
}

void OnEnable()
{
var o = new PropertyFetcher<WaterDecal>(serializedObject);
@@ -67,6 +74,9 @@ void OnDisable()
static public readonly GUIContent k_SurfaceFoamDimmerText = EditorGUIUtility.TrTextContent("Surface Foam Dimmer", "Specifies the dimmer for the surface foam.");
static public readonly GUIContent k_DeepFoamDimmerText = EditorGUIUtility.TrTextContent("Deep Foam Dimmer", "Specifies the dimmer for the deep foam.");

static public readonly GUIContent k_NewWaterDecalMaterialButtonText = EditorGUIUtility.TrTextContent("New", "Creates a new Water Decal shader and Material asset templates.");
static public readonly string k_NewEmptyWaterDecalText = "Empty Water Decal";
static public readonly string k_NewDeformerAndFoamWaterDecalText = "Deformer and Foam Water Decal";
public override void OnInspectorGUI()
{
serializedObject.Update();
@@ -80,11 +90,31 @@ public override void OnInspectorGUI()
serializedObject.ApplyModifiedProperties();
}

internal void WaterDecalMaterialFieldWithButton(SerializedProperty prop)
{
const int k_NewFieldWidth = 70;

var rect = EditorGUILayout.GetControlRect();
rect.xMax -= k_NewFieldWidth + 2;

EditorGUI.PropertyField(rect, prop);

var newFieldRect = rect;
newFieldRect.x = rect.xMax + 2;
newFieldRect.width = k_NewFieldWidth;

if (!EditorGUI.DropdownButton(newFieldRect, k_NewWaterDecalMaterialButtonText, FocusType.Keyboard))
return;

GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent(k_NewEmptyWaterDecalText), false, () => CreateDefaultDecalMaterial(target as MonoBehaviour, DefaultWaterDecal.Empty));
menu.AddItem(new GUIContent(k_NewDeformerAndFoamWaterDecalText), false, () => CreateDefaultDecalMaterial(target as MonoBehaviour, DefaultWaterDecal.DeformerAndFoam));
menu.DropDown(newFieldRect);
}

public void MaterialGUI()
{
WaterSurfaceEditor.MaterialFieldWithButton(null, m_Material, () => {
return CreateDefaultDecalMaterial(target as MonoBehaviour);
});
WaterDecalMaterialFieldWithButton(m_Material);

if (m_Material.objectReferenceValue == null)
return;
@@ -116,19 +146,46 @@ public void MaterialGUI()
EditorGUILayout.HelpBox("Water Decals only work with Water Decal Materials.", MessageType.Error);
}

public static Material CreateDefaultDecalMaterial(MonoBehaviour obj)
public static Material CreateDefaultDecalMaterial(MonoBehaviour obj, DefaultWaterDecal defaultWaterDecal)
{
string directory = WaterSurfaceEditor.GetWaterResourcesPath(obj);
System.IO.Directory.CreateDirectory(directory);

string baseName = directory + "/" + "New Water Decal Shader Graph";
var path = AssetDatabase.GenerateUniqueAssetPath(baseName + ".shadergraph");
var shader = ShaderGraph.WaterDecalSubTarget.CreateWaterDecalGraphAtPath(path);
string baseName = "";
string materialName = "";
string path = "";
Material material = null;

switch (defaultWaterDecal)
{
case DefaultWaterDecal.Empty:
materialName = "New " + k_NewEmptyWaterDecalText;
baseName = directory + "/" + materialName;
path = AssetDatabase.GenerateUniqueAssetPath(baseName + ".shadergraph");
material = new Material(ShaderGraph.WaterDecalSubTarget.CreateWaterDecalGraphAtPath(path));
break;
case DefaultWaterDecal.DeformerAndFoam:
materialName = "New " + k_NewDeformerAndFoamWaterDecalText;
baseName = directory + "/" + materialName;
path = AssetDatabase.GenerateUniqueAssetPath(baseName + ".shadergraph");
material = new Material(GraphicsSettings.GetRenderPipelineSettings<WaterSystemRuntimeResources>().waterDecalMigrationShader);
break;
default:
Debug.LogError("Water Decal creation failed.");
break;
}

if (material != null)
{
material.parent = AssetDatabase.LoadAssetAtPath<Material>(path);
AssetDatabase.CreateAsset(material, AssetDatabase.GenerateUniqueAssetPath(baseName + ".mat"));
EditorGUIUtility.PingObject(material);

// Setting this new material on the current water decal
WaterDecal waterDecal = obj as WaterDecal;
waterDecal.material = material;
}

Material material = new Material(shader);
material.parent = AssetDatabase.LoadAssetAtPath<Material>(path);
AssetDatabase.CreateAsset(material, AssetDatabase.GenerateUniqueAssetPath(baseName + ".mat"));
EditorGUIUtility.PingObject(material);
return material;
}

Original file line number Diff line number Diff line change
@@ -64,9 +64,9 @@ internal enum PassType
public CustomRenderTextureUpdateMode updateMode = CustomRenderTextureUpdateMode.OnLoad;

/// <summary>
/// Specifies the material used for the deformer.
/// Specifies the material used for the water decal.
/// </summary>
[Tooltip("Specifies the material used for the deformer.")]
[Tooltip("Specifies the material used for the water decal.")]
public Material material = null;

internal int updateCount = 0;