Skip to content

Issue with vertex colors not displayed after convertion #30

Open
@HyperCed

Description

@HyperCed

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 !!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions