How to use predefined material in replicator?

Hello,

I want to randomize the object’s material in replicator. E.g., Thin Glass
What is the best way to do it? I noticed there is an API

rep.create.material_omnipbr
rep.create.mdl_from_json

But I dont know how to create a Thin Glass material from using these APIs.

Thanks

I tried using following code to load the default Glass_Clear material. It fails as the material I applied to a object does not have glass effect and also the material dose not have correct properties when I inspect the Material and Shader property in isaac sim GUI.

path_mat_glass_clear = assets_root_path + "/NVIDIA/Materials/vMaterials_2/Glass/Glass_Clear.mdl"

success, result = omni.kit.commands.execute('CreateMdlMaterialPrimCommand',
    mtl_url=path_mat_glass_clear, # This can be path to local or remote MDL
    mtl_name='Glass_Clear', # sourceAsset:subIdentifier (i.e. the name of the material within the MDL)
    mtl_path="/World/Looks/glass_clear" # Prim path for the Material to create.
)
mat = UsdShade.Material(stage.GetPrimAtPath("/World/Looks/glass_clear"))

My Bad, I pass the wrong mtl_name. It works after I change it to Glass_Clear.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.