Clearing asset paramters of materials does not work

Hello,

we would like to update material parameters through our connector. That works fine, but when we have to clear an asset parameter it does not work as expected. When changing (or clearing) parameters of other types (for example the diffuse color of an OmniPBR material, that works fine).

Test case:

  1. Create new Material through our connector
  2. Open the scene with Create and enable live sync
  3. Create a mesh and bind the created material to the mesh
  4. Set diffuse color → The material is updated instantly
  5. Set diffuse texture and clear diffuse color → The material is updated instantly (and the diffuse color falls back to its default value)
  6. Clear the diffuse texture → The material is not updated (but the referenced file for the diffuse texture is cleared in create)

In this case the material is only updated when I bind it again.

This is the code that clears the attributes, that should no longer be overridden (inputsWithValues is a vector that contains the names of all attributes that currently have an override):

	UsdAttributeVector mdlShaderPrimAttributes = mdlShaderPrim.GetAuthoredAttributes();

	for (UsdAttribute mdlShaderPrimAttribute : mdlShaderPrimAttributes)
	{
		std::string mdlShaderPrimAttributeName = mdlShaderPrimAttribute.GetName().GetString();

		if (mdlShaderPrimAttributeName.rfind("inputs:", 0) == 0)
		{
			if (std::find(inputsWithValues.begin(), inputsWithValues.end(), mdlShaderPrimAttributeName) == inputsWithValues.end())
			{
				mdlShaderPrimAttribute.Clear();
			}
		}
	};

When I export the scene to usda after I’ve cleared an asset paramter, the attribute is still there (but cleared):

            asset inputs:diffuse_texture = @@ (
               colorSpace = "raw"
               customData = {
                   asset default = @@
               }
               displayGroup = "Albedo"
               displayName = "Albedo Map"
               hidden = false
           )

Is this a bug or am I doing something wrong? Would it make more sense to remove the attribute instead of clearing it? If yes, how can I do that from c++?

btw: Overriding asset parameter works as expected (the material is instantly updated)

Thanks

Carl

Hello @c.bickmeier! I notified the material team of this post. Thanks for reaching out to us!

Hi Wendy,

I`ve found out, that removing the corresponding property does solve my problem… but anyway… clreaing an asset paramter should work too…

Thanks

Carl

@c.bickmeier , I reproduced this issue between the Unreal Connector and Create using OmniPBR.

  • I opened the same stage in Create and Unreal
  • I set both apps to enable live sync
  • I dragged in salt_box.usd - omniverse://localhost/NVIDIA/Assets/ArchVis/Residential/Food/Boxed/salt_box.usd
  • In Unreal I started clearing out the Albedo Map, Normal Map, etc. These updates propagated to the UI, but didn’t appear in the viewport of Create. Obviously they updated properly in Unreal.

Note: while attempting to reproduce this repeatedly I found that it’s not completely consistent. I’ll keep digging and file a bug to address this behavior. I love that you found that removing the corresponding property solves the issue, I’ll note this in the bug.