From c053631c7ad6e3d6f49dbe23c98a5a079b7cbb12 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 5 Feb 2026 23:42:05 -0800 Subject: [PATCH] Fix geoset filtering for M2 models Group 0 (body parts 0-18) always renders all submeshes since they represent different body parts. Other groups filter by exact submeshId match to show only one variation per group. --- src/rendering/character_renderer.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/rendering/character_renderer.cpp b/src/rendering/character_renderer.cpp index 05b2f8c4..6aef4258 100644 --- a/src/rendering/character_renderer.cpp +++ b/src/rendering/character_renderer.cpp @@ -1216,8 +1216,20 @@ void CharacterRenderer::render(const Camera& camera, const glm::mat4& view, cons } // Draw batches (submeshes) with per-batch textures - // TODO: Geoset filtering disabled - need to determine actual submesh ID format + // Geoset filtering: Group = submeshId / 100, Variation = submeshId % 100 + // Group 0 (body parts): always render all (0-99 are different body parts, not variations) + // Other groups: render only if exact submeshId is in activeGeosets for (const auto& batch : gpuModel.data.batches) { + if (!instance.activeGeosets.empty()) { + uint16_t group = batch.submeshId / 100; + if (group != 0) { + // Non-body groups: require exact match + if (instance.activeGeosets.find(batch.submeshId) == instance.activeGeosets.end()) { + continue; + } + } + // Group 0 (body): always render + } // Resolve texture for this batch GLuint texId = whiteTexture;