Looking to implement shaders in React-three-fiber using 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>
Encountering an error message:
Property 'customMaterial' does not exist on type 'JSX.IntrinsicElements'.