Texture issue after build

I’m seeing everything correct with texture when i run the project locally. As soon as I make a build the texture disappears from my glb.


image

Hi Saad Baig,

The issue you’re facing with textures disappearing in your GLB after build can often be due to texture compression settings or the way your materials are set up for production builds.

  1. Texture Compression: Production builds by default use KTX2 compression for textures, which may cause some textures not to be visible if they are not correctly set up. Make sure you have the toktx tool installed and correctly configured in your environment.

  2. Material Settings: Double-check your texture and material settings in your project. In the Needle Engine, you can adjust texture compression settings via the Material tab in Blender or Unity, allowing you to specify whether to use KTX2, WebP, or no compression at all (see the documentation).

  3. Production vs Development Build: Remember that development builds do not perform certain optimizations like compression, which can lead to discrepancies in appearance between local testing and the final build. Always test using a production build to see the final effect you will have (see the documentation) (see the documentation).

  4. Texture Size and References: Ensure that your textures are not oversized and are properly referenced in your materials. Large textures can also lead to failed loads due to efficiency issues.

  5. Documentation: For a detailed look at how to manage your texture settings effectively, refer to the deployment section in the Needle Engine documentation (see the documentation) (see the documentation).

Make sure to build again after checking these settings to see if the issue persists. If these solutions do not resolve the issue, consider looking at specific error messages during the build process that can indicate what’s going wrong.

If you have any further questions or need clarification on any steps, feel free to ask!

3 replies left
thread_ZjRsHMHc5nmJrKGUV5Kas0ew
Reply to this message to continue the conversation

Hi,

Can you check the suggestions of the Bot + check the Unity and browser console for errors?

the texture has the size of 8.6MB.
When auto compress is turned on, even locally it doesn’t show the texture. Should I change the compression settings if yes which one suits best?

I dont see option to change compression methods too.

The texture importer should show this:
image

Which Unity version are you using? This project has the Needle Engine Unity package installed, right?

See the docs here for more info: Deployment and Optimization | Documentation

Can you send a bugreport with this asset again? By default the best compression is already chosen (for most cases)

Yes it has needle engine installed. I’m using 2022.3.12f1

I extracted the textures and materials from the gltf file inside unity from here.

You won’t see the texture here in the screenshot because i restored it back. but that’s from where I got it.

Ok, if you run into issues with experimental UnityGLTF features please open an issue in the UnityGLTF repository GitHub - KhronosGroup/UnityGLTF: Runtime glTF 2.0 Loader for Unity3D

But I’m still not sure what’s happening in your case. What format does your texture have on disc? Is it a png/jpeg/webp or perhaps already a KTX texture?

after extracting, on my disc it shows .asset file . if it helps i can share the glb here?

Yes please share the source glTF and your extracted file

is there option to attach file here?

Just image files unfortunately

have sent you gltf file via discord.

Thanks, seems to reproduce here. I opened an issue and will look at it tomorrow

Hi, this seems to be an issue with mesh compression with this specific model since it also reproduces with other tools.

I’ve raised an issue in the underlying toolchain and let you know once I know more.

Thanks marcel. I’ll be waiting.

Hello,

so the issue is with the model where a few UV seems are way out of bounds - this results in compression to not have enough bits/precision and the texture not rendering correctly.

To visualize it you can open the model in Blender, go to UV Editing and press a to select all (or “Select/All”) and then “View /Frame Selected” - you’ll see that Blender will zoom out so much that you basically don’t see your model anymore.

The broken UV coordinates:

So to fix you need to find these vertices/UVs and move them into a sensible range (or delete if it’s an errornous vertex anyways).

Thanks a lot for this!

I followed the steps and to my surprise everything looked normal here in the blender. It didn’t zoom out and I didn’t notice any out of bounds vertices.

Please follow the steps outlined above:

To visualize it you can open the model in Blender, go to UV Editing and press a to select all (or “Select/All”) and then “View /Frame Selected” - you’ll see that Blender will zoom out so much that you basically don’t see your model anymore.

You’ll see blender zooming out incredibly far

image