Repository navigation
Merge very small varying-data islands at mesh export (fewer submesh fragments) - #1114
Merged
Merged
Conversation
…sland One submesh per tiny island creates many small fragments on big models (each submesh is a full LuxCore mesh with per-point arrays); e.g. CannelleEtFromage exported ~90k submeshes, one plane alone 84k islands of 2-4 triangles (dense split normals). Islands smaller than MIN_ISLAND_TRIANGLE_COUNT (64) triangles are now unioned with an adjacent island via a second union-find pass, collapsing chains in one go. Merging never crosses a hard edge: the angle between the two sides' normals must be below MIN_ISLAND_MERGE_COS_ANGLE (30 deg), otherwise flat faces would be smoothed away (the default cube keeps its 6 face-islands and correct normals). Merging otherwise only affects varying data gathered at shared points (last write wins). CannelleEtFromage now exports 2307 submeshes (was ~90k); default cube still exports 6 submeshes with correct flat-face normals. Also adds an env-gated (BLC_DEBUG_ISLANDS) island size histogram log.
howetuft
force-pushed
the
fix/submesh-fragments
branch
from
November 8, 2026 22:00
919c002 to
c4d8100
Compare
…hapes The watertight envelope is now built in C++ (SubdivShape, via subdiv_envelope.cpp) from the meshes sharing the welded point buffer, so convert() only exports the per-(material, island) submeshes (first submesh owns the shared point buffer). Each submesh gets its material slot written as triangle AOV layer MATERIAL_TRI_AOV_INDEX (= 2); object_cache sets scene.shapes.<subdiv shape>.matslot = <material index> for subdiv shapes.
Generated images are not packed by default and image.pack() does not work for them (also their pixels may not exist yet in background mode). Save them to a temp file via image.save_render() instead, cached per image name, and replace the assert in _save_to_temp_file with a proper RuntimeError.
howetuft
added a commit
to howetuft/BlendLuxCore
that referenced
this pull request
Nov 11, 2026
…e per-submesh slot id in tri AOV layer 2 Ported from the feature branch onto current main (the rest of the branch was already merged via LuxCoreRender#1114/LuxCoreRender#1115): - set_matslot_on_subdiv_shape() walks a shape chain via the source links and sets matslot on the subdiv shape itself (the shape LuxCore reads matslot from), falling back to the final shape. - Each submesh (material x island group) gets a unique slot id (group index + 1; +1 because the wireframe texture reads tri AOV layer 2 and skips an edge class when the value is 0), written to the tri AOV and passed as matslot to the subdiv shape, so the C++ subdiv envelope resplits per submesh instead of merging all islands of one material. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One submesh per tiny island creates many small fragments on big models (CannelleEtFromage: 7692 submeshes, one plane alone 3321 islands of 2-4 triangles). Islands < 64 triangles are now unioned with an adjacent island via a second union-find pass. Result: 1733 submeshes (worst mesh 782). Verified: subdivBLC.blend still renders the full Suzanne, cube stays watertight (8 pts / 12 tris), crease export unchanged.