MeshLodGenerator: native v2 Mesh support - #580
Open
Laxx18 wants to merge 3 commits into
Open
Conversation
Guard against null mCurrentPassBuffer in fillBuffersFor. Prevents crash when using Ocean without Terra.
…LodOutputProviderMeshV2, LodConfig::meshV2, Mesh::_setLodValues/removeLodLevels, MeshLodUpgrader v2 input, MeshLodV2 sample)
darksylinc
requested changes
Aug 1, 2026
darksylinc
left a comment
Member
There was a problem hiding this comment.
Everything else looks alright. Good job!
|
|
||
| if( OGRE_EXTRACT_HLMS_TYPE_FROM_CACHE_HASH( lastCacheHash ) != mType ) | ||
| { | ||
| if( mCurrentPassBuffer == 0 ) |
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.
Quick summary of what it does and what I found along the way:
Two new classes (LodInputProviderMeshV2, LodOutputProviderMeshV2) slot into the existing LodInputProvider/LodOutputProvider strategy pattern, so MeshLodGenerator can read/write directly against a v2 Mesh's SubMesh Vaos — no v1 mesh involved anywhere.
Turns out the runtime side (camera-distance LOD switching for Item) already works end-to-end for v2 — I'd assumed otherwise partway through and want to flag that I was wrong about that, in case it's useful context. The actual gap was purely on the generation side.
MeshLodUpgrader now generates LOD for v2-native source meshes too, not just v1.
Added a sample (Sample_MeshLodV2) comparing a procedurally-built v2 mesh against Sinbad (v1-imported-then-LOD-generated-natively) side by side.
Three things I'd specifically like your read on before going further:
LodConfig's API shape — I added a parallel meshV2 field rather than changing the existing mesh field's type, to avoid breaking the v1 API. Open to a different shape if you'd prefer.
Manual (mesh-swap) LOD levels and independent (non-shared) shadow-mapping Vaos are explicitly unsupported for the v2 path in this first pass — both fail loudly rather than silently doing the wrong thing. Worth scoping into a follow-up, or should this PR cover them?
Mesh::removeLodLevels() was previously a no-op stub (commented-out body) — I implemented it for real since MeshTool's "drop LOD" option needs it to actually work. Wanted to flag that explicitly since it's existing dead code I'm reviving, not something I added net-new.
Here the result:
Best Regards
Lax