Compression and LOD settings overwrite texture settings on imported glb embdeed file

In Unity 6000.0.33f1 with Needle Engine 4.2.5 I am using Needle Compression and LOD settings component to globally set max texture size to 4096x4096. On Some glb models I am using on prefabs in scenes that are imported with UnityGLTF, I have set the texture size on the imported texture to be 2048x2048 but in the Production Build export, the texture size of that texture is 4096x4096 rather than the manually set 2048x2048 size.

Is this a bug or expected? If it is expected, how can I overwrite the global setting from Needle Compression and LOD settings component? I am trying disabling the component and rebuilding to see if it makes any difference.

Hi, Robyer1. This behavior is expected based on your current settings. The Needle Compression and LOD settings component globally sets the maximum texture size, which can override individual texture settings during the export process, especially when using UnityGLTF.

To override the global setting specifically for certain textures, you need to make sure you’re using the Override feature provided by the Needle Texture Settings. This setup is available in the NeedleTextureSettings structure, which allows you to set the Override property to true and specify a MaxSize for each texture individually (see the documentation).

Here is a potential solution:

  1. Make sure the Override property is set to true for the specific textures you want to change.
  2. Adjust the MaxSize property in the NeedleTextureSettings for the relevant textures.

Here is a quick example in C# of how you might set this up:

using UnityEngine;
using UnityEditor;
using Needle.Engine;

public class SetTextureSettings : MonoBehaviour
{
    [MenuItem("Needle/Set Specific Texture Settings")]
    public static void SetSpecificSettings()
    {
        // Replace "YourTexturePath" with the actual path to the texture in your project
        string texturePath = "Assets/YourTexturePath";

        if (NeedleAssetSettingsProvider.TryGetTextureSettings(texturePath, out var settings))
        {
            settings.Override = true;
            settings.MaxSize = 2048; // Set the desired max size
            NeedleAssetSettingsProvider.TrySetTextureSettings(texturePath, settings);
        }
    }
}

Ensure that this script is executed before the build process to guarantee the settings are applied correctly (see the documentation).

If you require additional customization, especially regarding compression methods, you might need to further explore the TextureCompressionSettings component (see the documentation).

Feel free to disable the Needle Compression and LOD settings component temporarily to see how your manual texture settings affect the build. Let me know if there are further questions!

24 replies left
thread_vkShYJO5zf9TdjAZYHKsWpYx
Reply to this message to continue the conversation

That is incorrect as most of the textures are exporting at the size I have set on their imports, it is only a few other textures that seem to just somehow ignore their manually set max texture size which seems to me to be a bug.

Hi, Robyer1. Thank you for the clarification. In light of this new information, it does sound like you may be dealing with an inconsistency rather than a complete override.

Here are some steps you can take to troubleshoot this issue further:

  1. Check Texture Import Settings: Confirm that the specific textures that are being ignored indeed have the correct import settings applied in the Unity inspector. Ensure that any compression settings or resolutions are set as intended prior to building.

  2. Inspect Logging: Enable verbose logging during the import or build process to check if there are any errors or warnings related to those specific textures.

  3. Needle Engine Version: Ensure that you are using the latest version of Needle Engine. Sometimes, bugs may be fixed in newer releases (see the documentation).

  4. Test in Isolation: Create a new scene with only the problematic textures and see if they behave the same way. This can help determine if it’s an issue specific to the textures or something related to other scene configurations.

  5. File Formats: Verify the file formats of the textures. Certain formats may have different behaviors during import/export.

  6. Needle Texture Settings: If you haven’t already, you could explicitly set the texture settings within the Needle Engine for those specific textures to see if this has any impact.

If you’ve gone through these checks and continue to experience this issue, it may be beneficial to reach out to the support community or the Needle Engine support team, as they would have more insights into any underlying issues regarding texture handling for your specific case.

Feel free to update me if you need help with any specific code or if additional issues arise!

23 replies left
thread_vkShYJO5zf9TdjAZYHKsWpYx
Reply to this message to continue the conversation

Hi @robyer1

Is that only the case for textures that are embedded inside a model asset (e.g. an importet FBX or GLB file?)

Because Unity 6 changed their importer API that’s why we had to start transitioning to move settings to the compression component next to the Export component.
We’re planning to add individual texture support to this component again but it’s not yet available and deprecate the old import settings options altogether to keep it easier to reason about what settings are being applied.

It seemed to be affecting textures embedded in glb files from my testing. Yep disabling the component did the trick, it was overriding some of the texture export settings. I am not sure why some of the textures I used still exported at smaller sizes as some of those were embedded.

If you can provide a minimal repo it would be helpful to iron out these inconsistencies… e.g. a scene with just the two textures that result in unexpected sizes

1 Like

Will do, the issue I have with that component is that it makes it tricky for me to globally override the mesh compression, texture LOD and mesh LOD settings if it is also overwriting the texture sizes which I don’t want it to do

It only clamps the max texture size and if you import your texture’s in unity in your current platform with e.g. a lower texture size already that won’t affect that size

e.g. if you import a texture, clamp the size to 2k in Unity’s importer and then set max texture size to 4k in the component textures will still be 2k on export