Skip to content

MeshLodGenerator: native v2 Mesh support - #580

Open
Laxx18 wants to merge 3 commits into
OGRECave:masterfrom
Laxx18:feature/v2-mesh-lod-generator
Open

MeshLodGenerator: native v2 Mesh support#580
Laxx18 wants to merge 3 commits into
OGRECave:masterfrom
Laxx18:feature/v2-mesh-lod-generator

Conversation

@Laxx18

@Laxx18 Laxx18 commented Jun 22, 2026

Copy link
Copy Markdown

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:

  1. 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.

  2. 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?

  3. 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:

Result

Best Regards
Lax

Laxx18 and others added 3 commits May 27, 2026 20:43
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 darksylinc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else looks alright. Good job!


if( OGRE_EXTRACT_HLMS_TYPE_FROM_CACHE_HASH( lastCacheHash ) != mType )
{
if( mCurrentPassBuffer == 0 )

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants