From de1c9a7dd0aa34b178ecaa722712ef7d6a8315d1 Mon Sep 17 00:00:00 2001 From: routersys Date: Tue, 20 Oct 2026 18:38:20 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=9E=E3=83=AB=E3=83=81=E3=82=B0=E3=83=AA?= =?UTF-8?q?=E3=83=83=E3=83=89=E6=B3=95=E3=81=AE=E5=BB=B6=E9=95=B7=E3=81=A8?= =?UTF-8?q?=E8=A3=9C=E6=AD=A3=E3=81=AE=E9=96=BE=E5=80=A4=E3=81=AB=E5=90=8D?= =?UTF-8?q?=E5=89=8D=E3=82=92=E4=BB=98=E3=81=91=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inflate/InflateGpuShaders.cs | 6 +++--- Inflate/InflateSettings.cs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Inflate/InflateGpuShaders.cs b/Inflate/InflateGpuShaders.cs index 8a5462e..0863e1f 100644 --- a/Inflate/InflateGpuShaders.cs +++ b/Inflate/InflateGpuShaders.cs @@ -467,7 +467,7 @@ internal readonly partial struct ProlongShader( var total = weight00 + weight10 + weight01 + weight11; var value = 0f; - if (total > 1e-6f) + if (total > InflateSettings.MinimumInterpolationWeight) value = (weight00 * potential[index00] + weight10 * potential[index10] + weight01 * potential[index01] + weight11 * potential[index11]) / total; if (accumulate != 0) @@ -576,7 +576,7 @@ internal readonly partial struct CorrectionDotShader( var weight01 = (1f - wx) * wy * (mask[index01] & InflateSettings.MaskInside); var weight11 = wx * wy * (mask[index11] & InflateSettings.MaskInside); var total = weight00 + weight10 + weight01 + weight11; - if (total <= 1e-6f) + if (total <= InflateSettings.MinimumInterpolationWeight) return 0f; return (weight00 * potential[index00] + weight10 * potential[index10] + weight01 * potential[index01] + weight11 * potential[index11]) / total; @@ -626,7 +626,7 @@ internal readonly partial struct CorrectionScaleShader( if (thread == 0) { var total = sums[InflateSettings.CorrectionReduceThreads]; - scale[0] = total > 1e-20f ? Hlsl.Clamp(sums[0] / total, 0f, maximum) : 1f; + scale[0] = total > InflateSettings.MinimumCorrectionEnergy ? Hlsl.Clamp(sums[0] / total, 0f, maximum) : 1f; } } } diff --git a/Inflate/InflateSettings.cs b/Inflate/InflateSettings.cs index 31dd79d..0e8bfba 100644 --- a/Inflate/InflateSettings.cs +++ b/Inflate/InflateSettings.cs @@ -14,6 +14,8 @@ internal static class InflateSettings public const int CorrectionGroupThreads = CorrectionGroupSize * CorrectionGroupSize; public const int CorrectionReduceThreads = 256; public const float MaximumCorrectionScale = 4f; + public const float MinimumInterpolationWeight = 1e-6f; + public const float MinimumCorrectionEnergy = 1e-20f; public const float RadiansPerDegree = MathF.PI / 180f; public const float MaximumLightElevationDegrees = 90f; public const float LightAzimuthLimitDegrees = 180f;