USD loading mesh but missing textures

I’m having trouble getting my usdc file to open correctly. The mesh loads fine but the textures are missing from the materials.

Here is what I’m using to load at runtime (if there’s a better way let me know):

                InitUsd.Initialize();
                var sc = Scene.Open(FullFilename);
                Debug.Log("Opening usdc: " + FullFilename);
                if (sc != null)
                {
                    this.Model = ImportHelpers.ImportSceneAsGameObject(sc, Selection.activeGameObject);
                    sc.Close();
                } else
                {
                    Debug.LogError("Could not find usdc file!");
                }

Which is loading this:
7610902--945505--upload_2021-10-28_11-55-40.png

But results in this:

I think it has something to do with the material import settings- I’d like to use a USD Lit Shader if possible, but I feel like even so it should at least load the textures.

Hi @fusobotic , the textures are not loaded by default. You need to pass ImportSceneAsGameObject a SceneImportOptions argument with its materialImportMode set to MaterialImportMode.ImportPreviewSurface.

var importOptions = new SceneImportOptions();
importOptions.materialImportMode = materialImportMode.ImportPreviewSurface;
this.Model = ImportHelpers.ImportSceneAsGameObject(sc, Selection.activeGameObject, importOptions);

That works to make the material URP but the textures still aren’t assigning- at least not all of them. Looks like Normal and Metallic are but Albedo isn’t. Also it looks like it’s copying the textures to the project (in the Assets folder) as the game is running? I don’t want it to work this way since I want these to load at runtime from another location locally or from a URL. Is there another, better way to import besides ImportHelpers? Thanks!

Sorry for the delay - there is an active PR to address issues in URP, this should be fixed in the next release.

The import process isn’t likely to change in this release, but I agree this should be configurable.

What is the status on this for USD 3.0? The textures are still not applying to the imported USD. Not through code and not even if unity’s USD plugin exports a FBX as a USDZ will not have its textures imported through the USD drop down import option from that same file it just exported.

1 Like

Hey, why aren’t textures imported when importing a USD file? And even when the textures are imported manually and applied to the material on the model, they don’t show? Does Unity not remap USD’s “st” values to proper “uv” values for rendering textures?