From efa572425603c39d6b1c5cb9f2833c4798ebf4b4 Mon Sep 17 00:00:00 2001 From: LiRuoChen <571244399@qq.com> Date: Sat, 7 Nov 2026 09:05:14 +0800 Subject: [PATCH] =?UTF-8?q?style(ShaderBake):=20=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E4=B8=8E=E6=8F=90=E7=A4=BA=E5=8F=AA=E7=95=99=E5=90=8D=E5=AD=97?= =?UTF-8?q?=EF=BC=8C=E5=8E=BB=E6=8E=89=E9=95=BF=E8=A7=A3=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试视图的菜单项原来写成"UV 颜色:红=U 绿=V,四角即 00/10/01/11"这类长句, 现在只留 UV / 梯度 / 棋盘 / 纯色,当前项靠勾选表示。 同区的其余说明一起去掉:面片网格、四角 UV 读数(和下面的 UV X/Y 重复)、 自检长文案、全局参数说明。自检结果也只报结论与覆盖率。 --- Editor/ShaderBake/BakeShaderAsImageWindow.cs | 92 ++++---------------- Editor/ShaderBake/BakeShaderWindow.uxml | 12 +-- 2 files changed, 20 insertions(+), 84 deletions(-) diff --git a/Editor/ShaderBake/BakeShaderAsImageWindow.cs b/Editor/ShaderBake/BakeShaderAsImageWindow.cs index 73e1a00..e7fe906 100644 --- a/Editor/ShaderBake/BakeShaderAsImageWindow.cs +++ b/Editor/ShaderBake/BakeShaderAsImageWindow.cs @@ -755,30 +755,12 @@ namespace XericUI.ShaderBake.Editor { faceInfo.text = meshMode ? "外部网格不参与面片点选" - : "选中第 " + (m_SelectedFace + 1) + " 格:UV (" + cell.uvX + ", " + cell.uvY + ")\n" + - FaceCornerText(surface, cell); + : "第 " + (m_SelectedFace + 1) + " 格 · UV (" + cell.uvX + ", " + cell.uvY + ")"; } SetFaceFieldsEnabled(!meshMode); UpdateFaceOverlay(); } - /// - /// 这一格四个顶点的实际 UV 写出来。"设为 UV0" 的约定就是四角落在 (0,0)(1,0)(0,1)(1,1), - /// 再乘重复、加偏移;把结果摊开显示,是不是这个范围一眼就能核对。 - /// - private static string FaceCornerText(ShaderBakeSurfaceSettings surface, ShaderBakeFaceCell cell) - { - Vector2 min = Vector2.Scale(new Vector2(cell.uvX, cell.uvY), surface.uvTiling) + surface.uvOffset; - Vector2 max = Vector2.Scale(new Vector2(cell.uvX + 1, cell.uvY + 1), surface.uvTiling) + surface.uvOffset; - return "四角 UV:(" + Corners(min.x, max.x) + ", " + Corners(min.y, max.y) + ")"; - } - - /// 一个轴的两个角值,左下在前 - private static string Corners(float low, float high) - { - return low.ToString("0.##") + " / " + high.ToString("0.##"); - } - private void SetFaceFieldsEnabled(bool enabled) { VisualElement x = rootVisualElement.Q("face-uv-x"); @@ -1034,43 +1016,24 @@ namespace XericUI.ShaderBake.Editor if (m_DebugView != DebugView.SolidColor) { - SetSelfTestNote("自检失败:纯色探针渲不出来 → 问题在渲染管线。" + DescribePipeline()); + SetSelfTestNote("自检失败:纯色探针画不出来"); return; } if (m_LastCoverage < 0f) { - SetSelfTestNote("自检读不回像素:显卡或纹理格式不支持这次采样"); + SetSelfTestNote("自检失败:读不回像素"); return; } if (m_LastCoverage <= 0.001f) { - SetSelfTestNote("自检未画出任何像素 → 问题在渲染管线。" + DescribePipeline() + - " 先按「框住面片」或「选中格铺满」再自检一次(探针固定 pass 0,pass 不背这个锅)。"); + SetSelfTestNote("自检失败:空画面"); SetStatus("管线自检:空画面"); return; } - SetSelfTestNote("自检通过:纯色面片盖住画面 " + Mathf.RoundToInt(m_LastCoverage * 100f) + - "%。管线是通的,画面空是被测 shader 自己的事(贴图、pass、混合模式、需要光照)"); + SetSelfTestNote("自检通过:覆盖 " + Mathf.RoundToInt(m_LastCoverage * 100f) + "%"); SetStatus("管线自检:正常"); } - /// - /// 把决定"画不画得见"的那几个数值摊开写一行。空画面的时候最缺的就是这个—— - /// 否则只能靠猜是相机框不住、面片太小还是 pass 选错。 - /// - private string DescribePipeline() - { - ShaderBakeSettings s = m_Renderer.settings; - return "正交=" + s.camera.orthographic + - " 半高=" + s.camera.orthographicSize.ToString("0.###") + - " 近/远=" + s.camera.nearClipPlane.ToString("0.###") + "/" + s.camera.farClipPlane.ToString("0.###") + - " 机位=" + s.camera.position + - " 面片=" + s.surface.gridColumns + "×" + s.surface.gridRows + " 格 尺寸=" + s.surface.size + - " 双面=" + s.surface.doubleSided + - " pass=" + s.output.shaderPass + "(探针固定用 0)" + - " 翻转Y=" + s.output.flipY; - } - private void SetSelfTestNote(string text) { Label note = rootVisualElement.Q