From 5ab2cdee436405647184b4599db8805f320b1f53 Mon Sep 17 00:00:00 2001 From: swrring Date: Sun, 13 Sep 2026 12:02:45 +0900 Subject: [PATCH] =?UTF-8?q?[WL-816a]=20=EB=AC=BC=20=EC=83=89=EB=8F=84=20?= =?UTF-8?q?=EB=8D=B0=EB=AA=A8=20=EA=B0=92=EC=9C=BC=EB=A1=9C=20+=20?= =?UTF-8?q?=EB=90=98=EB=8F=8C=EB=A6=AC=EA=B8=B0=20=EC=8A=A4=EC=9C=84?= =?UTF-8?q?=EC=B9=98=EA=B0=80=20ReferenceLook=20=EA=B9=8C=EC=A7=80=20?= =?UTF-8?q?=EB=81=88=EB=8B=A4=20(#816)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Farm_SimpleWater_Demo.mat (SimpleWater 복사본 · 깊은물/얕은물 색 = 데모 Water.mat 값) - WLFarmLook.Start: enabled_=0 이면 WL_ReferenceLook 도 끄고 Restore → 원본 조명 100% 실측 확인 - AgentScripts: 물 교체 · Play 캡처 · 스위치 토글 --- AgentScripts/WL816a_PlayCap.cs | 72 ++++++++++++++++ AgentScripts/WL816a_Toggle.cs | 16 ++++ AgentScripts/WL816a_Water.cs | 68 +++++++++++++++ Assets/WL/Look/Farm.meta | 8 ++ .../Farm/Materials/Farm_SimpleWater_Demo.mat | 84 +++++++++++++++++++ .../Materials/Farm_SimpleWater_Demo.mat.meta | 8 ++ Assets/WL/Look/Farm/Scenes/WL_FarmLook.unity | 9 +- Assets/WL/Look/Farm/WLFarmLook.cs | 15 ++++ 8 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 AgentScripts/WL816a_PlayCap.cs create mode 100644 AgentScripts/WL816a_Toggle.cs create mode 100644 AgentScripts/WL816a_Water.cs create mode 100644 Assets/WL/Look/Farm.meta create mode 100644 Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat create mode 100644 Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat.meta diff --git a/AgentScripts/WL816a_PlayCap.cs b/AgentScripts/WL816a_PlayCap.cs new file mode 100644 index 000000000..f9b52a6a6 --- /dev/null +++ b/AgentScripts/WL816a_PlayCap.cs @@ -0,0 +1,72 @@ +// WL-816a — Play 중 오프스크린 캡처 + 룩 진단 (배치모드 헤드리스에서도 동작) +public static class WL816a_PlayCap +{ + const string Dir = "Screenshots_WL/WL816a/"; + const int W = 1080, H = 1920; + + public static void Run() + { + var sb = new System.Text.StringBuilder(); + sb.AppendLine("isPlaying=" + UnityEngine.Application.isPlaying); + sb.AppendLine("FarmLook : mode=" + WL.Look.Farm.WLFarmLook.AppliedMode + " · " + WL.Look.Farm.WLFarmLook.LastLog); + sb.AppendLine("RefLook : applied=" + WL.Look.Arena.WLReferenceLook.IsApplied + + " · outlined=" + WL.Look.Arena.WLReferenceLook.OutlinedRenderers + + " · contrastMat=" + WL.Look.Arena.WLReferenceLook.ContrastMaterials + + " · rim=" + WL.Look.Arena.WLReferenceLook.RimRenderers + + " · " + WL.Look.Arena.WLReferenceLook.LastLog); + sb.AppendLine("ambient : " + UnityEngine.RenderSettings.ambientMode + " " + UnityEngine.RenderSettings.ambientLight + + " · skybox=" + (UnityEngine.RenderSettings.skybox != null ? UnityEngine.RenderSettings.skybox.name : "없음")); + var ls = UnityEngine.Object.FindObjectsByType(UnityEngine.FindObjectsInactive.Exclude, UnityEngine.FindObjectsSortMode.None); + for (int i = 0; i < ls.Length; i++) + sb.AppendLine("light : " + ls[i].name + " " + ls[i].type + " " + ls[i].color + " I=" + ls[i].intensity + " " + ls[i].shadows); + + Shot(FindCam("MainCamera"), Dir + "p_play_main.png"); + Shot(DemoAngleCam(), Dir + "p_play_demoangle.png"); + sb.AppendLine("캡처 p_play_main.png · p_play_demoangle.png"); + UnityEngine.Debug.Log("[WL816a PlayCap]\n" + sb.ToString()); + } + + static UnityEngine.Camera DemoAngleCam() + { + var go = UnityEngine.GameObject.Find("__WL816aDemoAngle"); + if (go == null) { go = new UnityEngine.GameObject("__WL816aDemoAngle"); go.hideFlags = UnityEngine.HideFlags.DontSave; } + var c = go.GetComponent(); + if (c == null) c = go.AddComponent(); + c.orthographic = true; c.orthographicSize = 10f; + c.nearClipPlane = 0.3f; c.farClipPlane = 500f; + c.clearFlags = UnityEngine.CameraClearFlags.Skybox; + c.backgroundColor = new UnityEngine.Color(0.192f, 0.302f, 0.475f, 0f); + c.depth = -100f; + var rot = UnityEngine.Quaternion.Euler(30f, 60f, 0f); + go.transform.rotation = rot; + go.transform.position = new UnityEngine.Vector3(0f, 0.6f, 0f) - rot * UnityEngine.Vector3.forward * 60f; + if (go.GetComponent() == null) + go.AddComponent(); + return c; + } + + static UnityEngine.Camera FindCam(string name) + { + var cams = UnityEngine.Object.FindObjectsByType( + UnityEngine.FindObjectsInactive.Exclude, UnityEngine.FindObjectsSortMode.None); + for (int i = 0; i < cams.Length; i++) if (cams[i].name == name) return cams[i]; + return cams.Length > 0 ? cams[0] : null; + } + + static void Shot(UnityEngine.Camera cam, string path) + { + if (cam == null) return; + var rt = new UnityEngine.RenderTexture(W, H, 24, UnityEngine.RenderTextureFormat.ARGB32, UnityEngine.RenderTextureReadWrite.sRGB); + rt.antiAliasing = 1; + var pT = cam.targetTexture; var pA = UnityEngine.RenderTexture.active; + cam.targetTexture = rt; cam.Render(); + UnityEngine.RenderTexture.active = rt; + var tex = new UnityEngine.Texture2D(W, H, UnityEngine.TextureFormat.RGB24, false); + tex.ReadPixels(new UnityEngine.Rect(0, 0, W, H), 0, 0); tex.Apply(); + UnityEngine.RenderTexture.active = pA; cam.targetTexture = pT; + var d = System.IO.Path.GetDirectoryName(path); + if (!System.IO.Directory.Exists(d)) System.IO.Directory.CreateDirectory(d); + System.IO.File.WriteAllBytes(path, UnityEngine.ImageConversion.EncodeToPNG(tex)); + UnityEngine.Object.DestroyImmediate(tex); UnityEngine.Object.DestroyImmediate(rt); + } +} diff --git a/AgentScripts/WL816a_Toggle.cs b/AgentScripts/WL816a_Toggle.cs new file mode 100644 index 000000000..8dba575de --- /dev/null +++ b/AgentScripts/WL816a_Toggle.cs @@ -0,0 +1,16 @@ +// WL-816a — 되돌리기 스위치 on/off (Play 전 콘솔 에러 출처 확인용) +public static class WL816a_Toggle +{ + const string SO = "Assets/WL/Look/Farm/Resources/WL/WLFarmLookSettings.asset"; + public static void Off() { Set(0); } + public static void On() { Set(1); } + static void Set(int v) + { + var so = UnityEditor.AssetDatabase.LoadAssetAtPath(SO); + if (so == null) { UnityEngine.Debug.Log("[WL816a Toggle] SO 없음"); return; } + so.enabled_ = v; + UnityEditor.EditorUtility.SetDirty(so); + UnityEditor.AssetDatabase.SaveAssets(); + UnityEngine.Debug.Log("[WL816a Toggle] enabled_=" + so.enabled_); + } +} diff --git a/AgentScripts/WL816a_Water.cs b/AgentScripts/WL816a_Water.cs new file mode 100644 index 000000000..9eb576865 --- /dev/null +++ b/AgentScripts/WL816a_Water.cs @@ -0,0 +1,68 @@ +// WL-816a 추가 — 물(SimpleWater)도 데모 물 색으로 맞춘다. +// 데모 Water.mat 실측: _Tint(깊은 물) = (0.13333, 0.51765, 0.74510) · _Color(얕은 물) = (0.29804, 0.80000, 1.0) +// FarmingIsland SimpleWater 원본은 Color_A271762B(깊음) = (0, 0.31609, 0.90566) · Color_E0824245(얕음) = (0.17453, 0.59879, 1) +// 🔴 원본 .mat 은 수정하지 않는다 — 복사본을 만들어 씬에서 교체. +public static class WL816a_Water +{ + const string DstScene = "Assets/WL/Look/Farm/Scenes/WL_FarmLook.unity"; + const string SrcMat = "Assets/FarmingIsland/Materials/Environments/SimpleWater.mat"; + const string NewMat = "Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat"; + + public static void Run() + { + var sb = new System.Text.StringBuilder(); + var src = UnityEditor.AssetDatabase.LoadAssetAtPath(SrcMat); + if (src == null) { UnityEngine.Debug.Log("[WL816a Water] 원본 없음"); return; } + + var m = UnityEditor.AssetDatabase.LoadAssetAtPath(NewMat); + if (m == null) + { + if (!UnityEditor.AssetDatabase.CopyAsset(SrcMat, NewMat)) { UnityEngine.Debug.Log("[WL816a Water] 복사 실패"); return; } + UnityEditor.AssetDatabase.Refresh(); + m = UnityEditor.AssetDatabase.LoadAssetAtPath(NewMat); + } + if (m == null) { UnityEngine.Debug.Log("[WL816a Water] 복사본 로드 실패"); return; } + + var deepOld = m.GetColor("Color_A271762B"); + var shallowOld = m.GetColor("Color_E0824245"); + m.SetColor("Color_A271762B", new UnityEngine.Color(0.13333334f, 0.5176471f, 0.74509805f, deepOld.a)); + m.SetColor("Color_E0824245", new UnityEngine.Color(0.2980392f, 0.8000001f, 1f, shallowOld.a)); + UnityEditor.EditorUtility.SetDirty(m); + sb.AppendLine("물 복사본 " + NewMat); + sb.AppendLine(" 깊은물 " + deepOld + " → " + m.GetColor("Color_A271762B")); + sb.AppendLine(" 얕은물 " + shallowOld + " → " + m.GetColor("Color_E0824245")); + + var scene = UnityEditor.SceneManagement.EditorSceneManager.OpenScene( + DstScene, UnityEditor.SceneManagement.OpenSceneMode.Single); + var comp = UnityEngine.Object.FindFirstObjectByType(UnityEngine.FindObjectsInactive.Include); + if (comp == null) { UnityEngine.Debug.Log("[WL816a Water] WLFarmLook 없음"); return; } + + var rends = UnityEngine.Object.FindObjectsByType( + UnityEngine.FindObjectsInactive.Include, UnityEngine.FindObjectsSortMode.None); + var list = new System.Collections.Generic.List(comp.entries); + int n = 0; + for (int i = 0; i < rends.Length; i++) + { + var r = rends[i]; + if (r == null || r is UnityEngine.ParticleSystemRenderer) continue; + var ms = r.sharedMaterials; + bool hit = false; + for (int s = 0; s < ms.Length; s++) if (ms[s] == src) hit = true; + if (!hit) continue; + var nw = (UnityEngine.Material[])ms.Clone(); + for (int s = 0; s < nw.Length; s++) if (nw[s] == src) nw[s] = m; + list.Add(new WL.Look.Farm.WLFarmLook.Entry + { target = r, original = ms, toonTex = nw, toonFlat = nw }); + r.sharedMaterials = nw; + UnityEditor.EditorUtility.SetDirty(r); + n++; + } + comp.entries = list.ToArray(); + UnityEditor.EditorUtility.SetDirty(comp); + UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(scene); + UnityEditor.SceneManagement.EditorSceneManager.SaveScene(scene); + UnityEditor.AssetDatabase.SaveAssets(); + sb.AppendLine("물 렌더러 교체 " + n + " · entries " + comp.entries.Length); + UnityEngine.Debug.Log("[WL816a Water]\n" + sb.ToString()); + } +} diff --git a/Assets/WL/Look/Farm.meta b/Assets/WL/Look/Farm.meta new file mode 100644 index 000000000..71c6eeb0d --- /dev/null +++ b/Assets/WL/Look/Farm.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3233ec3f81de6604a8cdcaac3648f21d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat b/Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat new file mode 100644 index 000000000..a6e4fcdd3 --- /dev/null +++ b/Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat @@ -0,0 +1,84 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-754393534345734001 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: 639247ca83abc874e893eb93af2b5e44, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 0 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Farm_SimpleWater_Demo + m_Shader: {fileID: -6465566751694194690, guid: 27b042674da390c46a1ff4cc2317d5f2, + type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: 2999 + stringTagMap: {} + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - Vector1_29A8EAB: 1 + - Vector1_3C2CF0EB: 0.005 + - Vector1_53B9698E: 3 + - Vector1_6D9DC178: 100 + - Vector1_93DCFAA9: 3 + - Vector1_95BBCBE0: 2000 + - Vector1_C5543ECF: 5 + - Vector1_E23798DE: 0.5 + - _QueueControl: 1 + - _QueueOffset: 0 + - _XRMotionVectorsPass: 1 + m_Colors: + - Color_A271762B: {r: 0.13333334, g: 0.5176471, b: 0.74509805, a: 1} + - Color_AFFD055F: {r: 1, g: 1, b: 1, a: 0.8} + - Color_E0824245: {r: 0.2980392, g: 0.8000001, b: 1, a: 0.9019608} + m_BuildTextureStacks: [] + m_AllowLocking: 1 +--- !u!114 &7395189638712792404 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 10 diff --git a/Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat.meta b/Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat.meta new file mode 100644 index 000000000..375324fce --- /dev/null +++ b/Assets/WL/Look/Farm/Materials/Farm_SimpleWater_Demo.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1c9ce9b7865f6d643ad9601f6fa81ba3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/WL/Look/Farm/Scenes/WL_FarmLook.unity b/Assets/WL/Look/Farm/Scenes/WL_FarmLook.unity index b4478d599..bbbcec5cb 100644 --- a/Assets/WL/Look/Farm/Scenes/WL_FarmLook.unity +++ b/Assets/WL/Look/Farm/Scenes/WL_FarmLook.unity @@ -13349,6 +13349,13 @@ MonoBehaviour: - {fileID: 2100000, guid: 68107aa66ca3855458e2ac55c239d57c, type: 2} toonFlat: - {fileID: 2100000, guid: 55a6667eb4d7a8d4c968af5aed178873, type: 2} + - target: {fileID: 1930350960} + original: + - {fileID: 2100000, guid: ce0f8fd131f36964dbc918b8c63f838b, type: 2} + toonTex: + - {fileID: 2100000, guid: 1c9ce9b7865f6d643ad9601f6fa81ba3, type: 2} + toonFlat: + - {fileID: 2100000, guid: 1c9ce9b7865f6d643ad9601f6fa81ba3, type: 2} originalLights: - target: {fileID: 705507994} color: {r: 1, g: 1, b: 1, a: 1} @@ -22767,7 +22774,7 @@ MeshRenderer: m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: - - {fileID: 2100000, guid: ce0f8fd131f36964dbc918b8c63f838b, type: 2} + - {fileID: 2100000, guid: 1c9ce9b7865f6d643ad9601f6fa81ba3, type: 2} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 diff --git a/Assets/WL/Look/Farm/WLFarmLook.cs b/Assets/WL/Look/Farm/WLFarmLook.cs index 6728a0a78..01e845823 100644 --- a/Assets/WL/Look/Farm/WLFarmLook.cs +++ b/Assets/WL/Look/Farm/WLFarmLook.cs @@ -62,6 +62,21 @@ namespace WL.Look.Farm if (cfg != null && cfg.verboseLog != 0) Debug.Log("[WL816a FarmLook] " + LastLog); } + /// + /// `enabled_ = 0` 이면 같은 씬의 `WL_ReferenceLook`(아레나 룩)도 함께 끈다. + /// Start 는 모든 Awake/OnEnable 뒤에 돌기 때문에 실행 순서에 상관없이 확실히 원복된다. + /// + void Start() + { + var cfg = WLFarmLookSettings.Instance; + if (cfg == null || cfg.enabled_ != 0) return; + var rl = Object.FindFirstObjectByType(FindObjectsInactive.Include); + if (rl != null && rl.gameObject.activeSelf) rl.gameObject.SetActive(false); // OnDisable → Restore() + WL.Look.Arena.WLReferenceLook.Restore(); + Apply(0, 0); + LastLog += " · ReferenceLook 도 off"; + } + /// 0 = 원본 · 1 = 텍스처 유지 · 2 = 단색. 몇 번 불러도 안전(멱등). public void Apply(int mode, int applyLighting) {