Skip to content

Commit 08cb1f7

Browse files
committed
clusterizer: Reduce duplicate seeds from the same meshlet
For now we aren't filtering the seeds from the meshlet precisely, and we may get duplicates: we select one neighbor triangle per vertex which means we will likely see the same triangle as a neighbor of another vertex in the same meshlet. Using non-strict comparison for replacement mitigates this issue somewhat, as it allows replacing the triangle with itself instead of forcing the triangle to occupy another slot. This improves the flow by giving more options to choose from during selection later.
1 parent 9a6a289 commit 08cb1f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/clusterizer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,8 @@ static unsigned int appendSeedTriangles(unsigned int* seeds, const meshopt_Meshl
485485

486486
for (size_t j = 0; j < kMeshletAddSeeds; ++j)
487487
{
488-
if (best_neighbor_live < best_live[j] || (best_neighbor_live == best_live[j] && best_neighbor_score < best_score[j]))
488+
// non-strict comparison reduces the number of duplicate seeds (triangles adjacent to multiple vertices)
489+
if (best_neighbor_live < best_live[j] || (best_neighbor_live == best_live[j] && best_neighbor_score <= best_score[j]))
489490
{
490491
best_seeds[j] = best_neighbor;
491492
best_live[j] = best_neighbor_live;

0 commit comments

Comments
 (0)