guc
guc copied to clipboard
Issue with vertex colors not displayed after convertion
Hi, I tried to convert this kind of model with only vertex colors : http://superced.rb38.eu/files/map.B4-UL01.1.glb
The colors was not visible since there is a white emit color instead. I tried without m flag with no success.
I found a way to modify the code and it's working with this patch. I don't know if this is a bug of guc or not.
So I changed that code
void Converter::createMaterialBinding(UsdPrim& prim, const std::string& materialName)
{
if (m_params.emitMtlx)
{
UsdShadeMaterialBindingAPI::Apply(prim).Bind(
UsdShadeMaterial::Get(m_stage, makeMtlxMaterialPath(materialName)),
UsdShadeTokens->fallbackStrength,
UsdShadeTokens->allPurpose
);
}
#ifndef NDEBUG
if (!TfGetEnvSetting(GUC_DISABLE_PREVIEW_MATERIAL_BINDINGS))
#endif
{
UsdShadeMaterialBindingAPI::Apply(prim).Bind(
UsdShadeMaterial::Get(m_stage, makeUsdPreviewSurfaceMaterialPath(materialName)),
UsdShadeTokens->fallbackStrength,
m_params.emitMtlx ? UsdShadeTokens->preview : UsdShadeTokens->allPurpose
);
}
}
by:
void Converter::createMaterialBinding(UsdPrim& prim, const std::string& materialName)
{
if (m_params.emitMtlx)
{
UsdShadeMaterialBindingAPI::Apply(prim).Bind(
UsdShadeMaterial::Get(m_stage, makeMtlxMaterialPath(materialName)),
UsdShadeTokens->fallbackStrength,
UsdShadeTokens->allPurpose
);
}
#ifndef NDEBUG
if (!TfGetEnvSetting(GUC_DISABLE_PREVIEW_MATERIAL_BINDINGS))
#endif
{
if (m_params.emitMtlx)
{
UsdShadeMaterialBindingAPI::Apply(prim).Bind(
UsdShadeMaterial::Get(m_stage, makeUsdPreviewSurfaceMaterialPath(materialName)),
UsdShadeTokens->fallbackStrength,
m_params.emitMtlx ? UsdShadeTokens->preview : UsdShadeTokens->allPurpose
);
}
}
}
And now, my vertex colors are ok in the usd file !!!
Hello, thanks for the report - and sorry for waiting, I'll have a look at it.
Just a few points:
- UsdPreviewSurface materials cannot technically support vertex colors
- MaterialX materials support it, but are not shown in usdview when a preview material is bound
- if no material if bound, which is perhaps what you are doing here (assuming
--emit-mtlxis not given), then usdview will natively display thedisplayColorprimvar, for which guc uses vertex colors