Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

Transmission property not working in vanilla version. #24

Closed
supermoos opened this issue Apr 6, 2022 · 1 comment
Closed

Transmission property not working in vanilla version. #24

supermoos opened this issue Apr 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@supermoos
Copy link

I'm making a new material like this:

export class JourneySphereMaterial extends LayerMaterial {
	constructor() {
		super({
			color: 'white',
			lighting: 'physical',
			transmission: 1,
			// @ts-ignore
			thickness: 0,
			roughness: 0.42,
			metalness: 0.19,
		});
//Transmission only works if this is set, should work in init properties too?
		this.transmission = 1;
	}
}

However some properties like thickness gives a typescript error, and transmission isn't even set on the material created. I have to set it manually with that last line in the example for it to take effect.

@FarazzShaikh FarazzShaikh added the bug Something isn't working label Apr 6, 2022
@FarazzShaikh
Copy link
Member

FarazzShaikh commented Apr 6, 2022

The constructor issue should be fixed in 1.1.11

About the types, the MeshPhysicalMaterialParameters type from @types/three seems to not have thickness as a property, the only option is to open an issue in ThreeJS and use ts-ignore

Also, LayerMaterial and all derived classes are of type Material and will give you type errors if you try to do LayerMaterial.transmission for example. This is because transmission is a property on the MeshPhysicalMaterial class and not on the base Material class. Only option here is to cast your material to MeshPhysicalMaterial

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants