I have a ShaderGraph (UnityGLTF’s Unlit graph + additional texture with some texture blending capabilities) which I export using the “Unlit WebGL2” route. Now during runtime I want to dynamically assign other textures but this breaks the LOD’ing: Only the lowest res LOD is being loaded.
Is it possible to inform the LOD manager about the texture change so it “just works”?
The automatic LOD system only inspects texture slots when the object first renders. Runtime swaps aren’t tracked, so you need to manually request the full LOD.
After assigning the texture, call NEEDLE_progressive.assignTextureLOD:
import { NEEDLE_progressive } from "@needle-tools/engine";
// Upgrade all texture slots on the material
NEEDLE_progressive.assignTextureLOD(material, 0);
// Or upgrade a single texture
NEEDLE_progressive.assignTextureLOD(yourTexture, 0).then(tex => {
if (tex) material.uniforms._YourUniform.value = tex;
});
This forces the highest-res LOD (level 0) to load. The same works for any custom shader uniform or swapped map.