Isaac Sim freezing when setting a shader's source asset

Isaac Sim Version

5.1.0
5.0.0
4.5.0
4.2.0
4.1.0
4.0.0
4.5.0
2023.1.1
2023.1.0-hotfix.1
Other (please specify):

Operating System

Ubuntu 24.04
Ubuntu 22.04
Ubuntu 20.04
Windows 11
Windows 10
Other (please specify):

GPU Information

  • Model: RTX 3090
  • Driver Version: 570-server-open

Topic Description

Isaac Sim freezes when I try to programmatically set the source asset of a shader and then view the properties of the shader prim.

Detailed Description

After creating a shader prim using UsdShade.Shader.Define, I set its source asset using shader.SetSourceAsset. When I select the prim in the GUI and then switch to the Properties window, Isaac Sim hangs. Below is an example script.

from pxr import UsdShade
import omni.usd

path = “/Looks/TestShader”
shader = UsdShade.Shader.Define(omni.usd.get_context().get_stage(), path)
shader.SetSourceAsset(“OmniPBR.mdl”, “mdl”)
context = omni.usd.get_context()

Steps to Reproduce

  1. Open Isaac Sim

  2. Open the script editor and paste the above code into it

  3. Run the script

  4. Select the prim at /Looks/TestShader

  5. Switch to the Properties window

  6. Isaac Sim hangs

Error Messages

Screenshots or Videos

Additional Information

What I’ve Tried

I have tried tracking the freeze back to its source, but the furthest I’ve managed to get is the ShaderInfoAPI class in omni.kit.property.material.scripts.widgets.usdshade.placeholder.shader_info_api.py. Since this relies on native libraries, I cannot trace the issue deeper.

Related Issues

Additional Context

Can you try upgrading to the latest Isaac Sim? You are several versions behind. This issue may not be present in the latest version.

Hi; sorry for the late response.

We tested this with Isaac Sim 5 and the issue is not present in that version. Though we are planning to upgrade to 5.0, updating our code will take a while and we must therefore continue to use 4.2 for the time being. Is there any assistance we could get with solving this problem on 4.2?

There should be no need to update your code from 4.2 to 5.0, unless there is a specific breaking change to an extension. Files that work in 4.2 should open fine in any other version. 4.5, 5.0, and soon 5.1. Just open it and it should run, without the need for new code changes.

Unfortunately, Isaac Sim 5 includes some changes to the default behaviors of the Pip API which break our extension. We are working on adapting our extension to work with these changes. Until we finish, though, is there anything we can do to fix or work around the issue in 4.2?

The freeze is caused by a missing SetSourceAssetSubIdentifier call. The Properties
panel tries to look up the shader node by deducing the subidentifier from the prim –
and without it set explicitly, that lookup hangs in Isaac Sim 4.2.

To fix it on 4.2, add the subidentifier call after SetSourceAsset:

from pxr import UsdShade, Sdf
import omni.usd

stage = omni.usd.get_context().get_stage()
path = "/Looks/TestShader"

shader = UsdShade.Shader.Define(stage, path)
shader.GetImplementationSourceAttr().Set(UsdShade.Tokens.sourceAsset)
shader.SetSourceAsset(Sdf.AssetPath("OmniPBR.mdl"), "mdl")
shader.SetSourceAssetSubIdentifier("OmniPBR", "mdl")  # <-- this was missing

For OmniPBR.mdl the subidentifier is "OmniPBR" – it is the MDL material name
exported from that file. For other MDL files, the subidentifier is the name of the
material defined inside the .mdl.

Alternatively, use the CreateMdlMaterialPrim command, which handles the full
Material/Shader prim structure, both calls, and the mdl output connections in
one step:

omni.kit.commands.execute(
    "CreateMdlMaterialPrim",
    mtl_url="${kit}/mdl/core/Base/OmniPBR.mdl",
    mtl_name="OmniPBR",
    mtl_path="/Looks/MyMaterial"
)

This is the same pattern the editor uses internally. If you are creating a standalone
shader prim (not a full Material), the manual approach with both SetSourceAsset +
SetSourceAssetSubIdentifier is correct.

The bug itself was fixed in 5.0 – the native MDL lookup became tolerant of missing
subidentifiers – which is why you did not see it there. On 4.2 the workaround is
simply to always set the subidentifier explicitly.


Closing this thread as answered. If you run into further issues migrating your
extension to 5.x or 6.x, please open a new topic
and link back here for context.