Skip to content

Deprecation of Ogre Loader#2713

Open
NwosuTy wants to merge 9 commits intojMonkeyEngine:masterfrom
NwosuTy:Dev_Conceited-Ogre-Depreciation
Open

Deprecation of Ogre Loader#2713
NwosuTy wants to merge 9 commits intojMonkeyEngine:masterfrom
NwosuTy:Dev_Conceited-Ogre-Depreciation

Conversation

@NwosuTy
Copy link
Copy Markdown

@NwosuTy NwosuTy commented Apr 18, 2026

Marked Ogre Loader as decprcated

Used Assimp CLI for batch conversion of example models to Gltf from.mesh.xml(ogre)

Then switched examples to make use of new gltf models excluding the ones that explicitly showcase the ogre loader

Marked Ogre Loader as decprcated

Used Assimp CLI for batch conversion of example models to Gltf from.mesh.xml(ogre)

Then switched examples to make use of new gltf models excluding the ones that explicitly showcase the ogre loader
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request migrates numerous examples and test cases from the deprecated Ogre model format to glTF and officially marks the Ogre loader classes as deprecated. Feedback indicates that several updated examples (such as TestLightScattering, TestSSAO2, and the stress tests) use fragile manual child access and explicit casts to Geometry that will likely result in ClassCastException due to the structural differences in glTF models. Furthermore, the Ninja.gltf asset is missing from the contribution, and certain models like Oto and Sinbad were overlooked in the conversion process.

Comment thread jme3-examples/src/main/java/jme3test/post/TestLightScattering.java Outdated
Comment thread jme3-examples/src/main/java/jme3test/post/TestSSAO2.java Outdated
Comment thread jme3-examples/src/main/java/jme3test/stress/TestBatchLod.java Outdated
Comment thread jme3-examples/src/main/java/jme3test/stress/TestLodStress.java Outdated
Comment thread jme3-examples/src/main/java/jme3test/tools/TestTextureAtlas.java Outdated
Comment thread jme3-examples/src/main/java/jme3test/helloworld/HelloAssets.java
@riccardobl
Copy link
Copy Markdown
Member

riccardobl commented Apr 18, 2026

Thanks! Can you look into the problems reported by gemini and make sure every modified example is rendered properly?
Also, please remove the old ogre files if they are not used by any test or example

@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 18, 2026

Yh sure would do that now

NwosuTy added 2 commits April 18, 2026 22:37
Fixed casting isues in class that still used older structure of ogre models as opposed to newer GLTF geometry
@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 18, 2026

alright i have resolved all gemini problems, removed all unused ogre files and confirmed that the examples are rendered properly

@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 18, 2026

@riccardobl

@yaRnMcDonuts yaRnMcDonuts added this to the v3.10.0 milestone Apr 18, 2026
@riccardobl
Copy link
Copy Markdown
Member

@gemini-code-assist do another review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request migrates jMonkeyEngine examples from the deprecated Ogre XML format to glTF and marks Ogre asset loaders as deprecated. Feedback indicates that the new glTF node hierarchy will cause ClassCastExceptions in TestLodStress and TestHoverTank where Geometry casts are performed on child nodes. Furthermore, replacing the Sinbad character with a sword in TestTextureAtlas reduces test coverage, and the findFirstGeometry helper method should be moved to a common utility to avoid duplication across test files.

Comment thread jme3-examples/src/main/java/jme3test/stress/TestLodStress.java
Comment thread jme3-examples/src/main/java/jme3test/model/TestHoverTank.java
Spatial obj3 = assetManager.loadModel("Models/Ninja/Ninja.gltf");
obj3.setLocalTranslation(-0, 0, 0);
Spatial obj4 = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml");
Spatial obj4 = assetManager.loadModel("Models/Sinbad/Sword.gltf");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Replacing the Sinbad character model with just his sword significantly reduces the complexity of this texture atlas test. If the full Sinbad character model is not available in glTF, consider using another character model (like Elephant.gltf or Ninja.gltf) to maintain the test's original intent of batching multiple complex models with distinct textures.

* Recursively finds the first Geometry in a spatial hierarchy.
* Handles both simple flat structures and complex nested node trees.
*/
private Geometry findFirstGeometry(com.jme3.scene.Spatial spatial) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This helper method is duplicated in TestBatchLod.java. Consider moving it to a common utility class to improve maintainability. Additionally, the fully qualified class name com.jme3.scene.Spatial is redundant here as Spatial is already imported.

@riccardobl
Copy link
Copy Markdown
Member

riccardobl commented Apr 19, 2026

confirmed that the examples are rendered properly

Sorry, but how can you confirm that, when in some examples the model was changed entirely instead of being properly ported? For example, Oto was replaced with Elephant. And some others just break because the converted glTF has a different scene graph, while the code still assumes the old one.

