V2 Lod implementation request.

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Lax
Orc Shaman
Posts: 715
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 80

V2 Lod implementation request.

Post by Lax »

Hi dark_sylinc,

I'd like to raise a feature request regarding the MeshLodGenerator. The current MeshLodGameState sample notes that the mesh must be in v1 format because the MeshLodGenerator hasn't yet been ported to v2 interfaces, with the suggested workaround being a v1 → generate LODs → v2 round-trip conversion.

In my engine (NOWA-Engine, built on Ogre-Next) I've made a deliberate architectural decision to use Ogre::Item and v2 meshes exclusively — v1 is completely gone from the pipeline. The v1 round-trip workaround is therefore not viable for me: it introduces significant load-time overhead, complicates the asset pipeline, and reintroduces a v1 dependency I've specifically eliminated.

What I'd like to request is native MeshLodGenerator support directly for v2 meshes, without requiring any conversion step. Concretely:

  • Port the MeshLodGenerator to operate on v2 VertexArrayObject / VertexBufferPacked structures natively
  • Allow LOD levels to be generated and stored directly on an Ogre::MeshV2 instance
  • Ideally expose this through the same or a parallel API to the existing MeshLodGenerator so existing tooling patterns transfer cleanly

I'm happy to test against a development branch if that's useful. Is this something on the roadmap, or would a community contribution be the right path here?

Thanks

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5571
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1405

Re: V2 Lod implementation request.

Post by dark_sylinc »

That sounds cool!

Is this something on the roadmap, or would a community contribution be the right path here?

Community Contribution.

Start with a draft PR so that critique can start early and avoid any critical blocker.

Lax
Orc Shaman
Posts: 715
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 80

Re: V2 Lod implementation request.

Post by Lax »

Hi @dark_sylinc,

Update on this: the draft PR is up at https://github.com/OGRECave/ogre-next/pull/580. 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:

Image

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62