From 00f31a482cd276d4fd1fab9e8707ee326128dd7a Mon Sep 17 00:00:00 2001 From: "Hyunseok Yang (YG)" Date: Tue, 7 May 2024 15:27:20 +0900 Subject: [PATCH 1/5] Log supress in SDF.Parser.Root --- Assets/Scripts/Tools/SDF/Parser/Root.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Scripts/Tools/SDF/Parser/Root.cs b/Assets/Scripts/Tools/SDF/Parser/Root.cs index 26af338e..0d4da9bd 100644 --- a/Assets/Scripts/Tools/SDF/Parser/Root.cs +++ b/Assets/Scripts/Tools/SDF/Parser/Root.cs @@ -263,7 +263,7 @@ public void UpdateResourceModelTable() private void ConvertPathToAbsolutePath(in string targetElement) { var nodeList = _doc.SelectNodes($"//{targetElement}"); - Console.Write("Target:" + targetElement + ", Num Of uri nodes: " + nodeList.Count); + // Console.Write("Target:" + targetElement + ", Num Of uri nodes: " + nodeList.Count); foreach (XmlNode node in nodeList) { var uri = node.InnerText; From 36e72cea17dd4763b18ac292b59a4273f8c76517 Mon Sep 17 00:00:00 2001 From: "Hyunseok Yang (YG)" Date: Tue, 7 May 2024 15:48:49 +0900 Subject: [PATCH 2/5] Bug fixed in OptimizeMesh() in SDf.Implement.Visual - wrong child relationship --- .../Tools/SDF/Implement/Implement.Visual.cs | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Assets/Scripts/Tools/SDF/Implement/Implement.Visual.cs b/Assets/Scripts/Tools/SDF/Implement/Implement.Visual.cs index 312cf627..f2748154 100644 --- a/Assets/Scripts/Tools/SDF/Implement/Implement.Visual.cs +++ b/Assets/Scripts/Tools/SDF/Implement/Implement.Visual.cs @@ -42,8 +42,9 @@ private static void OptimizeMesh(in UE.Transform target) if (!meshFilterTable.ContainsKey(materialName)) { - var meshFilterSet = new HashSet(); - meshFilterSet.Add(meshFilter); + var meshFilterSet = new HashSet(){ + meshFilter + }; meshFilterTable.Add(materialName, meshFilterSet); } else @@ -73,19 +74,23 @@ private static void OptimizeMesh(in UE.Transform target) } var meshFilterList = meshFilterSet.Value.ToArray(); - var mergedMesh = SDF2Unity.MergeMeshes(meshFilterList); + if (meshFilterList.Length > 0) + { + var targetParent = meshFilterList[0].transform.parent; + var mergedMesh = SDF2Unity.MergeMeshes(meshFilterList); - var newName = meshFilterSet.Key.Replace("(Instance)", "Combined").Trim(); - var newVisualGeometryObject = new UE.GameObject(newName); + var newName = meshFilterSet.Key.Replace("(Instance)", "Combined").Trim(); + var newVisualGeometryObject = new UE.GameObject(newName); - var meshFilter = newVisualGeometryObject.AddComponent(); - mergedMesh.name = newName; - meshFilter.sharedMesh = mergedMesh; + var meshFilter = newVisualGeometryObject.AddComponent(); + mergedMesh.name = newName; + meshFilter.sharedMesh = mergedMesh; - var meshRenderer = newVisualGeometryObject.AddComponent(); - meshRenderer.material = material; + var meshRenderer = newVisualGeometryObject.AddComponent(); + meshRenderer.material = material; - newVisualGeometryObject.transform.SetParent(target, true); + newVisualGeometryObject.transform.SetParent(targetParent, true); + } } } @@ -94,15 +99,11 @@ public static void OptimizeMeshes(in UE.Transform targetTransform) for (var i = 0; i< targetTransform.childCount; i++) { var child = targetTransform.GetChild(i); + var optimizationTarget + = (child.GetComponent() == null) + ? child : targetTransform; - if (child.GetComponent() == null) - { - OptimizeMesh(child); - } - else - { - OptimizeMesh(targetTransform); - } + OptimizeMesh(optimizationTarget); } } From 9d5bbb0b788c10b82fd5fa6a127fe770c75506d9 Mon Sep 17 00:00:00 2001 From: "Hyunseok Yang (YG)" Date: Tue, 7 May 2024 16:38:27 +0900 Subject: [PATCH 3/5] Fix segmentation shader - culling issue -> problem with SpeedTree8 when two-sidded is enabled. --- Assets/Resources/Shader/Segmentation.shader | 1 + 1 file changed, 1 insertion(+) diff --git a/Assets/Resources/Shader/Segmentation.shader b/Assets/Resources/Shader/Segmentation.shader index 38dd6b17..36a0bdbe 100644 --- a/Assets/Resources/Shader/Segmentation.shader +++ b/Assets/Resources/Shader/Segmentation.shader @@ -18,6 +18,7 @@ Shader "Sensor/Segmentation" { Name "Segmentation" + Cull Off // Disable backface culling HLSLPROGRAM #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" From d80b6b24c8324d26b0b648110a3af4adb344b0ef Mon Sep 17 00:00:00 2001 From: "Hyunseok Yang (YG)" Date: Tue, 7 May 2024 17:18:45 +0900 Subject: [PATCH 4/5] Update and refresh segmentaion tag after copy-n-paste an object --- Assets/Scripts/Core/ObjectSpawning.cs | 1 - Assets/Scripts/Tools/SDF/Import/Import.Material.cs | 1 - Assets/Scripts/UI/ModelImporter.cs | 5 +++++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/Scripts/Core/ObjectSpawning.cs b/Assets/Scripts/Core/ObjectSpawning.cs index 2f46b4ea..7b3a4706 100644 --- a/Assets/Scripts/Core/ObjectSpawning.cs +++ b/Assets/Scripts/Core/ObjectSpawning.cs @@ -163,7 +163,6 @@ private IEnumerator SpawnTargetObject(PropsType type, Vector3 position, Vector3 // var propTypeName = (type.ToString() + scale.ToString()).Trim(); // Debug.Log(propTypeName); SegmentationManager.AttachTag(type.ToString(), spawnedObject); - Main.SegmentationManager.UpdateTags(); } diff --git a/Assets/Scripts/Tools/SDF/Import/Import.Material.cs b/Assets/Scripts/Tools/SDF/Import/Import.Material.cs index 87000953..0fb234f4 100644 --- a/Assets/Scripts/Tools/SDF/Import/Import.Material.cs +++ b/Assets/Scripts/Tools/SDF/Import/Import.Material.cs @@ -47,7 +47,6 @@ protected override void ImportMaterial(in SDF.Material sdfMaterial, in System.Ob // UE.Debug.Log("ImportMaterial HasColorSpecular " + material.GetColor("_SpecColor")); } - // apply material script if (sdfMaterial.script != null) { diff --git a/Assets/Scripts/UI/ModelImporter.cs b/Assets/Scripts/UI/ModelImporter.cs index 348c93e8..b4a55d78 100644 --- a/Assets/Scripts/UI/ModelImporter.cs +++ b/Assets/Scripts/UI/ModelImporter.cs @@ -248,6 +248,11 @@ void LateUpdate() SetModelForDeploy(instantiatedObject); // Debug.Log("Paste " + instantiatedObject.name); + + var segmentationTag = instantiatedObject.GetComponentInChildren(); + segmentationTag?.Refresh(); + + Main.SegmentationManager.UpdateTags(); } } } From 8018beba6bb7babecf1abf21b51b0b5fe7cfe3ba Mon Sep 17 00:00:00 2001 From: "Hyunseok Yang (YG)" Date: Tue, 7 May 2024 17:20:25 +0900 Subject: [PATCH 5/5] Update app version info in Project settings : 4.5.1 -> 4.5.2 --- ProjectSettings/ProjectSettings.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 2997f80c..866bb0b0 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -139,7 +139,7 @@ PlayerSettings: loadStoreDebugModeEnabled: 0 visionOSBundleVersion: 1.0 tvOSBundleVersion: 1.0 - bundleVersion: 4.5.1 + bundleVersion: 4.5.2 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0