This bounty is medium difficulty because it requires manual testing to make sure all examples (a very important part of the engine) are still working, sane, and ported correctly. From this PR, it does not look like that manual testing was done, because otherwise it would have been obvious that parts of it are broken.

Anyone can run a batch conversion with Copilot. What is needed here is actual human testing.

@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 19, 2026

I'd have a look, cause I viewed them using Blender and running the engine to confirm they did render properly albeit not all models, I'd cross-check and fix any problems and commit, sorry

@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 19, 2026

@riccardobl want to confirm one last thing before push, cause i am using blender to export and import each mesh, when exporting the ogre mesh there are no textures needed to confirm if thats okay or if i should include their textures

i would also love to know, during conversion from ogre file to gltf i noticed that LOD data in for example the Teapot and SignTracker got lost, i wanted to inquire if i should create a new LOD Data, modify the LOD code to check if LOD Levels is greater than zero before creating LOD group or maintain ogre files for LOD testing in examples like TestBatchLOD, please if you could answer urgently would be nice

@riccardobl
Copy link
Copy Markdown
Member

riccardobl commented Apr 20, 2026

ogre mesh there are no textures needed to confirm if thats okay or if i should include their textures

depends if the original mesh had textures and what is the end goal of the example.
Ideally all the examples after the deprecation should look exactly as before, same texture, same lighting, mesh, material etc.

@riccardobl
Copy link
Copy Markdown
Member

i would also love to know, during conversion from ogre file to gltf i noticed that LOD data in for example the Teapot and SignTracker got lost, i wanted to inquire if i should create a new LOD Data, modify the LOD code to check if LOD Levels is greater than zero before creating LOD group or maintain ogre files for LOD testing in examples like TestBatchLOD, please if you could answer urgently would be nice

i think you can use LodGenerator to generate the lods from code

Fixed All LOD Problems and Casting Exception Issues

In the Texture Atlas Example Switched both Oto and Ferrari objects back, FerrariScene object issues on texture Mapping

Confirmed and fixed Threading issue in IncosistenceColliderTest
@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 20, 2026

i would also love to know, during conversion from ogre file to gltf i noticed that LOD data in for example the Teapot and SignTracker got lost, i wanted to inquire if i should create a new LOD Data, modify the LOD code to check if LOD Levels is greater than zero before creating LOD group or maintain ogre files for LOD testing in examples like TestBatchLOD, please if you could answer urgently would be nice

i think you can use LodGenerator to generate the lods from code

Alright let me work on that then, also fix this build errors in the test, yeah the car scene file had an issue when converting via blender, something about not being a valid source. left me to then import each part independently into a scene and then export all as one gltf object; is that fine

@riccardobl riccardobl marked this pull request as draft April 22, 2026 09:02
NwosuTy and others added 2 commits April 22, 2026 12:14
Migrate 3D models from Ogre XML to glTF format

- Convert model files (Elephant, Ferrari, HoverTank, Ninja, Oto, Sign Post,
  Sinbad, Rocket, Teapot, Tree) to glTF with binary assets
- Update example tests to use new model format
- Remove deprecated Ogre XML model files (.mesh, .mesh.xml)
- Maintain compatibility with existing test cases
@NwosuTy NwosuTy marked this pull request as ready for review April 22, 2026 11:22
@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 22, 2026

@riccardobl ready for review, fixed and reviewed all rendering ports to be occur, singular issue with tree material ogre file not reading .j30 file on blender and didnt want to make any change i wasnt sked to, but every other thing is perfect now

@riccardobl
Copy link
Copy Markdown
Member

@gemini-code-assist do another review

Comment thread gradlew
@@ -1,248 +0,0 @@
#!/bin/sh
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 file should not be emptied

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay it was in the merge conflict that got showed before i just accepted the current change to solve the conflict, id resolve that and push now

Comment thread rmdir Outdated
Comment thread taskkill Outdated
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request transitions the engine's test data and examples from the legacy Ogre XML format to glTF and deprecates Ogre loaders. It introduces a SpatialUtils utility class to handle the more complex hierarchies of glTF models. Feedback highlights the accidental deletion of the Gradle wrapper script and a logic change in TestInconsistentCompareDetection that removes the race condition it was designed to test. Further improvements include removing conversion log artifacts, using FastMath constants instead of literals, and refactoring duplicated LOD generation logic into the new utility class.

I am having trouble creating individual review comments. Click here to see my feedback.

gradlew (1-248)

critical

The Gradle wrapper script (gradlew) has been deleted. This script is essential for ensuring that the project can be built consistently across different environments without requiring a pre-installed version of Gradle. It should be restored.

jme3-examples/src/main/java/jme3test/renderer/TestInconsistentCompareDetection.java (48-50)

medium

The Javadoc should reflect the original purpose of the test, which is to detect inconsistent compare issues caused by unsafe multi-threaded modifications. The current description incorrectly frames it as a demonstration of thread-safe modifications.

 * Changes a material's texture from another thread while it is rendered.
 * This should trigger the sorting function's inconsistent compare detection.
