Nested GLTF object component ignores Progressive Loading Settings in Unity

In a test scene I am using the Progressive Loading Settings to turn off Mesh LODs and texture compression to make sure a model looks good uncompressed.

I have a main scene as a GLTF Object with that component on it and nested under it is the model which also has a GLTF Object component on it. When I export or play, the glb file doesn’t get copied as is to the assets folder, instead Needle exports a compressed version of the glb file. All other models that don’t use a gltf object component on them export uncompressed but there are material reasons why I need this glb file to be exported as is.

Hello robyer1,

To address the issue of nested GLTF objects using the Progressive Loading Settings in Unity, it appears the current implementation of the export system in Needle Engine is configured to handle nested GLTF exports in a specific way. When exporting, nested GLTF objects will automatically create a new file instead of embedding them in the parent GLTF. This behavior ensures that pre-compressed models remain compressed and are directly copied over (see the documentation).

Suggested Steps to Resolve the Issue:

  1. Check Export Settings: Make sure your Progressive Loading settings are correctly applied to both the main GLTF object and any nested objects.

  2. Nested Gltf Export Handler: Verify that the NestedGltfExportHandler properly respects your settings. The relevant method checks if the export is nested and uses custom export settings. You may need to adjust how nested exports are handled to comply with your requirements (see the documentation).

  3. Modify Export Logic: Explore modifying the export logic if necessary. Specifically, examine how the settings are cloned or overridden during export. You might want to ensure that compression settings are consistently applied to nested GLTF files.

  4. Use Direct File References: As a workaround, you can consider managing the nested GLTF files as separate assets rather than through nested components. This will allow you greater control over their export parameters.

If the issue persists, you might want to contact Needle support or the community for more specialized assistance.

You can find more information in the following links:

Let me know if you need further clarification or assistance!

1 replies left - Get a PRO license for more AI replies.
thread_2d7xOFYkj5ohoVQdt0aqUIsI
Reply to this message to continue the conversation

Hello @Rob_F

The model will never be exported compressed but compression will be applied unless you explictly turn off mesh+texture compression inside the model.

Is it possible that you turn off compression in the texture and mesh importer for that model?

Texture compression is set to Off/None for all texture on the model and also in the model’s import settings I have set Texture compression off but it is still happening.

I can share a repro project next week if it helps? It’s just a new/empty project I made to test with using Needle Samples repo.

I turned on Smart Export in Needle settings so maybe that is causing it.

My settings look the same as your screenshots and I am using Unity 6

Then my guess is the following, let me know if that’s correct:

  • your nested GltfObject is on a model file that is also a .gltf or .glb asset
  • the nested GltfObject component shows some message that the original model will be copied to the output directory

If that’s true then you can either:

A) Remove the nested GltfObject component, unless you have a specific reason to keep it (e.g. deferring the loading)
B) Move your nested GltfObject component to a new parent GameObject and move your model asset inside of that.

1 Like

Correct, it is a glb file imported in the project explorer then drag/dropped into the scene then I added a gtlf object component on it so it. I need to keep the glb file as-is in the web export for some materials on it to render correct. What’s going wrong here? It just gets compressed textures in the export every time, the glb file gets put in the /assets folder with all its compressed textures.

When a file is copied out it does not have extra information regarding compression settings. It will then be run through the default compression, which sounds like what you’re seeing. If you want to keep the file exactly as-is, then you might want to put it into includes/ or somewhere else and load it completely dynamically.

That beind said – what materials render incorrectly after roundtrip? Our goal is that roundtrips in UnityGLTF work 100%, so if there’s something not working please open an issue in the UnityGLTF repo. Thanks!

It’s the same test model I shared a while back with the light stick which has inner and outer glass. It loses some properties of refraction or alpha sorting on the round trip in Needle.

If you need it again I can send you the model or a minimal repro project to show this on the weekend.
Of course I can dynamically load it at runtime I just wanted to have it in the scene for easy placement.

I’ll be sure to open an issue on monday on the repo too.

Yes please open an issue! We specifically fixed roundtrip properties for that model, so if there’s remaining issues I’m all ears.

Just uploaded a minimal repro bug report that shows the glass material round trip issue and also shows that the gltfobject file gets compressed despite using the Progressive Texture Loading component to disable project-wide Texture LODS if you run it with ?debugprogressive.

Thanks for the report – as mentioned here it is by design that a file that is copied out does not use these settings, it uses the settings from the file (no settings, in that case, which results in the default progressive behavior).

That might explain the issue here then, but the round trip issue with the glass materials is shown in the repro project at least

1 Like

Is there any way to override this? I still want a gltf object nested in my scene as-is for easy workflows, I can obviously load them with code but I just want to be able to easily place a gltf object in a Unity scene and have it exported as-is without any compression.

At the moment the file always gets exported with progressive textures which I don’t want for this model.

Hello @Rob_F

there’s currently no way to disable compression for single assets if they’re just copied to the output directory I’m afraid. As Felix said here your glTF file doesn’t contain any pipeline information for disabling compression.