fix(ShaderBake): UV 视图按 UV 跨度归一,重复次数 >1 不再把一格切成两段
测试图原来直接用 frac(uv) 当格内进度,重复次数设成 2 时 uv 跨 0~2, 每过一个整数就被 floor 切一次,看上去像"这一格被分成了两块"。 现在先换算回 (uv - 偏移) / 重复次数,整格是一条连续递增的尺子; 整数 UV 边界改用绝对 uv 判断,所以重复次数为 2 时格正中间仍留一条线, 能数出这一格跨了几个 UV 单位。三种测试视图共用这套换算。
This commit is contained in:
@@ -1471,6 +1471,13 @@ namespace XericUI.ShaderBake.Editor
|
||||
if (!EnsureDebugMaterial())
|
||||
return false;
|
||||
|
||||
// 测试图要把 UV 换算回"每格 0~1",得知道当前的重复与偏移;这两项随时可改,每次渲染都推一遍
|
||||
if (m_DebugView != DebugView.SolidColor)
|
||||
{
|
||||
m_DebugMaterial.SetVector("_UvTiling", m_Renderer.settings.surface.uvTiling);
|
||||
m_DebugMaterial.SetVector("_UvOffset", m_Renderer.settings.surface.uvOffset);
|
||||
}
|
||||
|
||||
double start = EditorApplication.timeSinceStartup;
|
||||
string error;
|
||||
RenderTexture rt = m_Override.RenderWithMaterial(m_Renderer.settings, m_DebugMaterial, out error);
|
||||
|
||||
Reference in New Issue
Block a user