From e2617da5b9d2b81bafda5d37d0dba705c1e29f9e Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Thu, 16 Nov 2023 15:40:57 +0100 Subject: [PATCH] Fix 1px of warped main image shining through the composite mesh at higher resolutions. Now we don't add the half texel offset to the vertex coordinates, but to the calculated u/v, which will prevent the texture wrapping (happens mostly with "nearest" interpolation lookups) mentioned in Milkdrop's code from happening, but make the mesh exactly fill the screen. --- src/libprojectM/MilkdropPreset/FinalComposite.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libprojectM/MilkdropPreset/FinalComposite.cpp b/src/libprojectM/MilkdropPreset/FinalComposite.cpp index 77c25a957..d2dc1c460 100644 --- a/src/libprojectM/MilkdropPreset/FinalComposite.cpp +++ b/src/libprojectM/MilkdropPreset/FinalComposite.cpp @@ -156,13 +156,13 @@ void FinalComposite::InitializeMesh(const PresetState& presetState) { int const gridY2 = gridY - gridY / (compositeGridHeight / 2); float const v = SquishToCenter(gridY2 * dividedByY, 3.0f); - float const sy = -((v - halfTexelHeight) * 2.0f - 1.0f); + float const sy = -(v * 2.0f - 1.0f); for (int gridX = 0; gridX < compositeGridWidth; gridX++) { int const gridX2 = gridX - gridX / (compositeGridWidth / 2); float const u = SquishToCenter(gridX2 * dividedByX, 3.0f); - float const sx = (u - halfTexelWidth) * 2.0f - 1.0f; + float const sx = u * 2.0f - 1.0f; auto& vertex = m_vertices.at(gridX + gridY * compositeGridWidth); @@ -236,8 +236,8 @@ void FinalComposite::InitializeMesh(const PresetState& presetState) ang = PI * 0.0f; } } - vertex.u = u; - vertex.v = v; + vertex.u = u + halfTexelWidth; + vertex.v = v + halfTexelHeight; vertex.radius = rad; vertex.angle = ang;