CesiumGS / cesium-omniverse

Bringing the 3D geospatial ecosystem to Omniverse
https://cesium.com/platform/cesium-for-omniverse/
Apache License 2.0
55 stars 7 forks source link

Use _materialSource when copying tileset materials #644

Closed lilleyse closed 7 months ago

lilleyse commented 7 months ago

Sometimes materials reference a _materialSource prim, which seems to be related to a new material pooling mechanism in Omniverse. In order to copy a tileset material to tiles it needs to copy from _materialSource.

For testing: tileset-material-workaround.zip (the cube in there is a workaround for https://github.com/CesiumGS/cesium-omniverse/issues/607)

Prim: /World/Looks/Material (59393)
  Attributes:
    Attribute: _materialSource
      Type: rel
      Value: [38913]
    Attribute: Material
      Type: tag (primTypeName)
    Attribute: MergedMaterial
      Type: tag (primTypeName)
    Attribute: UsdTyped
      Type: tag (ancestorPrimTypeName)
    Attribute: NodeGraph
      Type: tag (ancestorPrimTypeName)
    Attribute: UsdSchemaBase
      Type: tag (ancestorPrimTypeName)
    Attribute: TfType::_Root
      Type: tag (ancestorPrimTypeName)

...

Prim: /__Fabric_StageInfo/MaterialPool/mat_35728244 (38913)
  Attributes:
    Attribute: _hash
      Type: uint64
      Value: 17650506036130513476
    Attribute: outputs:volume
      Type: token
      Value: 
    Attribute: outputs:displacement
      Type: token
      Value: 
    Attribute: outputs:surface
      Type: token
      Value: 
    Attribute: outputs:mdl:surface
      Type: token
      Value: 
    Attribute: outputs:mdl:volume
      Type: token
      Value: 
    Attribute: outputs:mdl:displacement
      Type: token
      Value: 
    Attribute: outputs:volume
      Type: connection
      Value: Path: /__Fabric_StageInfo/MaterialPool/mat_35728244/cesium_material, Attribute Name: out
    Attribute: outputs:displacement
      Type: connection
      Value: Path: /__Fabric_StageInfo/MaterialPool/mat_35728244/cesium_material, Attribute Name: out
    Attribute: outputs:surface
      Type: connection
      Value: Path: /__Fabric_StageInfo/MaterialPool/mat_35728244/cesium_material, Attribute Name: out
    Attribute: outputs:mdl:surface
      Type: connection
      Value: Path: /__Fabric_StageInfo/MaterialPool/mat_35728244/cesium_material, Attribute Name: out
    Attribute: outputs:mdl:volume
      Type: connection
      Value: Path: /__Fabric_StageInfo/MaterialPool/mat_35728244/cesium_material, Attribute Name: out
    Attribute: outputs:mdl:displacement
      Type: connection
      Value: Path: /__Fabric_StageInfo/MaterialPool/mat_35728244/cesium_material, Attribute Name: out
    Attribute: Material
      Type: tag (primTypeName)
    Attribute: UsdTyped
      Type: tag (ancestorPrimTypeName)
    Attribute: NodeGraph
      Type: tag (ancestorPrimTypeName)
    Attribute: UsdSchemaBase
      Type: tag (ancestorPrimTypeName)
    Attribute: TfType::_Root
      Type: tag (ancestorPrimTypeName)