Export Decalgeometry to gltf file get error

Hi, I want to export my model with decal geometry in gltf or glb.

I found and Decal example made with R3F. and I added an export function, scene to export gltf file .

But when I run export function it show error.

TypeError: Cannot read properties of undefined (reading 'toArray')
    at GLTFWriter.processMaterial (https://95d22z.csb.app/node_modules/three/examples/jsm/exporters/GLTFExporter.js:639:34)

When I follow that log I found that it cause error in this line in GLTFExporter.js

processMaterial( material ) {
...
...
const color = material.color.toArray().concat( [ material.opacity ] );

I think decal mesh has material and geometry each. so I can’t understand why this error occur.

Please check live examples and help :smiling_face_with_tear:

Thanks!

The decals are ok - just remove the debug prop from <Decal> component.

Drei decals use MeshNormalMaterial (here) for debugging - and since MeshNormalMaterial is just a debugging three-specific material, it cannot be exported to GLB.

LOL! I didn’t expect that…!

Thanks!

Anyway Maybe GltfExporter have to add ignore MeshNormalMaterial or something i think!