How to create a KHR_materials_sheen in runtime?

I have a GLTF which isn’t having the KHR_materials_sheen.
But it has only the PBRMaterial.
How can I create KHR_materials_sheen in the runtime?

var materialClothSheen = new BABYLON.GLTF2.Loader.Extensions.KHR_materials_sheen(“sheen_material”);

I tried above, but it reports error as below:
Attempted import error: ‘GLTF2’ is not exported from '@babylonjs/core/Legacy/legacy

Sorry for the trouble, it worked after the import as shown below:

import {
KHR_materials_sheen
} from “@babylonjs/loaders/glTF/2.0/Extensions/KHR_materials_sheen”;

Couldn’t create KHR_materials_sheen.
It throws error:
Unhandled Rejection (TypeError): this._loader.isExtensionUsed is not a function

I have a GLTF which isn’t having the KHR_materials_sheen.
But it has the PBRMaterial.
How can I create KHR_materials_sheen in the runtime?

You can simply enable sheen on the material(s):

matPBR.sheen.isEnabled = true;

Then you can use the properties of matPBR.sheen to configurate the sheen component:

2 Likes

Thanks. It works for the PBRMaterial!

1 Like