References
  1. When identifying missing or incorrect Javadoc, provide a code suggestion to fix it directly.
  2. Issues found in test code should be reported with a reduced priority, at most medium.

jme3-examples/src/main/java/jme3test/renderer/TestInconsistentCompareDetection.java (105-126)

medium

This change defeats the purpose of the test. TestInconsistentCompareDetection is specifically designed to trigger race conditions by modifying materials from a non-render thread to verify that the engine's "inconsistent compare" detection works. By wrapping the modification in enqueue() and adding a Thread.sleep(100), you've made the operation thread-safe and reduced the frequency of modifications, meaning the test will no longer trigger the condition it was built to detect. The logic should be reverted to unsafe modification to maintain test coverage.

                while (true) {
                    for (Spatial child : rootNode.getChildren()) {
                        Geometry g = SpatialUtils.findFirstGeometry(child);
                        Material mat = g.getMaterial();
                        Texture curTex = mat.getTextureParam("ColorMap").getTextureValue();
                        if (curTex == t1) {
                            mat.setTexture("ColorMap", t2);
                        } else {
                            mat.setTexture("ColorMap", t1);
                        }
                    }
                }
References
  1. Issues found in test code should be reported with a reduced priority, at most medium.

jme3-testdata/src/main/resources/Models/Elephant/OgreXMLConverter.log (1-84)

medium

Artifact log files from the conversion process (like OgreXMLConverter.log) should not be committed to the repository. Please remove them from all model directories.

References
  1. Issues found in test code should be reported with a reduced priority, at most medium.

jme3-examples/src/main/java/jme3test/model/TestHoverTank.java (69)

medium

Replacing FastMath.PI / 2 with a hardcoded float literal reduces code readability and maintainability. It is better to use the constant provided by FastMath (ensure the import is restored).

        chaseCam.setMinVerticalRotation(-FastMath.PI / 2);
References
  1. Issues found in test code should be reported with a reduced priority, at most medium.

jme3-examples/src/main/java/jme3test/stress/TestBatchLod.java (106-110)

medium

The generateLOD method is duplicated in TestLodStress.java. Consider moving this utility method to the newly created SpatialUtils class to promote reusability and maintainability.

References
  1. Issues found in test code should be reported with a reduced priority, at most medium.

Copy link
Copy Markdown
Member

@riccardobl riccardobl left a comment

Choose a reason for hiding this comment

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

the pr looks better now, but there are still some issues

Comment thread jme3-examples/src/main/java/jme3test/effect/TestEverything.java
Comment thread jme3-examples/src/main/java/jme3test/model/TestHoverTank.java
Comment thread jme3-examples/src/main/java/jme3test/model/TestHoverTank.java
} catch (InterruptedException ex) {
}

// begin randomly changing textures after 1 sec.
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.

Why ??

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It was throwing an Uncaught Exception Error in thread; regarding scene modification from another thread, basically a function was spawning daemon threads that contiously swapped textures on the box materials witout sync also affecting the renderer internal sorter, so i then all modifications to be made on thread and then added a delay for sync



Geometry geom = null;
try {
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.

i don't think it is good to have this try-catch here, if it fails better to just let it throw, it's a test

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ok, would remove

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Okay I have resolved every problem raised except this one before i make a commit i want to tell you that it keeps throwing this exception: Uncaught exception thrown in Thread[jME3 Main,6,main]
IllegalStateException: Geometry has no proper texture.

Copy link
Copy Markdown
Member

@riccardobl riccardobl Apr 23, 2026

Choose a reason for hiding this comment

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

i think the problem here is that the texture atlas batcher is built to work with the generic Lighting material, but gltf is imported as PBR. I'll look into it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alright in the meantime I want to try a texture approach I researched on last night, I'd try and implement it to see if I get better results and then make a commit, but I just want to confirm every other thing is fine right ?

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.

looks good, but i still have to run the tests.
I will try them later today

Copy link
Copy Markdown
Member

@riccardobl riccardobl Apr 23, 2026

Choose a reason for hiding this comment

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

the only problem i see is the gradlew that is still in the diff.
EDIT: there are some things that you marked resolved but are not

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Could you run the tests again

box.setMaterial(geom.getMaterial());
box.setLocalTranslation(0, 1, 3);
rootNode.attachChild(box);
} else {
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.

fallback is not good in this test, it is masking the issue at best

@NwosuTy NwosuTy requested a review from riccardobl April 22, 2026 23:24
@codex128 codex128 changed the title Depreciation of Ogre Loader Deprecation of Ogre Loader Apr 23, 2026
@NwosuTy
Copy link
Copy Markdown
Author

NwosuTy commented Apr 23, 2026

I'm lost on ideas on how to fix this exact test build issue if you could be of help @riccardobl

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.

3 participants