I'm trying to use shaders with React-three-fiber and Typescript. Shader file:
import { ShaderMaterial } from "three"
import { extend } from "react-three-fiber"
class CustomMaterial extends ShaderMaterial {
constructor() {
super({
vertexShader: `...`,
fragmentShader: `...`,
uniforms: [...]
})
}
}
extend({ CustomMaterial })
and the component file:
<mesh
key={el.name}
material={el.material}
receiveShadow
castShadow
>
<bufferGeometry attach="geometry" {...el.geometry} />
<customMaterial attach="material" />
</mesh>
I'm getting error:
Property 'customMaterial' does not exist on type 'JSX.IntrinsicElements'.