Instantiating a SceneObject from GltfAsset using tryInstantiate()

The documentation for tryInstantiate is quite lacking: https://docs.snap.com/api/lens-studio/Classes/Assets/#GltfAsset

What is the purpose of the material parameter? I'd like to just instantiate the model as-is, without overriding any material.

Best Answer

  • Max
    Max Posts: 26 🔥
    #2 Answer ✓

    The gltf asset doesn't have the full shader code for a material inside of it,
    instead it has the textures and the material parameters stored with their respective names (like 'baseTex', 'baseColor', 'materialParamsTex', etc).

    A standard PBR material in Lens Studio should catch these parameters and render the object correctly!

Answers