Skip to content

Commit

Permalink
Fix 1px of warped main image shining through the composite mesh at hi…
Browse files Browse the repository at this point in the history
…gher 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.
  • Loading branch information
kblaschke committed Nov 16, 2023
1 parent f9bc83d commit e2617da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libprojectM/MilkdropPreset/FinalComposite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit e2617da

Please sign in to comment.