Skip to content

Some how Texture Loading Error by Path. #29

@jomin398

Description

@jomin398

const manager: LoadingManager = DefaultLoadingManager

Summary

I fixed a texture loading error by refactoring buildMaterials into a plugin-style hook
and injecting a custom LoadingManager.

The issue was caused by a single line that indirectly produced an invalid blob URL.

Environment

  • THREE (jsdelivr cdn, esm, latest)
  • MMDLoader (jsdelivr cdn, esm, latest)

What I changed

I copied the original buildMaterials implementation and modified only the manager
injection part to make it work as a plugin.

// custom manager
const cm = new THREE.DefaultLoadingManager();

// Plugin for allow the custom Manager.
const p = (_deps) => {
  return {
    buildMaterials: (pmx, geometry, resourcePath, onProgress, onError) => {
      return buildMaterial(pmx, geometry, resourcePath, onProgress, onError, cm);
    }
  };
};

function buildMaterial(data, geometry, resourcePath, onProgress, onError, customManager) {
  const crossOrigin = "anonymous";
  const manager = customManager || DefaultLoadingManager;
  // rest of code...
}

Error

Fetch API cannot load "blob:./tex/hair_Mikuv4x.tga"
URL scheme "blob" is not supported.

Root cause

This was caused by one line inside buildMaterial / loadTexture that generated an
invalid blob: relative URL when DefaultLoadingManager was not used.

After routing everything through my custom manager, the problem disappeared.

Notes

I did NOT change any logic besides the manager-related part.
All other code is identical to the original buildMaterials.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions