feat(ShaderBake): 自检失败时把关键参数摊开写一行

空画面最难的是不知道往哪查,现在直接把正交/半高/近远/机位/格数/尺寸/双面/pass/翻转Y
打在提示里,一眼能看出是相机框不住还是 pass 选错。
This commit is contained in:
2026-11-06 08:28:00 +08:00
parent f8499752bb
commit 7ce5a96f47
+19 -1
View File
@@ -923,7 +923,8 @@ namespace XericUI.ShaderBake.Editor
}
if (coverage <= 0.001f)
{
SetSelfTestNote("自检未画出任何像素 → 问题在渲染管线本身。先按「框住面片」,再看面片宽高、pass 下标与翻转 Y");
SetSelfTestNote("自检未画出任何像素 → 问题在渲染管线。" + DescribePipeline() +
" 先按「框住面片」再自检一次;仍为空就查 pass 下标与面片宽高。");
SetStatus("管线自检:空画面");
return;
}
@@ -932,6 +933,23 @@ namespace XericUI.ShaderBake.Editor
SetStatus("管线自检:正常");
}
/// <summary>
/// 把决定"画不画得见"的那几个数值摊开写一行。空画面的时候最缺的就是这个——
/// 否则只能靠猜是相机框不住、面片太小还是 pass 选错。
/// </summary>
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 +
" 翻转Y=" + s.output.flipY;
}
private void SetSelfTestNote(string text)
{
Label note = rootVisualElement.Q<Label>("selftest-note");