Property 'albedoColor' does not exist on type 'Material' Err:

this Err:
is applied to all the red once
Property ‘albedoColor’ does not exist on type ‘Material’

(this is an typescript file)

can any one tell me how to declare it

So the Mesh property “material” uses the generic base type Material, that way various descendant materials (e.g. StandardMaterial, PBRMaterial, NodeMaterial, etc.) can be assigned to it. But then you need to tell TypeScript which type of material it is if you want to access its properties, otherwise you only have access to the Material class’s properties.

EDIT: it looks like you’re using scene.materials here, not mesh.material, but it’s the same issue of casting from the generic base type Material to the descendant type PBRMaterial. :slight_smile:

For example you could do the casting once like this:

const pbrMaterial = el as PBRMaterial;
pbrMaterial.albedoTexture = tex;
pbrMaterial.UseAlphaFromAlbedoTexture = true;

Or like this on each line:

(el as PBRMaterial).albedoTexture = tex;
(el as PBRMaterial).UseAlphaFromAlbedoTexture = true;